1const BB_WIDGET_URL = 'https://points.boxberry.ru'; 2 3var bbWidget = { 4 parameters: {}, 5 6 init: function () { 7 this._callback_function = (this._callback_function ? this._callback_function : function () { 8 return false; 9 }); 10 this._overlay = (this._overlay ? this._overlay : null); 11 this._frame = (this._frame ? this._frame : null); 12 13 var h = document.getElementsByTagName('HEAD')[0]; 14 15 var el = document.createElement('LINK'); 16 el.rel = 'stylesheet'; 17 el.type = 'text/css'; 18 el.href = BB_WIDGET_URL + '/css/boxberry.css'; 19 h.appendChild(el); 20 var el = document.createElement('SCRIPT'); 21 el.src = BB_WIDGET_URL + '/js/postmessage.js'; 22 el.onload = function () { 23 pm.bind('boxberry-map-point-select', function (data) { 24 this.callCallbackSelfFunction(data); 25 this.hideOverlay(); 26 this.hideContainer(); 27 }.bind(this)); 28 }.bind(this); 29 h.appendChild(el); 30 31 32 }, 33 versionAPI: function (val) { 34 if (val % 1 === 0) { 35 this.parameters.versionAPI = ''; 36 } else { 37 this.parameters.versionAPI = encodeURIComponent(val); 38 } 39 }, 40 checkLocation: function (val) { 41 this.parameters.checkLocation = (val === 1 ? 1 : 0); 42 }, 43 makeUrl: function (parameters) { 44 var url = '?'; 45 for (var index in parameters) { 46 url = url + index + '=' + parameters[index] + '&'; 47 } 48 return url + 'host=' + location.hostname; 49 }, 50 sucrh: function (toggle) { 51 if (toggle === 1) { 52 this.parameters.sucrh = 1; 53 } else { 54 this.parameters.sucrh = 0; 55 } 56 }, 57 openOnPage: function (element) { 58 this.parameters.element = element; 59 }, 60 displaySettings: function (parameters) { 61 this.displaySettings.top = parameters.top; 62 }, 63 open: function (callback_function, api_token, custom_city, target_start, ordersum, weight, paysum, height, width, depth, prepaid) { 64 this.parameters.calc = 0; 65 if (prepaid % 1 === 0) { 66 this.parameters.prepaid = prepaid; 67 } 68 this.parameters.chgPaysum = (this.parameters.paysum !== paysum); 69 this.parameters.chgCity = (this.parameters.custom_city !== encodeURIComponent(custom_city)); 70 this.parameters.select_office = 1; 71 this.parameters.kd = 0; 72 this.parameters.ordersum = (ordersum !== undefined ? ordersum : ''); 73 this.parameters.paysum = (paysum !== undefined ? paysum : ''); 74 this.parameters.weight = (weight !== undefined ? weight : 0); 75 this.parameters.height = (height !== undefined ? height : 0); 76 this.parameters.width = (width !== undefined ? width : 0); 77 this.parameters.depth = (depth !== undefined ? depth : 0); 78 79 if (this.parameters.paysum > 0) { 80 this.parameters.prepaid = 1; 81 } 82 if (api_token % 1 === 0) { 83 this.parameters.api_token = ''; 84 this.parameters.custom_city = encodeURIComponent(custom_city); 85 this.parameters.target_start = '68'; 86 } else { 87 this.parameters.api_token = (api_token !== undefined ? encodeURIComponent(api_token) : ''); 88 this.parameters.custom_city = (custom_city !== undefined ? encodeURIComponent(custom_city) : ''); 89 if (target_start !== undefined && target_start !== '') { 90 this.parameters.target_start = target_start; 91 } 92 } 93 if (this.parameters.api_token % 1 === 0) { 94 this.parameters.calc = 0; 95 } 96 97 if (typeof callback_function === 'string') { 98 callback_function = window[callback_function]; 99 } 100 if (callback_function === undefined) { 101 this.parameters.calc = 0; 102 this.parameters.select_office = 1; 103 } 104 105 this._callback_function = callback_function; 106 if (this.parameters.element) { 107 this.showContainerOnPage(); 108 } else { 109 this.showOverlay(); 110 this.showContainer(); 111 } 112 }, 113 openKD: function (callback_function, api_token, custom_city, uniqNameCity, regionName) { 114 this._callback_function = callback_function; 115 116 this.parameters.kd = 1; 117 this.parameters.calc = 0; 118 this.parameters.select_office = 0; 119 120 this.parameters.api_token = (api_token !== undefined ? encodeURIComponent(api_token) : ''); 121 this.parameters.custom_city = (custom_city !== undefined ? encodeURIComponent(custom_city) : ''); 122 this.parameters.uniqnamecity = (uniqNameCity !== undefined ? encodeURIComponent(uniqNameCity) : ''); 123 this.parameters.regionName = (regionName !== undefined ? encodeURIComponent(regionName) : ''); 124 this.showOverlay(); 125 this.showContainer(); 126 }, 127 callCallbackSelfFunction: function () { 128 if (typeof (this._callback_function) != 'undefined') { 129 this._callback_function.apply(window, arguments); 130 } 131 }, 132 133 showOverlay: function () { 134 if (!this._overlay) {
135 this._overlay = document.createElement('DIV'); 136 this._overlay.className = 'boxberry_overlay'; 137 document.getElementsByTagName('BODY')[0].appendChild(this._overlay); 138 } 139 this._overlay.style.display = 'block'; 140 }, 141 142 hideOverlay: function () { 143 144 if (this._overlay) { 145 this._overlay.style.display = 'none'; 146 } 147 }, 148 showContainerOnPage: function () { 149 content = document.getElementById(this.parameters.element); 150 if (content) { 151 this._frame = document.createElement('IFRAME'); 152 this._frame.src = BB_WIDGET_URL + '/map/' + this.makeUrl(this.parameters); 153 this._frame.frameBorder = "0"; 154 this._frame.height = "560px"; 155 this._frame.width = "100%"; 156 content.appendChild(this._frame); 157 } 158 }, 159 showContainer: function () { 160 161 this._container = document.createElement('DIV'); 162 this._container.className = 'boxberry_container'; 163 164 document.getElementsByTagName('BODY')[0].appendChild(this._container); 165 166 var toppanel = document.createElement('DIV'); 167 toppanel.className = 'boxberry_toppanel'; 168 var a = document.createElement('A'); 169 a.href = '#'; 170 a.innerHTML = '<img src="' + BB_WIDGET_URL + '/img/close_round_button.png" alt="close">'; 171 a.className = 'boxberry_container_close'; 172 a.onclick = function () { 173 this.hideOverlay(); 174 this.hideContainer(); 175 return false; 176 }.bind(this); 177 toppanel.appendChild(a); 178 this._container.appendChild(toppanel); 179 this._container.style.display = 'block'; 180 var s = this.getPageScroll(); 181 182 ytop = document.documentElement.clientHeight; 183 this._container.style.top = '30px'; 184 185 if (this.displaySettings.top !== undefined) { 186 this._container.style.top = this.displaySettings.top + 'px'; 187 } 188 if (window.innerWidth <= 600) { 189 if (s.top > 0) { 190 this._container.style.top = (s.top + 30) + 'px'; 191 } 192 } 193 this._container.style.left = (s.left + Math.max(0, (document.documentElement.clientWidth - this._container.offsetWidth) / 2)) + 'px'; 194 195 var content = document.createElement('DIV'); 196 content.className = 'boxberry_content'; 197 this._content = content; 198 this._container.appendChild(content); 199 200 this._frame = document.createElement('IFRAME'); 201 this._frame.src = BB_WIDGET_URL + '/map/' + this.makeUrl(this.parameters); 202 203 this._frame.frameborder = '0'; 204 this._frame.style.border = '0'; 205 206 this._frame.height = '560px'; 207 this._frame.data = document.documentElement.clientHeight; 208 this._frame.style.width = '100%'; 209 this._frame.id = 'boxberry_map'; 210 content.appendChild(this._frame); 211 212 if (this._frame.contentWindow) { 213 pm({ 214 target: this._frame.contentWindow, 215 type: 'boxberry-map-init', 216 data: {init: true} 217 }); 218 } 219 }, 220 221 hideContainer: function () { 222 if (this._frame) { 223 pm({ 224 target: this._frame.contentWindow, 225 type: 'boxberry-map-destroy', 226 data: {} 227 }); 228 } 229 if (this._container) { 230 if (typeof this._container.remove == 'function') { 231 this._container.remove() 232 } else { 233 this._container.outerHTML = ''; 234 } 235 this._container.style.display = 'none'; 236 } 237 238 }, 239 240 getPageScroll: function () { 241 242 var doc = document; 243 var html = doc.documentElement; 244 var body = doc.body; 245 246 var top = (window && window.pageYOffset) || (doc && doc.scrollTop) || (html && html.scrollTop) || 0; 247 top -= html.clientTop; 248 var left = (doc && doc.scrollLeft) || (doc.body && doc.body.scrollLeft) || (html && html.scrollLeft) || 0; 249 left -= html.clientLeft; 250 251 return { 252 top: top, 253 left: left 254 }; 255 } 256}; 257 258bbWidget.init(); 259
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.