js/purchasing.js

Code: DEV-2E787B27 Size: 1.2 KB Lines: 33 Path: /home/prodconfig.wenesthosting.com/dev.solargroup.wenest.se/js/purchasing.js

Task / Comment

Open report form
// purchasing.js - bridge to legacy purchasing engine
(function(){
    if (window.__purchasingBridgeLoaded) return;
    window.__purchasingBridgeLoaded = true;

    function ensureLegacyPurchasingScript() {
        if (typeof loadInkopPage === 'function') {
            if (typeof currentPage !== 'undefined' && currentPage === 'inkop') {
                try { loadInkopPage(); } catch (e) {}
            }
            return;
        }
        if (document.querySelector('script[data-legacy-purchasing="true"]')) {
            return;
        }
        var script = document.createElement('script');
        script.src = 'js/inkop.js?v=' + Date.now();
        script.dataset.legacyPurchasing = 'true';
        script.onload = function(){
            if (typeof currentPage !== 'undefined' && currentPage === 'inkop' && typeof loadInkopPage === 'function') {
                try { loadInkopPage(); } catch (e) {}
            }
        };
        document.body.appendChild(script);
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', ensureLegacyPurchasingScript);
    } else {
        ensureLegacyPurchasingScript();
    }
})();