Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/boxberry.delivery/ |
Upload File : |
const BB_WIDGET_URL = 'https://points.boxberry.ru'; var bbWidget = { parameters: {}, init: function () { this._callback_function = (this._callback_function ? this._callback_function : function () { return false; }); this._overlay = (this._overlay ? this._overlay : null); this._frame = (this._frame ? this._frame : null); var h = document.getElementsByTagName('HEAD')[0]; var el = document.createElement('LINK'); el.rel = 'stylesheet'; el.type = 'text/css'; el.href = BB_WIDGET_URL + '/css/boxberry.css'; h.appendChild(el); var el = document.createElement('SCRIPT'); el.src = BB_WIDGET_URL + '/js/postmessage.js'; el.onload = function () { pm.bind('boxberry-map-point-select', function (data) { this.callCallbackSelfFunction(data); this.hideOverlay(); this.hideContainer(); }.bind(this)); }.bind(this); h.appendChild(el); }, versionAPI: function (val) { if (val % 1 === 0) { this.parameters.versionAPI = ''; } else { this.parameters.versionAPI = encodeURIComponent(val); } }, checkLocation: function (val) { this.parameters.checkLocation = (val === 1 ? 1 : 0); }, makeUrl: function (parameters) { var url = '?'; for (var index in parameters) { url = url + index + '=' + parameters[index] + '&'; } return url + 'host=' + location.hostname; }, sucrh: function (toggle) { if (toggle === 1) { this.parameters.sucrh = 1; } else { this.parameters.sucrh = 0; } }, openOnPage: function (element) { this.parameters.element = element; }, displaySettings: function (parameters) { this.displaySettings.top = parameters.top; }, open: function (callback_function, api_token, custom_city, target_start, ordersum, weight, paysum, height, width, depth, prepaid) { this.parameters.calc = 0; if (prepaid % 1 === 0) { this.parameters.prepaid = prepaid; } this.parameters.chgPaysum = (this.parameters.paysum !== paysum); this.parameters.chgCity = (this.parameters.custom_city !== encodeURIComponent(custom_city)); this.parameters.select_office = 1; this.parameters.kd = 0; this.parameters.ordersum = (ordersum !== undefined ? ordersum : ''); this.parameters.paysum = (paysum !== undefined ? paysum : ''); this.parameters.weight = (weight !== undefined ? weight : 0); this.parameters.height = (height !== undefined ? height : 0); this.parameters.width = (width !== undefined ? width : 0); this.parameters.depth = (depth !== undefined ? depth : 0); if (this.parameters.paysum > 0) { this.parameters.prepaid = 1; } if (api_token % 1 === 0) { this.parameters.api_token = ''; this.parameters.custom_city = encodeURIComponent(custom_city); this.parameters.target_start = '68'; } else { this.parameters.api_token = (api_token !== undefined ? encodeURIComponent(api_token) : ''); this.parameters.custom_city = (custom_city !== undefined ? encodeURIComponent(custom_city) : ''); if (target_start !== undefined && target_start !== '') { this.parameters.target_start = target_start; } } if (this.parameters.api_token % 1 === 0) { this.parameters.calc = 0; } if (typeof callback_function === 'string') { callback_function = window[callback_function]; } if (callback_function === undefined) { this.parameters.calc = 0; this.parameters.select_office = 1; } this._callback_function = callback_function; if (this.parameters.element) { this.showContainerOnPage(); } else { this.showOverlay(); this.showContainer(); } }, openKD: function (callback_function, api_token, custom_city, uniqNameCity, regionName) { this._callback_function = callback_function; this.parameters.kd = 1; this.parameters.calc = 0; this.parameters.select_office = 0; this.parameters.api_token = (api_token !== undefined ? encodeURIComponent(api_token) : ''); this.parameters.custom_city = (custom_city !== undefined ? encodeURIComponent(custom_city) : ''); this.parameters.uniqnamecity = (uniqNameCity !== undefined ? encodeURIComponent(uniqNameCity) : ''); this.parameters.regionName = (regionName !== undefined ? encodeURIComponent(regionName) : ''); this.showOverlay(); this.showContainer(); }, callCallbackSelfFunction: function () { if (typeof (this._callback_function) != 'undefined') { this._callback_function.apply(window, arguments); } }, showOverlay: function () { if (!this._overlay) { this._overlay = document.createElement('DIV'); this._overlay.className = 'boxberry_overlay'; document.getElementsByTagName('BODY')[0].appendChild(this._overlay); } this._overlay.style.display = 'block'; }, hideOverlay: function () { if (this._overlay) { this._overlay.style.display = 'none'; } }, showContainerOnPage: function () { content = document.getElementById(this.parameters.element); if (content) { this._frame = document.createElement('IFRAME'); this._frame.src = BB_WIDGET_URL + '/map/' + this.makeUrl(this.parameters); this._frame.frameBorder = "0"; this._frame.height = "560px"; this._frame.width = "100%"; content.appendChild(this._frame); } }, showContainer: function () { this._container = document.createElement('DIV'); this._container.className = 'boxberry_container'; document.getElementsByTagName('BODY')[0].appendChild(this._container); var toppanel = document.createElement('DIV'); toppanel.className = 'boxberry_toppanel'; var a = document.createElement('A'); a.href = '#'; a.innerHTML = '<img src="' + BB_WIDGET_URL + '/img/close_round_button.png" alt="close">'; a.className = 'boxberry_container_close'; a.onclick = function () { this.hideOverlay(); this.hideContainer(); return false; }.bind(this); toppanel.appendChild(a); this._container.appendChild(toppanel); this._container.style.display = 'block'; var s = this.getPageScroll(); ytop = document.documentElement.clientHeight; this._container.style.top = '30px'; if (this.displaySettings.top !== undefined) { this._container.style.top = this.displaySettings.top + 'px'; } if (window.innerWidth <= 600) { if (s.top > 0) { this._container.style.top = (s.top + 30) + 'px'; } } this._container.style.left = (s.left + Math.max(0, (document.documentElement.clientWidth - this._container.offsetWidth) / 2)) + 'px'; var content = document.createElement('DIV'); content.className = 'boxberry_content'; this._content = content; this._container.appendChild(content); this._frame = document.createElement('IFRAME'); this._frame.src = BB_WIDGET_URL + '/map/' + this.makeUrl(this.parameters); this._frame.frameborder = '0'; this._frame.style.border = '0'; this._frame.height = '560px'; this._frame.data = document.documentElement.clientHeight; this._frame.style.width = '100%'; this._frame.id = 'boxberry_map'; content.appendChild(this._frame); if (this._frame.contentWindow) { pm({ target: this._frame.contentWindow, type: 'boxberry-map-init', data: {init: true} }); } }, hideContainer: function () { if (this._frame) { pm({ target: this._frame.contentWindow, type: 'boxberry-map-destroy', data: {} }); } if (this._container) { if (typeof this._container.remove == 'function') { this._container.remove() } else { this._container.outerHTML = ''; } this._container.style.display = 'none'; } }, getPageScroll: function () { var doc = document; var html = doc.documentElement; var body = doc.body; var top = (window && window.pageYOffset) || (doc && doc.scrollTop) || (html && html.scrollTop) || 0; top -= html.clientTop; var left = (doc && doc.scrollLeft) || (doc.body && doc.body.scrollLeft) || (html && html.scrollLeft) || 0; left -= html.clientLeft; return { top: top, left: left }; } }; bbWidget.init();