1(function(){ 2 var tridentOrEdge = (navigator.userAgent.match(/ Trident/) || navigator.userAgent.match(/ Edge/)); 3 4 window.Rolv = { 5 show: function($popup){ 6 7 var updateYScroll = function(){ 8 if($(window).outerHeight() < $popup.find('.Rolv-content').outerHeight()){ 9 $popup.addClass('Rolv--yscroll'); 10 }else{ 11 $popup.removeClass('Rolv--yscroll'); 12 } 13 }; 14 15 if($popup.is('.Rolv--visible')){ 16 // if the popup is already visible, there is not much to do 17 window.scrollTo(0,0); 18 updateYScroll(); 19 return; 20 } 21 22 $popup.trigger('RolvWillOpen'); 23 24 var scrollPosition = (window.scrollY === undefined) ? window.pageYOffset : window.scrollY; 25 $popup.data('scrollPosition', scrollPosition); 26 27 $popup.addClass('Rolv--visible'); 28 // never ever append, this causes servere issues in iOS 29 $('body').prepend($popup); 30 $('html').addClass('Rolv--visible'); 31 $popup.get(0).removeAttribute('hidden'); 32 33 $('.body, [data-Rolv-role="body"]').css({ 34 'top': -scrollPosition, 35 'height': 'auto' // overwrite any height value 36 }); 37 window.scrollTo(0,0); 38 39 // wait for scroll to be updated (IE11) 40 window.setTimeout(function(){ 41 window.Rolv._removeEventListener($popup); 42 43 window.scrollTo(0,0); 44 updateYScroll(); 45 46 // click handler is sometimes buggy on ios! 47 $popup.on('touchend.Rolv, click.Rolv', '.Rolv-Close, [data-Rolv-role="close"], [data-rolv-role="close"]', function(evt){ 48 window.Rolv.close($popup); 49 evt.preventDefault(); 50 }); 51 52 $(window).on('resize.Rolv', function(){ 53 updateYScroll(); 54 }); 55 56 $(window).on('keyup.Rolv', function(evt){ 57 if(evt.which == 27){ 58 window.Rolv.close($popup); 59 evt.preventDefault(); 60 } 61 }); 62 63 // click handler is sometimes buggy on ios! 64 $popup.on('touchend.Rolv, click.Rolv', function(evt){ 65 if($(evt.target).parents('.Rolv-content').length == 0 && !$(evt.target).is('[data-Rolv-type="interactive"]') && $(evt.target).parents('[data-Rolv-type="interactive"]').length == 0) { 66 window.Rolv.close($popup); 67 evt.preventDefault(); 68 } 69 }); 70 71 72 if(window.lazySizes && window.lazySizes.autoSizer) { 73 // required to update sizes properly 74 window.lazySizes.autoSizer.checkElems(); 75 } 76 77 $popup.trigger('RolvOpened'); 78 }, 1); 79 80 if(tridentOrEdge) { 81 $('html').on('mousewheel.Rolv', function (event) { 82 // remove default behavior 83 event.preventDefault(); 84 85 //scroll without smoothing 86 var wheelDelta = event.originalEvent.wheelDelta; 87 var currentScrollPosition = window.pageYOffset; 88 window.scrollTo(0, currentScrollPosition - wheelDelta); 89 }); 90 } 91 }, 92 _removeEventListener: function($popup){ 93 $(window).off('resize.Rolv'); 94 $(window).off('keyup.Rolv'); 95 $popup.off('touchend.Rolv, click.Rolv', '.Rolv-Close, [data-Rolv-role="close"]'); 96 $popup.off('touchend.Rolv, click.Rolv'); 97 if(tridentOrEdge) { 98 $('body').off('mousewheel.Rolv'); 99 } 100 }, 101 close: function($popup){ 102 var event = jQuery.Event('RolvWillClose'); 103 $popup.trigger(event); 104 105 if(event.isDefaultPrevented()){ 106 return; 107 } 108 // remove event listener 109 window.Rolv._removeEventListener($popup); 110 111 $('html').removeClass('Rolv--visible'); 112 113 $popup.removeClass('Rolv--visible'); 114 $popup.get(0).setAttribute('hidden', true); 115 116 $('.body, [data-Rolv-role="body"]').css({ 117 'top': '', 118 'height': '' 119 }); 120 121 $popup.trigger('RolvClosed'); 122 123 var scrollPosition = $popup.data('scrollPosition'); 124 window.scrollTo(0, scrollPosition); 125 126 window.setTimeout(function(){ 127 window.scrollTo(0, scrollPosition); 128 }, 1); 129 130 } 131 } 132})();
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.