1/** 2 * @copyright Commercial License By LeoTheme.Com 3 * @email leotheme.com 4 * @visit http://www.leotheme.com 5 */ 6 7(function($) { 8 $.LeoCustomAjax = function() { 9 this.leoData = 'leoajax=1'; 10 }; 11 $.LeoCustomAjax.prototype = { 12 processAjax: function() { 13 var myElement = this; 14 15 if (leoOption.productNumber && $("#categories_block_left .leo-qty").length) myElement.getCategoryList(); 16 else if($("#categories_block_left .leo-qty").length) $("#categories_block_left .leo-qty").remove(); 17 if (leoOption.productInfo && $(".leo-more-info").length) myElement.getProductListInfo(); 18 else if($(".leo-more-info").length) $(".leo-more-info").remove(); 19 if (leoOption.productTran && $(".product-additional").length) myElement.getProductListTran(); 20 else if($(".product-additional").length) $(".product-additional").remove(); 21 if (leoOption.productCdown && $(".leo-more-cdown").length) myElement.getProductCdownInfo(); 22 else if($(".leo-more-cdown").length) $(".leo-more-cdown").remove(); 23 if (leoOption.productCdown && $(".leo-more-color").length) myElement.getProductColorInfo(); 24 else if($(".leo-more-color").length) $(".leo-more-color").remove(); 25 26 if(myElement.leoData != "leoajax=1"){ 27 $.ajax({
28 type: 'POST', 29 headers: {"cache-control": "no-cache"}, 30 url: baseDir + 'modules/leocustomajax/leoajax.php' + '?rand=' + new Date().getTime(), 31 async: true, 32 cache: false, 33 dataType: "json", 34 data: myElement.leoData, 35 success: function(jsonData) { 36 if (jsonData) { 37 if (jsonData.cat) { 38 for (i = 0; i < jsonData.cat.length; i++) { 39 $("#leo-cat-" + jsonData.cat[i].id_category).html(jsonData.cat[i].total); 40 $("#leo-cat-" + jsonData.cat[i].id_category).show(); 41 } 42 } 43 if (jsonData.pro_info) { 44 var listProduct = new Array(); 45 for (i = 0; i < jsonData.pro_info.length; i++) { 46 listProduct[jsonData.pro_info[i].id] = jsonData.pro_info[i].content; 47 } 48 49 $(".leo-more-info").each(function() { 50 $(this).html(listProduct[$(this).data("idproduct")]); 51 }); 52 addEffectProducts(); 53 } 54 55 if (jsonData.pro_cdown) { 56 var listProduct = new Array(); 57 for (i = 0; i < jsonData.pro_cdown.length; i++) { 58 listProduct[jsonData.pro_cdown[i].id] = jsonData.pro_cdown[i].content; 59 } 60 61 $(".leo-more-cdown").each(function() { 62 $(this).html(listProduct[$(this).data("idproduct")]); 63 }); 64 } 65 66 if (jsonData.pro_color) { 67 var listProduct = new Array(); 68 for (i = 0; i < jsonData.pro_color.length; i++) { 69 listProduct[jsonData.pro_color[i].id] = jsonData.pro_color[i].content; 70 } 71 72 $(".leo-more-color").each(function() { 73 $(this).html(listProduct[$(this).data("idproduct")]); 74 }); 75 } 76 77 if (jsonData.pro_add) { 78 var listProductImg = new Array(); 79 var listProductName = new Array(); 80 for (i = 0; i < jsonData.pro_add.length; i++) { 81 listProductImg[jsonData.pro_add[i].id] = jsonData.pro_add[i].content; 82 listProductName[jsonData.pro_add[i].id] = jsonData.pro_add[i].name; 83 } 84 $(".product-additional").each(function() { 85 if (listProductImg[$(this).data("idproduct")]){ 86 var str_image = listProductImg[$(this).data("idproduct")]; 87 var src_image = str_image.replace('home_default', 'home_default'); 88 var name_image = listProductName[$(this).data("idproduct")]; 89 $(this).html('<img class="img-responsive" title="'+name_image+'" alt="'+name_image+'" src="' + src_image + '"/>'); 90 } 91 }); 92 //addEffOneImg(); 93 } 94 } 95 }, 96 error: function() { 97 } 98 }); 99 } 100 }, 101 getCategoryList: function() { 102 //get category id 103 var leoCatList = ""; 104 $("#categories_block_left .leo-qty").each(function() { 105 if (leoCatList) 106 leoCatList += "," + $(this).attr("id"); 107 else 108 leoCatList = $(this).attr("id"); 109 }); 110 111 if (leoCatList) { 112 leoCatList = leoCatList.replace(/leo-cat-/g, ""); 113 this.leoData += '&cat_list=' + leoCatList; 114 } 115 return false; 116 }, 117 getProductListInfo: function() { 118 var leoProInfo = ""; 119 $(".leo-more-info").each(function() { 120 if (!leoProInfo) 121 leoProInfo += $(this).data("idproduct"); 122 else 123 leoProInfo += "," + $(this).data("idproduct"); 124 }); 125 if (leoProInfo) { 126 this.leoData += '&pro_info=' + leoProInfo; 127 } 128 return false; 129 }, 130 131 getProductCdownInfo: function() { 132 var leoProCdown = ""; 133 $(".leo-more-cdown").each(function() { 134 if (!leoProCdown) 135 leoProCdown += $(this).data("idproduct"); 136 else 137 leoProCdown += "," + $(this).data("idproduct"); 138 }); 139 if (leoProCdown) { 140 this.leoData += '&pro_cdown=' + leoProCdown; 141 } 142 return false; 143 }, 144 145 getProductColorInfo: function() { 146 var leoProColor = ""; 147 $(".leo-more-color").each(function() { 148 if (!leoProColor) 149 leoProColor += $(this).data("idproduct"); 150 else 151 leoProColor += "," + $(this).data("idproduct"); 152 }); 153 if (leoProColor) { 154 this.leoData += '&pro_color=' + leoProColor; 155 } 156 return false; 157 }, 158 159 getProductListTran: function() { 160 //tranditional image 161 var leoAdditional = ""; 162 $(".product-additional").each(function() { 163 if (!leoAdditional) 164 leoAdditional += $(this).data("idproduct"); 165 else 166 leoAdditional += "," + $(this).data("idproduct"); 167 }); 168 if (leoAdditional) { 169 this.leoData += '&pro_add=' + leoAdditional; 170 } 171 return false; 172 } 173 }; 174}(jQuery)); 175 176function addJSProduct(currentProduct) { 177// if (typeof serialScroll == 'function') {
178 $('.thumbs_list_' + currentProduct).serialScroll({ 179 items: 'li:visible', 180 prev: '.view_scroll_left_' + currentProduct, 181 next: '.view_scroll_right_' + currentProduct, 182 axis: 'y', 183 offset: 0, 184 start: 0, 185 stop: true, 186 duration: 700, 187 step: 1, 188 lazy: true, 189 lock: false, 190 force: false, 191 cycle: false 192 }); 193 $('.thumbs_list_' + currentProduct).trigger('goto', 1);// SerialScroll Bug on goto 0 ? 194 $('.thumbs_list_' + currentProduct).trigger('goto', 0); 195 // } 196} 197function addEffectProducts(){ 198 if(typeof(leoOption) != 'undefined' && leoOption.productInfo){ 199 $(".leo-more-info").each(function() { 200 addJSProduct($(this).data("idproduct")); 201 }); 202 addEffectProduct(); 203 } 204} 205 206function addEffectProduct() { 207 var speed = 800; 208 var effect = "easeInOutQuad"; 209 210 //$(".products_block .carousel-inner .ajax_block_product:first-child").mouseenter(function() { 211 //$(".products_block .carousel-inner").css("overflow", "inherit"); 212 //}); 213 //$(".carousel-inner").mouseleave(function() { 214 //$(".carousel-inner").css("overflow", "hidden"); 215 //}); 216 217 $(".leo-more-info").each(function() { 218 var leo_preview = this; 219 $(leo_preview).find(".leo-hover-image").each(function() { 220 $(this).mouseover(function() { 221 var big_image = $(this).attr("rel"); 222 imgElement = $(leo_preview).parent().find(".product_img_link img").first(); 223 if (!imgElement.length) { 224 imgElement = $(leo_preview).parent().find(".product_image img").first(); 225 } 226 227 if (imgElement.length) { 228 $(imgElement).stop().animate({opacity: 0}, {duration: speed, easing: effect}); 229 $(imgElement).first().attr("src", big_image); 230 $(imgElement).first().attr("data-rel", big_image); 231 $(imgElement).stop().animate({opacity: 1}, {duration: speed, easing: effect}); 232 } 233 }); 234 }); 235 236 $('.thickbox-ajax-'+$(this).data("idproduct")).fancybox({ 237 'hideOnContentClick': true, 238 'transitionIn' : 'elastic', 239 'transitionOut' : 'elastic' 240 }); 241 }); 242} 243 244function addEffOneImg() { 245 var speed = 800; 246 var effect = "easeInOutQuad"; 247 248 $(".product-additional").each(function() { 249 if ($(this).find("img").length) { 250 var leo_hover_image = $(this).parent().find("img").first(); 251 var leo_preview = $(this); 252 $(this).parent().mouseenter(function() { 253 $(this).find("img").first().stop().animate({opacity: 0}, {duration: speed, easing: effect}); 254 $(leo_preview).stop().animate({opacity: 1}, {duration: speed, easing: effect}); 255 }); 256 $(this).parent().mouseleave(function() { 257 $(this).find("img").first().stop().animate({opacity: 1}, {duration: speed, easing: effect}); 258 $(leo_preview).stop().animate({opacity: 0}, {duration: speed, easing: effect}); 259 }); 260 } 261 }); 262}
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.