1"use strict"; 2 3(function ($) { 4 5 if( 'undefined' == typeof hybridExtendData ) 6 window.hybridExtendData = {}; 7 8 /*** Scrollpoints ***/ 9 10 $.fn.hybridExtendScroller = function (options) { 11 12 var scrollSpeed = 500, 13 scrollPadding = 50; 14 if( 'undefined' != typeof hybridExtendData && 'undefined' != typeof hybridExtendData.customScrollerSpeed ) 15 scrollSpeed = hybridExtendData.customScrollerSpeed; 16 if( 'undefined' != typeof hybridExtendData && 'undefined' != typeof hybridExtendData.customScrollerPadding ) 17 scrollPadding = hybridExtendData.customScrollerPadding; 18 19 // Options 20 var settings = $.extend({ 21 urlLoad: false, // value: boolean 22 speed: scrollSpeed, // value: integer 23 padding: scrollPadding, // value: integer 24 }, options); 25 26 // Scroll to hash 27 if (typeof scrollToHash == 'undefined') { 28 var scrollToHash = function( target ) { 29 target = target.replace("#scrollpoint-", "#"); // replace first occurence 30 if ( target.length > 1 ){ 31 var $target = $( target ); 32 if ( $target.length ) { 33 var destin = $target.offset().top - settings.padding; 34 $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destin}, settings.speed ); 35 return true; 36 } 37 } 38 return false; 39 }; 40 }; 41 42 return this.each(function () { 43 if( 'undefined' == typeof hybridExtendData || 'undefined' == typeof hybridExtendData.scroller || 'enable' == hybridExtendData.scroller ) { 44 45 if ( settings.urlLoad ) { 46 if( 'undefined' == typeof hybridExtendData || 'undefined' == typeof hybridExtendData.scrollerPageLoad || 'enable' == hybridExtendData.scrollerPageLoad ) { 47 var target = window.location.hash; 48 if ( target ) { 49 target = target.split("&"); 50 target = target[0].split("?"); 51 target = target[0].split("="); 52 scrollToHash(target[0]); 53 } 54 } 55 } else { 56 57 var $self = $(this), 58 executed = '', 59 parseHref = $self.attr('href'); 60 61 if(typeof parseHref != 'undefined') 62 parseHref = parseHref.replace(/#([A-Za-z0-9\-\_]+)/g,'#scrollpoint-$1'); 63 else 64 return; // Bugfix: We can break the $.each() loop at a particular iteration by making the callback function return false. Returning non-false is the same as a continue statement in a for loop; it will skip immediately to the next iteration. 65 66 // Add namespace so when new page is loaded, the hashtag has unique namespace (this ways the script overtakes browser behavior to scroll to hashtag on pageload) 67 if( 'undefined' == typeof hybridExtendData || 'undefined' == typeof hybridExtendData.scrollerPageLoad || 'enable' == hybridExtendData.scrollerPageLoad ) 68 $self.attr('href', parseHref); 69 70 $self.on('click', function(e) { 71 // Only if href points to current url 72 // $self.context.pathname is empty in IE11, so we need to scrape off this test 73 // if ( $self.context.pathname == window.location.pathname ) { 74 executed = ''; 75 if ( $self.prop('hash') ) 76 executed = scrollToHash( $self.prop('hash') ); 77 if ( !executed && $self.attr('data-scrollto') ) 78 executed = scrollToHash( $self.attr('data-scrollto') ); 79 if ( executed ) 80 e.preventDefault(); 81 // } 82 }); 83 84 } 85 86 } 87 }); 88 89 }; 90 91}(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.