PageSourceSearch

https://www.magnumphotos.com/wp-content/cache/min/1/wp-content/themes/template/res/js/main.js?ver=1789541794

js magnumphotos.com collected 2026-09-24 08:26:30 UTC 14,614 bytes, 40 lines download raw bytes

1(function($){"use strict";setTimeout(function(){(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return}
2js=d.createElement(s);js.id=id;js.src="//connect.facebook.net/en_GB/sdk.js";fjs.parentNode.insertBefore(js,fjs)}(document,'script','facebook-jssdk'))},3800);window.shareInit=function(){$shares=$('.share-button');if(typeof FB==='undefined'){window.fbAsyncInit=function(){FB.init({appId:'2334186473528066',status:!0,version:'v2.6'})}}
3$shares.each(function(){var $share=$(this);if($share.data('sharable'))return;$share.data('sharable',!0);$share.click(function(e){e.preventDefault();if($share.is('.facebook')){shareFacebook($share)}else if($share.is('.twitter')){shareTwitter($share)}else if($share.is('.pinterest')){sharePinterest($share)}})})}
4var $shares=$('.share-button');if($shares.length){shareInit()}
5function shareFacebook($s){var link=window.location.href;var image=$s.data('share-image');var text=$s.data('share-text');FB.ui({method:'share',name:text,href:link,picture:image,description:text})}
6function shareTwitter($s){var link=$s.attr('href');link+=window.location.href;window.open(link,'_blank','width=600,height=400')}
7function sharePinterest($s){var link=$s.attr('href');link+=window.location.href;window.open(link,'_blank','width=600,height=400')}
8function letterHighlighting(){if(!$body.is('.page-template-template-photographers'))return;var $letters=$('.list_letter');var l=$('.photographer_landing .locked').height();var top=$win.scrollTop()+headerHeight;top+=l?l:0;var visible=[];var topRow=[];var topHeight=0;var rowHeight=0;$letters.each(function(i,letter){var $l=$(letter);var posBottom=$l.offset().top+$l.height();rowHeight=$l.height();if(posBottom>top){visible.push($l);if(posBottom<top+rowHeight){topRow.push($l);topHeight=posBottom}}});$('.letter').removeClass('active');if(!visible.length)return;if(!topRow.length)$('.letter[href="#'+visible[0].attr('id')+'"]').addClass('active');else{var count=topRow.length;
8var diff=(topHeight-top);var n=Math.floor(rowHeight/diff);if(n>count)n=count;$('.letter[href="#'+topRow[n-1].attr('id')+'"]').addClass('active')}}
9window.updateOn.both.push(letterHighlighting);$win.load(function(){$('.related__mobile-more').click(function(){var $this=$(this);$this.parent().find('.teaser').slideDown('slow');$this.addClass('hidden')});$('.type-select select').select2();if(!Cookies.get('landing-popup')){var $popup=$('.b-popup.b-popup--landing');window.openNicely($popup);$popup.find('.stay').click(function(e){e.preventDefault();window.closeNicely($popup);Cookies.set('landing-popup',!0,{expires:300})});$popup.find('.leave').click(function(e){window.closeNicely($popup);Cookies.set('landing-popup',!0,{expires:300})})}
10$('body.logged-in .mobile-signup .username').click(function(e){e.preventDefault();$(this).closest('.mobile-signup').toggleClass('opened')});$('.login-link').each(function(){var $link=$(this).find('.username'),$menu=$('.header-login-dropdown-links'),timeout;function hide(){clearTimeout(timeout);timeout=setTimeout(function(){$menu.fadeOut()},300)}
11function show(){clearTimeout(timeout);$menu.fadeIn()}
12$link.hover(show,hide);$menu.hover(show,hide)})})
13var headerLoginRepositioning=function(){var $headerLogin=$('body.logged-in .header-login-dropdown-links');var $cont=$('.login-link ');if(!$headerLogin.length||!$cont.length)return;var left=$cont.offset().left;$headerLogin.css('left',left+$cont.outerWidth()/2-$headerLogin.outerWidth()/2)}
14window.updateOn.resize.push(headerLoginRepositioning);$('.js-newsletter-button').click(function(e){e.preventDefault();var $b=$(this);$b.siblings('.js-newsletter-form').removeClass('not-on-mobile');$b.addClass('not-on-mobile')});window.checkCaptions=function(){$('.b-caption__opener').each(function(){var $button=$(this);if(!$button.data('caption-prepared')){$button.data('caption-prepared',!0);$button.click(function(){$button.hide();var $rest=$button.next();$rest.removeClass('hidden');setTimeout(function(){$rest.addClass('visible');window.updateAll();var $slide=$button.closest('.swiper-slide');var $imgWithProduct=$button.closest('.match-big');setTimeout(function(){window.updateAll()},500);if($imgWithProduct.length){$imgWithProduct.height('')}
15if($slide.length){$slide.height('');setTimeout(function(){$slide.data('height',$slide.height());$slide.height($slide.height());$slide.closest('.swiper-container').height($slide.height())},100)}},10)})}})}
16checkCaptions();$('.pro-toggle').each(function(){var $toggle=$(this),$section=$('#pro'),$close=$section.find('.close'),visible=!1;var showed=!1;if(Cookies.get('pro-peaked'))$section.data('peaked',!0);$win.load(function(){if($section.data('peaked'))return;show()});$toggle.hover(function(){return;$(this).unbind('mouseenter mouseleave');if(resp.touch)return;$section.show();setTimeout(function(){$body.css('top',30);$locked.each(function(){var $this=$(this);$this.css('top',30+parseInt($this.css('top')))});$section.addClass('peaked');setTimeout(function(){$body.css('top',0);$locked.css('top','');$section.removeClass('peaked');setTimeout(function(){if(!showed){$section.hide()}},400)},600)},10)});function show(){$section.show();visible=!0;$toggle.addClass('toggled');showed=!0;setTimeout(function(){$locked.each(function(){var $this=$(this);$this.css('top',90+parseInt($this.css('top')))});$section.addClass('opened')},10)}
17function hide(){$section.removeClass('opened');$locked.css('top','');$toggle.removeClass('toggled');$section.data('peaked',!0);Cookies.set('pro-peaked',!0,{expires:30});setTimeout(function(){$section.hide();visible=!1},410)}
18$toggle.click(function(){if(visible){hide()}else{show()}
19return!1});$close.click(function(){hide();return!1});$toggle.on('hide',function(){if(visible)hide()})});$('.mega-toggle').each(function(){var $toggle=$(this),$section=$('#mega'),$close=$section.find('.js-mega-close'),visible=!1;function show(){window.openNicely($section);$('html, body').addClass('mega-opened');visible=!0;setTimeout(function(){window.updateAll()},500)}
20function hide(){window.closeNicely($section);$('html, body').removeClass('mega-opened');visible=!1}
21$('.js-search-open').click(function(){hide()});$toggle.click(function(){if(visible){hide()}else{show()}
22return!1});$close.click(function(){hide();return!1});$toggle.on('hide',function(){if(visible)hide()})});var $rte=$('.with-read-more');$('.read_more').click(function(e){e.preventDefault();$(this).parent().addClass('invisible');$rte.removeClass('with-read-more');$rte.find('.after-read-more').slideDown(800)});var $categoryFeatured=$('.category__featured');function adjustCategoryFeatured(){$categoryFeatured.each(function(){var $this=$(this);var $img=$this.find('.image');var w=$img.width();var cont=$this.find('.teaser.main').width();var side=$this.find('.teaser.info').width()+35;var margin=Math.max((cont-side-w)/2,0);$img.css('margin-left',margin)})}
23if($categoryFeatured.length){window.updateOn.resize.push(adjustCategoryFeatured)}
24$(document).on('click','.b-star',function(e){var $this=$(this),$star=$this.find('.star');e.preventDefault();if($star.is('.active')){$star.removeClass('active');$.get(dw.ajax+'?favourite=remove:'+$this.data('for'))}else{var position={top:$star.offset().top+$star.height()/2,left:$star.offset().left+$star.width()/2};var color=$star.css('color');var $text=$('<div />').addClass('b-star__text').text('Saved').appendTo('body').css(position).css('color',color);$.get(dw.ajax+'?favourite=add:'+$this.data('for'));$star.removeClass('active');setTimeout(function(){$text.css('opacity',1);$star.addClass('active');setTimeout(function(){$text.css('opacity',0);setTimeout(function(){$star.css('opacity',1);$text.remove()},400)},800)},100)}});$('.page-menu').each(function(){var $menu=$(this),open=$menu.is('.open');if(resp.st&&open){$menu.removeClass('open').find('.sub-menu').stop().slideUp(args);open=!open}
25function adjust(){$menu.next().css({paddingTop:$menu.height()})}
26var args={step:function(){adjust()}};$menu.find('a:not(.toggle)').click(function(e){if(!open){e.preventDefault();$menu.addClass('open').find('.sub-menu').stop().slideDown(args);open=!0}});$win.load(adjust);$win.resize(adjust);$menu.find('.toggle').click(function(){if(open){$menu.removeClass('open').find('.sub-menu').stop().slideUp(args)}else{$menu.addClass('open').find('.sub-menu').stop().slideDown(args)}
27open=!open;return!1});$win.scroll(function(){if(open){open=!1;$menu.removeClass('open').find('.sub-menu').stop().slideUp(args)}})});var $anchors=$('.anchor');$anchors.click(function(e){e.preventDefault();var $this=$(this);var id=$this.attr('href');var $anchor=$(id);if($anchor.length){$anchors.removeClass('active');var pos=$anchor.offset().top-headerHeight;if($this.is('.lock'))pos=pos-70;$("html, body").animate({scrollTop:pos},800);return;if($this.is('.lock')){setTimeout(function(){pos=$anchor.offset().top-getLockedHeight();$("html, body").animate({scrollTop:pos},800)},600)}}});function getLockedHeight(){var height=0;window.$locked.each(function(){var $l=$(this);height+=$l.height()});return height}
28var $forms=$('.b-form');$forms.each(function(){var $form=$(this);
28var $inputs=$form.find('input:not([type="radio"]):not([type="checkbox"]):not([type="submit"])');if($form.find('.gform_wrapper').length){$inputs.each(function(){var $parent=$(this).parent();$parent.siblings('label').appendTo($parent)})}
29$inputs.each(function(){var $input=$(this);$input.keypress(function(){checkInput(this)});$input.keyup(function(){checkInput(this)});$input.change(function(){checkInput(this)})});function checkInput(i){var $i=$(i);if($i.val().trim()!==''){$i.addClass('not-empty')}else{$i.removeClass('not-empty')}}});$win.load(function(){matchHeights()})
30function matchHeights(){$('.teasers.next-to').find('.teaser').matchHeight();$('.products-grid, .four-products').find('.teaser').matchHeight();$('.teaser.format-event:not(.theme-preview .teaser)').matchHeight();$('.breaker-products').find('.breaker-product').matchHeight();$('.breakers .breaker-teaser').matchHeight({byRow:!1});$('.big-img-related .teaser').matchHeight();$('.featured-products .mh').matchHeight();$('.match-big').matchHeight();$('.three-cols.next-to .teaser').matchHeight();$('.search_page-wrapper').matchHeight()}
31$('.locked-text').click(function(){var $filters=$('.p-search__filters');$filters.slideToggle()});var $mobileDD=$('.mobile-dropdown');$mobileDD.click(function(){var $dd=$(this);updateDropdown($dd,!0);$dd.toggleClass('closed')});function updateDropdown($el,dontAddClass){if(!$el)$el=$mobileDD;$el.each(function(){var $dd=$(this);if(resp.m){var height=$dd.height();if(!$dd.data('height'))$dd.data('height',0);if(height>$dd.data('height')){if(!$dd.is('.closed')){$dd.height(height);$dd.data('height',height);if(!dontAddClass)$dd.addClass('closed')}}}else{$dd.height('');$dd.data('height',0)}})}
32window.updateOn.resize.push(updateDropdown);window.updateAll=function(){window.updateOn.scroll.forEach(function(f){f()});window.updateOn.resize.forEach(function(f){f()});window.updateOn.both.forEach(function(f){f()});$.fn.matchHeight._update()};window.dwResize=throttle(function(){window.updateOn.resize.forEach(function(f){f()});window.updateOn.both.forEach(function(f){f()})},100);$win.resize(window.dwResize);window.dwScroll=throttle(function(){window.updateOn.scroll.forEach(function(f){f()});window.updateOn.both.forEach(function(f){f()})},100);$win.on('scroll',window.dwScroll);$win.load(function(){window.updateAll();setTimeout(function(){window.updateAll()},1000)});window.updateAll();var imagesLoaded=$('.image-placeholder').length>0;var updateAllFlag=!1;setInterval(function(){if(updateAllFlag){updateAllFlag=!1;setTimeout(function(){window.dwResize()},150)}},300);$.fn.dwImagePlaceholder=function(){function loadImage($image,cb){if($image.data('loaded')){return}
33var st=$win.scrollTop(),w=$win.width(),h=$win.height(),$tmp,horizontalMargin=$image.closest('.b-overlay').length?1600:500,src=$image.data('src');if($image.is(':visible')&&($image.offset().left+$image.width()>$win.scrollLeft())&&($image.offset().top<st+h+600)&&($image.offset().left<w+horizontalMargin)){$tmp=$('<img />');$tmp.load(function(){$image.attr('src',src);if(cb)cb();updateAllFlag=!0});$tmp.attr('src',src);$image.data('loaded',!0)}}
34return this.find('.image-placeholder:not(.handled)').each(function(){var st=$win.scrollTop(),h=$win.height(),$image=$(this);$image.addClass('handled');if(!$image.data('src')){return}
35loadImage($image);window.updateOn.scroll.push(function(){loadImage($image)});$image.on('external-resize',function(){loadImage($image,function(){$image.trigger('external-resize-finished')})})})}
36$('body').dwImagePlaceholder();$(document).on('submit','.newsletter-form-form',function(){var $form=$(this);var redirectUrl=$form.data('redirecturl');$.ajax({url:$form.attr('action'),type:$form.attr('method'),data:$form.serialize(),success:function(json){json=$.parseJSON(json);if('success' in json){var alerttext=json.success;var alertaID=json.aID;$form.append('<div class="newsletter-form-message" style="display:none;">'+alerttext+'</div>');console.log(alerttext);$form.find('input[type=email]').val('').blur();$form.find('input[type=text]').val('').blur();$form.find('input[type=checkbox]').prop('checked',!1);if('function'==typeof fbq){fbq('track','Lead')}
37if(redirectUrl){Cookies.set('aID',alertaID,{expires:14});console.log(alertaID);setTimeout(function(){window.location.href=redirectUrl},300)}}else{var alerttext=json.error;$form.append('<div class="newsletter-form-message" style="display:none;">
37'+alerttext+'</div>');console.log(alerttext);$form.find('input[type=email]').focus()}
38$('.newsletter-form-message').fadeIn('fast');setTimeout(function(){$('.newsletter-form-message').fadeOut('slow',function(){$(this).remove()})},4000)}})
39return!1});function videoCenter(){if(jQuery('.breaker-newsletter-expanded .fullscreen-bg-video').find('video').length){setTimeout(function(){var parent=jQuery('.breaker-newsletter-expanded .fullscreen-bg-video');var targetVideo=jQuery('.breaker-newsletter-expanded .fullscreen-bg-video').find('video');targetVideo.width('auto').height('100%').css('margin-left',0).css('margin-top',0);var wWindow=parent.width();var hWindow=parent.height();var widthVideo=targetVideo.width();var heightVideo=targetVideo.height();if(widthVideo<wWindow){targetVideo.width('100%').height('auto');var margTop=(targetVideo.height()-hWindow)/2;targetVideo.css('margin-top',-margTop)}else{targetVideo.width('auto').height('100%');var margLeft=(targetVideo.width()-wWindow)/2;targetVideo.css('margin-left',-margLeft)}},200)}}
40jQuery(window).load(function(){videoCenter()});jQuery(window).resize(function(){videoCenter()})})(jQuery)

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.