1/* 2* 2007-2016 PrestaShop 3* 4* NOTICE OF LICENSE 5* 6* This source file is subject to the Academic Free License (AFL 3.0) 7* that is bundled with this package in the file LICENSE.txt. 8* It is also available through the world-wide-web at this URL: 9* http://opensource.org/licenses/afl-3.0.php 10* If you did not receive a copy of the license and are unable to 11* obtain it through the world-wide-web, please send an email 12* to [email protected] so we can send you a copy immediately. 13* 14* DISCLAIMER 15* 16* Do not edit or add to this file if you wish to upgrade PrestaShop to newer 17* versions in the future. If you wish to customize PrestaShop for your 18* needs please refer to http://www.prestashop.com for more information. 19* 20* @author PrestaShop SA <[email protected]> 21* @copyright 2007-2016 PrestaShop SA 22* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 23* International Registered Trademark & Property of PrestaShop SA 24*/ 25//global variables 26var responsiveflag = false; 27 28$(document).ready(function(){ 29 highdpiInit(); 30 responsiveResize(); 31 $(window).resize(responsiveResize); 32 if (navigator.userAgent.match(/Android/i)) 33 { 34 var viewport = document.querySelector('meta[name="viewport"]'); 35 viewport.setAttribute('content', 'initial-scale=1.0,maximum-scale=1.0,user-scalable=0,width=device-width,height=device-height'); 36 window.scrollTo(0, 1); 37 } 38 if (typeof quickView !== 'undefined' && quickView) 39 quick_view(); 40 dropDown(); 41 42 if (typeof page_name != 'undefined' && !in_array(page_name, ['index', 'product'])) 43 { 44 bindGrid(); 45 46 $(document).on('change', '.selectProductSort', function(e){ 47 if (typeof request != 'undefined' && request) 48 var requestSortProducts = request; 49 var splitData = $(this).val().split(':'); 50 var url = ''; 51 if (typeof requestSortProducts != 'undefined' && requestSortProducts) 52 { 53 url += requestSortProducts ; 54 if (typeof splitData[0] !== 'undefined' && splitData[0]) 55 { 56 url += ( requestSortProducts.indexOf('?') < 0 ? '?' : '&') + 'orderby=' + splitData[0] + (splitData[1] ? '&orderway=' + splitData[1] : ''); 57 if (typeof splitData[1] !== 'undefined' && splitData[1]) 58 url += '&orderway=' + splitData[1]; 59 } 60 document.location.href = url; 61 } 62 }); 63 64 $(document).on('change', 'select[name="n"]', function(){ 65 $(this.form).submit(); 66 }); 67 68 $(document).on('change', 'select[name="currency_payment"]', function(){ 69 setCurrency($(this).val()); 70 }); 71 } 72 73 $(document).on('change', 'select[name="manufacturer_list"], select[name="supplier_list"]', function(){ 74 if (this.value != '') 75 location.href = this.value; 76 }); 77 78 $(document).on('click', '.back', function(e){ 79 e.preventDefault(); 80 history.back(); 81 }); 82 83 jQuery.curCSS = jQuery.css; 84 if (!!$.prototype.cluetip) 85 $('a.cluetip').cluetip({ 86 local:true, 87 cursor: 'pointer', 88 dropShadow: false, 89 dropShadowSteps: 0, 90 showTitle: false, 91 tracking: true, 92 sticky: false, 93 mouseOutClose: true, 94 fx: { 95 open: 'fadeIn', 96 openSpeed: 'fast' 97 } 98 }).css('opacity', 0.8); 99 100 if (typeof(FancyboxI18nClose) !== 'undefined' && typeof(FancyboxI18nNext) !== 'undefined' && typeof(FancyboxI18nPrev) !== 'undefined' && !!$.prototype.fancybox) 101 $.extend($.fancybox.defaults.tpl, { 102 closeBtn : '<a title="' + FancyboxI18nClose + '" class="fancybox-item fancybox-close" href="javascript:;"></a>', 103 next : '<a title="' + FancyboxI18nNext + '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>', 104 prev : '<a title="' + FancyboxI18nPrev + '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>' 105 }); 106 107 // Close Alert messages 108 $(".alert.alert-danger").on('click', this, function(e){ 109 if (e.offsetX >= 16 && e.offsetX <= 39 && e.offsetY >= 16 && e.offsetY <= 34) 110 $(this).fadeOut(); 111 }); 112 113 114 115 // eclairage menu 116 $('.main-navigation > ul > li > ul > li > a[href="'+window.location.pathname+'"]').parent().addClass('current-menu-item'); 117 if ($('body#product').length) { 118 var productParentCatURL = $('#breadcrumbs .container a').attr('href').replace('http://'+window.location.hostname, ''); 119 $('.main-navigation > ul > li > ul > li > a[href="'+productParentCatURL+'"]').parent().addClass('current-menu-item'); 120 } 121}); 122 123function highdpiInit() 124{ 125 if (typeof highDPI === 'undefined') 126 return; 127 if(highDPI && $('.replace-2x').css('font-size') == "1px") 128 { 129 var els = $("img.replace-2x").get(); 130 for(var i = 0; i < els.length; i++) 131 { 132 src = els[i].src; 133 extension = src.substr( (src.lastIndexOf('.') +1) ); 134 src = src.replace("." + extension, "2x." + extension); 135 136 var img = new Image(); 137 img.src = src; 138 img.height != 0 ? els[i].src = src : els[i].src = els[i].src; 139 } 140 } 141} 142 143 144// Used to compensante Chrome/Safari bug (they don't care about scroll bar for width)
145function scrollCompensate() 146{ 147 var inner = document.createElement('p'); 148 inner.style.width = "100%"; 149 inner.style.height = "200px"; 150 151 var outer = document.createElement('div'); 152 outer.style.position = "absolute"; 153 outer.style.top = "0px"; 154 outer.style.left = "0px"; 155 outer.style.visibility = "hidden"; 156 outer.style.width = "200px"; 157 outer.style.height = "150px"; 158 outer.style.overflow = "hidden"; 159 outer.appendChild(inner); 160 161 document.body.appendChild(outer); 162 var w1 = inner.offsetWidth; 163 outer.style.overflow = 'scroll'; 164 var w2 = inner.offsetWidth; 165 if (w1 == w2) w2 = outer.clientWidth; 166 167 document.body.removeChild(outer); 168 169 return (w1 - w2); 170} 171 172function responsiveResize() 173{ 174 compensante = scrollCompensate(); 175 if (($(window).width()+scrollCompensate()) <= 767 && responsiveflag == false) 176 { 177 accordion('enable'); 178 accordionFooter('enable'); 179 responsiveflag = true; 180 } 181 else if (($(window).width()+scrollCompensate()) >= 768) 182 { 183 accordion('disable'); 184 accordionFooter('disable'); 185 responsiveflag = false; 186 if (typeof bindUniform !=='undefined') 187 bindUniform(); 188 } 189 blockHover(); 190} 191 192function blockHover(status) 193{ 194 var screenLg = $('body').find('.container').width() == 1170; 195 196 if ($('.product_list').is('.grid')) 197 if (screenLg) 198 $('.product_list .button-container').hide(); 199 else 200 $('.product_list .button-container').show(); 201 202 $(document).off('mouseenter').on('mouseenter', '.product_list.grid li.ajax_block_product .product-container', function(e){ 203 if (screenLg) 204 { 205 var pcHeight = $(this).parent().outerHeight(); 206 var pcPHeight = $(this).parent().find('.button-container').outerHeight() + $(this).parent().find('.comments_note').outerHeight() + $(this).parent().find('.functional-buttons').outerHeight(); 207 $(this).parent().addClass('hovered').css({'height':pcHeight + pcPHeight, 'margin-bottom':pcPHeight * (-1)}); 208 $(this).find('.button-container').show(); 209 } 210 }); 211 212 $(document).off('mouseleave').on('mouseleave', '.product_list.grid li.ajax_block_product .product-container', function(e){ 213 if (screenLg) 214 { 215 $(this).parent().removeClass('hovered').css({'height':'auto', 'margin-bottom':'0'}); 216 $(this).find('.button-container').hide(); 217 } 218 }); 219} 220 221function quick_view() 222{ 223 $(document).on('click', '.quick-view:visible, .quick-view-mobile:visible', function(e){ 224 e.preventDefault(); 225 var url = this.rel; 226 var anchor = ''; 227 228 if (url.indexOf('#') != -1) 229 { 230 anchor = url.substring(url.indexOf('#'), url.length); 231 url = url.substring(0, url.indexOf('#')); 232 } 233 234 if (url.indexOf('?') != -1) 235 url += '&'; 236 else 237 url += '?'; 238 239 if (!!$.prototype.fancybox) 240 $.fancybox({ 241 'padding': 0, 242 'width': 1087, 243 'height': 610, 244 'type': 'iframe', 245 'href': url + 'content_only=1' + anchor 246 }); 247 }); 248} 249 250function bindGrid() 251{ 252 var storage = false; 253 if (typeof(getStorageAvailable) !== 'undefined') { 254 storage = getStorageAvailable(); 255 } 256 if (!storage) { 257 return; 258 } 259 260 var view = $.totalStorage('display'); 261 262 if (!view && (typeof displayList != 'undefined') && displayList) 263 view = 'list'; 264 265 if (view && view != 'grid') 266 display(view); 267 else 268 $('.display').find('li#grid').addClass('selected'); 269 270 $(document).on('click', '#grid', function(e){ 271 e.preventDefault(); 272 display('grid'); 273 }); 274 275 $(document).on('click', '#list', function(e){ 276 e.preventDefault(); 277 display('list'); 278 }); 279} 280 281function display(view) 282{ 283 if (view == 'list') 284 { 285 $('ul.product_list').removeClass('grid').addClass('list row'); 286 $('.product_list > li').removeClass('col-xs-12 col-sm-6 col-md-4').addClass('col-xs-12'); 287 $('.product_list > li').each(function(index, element) { 288 var html = ''; 289 html = '<div class="product-container"><div class="row">'; 290 html += '<div class="left-block col-xs-4 col-sm-5 col-md-4">' + $(element).find('.left-block').html() + '</div>'; 291 html += '<div class="center-block col-xs-4 col-sm-7 col-md-4">'; 292 html += '<div class="product-flags">'+ $(element).find('.product-flags').html() + '</div>'; 293 html += '<h5 itemprop="name">'+ $(element).find('h5').html() + '</h5>'; 294 var hookReviews = $(element).find('.hook-reviews'); 295 if (hookReviews.length) { 296 html += hookReviews.clone().wrap('<div>').parent().html(); 297 } 298 html += '<p class="product-desc">'+ $(element).find('.product-desc').html() + '</p>'; 299 var colorList = $(element).find('.color-list-container').html(); 300 if (colorList != null) { 301 html += '<div class="color-list-container">'+ colorList +'</div>'; 302 } 303 var availability = $(element).find('.availability').html(); // check : catalog mode is enabled
304 if (availability != null) { 305 html += '<span class="availability">'+ availability +'</span>'; 306 } 307 html += '</div>'; 308 html += '<div class="right-block col-xs-4 col-sm-12 col-md-4"><div class="right-block-content row">'; 309 var price = $(element).find('.content_price').html(); // check : catalog mode is enabled 310 if (price != null) { 311 html += '<div class="content_price col-xs-5 col-md-12">'+ price + '</div>'; 312 } 313 html += '<div class="button-container col-xs-7 col-md-12">'+ $(element).find('.button-container').html() +'</div>'; 314 html += '<div class="functional-buttons clearfix col-sm-12">' + $(element).find('.functional-buttons').html() + '</div>'; 315 html += '</div>'; 316 html += '</div></div>'; 317 $(element).html(html); 318 }); 319 $('.display').find('li#list').addClass('selected'); 320 $('.display').find('li#grid').removeAttr('class'); 321 $.totalStorage('display', 'list'); 322 } 323 else 324 { 325 $('ul.product_list').removeClass('list').addClass('grid row'); 326 $('.product_list > li').removeClass('col-xs-12').addClass('col-xs-12 col-sm-6 col-md-4'); 327 $('.product_list > li').each(function(index, element) { 328 var html = ''; 329 html += '<div class="product-container">'; 330 html += '<div class="left-block">' + $(element).find('.left-block').html() + '</div>'; 331 html += '<div class="right-block">'; 332 html += '<div class="product-flags">'+ $(element).find('.product-flags').html() + '</div>'; 333 html += '<h5 itemprop="name">'+ $(element).find('h5').html() + '</h5>'; 334 var hookReviews = $(element).find('.hook-reviews'); 335 if (hookReviews.length) { 336 html += hookReviews.clone().wrap('<div>').parent().html(); 337 } 338 html += '<p itemprop="description" class="product-desc">'+ $(element).find('.product-desc').html() + '</p>'; 339 var price = $(element).find('.content_price').html(); // check : catalog mode is enabled 340 if (price != null) { 341 html += '<div class="content_price">'+ price + '</div>'; 342 } 343 html += '<div itemprop="offers" itemscope itemtype="https://schema.org/Offer" class="button-container">'+ $(element).find('.button-container').html() +'</div>'; 344 var colorList = $(element).find('.color-list-container').html(); 345 if (colorList != null) { 346 html += '<div class="color-list-container">'+ colorList +'</div>'; 347 } 348 var availability = $(element).find('.availability').html(); // check : catalog mode is enabled 349 if (availability != null) { 350 html += '<span class="availability">'+ availability +'</span>'; 351 } 352 html += '</div>'; 353 html += '<div class="functional-buttons clearfix">' + $(element).find('.functional-buttons').html() + '</div>'; 354 html += '</div>'; 355 $(element).html(html); 356 }); 357 $('.display').find('li#grid').addClass('selected'); 358 $('.display').find('li#list').removeAttr('class'); 359 $.totalStorage('display', 'grid'); 360 } 361} 362 363function dropDown() 364{ 365 elementClick = '#header .current'; 366 elementSlide = 'ul.toogle_content'; 367 activeClass = 'active'; 368 369 $(elementClick).on('click', function(e){ 370 e.stopPropagation(); 371 var subUl = $(this).next(elementSlide); 372 if(subUl.is(':hidden')) 373 { 374 subUl.slideDown(); 375 $(this).addClass(activeClass); 376 } 377 else 378 { 379 subUl.slideUp(); 380 $(this).removeClass(activeClass); 381 } 382 $(elementClick).not(this).next(elementSlide).slideUp(); 383 $(elementClick).not(this).removeClass(activeClass); 384 e.preventDefault(); 385 }); 386 387 $(elementSlide).on('click', function(e){ 388 e.stopPropagation(); 389 }); 390 391 $(document).on('click', function(e){ 392 e.stopPropagation(); 393 var elementHide = $(elementClick).next(elementSlide); 394 $(elementHide).slideUp(); 395 $(elementClick).removeClass('active'); 396 }); 397} 398 399function accordionFooter(status) 400{ 401 if(status == 'enable') 402 { 403 $('#footer .footer-block h4').on('click', function(e){ 404 $(this).toggleClass('active').parent().find('.toggle-footer').stop().slideToggle('medium'); 405 e.preventDefault(); 406 }) 407 $('#footer').addClass('accordion').find('.toggle-footer').slideUp('fast'); 408 } 409 else 410 { 411 $('.footer-block h4').removeClass('active').off().parent().find('.toggle-footer').removeAttr('style').slideDown('fast'); 412 $('#footer').removeClass('accordion'); 413 } 414} 415 416function accordion(status) 417{ 418 if(status == 'enable') 419 { 420 var accordion_selector = '#right_column .block .title_block, #left_column .block .title_block, #left_column #newsletter_block_left h4,' + 421 '#left_column .shopping_cart > a:first-child, #right_column .shopping_cart > a:first-child'; 422 423 $(accordion_selector).on('click', function(e){ 424 $(this).toggleClass('active').parent().find('.block_content').stop().slideToggle('medium'); 425 }); 426 $('#right_column, #left_column').addClass('accordion').find('.block .block_content').slideUp('fast'); 427 if (typeof(ajaxCart) !== 'undefined') 428 ajaxCart.collapse(); 429 } 430 else 431 { 432 $('#right_column .block .title_block, #left_column .block .title_block, #left_column #newsletter_block_left h4').removeClass('active').off().parent().find('.block_content').removeAttr('style').slideDown('fast'); 433 $('#left_column, #right_column').removeClass('accordion'); 434 } 435} 436 437function bindUniform() 438{ 439 if (!!$.prototype.uniform) 440 $("select.form-control,input[type='radio'],input[type='checkbox']").not(".not_uniform").uniform(); 441} 442$( window).load(function() { 443 $('#sidebar figure img:nth-child(2)').attr('src','https://www.avons.fr/themes/default-bootstrap/img/profile_img.png'); 444$('#sidebar figure').after('<p>Véritable passionnée de couture,<strong> Mallaury </strong>saura vous prodiguer les meilleurs conseils :)</p>'); 445$('#sidebar figure p').css('background','transparent'); 446$('#sidebar figure p').css('text-align','center'); 447$('#sidebar figure p').html('<a href="javascript:;" class="button" style="background: #E71F60;font-weight: 700;font-size: 14px;line-height: 15px;color: #FFFFFF;text-decoration: none;padding: 9px 16px 9px 16px;display: inline-block;border: 1px solid transparent;transition: all 0.3s ease;cursor: pointer;">Contactez-nous</a>'); 448$('#sidebar figure').before('<p style="margin: 0;font-weight: 700;font-size: 20px;line-height: 15px;color: #FFFFFF;">Demander conseil</p>'); 449$('#sidebar .clearfix p:nth-child(8)').remove(); 450 });
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.