1//CITY_CHANGE// 2BX.CityChange = function() { 3 var close; 4 5 BX.CityChange.popup = BX.PopupWindowManager.create("cityChange", null, { 6 autoHide: true, 7 offsetLeft: 0, 8 offsetTop: 0, 9 overlay: { 10 opacity: 100 11 }, 12 draggable: false, 13 closeByEsc: false, 14 closeIcon: { right : "-10px", top : "-10px"}, 15 titleBar: {content: BX.create("span", {html: BX.message("GEOLOCATION_POPUP_WINDOW_TITLE")})}, 16 content: "<div class='popup-window-wait'><i class='fa fa-spinner fa-pulse'></i></div>", 17 events: { 18 onAfterPopupShow: function() 19 { 20 if(!BX.findChild(BX("cityChange"), {className: "bx-sls"}, true, false)) { 21 BX.ajax.post( 22 BX.message("GEOLOCATION_COMPONENT_TEMPLATE") + "/popup.php", 23 { 24 arParams: BX.message("GEOLOCATION_PARAMS") 25 }, 26 BX.delegate(function(result) 27 { 28 this.setContent(result); 29 var windowSize = BX.GetWindowInnerSize(), 30 windowScroll = BX.GetWindowScrollPos(), 31 popupHeight = BX("cityChange").offsetHeight; 32 BX("cityChange").style.top = windowSize.innerHeight/2 - popupHeight/2 + windowScroll.scrollTop + "px"; 33 }, 34 this) 35 ); 36 } 37 } 38 } 39 }); 40 41 BX.addClass(BX("cityChange"), "pop-up city-change"); 42 close = BX.findChildren(BX("cityChange"), {className: "popup-window-close-icon"}, true); 43 if(!!close && 0 < close.length) { 44 for(i = 0; i < close.length; i++) { 45 close[i].innerHTML = "<i class='fa fa-times'></i>"; 46 } 47 } 48 49 BX.CityChange.popup.show(); 50}; 51 52//CITY_CONFIRM// 53BX.CityConfirm = function(not_defined) { 54 var not_defined = not_defined || false, 55 close, 56 strContent, 57 buttons = []; 58 59 BX.CityConfirm.popup = BX.PopupWindowManager.create("cityConfirm", null, { 60 autoHide: true, 61 offsetLeft: 0, 62 offsetTop: 0, 63 overlay: { 64 opacity: 100 65 }, 66 draggable: false, 67 closeByEsc: false, 68 closeIcon: { right : "-10px", top : "-10px"}, 69 titleBar: false 70 }); 71 72 BX.addClass(BX("cityConfirm"), "pop-up city-confirm"); 73 close = BX.findChildren(BX("cityConfirm"), {className: "popup-window-close-icon"}, true); 74 if(!!close && 0 < close.length) { 75 for(i = 0; i < close.length; i++) { 76 close[i].innerHTML = "<i class='fa fa-times'></i>"; 77 } 78 } 79 80 strContent = "<div class='your-city'><div class='your-city__label'>" + BX.message("GEOLOCATION_YOUR_CITY") + "</div><div class='your-city__val'>" + BX.message("GEOLOCATION_POSITIONING") + "</div></div>"; 81 82 var CityConfirmButton = function(params) { 83 CityConfirmButton.superclass.constructor.apply(this, arguments); 84 this.buttonNode = BX.create("button", { 85 text: params.text, 86 attrs: { 87 name: params.name, 88 className: params.className 89 }, 90 events : this.contextEvents 91 }); 92 }; 93 BX.extend(CityConfirmButton, BX.PopupWindowButton); 94 95 if(!not_defined) { 96 buttons = [ 97 new CityConfirmButton({ 98 text: BX.message("GEOLOCATION_YES"), 99 name: "cityConfirmYes", 100 className: "btn_buy popdef", 101 events: { 102 click: BX.delegate(BX.CityConfirm.popup.close, BX.CityConfirm.popup) 103 } 104 }), 105 new CityConfirmButton({ 106 text: BX.message("GEOLOCATION_CHANGE_CITY"), 107 name: "cityConfirmChange", 108 className: "btn_buy apuo", 109 events: { 110 click: BX.delegate(BX.CityChange, BX) 111 } 112 }) 113 ]; 114 } else { 115 buttons = [ 116 new CityConfirmButton({ 117 text: BX.message("GEOLOCATION_CHANGE_CITY"), 118 name: "cityConfirmChange", 119 className: "btn_buy apuo", 120 events: { 121 click: BX.delegate(BX.CityChange, BX) 122 } 123 }) 124 ]; 125 } 126 127 BX.CityConfirm.popup.setContent(strContent); 128 BX.CityConfirm.popup.setButtons(buttons); 129 130 BX("geolocation").appendChild(BX("popup-window-overlay-cityConfirm")); 131 BX("geolocation").appendChild(BX("cityConfirm")); 132 133 BX.CityConfirm.popup.show(); 134}; 135 136//GEOLOCATION_DELIVERY// 137BX.GeolocationDelivery = function(elementId) { 138 BX("geolocationDelivery-" + elementId).appendChild( 139 BX.create("div", { 140 attrs: { 141 className: "geolocation-delivery__wait" 142 }, 143 children: [ 144 BX.create("i", { 145 attrs: { 146 className: "fa fa-spinner fa-pulse" 147 } 148 }) 149 ] 150 }) 151 );
152 BX.ajax.post( 153 "/bitrix/components/altop/geolocation.delivery/ajax.php", 154 { 155 sessid: BX.bitrix_sessid(), 156 action: "geolocationDelivery", 157 arParams: { 158 "ELEMENT_ID": elementId, 159 "ELEMENT_COUNT": BX("geolocationDelivery-" + elementId).getAttribute("data-element-count"), 160 "CART_PRODUCTS": BX("geolocationDelivery-" + elementId).getAttribute("data-cart-products"), 161 "CACHE_TYPE": BX("geolocationDelivery-" + elementId).getAttribute("data-cache-type"), 162 "CACHE_TIME": BX("geolocationDelivery-" + elementId).getAttribute("data-cache-time") 163 } 164 }, 165 function(result) { 166 BX("geolocationDelivery-" + elementId).parentNode.innerHTML = result; 167 } 168 ); 169}; 170 171//GEOLOCATION// 172BX.Geolocation = function() { 173 var geolocation = ymaps.geolocation; 174 175 if(geolocation.city) { 176 BX.ajax.post( 177 BX.message("GEOLOCATION_COMPONENT_PATH") + "/ajax.php", 178 { 179 arParams: BX.message("GEOLOCATION_PARAMS"), 180 sessid: BX.bitrix_sessid(), 181 action: "searchLocation", 182 country: geolocation.country, 183 region: geolocation.region, 184 city: geolocation.city 185 }, 186 function(result) { 187 var json = JSON.parse(result); 188 $(".geolocation__value").html(json.city); 189 if(BX.message("GEOLOCATION_SHOW_CONFIRM") == "Y") { 190 BX.CityConfirm(); 191 $(".your-city__val").html(json.city + "?"); 192 } 193 if(!!json.contacts && json.contacts.length > 0) 194 $(".telephone").html(json.contacts); 195 geolocationDeliveryItems = BX.findChildren(document.body, {className: "geolocation-delivery"}, true); 196 if(!!geolocationDeliveryItems && 0 < geolocationDeliveryItems.length) { 197 for(i = 0; i < geolocationDeliveryItems.length; i++) { 198 elementId = geolocationDeliveryItems[i].getAttribute("data-element-id"); 199 if(!!elementId) 200 BX.GeolocationDelivery(elementId); 201 } 202 } 203 } 204 ); 205 } else { 206 $(".geolocation__value").html(BX.message("GEOLOCATION_NOT_DEFINED")); 207 if(BX.message("GEOLOCATION_SHOW_CONFIRM") == "Y") { 208 BX.CityConfirm(true); 209 $(".your-city__val").html(BX.message("GEOLOCATION_NOT_DEFINED")); 210 } 211 geolocationDeliveryItems = BX.findChildren(document.body, {className: "geolocation-delivery"}, true); 212 if(!!geolocationDeliveryItems && 0 < geolocationDeliveryItems.length) { 213 for(i = 0; i < geolocationDeliveryItems.length; i++) { 214 elementId = geolocationDeliveryItems[i].getAttribute("data-element-id"); 215 if(!!elementId) 216 BX.GeolocationDelivery(elementId); 217 } 218 } 219 } 220};
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.