1$(document).ready(function() { 2 3 4 var $w_resize_end_to = false; 5 6 resizeFunctions(); 7 resizeEndFunctions(); 8 $(window).resize(function(){ 9 resizeFunctions(); 10 clearTimeout($w_resize_end_to); 11 $w_resize_end_to = setTimeout(function(){ 12 resizeEndFunctions(); 13 }, 300); 14 }); 15 16 //$('.ms_default').myscroller(); 17 18 initLightbox(); 19 initPlaceholder(); 20 initCart(); 21 initMobileCatNav(); 22 initCatView(); 23 initStart(); 24 initZoom(); 25 initDefectLayer(); 26 initCheckout(); 27 28 initClinic(); 29 30 $('label.req').append('<span>*</span>'); 31 32 33 initAccordionList(); 34 35 $('.ms_default').myscroller(); 36 37 if ($('.load_layer').length) { 38 $('.load_layer').lightbox_me({ 39 centered: true, 40 overlayCSS: { 41 background: 'black', 42 opacity: .7 43 } 44 }); 45 } 46 47 48 49 initSetInputValue(); 50}); 51 52 53 54function resizeFunctions() { 55 initProductDetailImages(); 56 initChTeasers(); 57} 58 59function resizeEndFunctions() { 60 equalizeImages(); 61} 62 63function initStart() { 64 $('.sc_opener').mouseover(function(){ 65 var $parent = $(this).parents('.start_category'); 66 openSCArticles($parent); 67 return false; 68 }); 69 70 $('.sc_articles').mouseleave(function(){ 71 var $parent = $(this).parents('.start_category'); 72 closeSCArticles($parent); 73 return false; 74 }); 75 76 function openSCArticles($parent) { 77 $parent.find('.sc_overlay').fadeIn(); 78 $parent.find('.sc_articles').fadeIn(); 79 } 80 81 function closeSCArticles($parent) { 82 $parent.find('.sc_overlay').fadeOut(); 83 $parent.find('.sc_articles').fadeOut(); 84 } 85} 86 87function initLightbox() { 88 $('.open_lightbox').click(function(e){ 89 90 if ($(this).data('lightbox-selector')) { 91 92 var $element = $($(this).data('lightbox-selector')); 93 94 if ($element.length) { 95 $element.lightbox_me({ 96 centered: true, 97 overlayCSS: { 98 background: 'black', 99 opacity: .7 100 } 101 }); 102 } 103 } else { 104 105 $('.lightbox_me').load($(this).attr('href'), function(){ 106 $('.lightbox_me').lightbox_me({ 107 centered: true, 108 overlayCSS: { 109 background: 'black', 110 opacity: .9 111 }, 112 onLoad: function(){ 113 initSelectReplaces(); 114 initLayerSortable(); 115 initLayerScrollable(); 116 117 $('.lightbox_me').trigger('reposition'); 118 119 $change_logo = false; 120 smallerLogo(); 121 }, 122 onClose: function(){ 123 $change_logo = true; 124 initLogo(); 125 } 126 }); 127 128 129 }); 130 } 131 132 e.preventDefault(); 133 }); 134} 135 136function initPlaceholder() { 137 if ( !("placeholder" in document.createElement("input")) ) { 138 $("input[placeholder], textarea[placeholder]").each(function() { 139 var val = $(this).attr("placeholder"); 140 if ( this.value == "" ) { 141 this.value = val; 142 } 143 $(this).focus(function() { 144 if ( this.value == val ) { 145 this.value = ""; 146 } 147 }).blur(function() { 148 if ( $.trim(this.value) == "" ) { 149 this.value = val; 150 } 151 }) 152 }); 153 154 // Clear default placeholder values on form submit 155 $('form').submit(function() { 156 $(this).find("input[placeholder], textarea[placeholder]").each(function() { 157 if ( this.value == $(this).attr("placeholder") ) { 158 this.value = ""; 159 } 160 }); 161 }); 162 } 163} 164 165function initCart() { 166 $('.open_header_cart').click(function(){ 167 168 $('.w_overlay').fadeIn(); 169 $('.header_cart').fadeIn(400, function(){ 170 171 172 $('.hc_close').click(function(){ 173 closeHeaderCart(); 174 }); 175 $('.w_overlay').click(function(){ 176 closeHeaderCart(); 177 }); 178 179 $('.equalize').height('auto'); 180 equalizeImages(); 181 182 $(window).trigger('resize'); 183 }); 184 185 setTimeout(function(){ 186 $(window).trigger('resize'); 187 }, 50); 188 189 return false; 190 }); 191 192 if ($('.new_item_in_basket').length) { 193 $('.new_item_in_basket').lightbox_me({ 194 centered: true, 195 overlayCSS: { 196 background: 'black', 197 opacity: .7 198 } 199 }); 200 } 201 202 $('.cart_delete_item').click(function(){ 203 $(this).prev('input').prop('checked', true); 204 $('#removeBtn').val(true); 205 var $form = $(this).parents('form'); 206 207 $form.append('<input type="hidden" name="removeBtn" id="removeBtn" value="true" />'); 208 209 setTimeout(function(){ 210 $form.submit(); 211 }, 1000); 212 213 }); 214 215 var $cart_count = $.cookie('cart_count'); 216 217 if (typeof($cart_count) == 'undefined') { 218 $cart_count = 0; 219 } 220 221 if ($('#body_magazine').length) { 222 $('.header_cart_btn span').html($cart_count); 223 } else {
224 $.cookie('cart_count', $('.header_cart_btn span').html(), { expires: 1, path: '/' }); 225 } 226} 227 228function closeHeaderCart() { 229 $('.w_overlay').fadeOut(); 230 $('.header_cart').fadeOut(); 231} 232 233function initMobileCatNav() { 234 $('.open_mob_cats').click(function(){ 235 $('.filter').slideUp(); 236 $('.collection_subnav').slideToggle(); 237 return false; 238 }); 239 $('.open_mob_filter').click(function(){ 240 $('.collection_subnav').slideUp(); 241 $('.filter').slideToggle(); 242 return false; 243 }); 244} 245 246function initCatView() { 247 248 var $size = $.cookie('category_view'); 249 250 if (typeof($size) == 'undefined') { 251 $size = 's'; 252 } 253 254 if ($size == 's') { 255 $('.cat_view_small').addClass('active'); 256 } else { 257 $('.cat_view_large').addClass('active'); 258 $('.overview_products').addClass('large_overview_products'); 259 } 260 261 $('.category_view a').click(function(){ 262 $('.category_view a').removeClass('active'); 263 $(this).addClass('active'); 264 if ($(this).hasClass('cat_view_small')) { 265 $('.overview_products').removeClass('large_overview_products'); 266 $.cookie('category_view', 's'); 267 } else { 268 $('.overview_products').addClass('large_overview_products'); 269 $.cookie('category_view', 'l'); 270 } 271 272 equalizeImages(); 273 }); 274} 275 276function initAccordionList() { 277 $('.al_hidden').hide(); 278 $('.al_toggle').click(function(){ 279 if ($(this).parent('.al_item').hasClass('al_item_open')) { 280 $(this).parent('.al_item').removeClass('al_item_open'); 281 $(this).parent('.al_item').find('.al_hidden').slideUp(); 282 } else { 283 $(this).parent('.al_item').addClass('al_item_open'); 284 $(this).parent('.al_item').find('.al_hidden').slideDown(); 285 } 286 return false; 287 }); 288} 289 290function initZoom() { 291 if ($('.d_zoom').length) { 292 var $zoom = false; 293 294 $('.d_zoom_open').click(function(){ 295 $('.d_zoom_image img').attr('src', $(this).data('zoom-src')); 296 297 var $aspect_ratio = $(this).find('img').width() / $(this).find('img').height(); 298 299 if (!$('.gzoomwrap').length) { 300 301 var $sW = ($(window).height() - 60) * $aspect_ratio; 302 var $sH = $(window).height() - 60; 303 if ($sW > $(window).width()) { 304 $sW = $(window).width(); 305 $sH = $(window).width() / $aspect_ratio; 306 } 307 308 var $large_width = 3100; 309 var $large_height = $large_width / $aspect_ratio; 310 311 $zoom = $('.d_zoom_image').gzoom({ 312 sW: $sW, 313 sH: $sH, 314 lW: $large_width, 315 lH: $large_height, 316 lightbox: false, 317 step : 1, 318 debug: false 319 }); 320 321 } 322 $zoom.setZoom(0); 323 $('.d_zoom').delay(500).fadeIn('fast',function(){ 324 $(".gzoombutton").mousedown(function(){ 325 return false; 326 }); 327 }); 328 }); 329 330 $('.d_zoom_close').click(function(){ 331 $('.d_zoom').fadeOut(); 332 }); 333 334 335 } 336} 337 338function initProductDetailImages() { 339 if ($('.d_images_mobile').length) { 340 $('.d_images_mobile img').width($('.d_images_mobile').width()); 341 } 342} 343 344function initDefectLayer() { 345 if ($(window).width() > 600) { 346 $('.open_defect_layer').click(function(){ 347 $('.defect_layer iframe').attr('src', $(this).attr('href')); 348 $('.defect_layer').lightbox_me({ 349 centered: true, 350 overlayCSS: { 351 background: 'black', 352 opacity: .9 353 } 354 }); 355 return false; 356 }); 357 } 358 359} 360 361function closeDefectLayer() { 362 $('.defect_layer').trigger('close'); 363} 364 365function equalizeImages() { 366 367 imagesLoaded( '.equalize', function() { 368 369 $('.equalize_group').each(function(){ 370 371 var $max = 0; 372 373 $(this).find('.equalize').each(function(){ 374 var $img_height = $(this).find('img').height(); 375 if ($max < $img_height) { 376 $max = $img_height; 377 } 378 }); 379 380 $(this).find('.equalize').animate({ 381 height: $max 382 }, 100); 383 }); 384 }); 385 386} 387 388function initClinic() { 389 390 if ($('#agform_perisistparam').length) { 391 $('#agform_defectsOid').val($('#agform_perisistparam').val()); 392 } 393 394 if ($(".c_teasers").length && $(window).width() < 768) { 395 $(".c_teasers").detach().appendTo('.d_text'); 396 } 397} 398 399function initChTeasers() { 400 401 $('.ch_teasers').each(function(){ 402 403 $(this).find('.ch_teaser_content').height('auto'); 404 405 var $max = 0; 406 $(this).find('.ch_teaser').each(function(){ 407 408 if ($(this).find('.ch_teaser_content').height() > $max) { 409 $max = $(this).find('.ch_teaser_content').height(); 410 } 411 }); 412 413 $(this).find('.ch_teaser_content').height($max); 414 }); 415} 416 417function initCheckout() { 418 if ($("form#payment").length) { 419 $("form#payment dl").each(function(){ 420 $(this).addClass($(this).find("input").attr('id')); 421 }); 422 } 423 424 if ($(".checkout_order").length && $(".status.error").length) { 425 $('body,html').animate({ 426 scrollTop: $('.agb').offset().top 427 }, 1000); 428 $('.agb').addClass('agb_error'); 429 $(".status.error").detach().prependTo('.agb'); 430
431 $('.agb .my_checkbox').change(function(){ 432 if ($(this).is(':checked')) { 433 $('.agb').removeClass('agb_error'); 434 } else { 435 $('.agb').addClass('agb_error'); 436 } 437 }); 438 } 439 440 if ($("#shipSetCost").length) { 441 $('#shipSetCost span').clone().appendTo('.checkout_shipping_active dt .cs_price'); 442 } 443 444} 445 446function initSetInputValue() { 447 448 setActive(); 449 450 $('.set_input_val').click(function(){ 451 var $target = $(this).data('selection-target'); 452 $($target).val($(this).data('selection-id')); 453 454 setActive(); 455 }); 456 457 function setActive() { 458 $('.set_input_val').each(function(){ 459 460 var $target = $(this).data('selection-target'); 461 if ($($target).val() == $(this).data('selection-id')) { 462 $(this).parents('ul').find('li').removeClass('active'); 463 $(this).parents('li').addClass('active'); 464 } 465 }); 466 } 467}
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.