PageSourceSearch

https://centauriweb.hu/en/wp-content/themes/unos-premium/premium/library/js/scroller.js?ver=3.0.3

js centauriweb.hu collected 2026-09-25 00:30:41 UTC 7,114 bytes, 208 lines download raw bytes

1jQuery(document).ready(function($) {
2	"use strict";
3
4	if( 'undefined' == typeof hootData )
5		window.hootData = {};
6
7	/*** Generic hootScroller ***/
8
9	$.fn.hootScroller = function (options) {
10
11		var scrollSpeed = 500,
12			scrollPadding = 50;
13		if( 'undefined' != typeof hootData && 'undefined' != typeof hootData.customScrollerSpeed )
14			scrollSpeed = hootData.customScrollerSpeed;
15		if( 'undefined' != typeof hootData && 'undefined' != typeof hootData.customScrollerPadding )
16			scrollPadding = hootData.customScrollerPadding;
17
18		// Options
19		var settings = $.extend({
20			urlLoad: false,                 // value: boolean
21			speed: scrollSpeed,         // value: integer
22			padding: scrollPadding,     // value: integer
23		}, options);
24
25		// Scroll to hash
26		if (typeof scrollToHash == 'undefined') {
27			var scrollToHash = function( target ) {
28				target = target.replace("#scrollpoint-", "#"); // replace first occurence
29				if ( target.length > 1 ){
30					var $target = $( target );
31					if ( $target.length ) {
32						var destin = $target.offset().top - settings.padding;
33						$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destin}, settings.speed );
34						return true;
35					}
36				}
37				return false;
38			};
39		};
40
41		return this.each(function () {
42			if( 'undefined' == typeof hootData.scroller || 'enable' == hootData.scroller ) {
43
44				if ( settings.urlLoad ) {
45					if( 'undefined' == typeof hootData.scrollerPageLoad || 'enable' == hootData.scrollerPageLoad ) {
46						var target = window.location.hash;
47						if ( target ) {
48							target = target.split("&");
49							target = target[0].split("?");
50							target = target[0].split("=");
51							scrollToHash(target[0]);
52						}
53					}
54				} else {
55
56					var $self = $(this),
57						executed = '',
58						parseHref = $self.attr('href');
59
60					if(typeof parseHref != 'undefined')
61						parseHref = parseHref.replace(/#([A-Za-z0-9\-\_]+)/g,'#scrollpoint-$1');
62					else
63						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.
64
65					// 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)
66					if( 'undefined' == typeof hootData.scrollerPageLoad || 'enable' == hootData.scrollerPageLoad )
67						$self.attr('href', parseHref);
68
69					$self.on('click', function(e) {
70						// Only if href points to current url
71						// $self.context.pathname is empty in IE11, so we need to scrape off this test
72						// if ( $self.context.pathname == window.location.pathname ) {
73							executed = '';
74							if ( $self.prop('hash') )
75								executed = scrollToHash( $self.prop('hash') );
76							if ( !executed && $self.attr('data-scrollto') )
77								executed = scrollToHash( $self.attr('data-scrollto') );
78							if ( executed )
79								e.preventDefault();
80						// }
81					});
82
83				}
84
85			}
86		});
87
88	};
89
90	/*** Top Button ***/
91
92	if( 'undefined' == typeof hootData.topButton || 'enable' == hootData.topButton ) {
93		$('.fixed-goto-top').hootScroller({padding:0});
94		var $top_btn = $('.waypoints-goto-top');
95		if ( $top_btn.length ) {
96			if (typeof Waypoint === "function") {
97				var waypoints = $('#page-wrapper').waypoint(function(direction) {
98					if(direction=='down')
99						$top_btn.addClass('topshow');
100					if(direction=='up')
101						$top_btn.removeClass('topshow');
102					},{offset: '-80%'});
103			} else {
104				$top_btn.addClass('topshow');
105			}
106		}
107	}
108
109	/*** Scrollpoints ***/
110
111	// Watch all links within .scrollpoints container and links with .scrollpoint
112	// => used for implementing Menu Scroll
113	if( 'undefined' == typeof hootData.scrollpointsContainer || 'enable' == hootData.scrollpointsContainer ) {
114		$('.scrollpointscontainer a, a.scrollpoint').hootScroller();
115	}
116
117	/*** Scroll on URL Load ***/
118
119	// Scroll on url load has a few inherent issues. Complying with standard url hash structure, we
120	// cant override browser behavior. Adopting additional methods (prepend hash tag with unique id,
121	// or using query args instead of hash) leads to non standard url (what if when user changes
122	// themes).
123	// Hence possible solution for now: Pepend hash tag with unique id using scroller js only..
124	if( 'undefined' == typeof hootData.urlScroller || 'enable' == hootData.urlScroller ) {
125		$('#page-wrapper').hootScroller({urlLoad:true, speed:1500});
126	}
127
128	/*** Sticky Header ***/
129
130	if( 'undefined' == typeof hootData.stickyHeader || 'enable' == hootData.stickyHeader ) {
131		if (typeof Waypoint === "function" && $('.hoot-sticky-header #header').length) {
132			var offset = -300; // offset = -10 // fixes bug: header gets stuck when no topbar i.e. header is at top 0 at page load
133			if( 'undefined' != typeof hootData && 'undefined' != typeof hootData.stickyHeaderOffset )
134				offset = hootData.stickyHeaderOffset;
135			if ( typeof Waypoint.Sticky === 'undefined' ) {
136
137				  // var Waypoint = window.Waypoint
138
139				  /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */
140				  function Sticky(options) {
141				    this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options)
142				    this.element = this.options.element
143				    this.$element = $(this.element)
144				    this.createWrapper()
145				    this.createWaypoint()
146				  }
147
148				  /* Private */
149				  Sticky.prototype.createWaypoint = function() {
150				    var originalHandler = this.options.handler
151
152				    this.waypoint = new Waypoint($.extend({}, this.options, {
153				      element: this.wrapper,
154				      handler: $.proxy(function(direction) {
155				        var shouldBeStuck = this.options.direction.indexOf(direction) > -1
156				        var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''
157
158				        this.$wrapper.height(wrapperHeight)
159				        this.$element.toggleClass(this.options.stuckClass, shouldBeStuck)
160
161				        if (originalHandler) {
162				          originalHandler.call(this, direction)
163				        }
164				      }, this)
165				    }))
166				  }
167
168				  /* Private */
169				  Sticky.prototype.createWrapper = function() {
170				    if (this.options.wrapper) {
171				      this.$element.wrap(this.options.wrapper)
172				    }
173				    this.$wrapper = this.$element.parent()
174				    this.wrapper = this.$wrapper[0]
175				  }
176
177				  /* Public */
178				  Sticky.prototype.destroy = function() {
179				    if (this.$element.parent()[0] === this.wrapper) {
180				      this.waypoint.destroy()
181				      this.$element.removeClass(this.options.stuckClass)
182				      if (this.options.wrapper) {
183				        this.$element.unwrap()
184				      }
185				    }
186				  }
187
188				  Sticky.defaults = {
189				    wrapper: '<div class="sticky-wrapper" />',
190				    stuckClass: 'stuck',
191				    direction: 'down right'
192				  }
193
194				  Waypoint.Sticky = Sticky;
195
196			}
197
198
199			if ( typeof Waypoint.Sticky === 'function' ) {
200				var stickyHeader = new Waypoint.Sticky({
201					element: $('.hoot-sticky-header #header')[0],
202					offset: offset
203				});
204			} else { console.log( 'Waypoint exist. Sticky does not.'); }
205		}
206	}
207
208});

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.