1$(function(){ 2 /* 3 $(".colors > a").click(function(){ 4 5 var id = $(this).attr("id"); 6 var color = $(this).find("div").attr("id"); 7 var parentID = $(this).parent().find(".parent_id").attr("id"); 8 var buttonID = "#add-"+parentID; 9 var titleID = ".div_"+parentID; 10 11 var link_product_it = $(this).parents(".products-list_it") 12 link_product_it.find(".element_link").attr('href',link_product_it.find(".default_link").attr("data-default-href")+"?color_id="+$(this).attr("id")); 13 14 15 $(this).parent().find("a > div").removeClass("__selected"); 16 $(this).find("div").addClass("__selected"); 17 BX.showWait(); 18 $.getJSON( 19 $(".default_path").val() + "/json.php", 20 {"ID": id, "COLOR":color}, 21 function (data) 22 { 23 $(titleID).find(".bx_catalog_item_price .current").text(data.PRICE_FORMATED); 24 $(titleID).find("figcaption > a").text(data.NAME); 25 var newColor = data.COLOR == undefined ? "/img/no_photo.png" : data.COLOR; 26 $(titleID).find(".products-list_it_pic_inner").find("img").attr("src", newColor); 27 $(titleID).find(".products-list_it_buy-btn").attr("id", "add-"+data.ID); 28 // alert($(titleID).find(".products-list_it_buy-btn").attr("id")); 29 BX.closeWait(); 30 } 31 ); 32 33 return false; 34 }); 35 */ 36 37 $(".bx_cart").click(function() 38 { 39 var item_id = $(this).attr("id").replace("add-", ""), 40 default_item_id = $(this).attr("data_default_id"); 41 $.ajax({ 42 "type":"POST", 43 "url":$(".default_path").val() + "/add2basket_ajax.php", 44 data:{id:item_id} 45 }) 46 .success(function(data){ 47 $(".basket-header").html(data); 48 var $countBasketVal = $(data).find('.count_goods').text(); 49 $("#mobile_cart_link .count_goods").html($countBasketVal); 50 51 $.fancybox(['<p><nobr>Ð¢Ð¾Ð²Ð°Ñ <b>'+$("#item_"+default_item_id+"_name").attr("title")+'</b> добавлен в коÑзинÑ.</nobr></p><p class="alcenter"><a href="javascript:void(0);" class="close_popup">ÐÑодолжиÑÑ Ð¿Ð¾ÐºÑпки</a> | <a href="/personal/cart/">ÐеÑейÑи в коÑзинÑ</a></p>'],{ 52 minHeight: 0, 53 minWidth: 200, 54 }); 55 $(".close_popup").on("click",function(){ 56 $.fancybox.close(); 57 }); 58 }); 59 }); 60 61 62 /*$(".bx-no-touch .products-list_it:not('.statik')").hover(function(){ 63 $(this).addClass("hover"); 64 $(this).css("z-index", "999"); 65 66 //анимаÑÐ¸Ñ Ð²Ñего блока 67 $(this).stop(1, 1).animate({ 68 'left': "-18", 69 'top': "-13", 70 'padding-left': "27", 71 'padding-right': "27", 72 'padding-top': "10", 73 }, 400, function() { 74 // Animation complete. 75 }); 76 77 //анимаÑÐ¸Ñ Ð²Ð½ÑÑÑи блока 78 $(this).find(".secret_block").stop(1, 1).slideToggle(400); 79 }, function() { //outhover 80 $(this).stop(1, 1).animate({ 81 'left': "-1", 82 'top': "-3", 83 'padding-left': "10", 84 'padding-right': "10", 85 'padding-top': "0", 86 }, 200, function() { 87 $(this).css("z-index", "0"); 88 //$( this ).removeClass( "hover" ); 89 }); 90 91 $(this).find(".secret_block").stop(1, 1).slideToggle(200); 92 } 93 );*/ 94 95 96}); 97 98JCCatalogSection = function (arParams) 99{ 100 this.productType = 0; 101 this.showQuantity = true; 102 this.showAbsent = true; 103 this.secondPict = false; 104 this.showOldPrice = false; 105 this.showPercent = false; 106 this.showSkuProps = false; 107 this.visual = { 108 ID: '', 109 PICT_ID: '', 110 SECOND_PICT_ID: '', 111 QUANTITY_ID: '', 112 QUANTITY_UP_ID: '', 113 QUANTITY_DOWN_ID: '', 114 PRICE_ID: '', 115 DSC_PERC: '', 116 SECOND_DSC_PERC: '', 117 DISPLAY_PROP_DIV: '' 118 }; 119 this.product = { 120 checkQuantity: false, 121 maxQuantity: 0, 122 stepQuantity: 1, 123 isDblQuantity: false, 124 canBuy: true, 125 canSubscription: true, 126 name: '', 127 pict: {}, 128 id: 0 129 }; 130 131 this.defaultPict = { 132 pict: null, 133 secondPict: null 134 }; 135 136 this.ajaxPath = ''; 137 138 this.checkQuantity = false; 139 this.maxQuantity = 0; 140 this.stepQuantity = 1; 141 this.isDblQuantity = false; 142 this.canBuy = true; 143 this.canSubscription = true; 144 145 this.offers = []; 146 this.offerNum = 0; 147 this.treeProps = []; 148 this.obTreeRows = []; 149 this.showCount = []; 150 this.showStart = []; 151 this.selectedValues = {}; 152 153 this.obProduct = null; 154 this.obQuantity = null; 155 this.obQuantityUp = null; 156 this.obQuantityDown = null; 157 this.obPict = null; 158 this.obSecondPict = null; 159 this.obPrice = null; 160 this.obTree = null; 161 this.obBuyBtn = null; 162 this.obDscPerc = null; 163 this.obSecondDscPerc = null; 164 this.obSkuProps = null; 165 this.obMeasure = null; 166 167 this.errorCode = 0; 168 169 if ('object' == typeof(arParams)) 170 { 171 this.productType = parseInt(arParams.PRODUCT_TYPE);
172 this.showQuantity = arParams.SHOW_QUANTITY; 173 this.showAbsent = arParams.SHOW_ABSENT; 174 this.visual = arParams.VISUAL; 175 this.ajaxPath = arParams.AJAX_PATH; 176 177 switch(this.productType) 178 { 179 case 1://product 180 case 2://set 181 if (!!arParams.PRODUCT && 'object' == typeof(arParams.PRODUCT)) 182 { 183 if (this.showQuantity) 184 { 185 this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY; 186 this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT; 187 if (this.product.checkQuantity) 188 this.product.maxQuantity = (this.product.isDblQuantity 189 ? parseFloat(arParams.PRODUCT.MAX_QUANTITY) 190 : parseInt(arParams.PRODUCT.MAX_QUANTITY) 191 ); 192 this.product.stepQuantity = (this.product.isDblQuantity 193 ? parseFloat(arParams.PRODUCT.STEP_QUANTITY) 194 : parseInt(arParams.PRODUCT.STEP_QUANTITY) 195 ); 196 197 this.checkQuantity = this.product.checkQuantity; 198 this.isDblQuantity = this.product.isDblQuantity; 199 this.maxQuantity = this.product.maxQuantity; 200 this.stepQuantity = this.product.stepQuantity; 201 } 202 this.product.canBuy = arParams.PRODUCT.CAN_BUY; 203 this.product.canSubscription = arParams.PRODUCT.SUBSCRIPTION; 204 205 this.canBuy = this.product.canBuy; 206 this.canSubscription = this.product.canSubscription; 207 208 this.product.name = arParams.PRODUCT.NAME; 209 this.product.pict = arParams.PRODUCT.PICT; 210 this.product.id = arParams.PRODUCT.ID; 211 } 212 else 213 { 214 this.errorCode = -1; 215 } 216 break; 217 case 3://sku 218 if (!!arParams.OFFERS && BX.type.isArray(arParams.OFFERS)) 219 { 220 this.offers = arParams.OFFERS; 221 this.offerNum = 0; 222 if (!!arParams.OFFER_SELECTED) 223 this.offerNum = parseInt(arParams.OFFER_SELECTED); 224 if (isNaN(this.offerNum)) 225 this.offerNum = 0; 226 if (!!arParams.TREE_PROPS) 227 this.treeProps = arParams.TREE_PROPS; 228 if (!!arParams.DEFAULT_PICTURE) 229 { 230 this.defaultPict.pict = arParams.DEFAULT_PICTURE.PICTURE; 231 this.defaultPict.secondPict = arParams.DEFAULT_PICTURE.PICTURE_SECOND; 232 } 233 } 234 else 235 { 236 this.errorCode = -1; 237 } 238 break; 239 default: 240 this.errorCode = -1; 241 } 242 243 if (!!this.visual.BUY_ID) 244 { 245 this.obBuyBtn = BX(this.visual.BUY_ID); 246 if (!this.obBuyBtn) 247 { 248 249 } 250 } 251 } 252 253 if (0 == this.errorCode) 254 { 255 BX.ready(BX.delegate(this.Init,this)); 256 } 257}; 258 259JCCatalogSection.prototype.Init = function() 260{ 261 if (0 == this.errorCode) { 262 if (!!this.obBuyBtn) 263 BX.bind(this.obBuyBtn, 'click', BX.delegate(this.Basket, this)); 264 } 265}; 266 267JCCatalogSection.prototype.Basket = function() 268{ 269 if (!this.canBuy) 270 return; 271 var ajaxParams = { 272 sessid: BX.bitrix_sessid(), 273 action: 'ADD2BASKET', 274 ajax_basket: 'Y' 275 }; 276 277 switch (this.productType) 278 { 279 case 1://product 280 ajaxParams.id = this.product.id; 281 if (this.showQuantity) 282 ajaxParams.quantity = this.obQuantity.value; 283 break; 284 case 3://sku 285 ajaxParams.id = this.offers[this.offerNum].ID; 286 if (this.showQuantity) 287 ajaxParams.quantity = 1; 288 break; 289 default: 290 return; 291 } 292 293 BX.ajax.loadJSON( 294 this.ajaxPath, 295 ajaxParams, 296 BX.delegate(this.ShowBasketPopup, this) 297 ); 298}; 299 300JCCatalogSection.prototype.UpdateBasketData = function() { 301 $updateBasketLink = this.ajaxPath + '?ajaxBasketUpdate=Y'; 302 BX.ajax.insertToNode($updateBasketLink,'b-header-basket-wrapp'); 303}; 304 305JCCatalogSection.prototype.ShowBasketPopup = function(arResult) 306{ 307 var strContent = ''; 308 if ('object' == typeof(arResult)) 309 { 310 if ('OK' == arResult.STATUS) 311 { 312 this.UpdateBasketData(); 313 314 strName = ''; 315 strPict = ''; 316 switch(this.productType) 317 { 318 case 1:// 319 strName = this.product.name; 320 strPict = this.product.pict.SRC; 321 break; 322 case 3: 323 strName = this.offers[this.offerNum].NAME; 324 strPict = this.offers[this.offerNum].PREVIEW_PICTURE.SRC; 325 break; 326 } 327 328 strContent = '<p>'+BX.message('ADD_TO_BASKET_OK')+'</p>'; 329 if(typeof(strPict) != 'undefined' && strPict.length > 0) 330 strContent += '<img src="'+strPict+'" height="130">'; 331 332 if(typeof(strName) != 'undefined' && strName.length > 0) 333 strContent += '<p>'+strName+'</p>'; 334 } 335 else 336 { 337 strContent = '<p>'+BX.message('ADD_TO_BASKET_ERROR')+'</p>'; 338 } 339 } 340 else 341 { 342 343 } 344 345 var popup = BX.PopupWindowManager.create('CatalogSectionBasket'+this.visual.ID, null, { 346 autoHide: false, 347 // zIndex: 0, 348 offsetLeft: 0, 349 offsetTop: 0, 350 overlay : true, 351 draggable: {restrict:true}, 352 closeByEsc: true, 353 closeIcon: { right : "12px", top : "10px"}, 354 content: '' + 355 '<div style="width:300px;text-align: center;padding-top:5px; margin-bottom: 10px;">' + 356 strContent+ 357 '<a class="bx_bt_blue bx_medium" href="'+BX.message("setButtonBuyUrl")+'"><span class="bx_icon_cart"></span><span>'+BX.message("setButtonBuyName")+'</span></a>'+ 358 ' <a class="bx_bt_blue bx_medium" id="bx_close_btn" href="#â"><span class="bx_icon_cart"></span><span>'+BX.message("CONTINUE_SHOPPING_MSG")+'</span></a>'+ 359 '</div>' 360 }); 361 362 popup.show(); 363 364 this.popup = popup; 365 366 // ÑобÑÑие на закÑÑÑие окна 367 BX.bind(BX('bx_close_btn'), 'click', BX.delegate(this.ClosePopup, this)); 368}; 369 370 371JCCatalogSection.prototype.ClosePopup = function(popup){ 372 this.popup.close(); 373 this.popup.destroy(); 374 return false;
375}; 376 377/* 378$(window).load(function(){ 379 InitCatalogItems(); 380}); 381function InitCatalogItems() 382{ 383 var items = $(".products-list_it_w"); 384 items.each(function() { 385 var first_a = $(this).find(".colors a").first(); 386 $(this).find(".colors_it").first().addClass("__selected"); 387 388 var id = $(first_a).attr("id"); 389 390 var color = $(first_a).find("div").attr("id"); 391 var parentID = $(first_a).parent().find(".parent_id").attr("id"); 392 var buttonID = "#add-"+parentID; 393 var titleID = ".div_"+parentID; 394 395 BX.showWait(); 396 $.getJSON( 397 $(".default_path").val() + "/json.php", 398 {"ID": id, "COLOR":color}, 399 function (data) 400 { 401 console.log(id); 402 console.log(color); 403 var photoPlaceholderSrc = "/img/no_photo.png"; 404 $(titleID).find(".bx_catalog_item_price .current").text(data.PRICE_FORMATED); 405 $(titleID).find("figcaption > a").text(data.NAME); 406 var newColor = data.COLOR == undefined ? photoPlaceholderSrc : data.COLOR; 407 $(titleID).find(".products-list_it_pic_inner").find("img").attr("src", newColor); 408 $(titleID).find(".products-list_it_buy-btn").attr("id", "add-"+data.ID); 409 BX.closeWait(); 410 } 411 ); 412 //оÑеÑÐµÐ´Ð½Ð°Ñ Ð¼Ð¸Ð½ÑÑка веÑелÑÑ 413 first_a.click(); 414 }); 415} 416*/
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.