PageSourceSearch

https://portal.londrina.pr.gov.br/modules/mod_vertical_menu/js/perfect-scrollbar.js?v=3.1.215

js londrina.pr.gov.br collected 2026-09-24 09:10:05 UTC 15,151 bytes, 494 lines download raw bytes

1// Copyright (c) 2012, 2014 Hyunje Alex Jun and other contributors
2// Licensed under the MIT License
3
4smMobile = navigator.userAgent.match(/(Android|webOS|BlackBerry|iPhone|iPad|iPod|Windows Phone)/i);
5if (!smMobile) (function (factory) {
6	factory(window.jq183 || jQuery);
7})(function ($) {
8	'use strict';
9
10	function int(x) {
11		if (typeof x === 'string') {
12			return parseInt(x, 10);
13		} else {
14			return ~~x;
15		}
16	}
17
18	var defaultSettings = {
19		wheelSpeed: 1,
20		wheelPropagation: false,
21		minScrollbarLength: null,
22		maxScrollbarLength: null,
23		useBothWheelAxes: false,
24		useKeyboard: true,
25		suppressScrollX: true,
26		suppressScrollY: false,
27		scrollXMarginOffset: 0,
28		scrollYMarginOffset: 0,
29		includePadding: true
30	};
31
32	var getEventClassName = (function () {
33		var incrementingId = 0;
34		return function () {
35			var id = incrementingId;
36			incrementingId += 1;
37			return '.perfect-scrollbar-' + id;
38		};
39	})();
40
41	$.fn.perfectScrollbar = function (suppliedSettings, option) {
42
43		return this.each(function () {
44			var settings = $.extend(true, {}, defaultSettings);
45			var $this = $(this);
46
47			if (typeof suppliedSettings === "object") {
48				// Override default settings with any supplied
49				$.extend(true, settings, suppliedSettings);
50			} else {
51				// If no setting was supplied, then the first param must be the option
52				option = suppliedSettings;
53			}
54
55			// Catch options
56			if (option === 'update') {
57				if ($this.data('perfect-scrollbar-update')) {
58					$this.data('perfect-scrollbar-update')();
59				}
60				return $this;
61			}
62			else if (option === 'destroy') {
63				if ($this.data('perfect-scrollbar-destroy')) {
64					$this.data('perfect-scrollbar-destroy')();
65				}
66				return $this;
67			}
68
69			if ($this.data('perfect-scrollbar')) {
70				// if there's already perfect-scrollbar
71				return $this.data('perfect-scrollbar');
72			}
73
74
75			// Or generate new perfectScrollbar
76
77			$this.addClass('ps-container');
78
79			var containerWidth;
80			var containerHeight;
81			var contentWidth;
82			var contentHeight;
83
84			var isRtl = $this.css('direction') === "rtl";
85			var eventClassName = getEventClassName();
86			var ownerDocument = this.ownerDocument || document;
87
88			var $scrollbarYRail = $("<div class='ps-scrollbar-y-rail'>").appendTo($this);
89			var $scrollbarY = $("<div class='ps-scrollbar-y'>").appendTo($scrollbarYRail);
90			var scrollbarYActive;
91			var scrollbarYHeight;
92			var scrollbarYTop;
93			var scrollbarYRight = int($scrollbarYRail.css('right'));
94			var isScrollbarYUsingRight = scrollbarYRight === scrollbarYRight; // !isNaN
95			var scrollbarYLeft = isScrollbarYUsingRight ? null : int($scrollbarYRail.css('left'));
96			var railBorderYWidth = 0;
97
98			function updateScrollTop(currentTop, deltaY) {
99				var newTop = currentTop + deltaY;
100				var maxTop = containerHeight - scrollbarYHeight;
101
102				if (newTop < 0) {
103					scrollbarYTop = 0;
104				} else if (newTop > maxTop) {
105					scrollbarYTop = maxTop;
106				} else {
107					scrollbarYTop = newTop;
108				}
109
110				var scrollTop = int(scrollbarYTop * (contentHeight - containerHeight) / (containerHeight - scrollbarYHeight));
111				$this.scrollTop(scrollTop);
112			}
113
114			function getThumbSize(thumbSize) {
115				if (settings.minScrollbarLength) {
116					thumbSize = Math.max(thumbSize, settings.minScrollbarLength);
117				}
118				if (settings.maxScrollbarLength) {
119					thumbSize = Math.min(thumbSize, settings.maxScrollbarLength);
120				}
121				return thumbSize;
122			}
123
124			function updateCss() {
125				var railYOffset = {top: $this.scrollTop(), height: containerHeight, display: scrollbarYActive ? "inherit" : "none"};
126
127				if (isScrollbarYUsingRight) {
128					if (isRtl) {
129						railYOffset.right = contentWidth - $this.scrollLeft() - scrollbarYRight - $scrollbarY.outerWidth();
130					} else {
131						railYOffset.right = scrollbarYRight - $this.scrollLeft();
132					}
133				} else {
134					if (isRtl) {
135						railYOffset.left = $this.scrollLeft() + containerWidth * 2 - contentWidth - scrollbarYLeft - $scrollbarY.outerWidth();
136					} else {
137						railYOffset.left = scrollbarYLeft + $this.scrollLeft();
138					}
139				}
140				$scrollbarYRail.css(railYOffset);
141
142				$scrollbarY.css({top: scrollbarYTop, height: scrollbarYHeight - railBorderYWidth});
143				$scrollbarY.parent().css("visibility", scrollbarYHeight - railBorderYWidth > 0 ? "visible" : "hidden");
144			}
145
146			function updateGeometry() {
147				// Hide scrollbars not to affect scrollWidth and scrollHeight
148				$scrollbarYRail.hide();
149
150				containerWidth = settings.includePadding ? $this.innerWidth() : $this.width();
151				containerHeight = settings.includePadding ? $this.innerHeight() : $this.height();
152				contentWidth = $this.prop('scrollWidth');
153				contentHeight = $this.prop('scrollHeight');
154
155				if (!settings.suppressScrollY && containerHeight + settings.scrollYMarginOffset < contentHeight - 1) {
156					scrollbarYActive = true;
157					scrollbarYHeight = getThumbSize(int(containerHeight * containerHeight / contentHeight));
158					scrollbarYTop = int($this.scrollTop() * (containerHeight - scrollbarYHeight) / (contentHeight - containerHeight));
159				} else {
160					scrollbarYActive = false;
161					scrollbarYHeight = 0;
162					scrollbarYTop = 0;
163					$this.scrollTop(0);
164				}
165
166				if (scrollbarYTop >= containerHeight - scrollbarYHeight) {
167					scrollbarYTop = containerHeight - scrollbarYHeight;
168				}
169
170				updateCss();
171
172				if (scrollbarYActive) {
173					$this.addClass('ps-active-y');
174				} else {
175					$this.removeClass('ps-active-y');
176				}
177
178				// Show scrollbars if needed after updated
179				if (!settings.suppressScrollY) {
180					$scrollbarYRail.show();
181				}
182			}
183
184			function bindMouseScrollYHandler() {
185				var currentTop;
186				var currentPageY;
187
188				$scrollbarY.on('mousedown' + eventClassName, function (e) {
189					currentPageY = e.pageY;
190					currentTop = $scrollbarY.position().top;
191					$scrollbarYRail.addClass('in-scrolling');
192					e.stopPropagation();
193					e.preventDefault();
194				});
195
196				$(ownerDocument).on('mousemove' + eventClassName, function (e) {
197					if ($scrollbarYRail.hasClass('in-scrolling')) {
198						updateScrollTop(currentTop, e.pageY - currentPageY);
199						updateGeometry();
200						e.stopPropagation();
201						e.preventDefault();
202					}
203				});
204
205				$(ownerDocument).on('mouseup' + eventClassName, function (e) {
206					if ($scrollbarYRail.hasClass('in-scrolling')) {
207						$scrollbarYRail.removeClass('in-scrolling');
208					}
209				});
210
211				currentTop =
212				currentPageY = null;
213			}
214
215			// check if the default scrolling should be prevented.
216			function shouldPreventDefault(deltaX, deltaY) {
217				var scrollTop = $this.scrollTop();
218				if (deltaX === 0) {
219					if (!scrollbarYActive) {
220						return false;
221					}
222					if ((scrollTop === 0 && deltaY > 0) || (scrollTop >= contentHeight - containerHeight && deltaY < 0)) {
223						return !settings.wheelPropagation;
224					}
225				}
226
227				var scrollLeft = $this.scrollLeft();
228				if (deltaY === 0) {
229					if (!scrollbarXActive) {
230						return false;
231					}
232					if ((scrollLeft === 0 && deltaX < 0) || (scrollLeft >= contentWidth - containerWidth && deltaX > 0)) {
233						return !settings.wheelPropagation;
234					}
235				}
236				return true;
237			}
238
239			function bindMouseWheelHandler() {
240				var shouldPrevent = false;
241
242				function getDeltaFromEvent(e) {
243					var deltaX = e.originalEvent.deltaX;
244					var deltaY = -1 * e.originalEvent.deltaY;
245
246					if (typeof deltaX === "undefined" || typeof deltaY === "undefined") {
247						// OS X Safari
248						deltaX = -1 * e.originalEvent.wheelDeltaX / 6;
249						deltaY = e.originalEvent.wheelDeltaY / 6;
250					}
251
252					if (e.originalEvent.deltaMode && e.originalEvent.deltaMode === 1) {
253						// Firefox in deltaMode 1: Line scrolling
254						deltaX *= 10;
255						deltaY *= 10;
256					}
257
258					if (deltaX !== deltaX && deltaY !== deltaY/* NaN checks */) {
259						// IE in some mouse drivers
260						deltaX = 0;
261						deltaY = e.originalEvent.wheelDelta;
262					}
263
264					return [deltaX, deltaY];
265				}
266
267				function mousewheelHandler(e) {
268					var delta = getDeltaFromEvent(e);
269
270					var deltaX = delta[0];
271					var deltaY = delta[1];
272
273					shouldPrevent = false;
274					if (!settings.useBothWheelAxes) {
275						// deltaX will only be used for horizontal scrolling and deltaY will
276						// only be used for vertical scrolling - this is the default
277						$this.scrollTop($this.scrollTop() - (deltaY * settings.wheelSpeed));
278						$this.scrollLeft($this.scrollLeft() + (deltaX * settings.wheelSpeed));
279					} else if (scrollbarYActive && !scrollbarXActive) {
280						// only vertical scrollbar is active and useBothWheelAxes option is
281						// active, so let's scroll vertical bar using both mouse wheel axes
282						if (deltaY) {
283							$this.scrollTop($this.scrollTop() - (deltaY * settings.wheelSpeed));
284						} else {
285							$this.scrollTop($this.scrollTop() + (deltaX * settings.wheelSpeed));
286						}
287						shouldPrevent = true;
288					} else if (scrollbarXActive && !scrollbarYActive) {
289						// useBothWheelAxes and only horizontal bar is active, so use both
290						// wheel axes for horizontal bar
291						if (deltaX) {
292							$this.scrollLeft($this.scrollLeft() + (deltaX * settings.wheelSpeed));
293						} else {
294							$this.scrollLeft($this.scrollLeft() - (deltaY * settings.wheelSpeed));
295						}
296						shouldPrevent = true;
297					}
298
299					updateGeometry();
300
301					shouldPrevent = (shouldPrevent || shouldPreventDefault(deltaX, deltaY));
302					if (shouldPrevent) {
303						e.stopPropagation();
304						e.preventDefault();
305					}
306				}
307
308				if (typeof window.onwheel !== "undefined") {
309					$this.on('wheel' + eventClassName, mousewheelHandler);
310				} else if (typeof window.onmousewheel !== "undefined") {
311					$this.on('mousewheel' + eventClassName, mousewheelHandler);
312				}
313			}
314
315			function bindKeyboardHandler() {
316				var hovered = false;
317				$this.on('mouseenter' + eventClassName, function (e) {
318					hovered = true;
319				});
320				$this.on('mouseleave' + eventClassName, function (e) {
321					hovered = false;
322				});
323
324				var shouldPrevent = false;
325				$(ownerDocument).on('keydown' + eventClassName, function (e) {
326					if (e.isDefaultPrevented && e.isDefaultPrevented()) {
327						return;
328					}
329
330					if (!hovered) {
331						return;
332					}
333
334					var activeElement = document.activeElement ? document.activeElement : ownerDocument.activeElement;
335					// go deeper if element is a webcomponent
336					while (activeElement.shadowRoot) {
337						activeElement = activeElement.shadowRoot.activeElement;
338					}
339					if ($(activeElement).is(":input,[contenteditable]")) {
340						return;
341					}
342
343					var deltaX = 0;
344					var deltaY = 0;
345
346					switch (e.which) {
347					case 38: // up
348						deltaY = 30;
349						break;
350					case 40: // down
351						deltaY = -30;
352						break;
353					case 33: // page up
354						deltaY = 90;
355						break;
356					case 32: // space bar
357					case 34: // page down
358						deltaY = -90;
359						break;
360					case 35: // end
361						if (e.ctrlKey) {
362							deltaY = -contentHeight;
363						} else {
364							deltaY = -containerHeight;
365						}
366						break;
367					case 36: // home
368						if (e.ctrlKey) {
369							deltaY = $this.scrollTop();
370						} else {
371							deltaY = containerHeight;
372						}
373						break;
374					default:
375						return;
376					}
377
378					$this.scrollTop($this.scrollTop() - deltaY);
379					$this.scrollLeft($this.scrollLeft() + deltaX);
380
381					shouldPrevent = shouldPreventDefault(deltaX, deltaY);
382					if (shouldPrevent) {
383						e.preventDefault();
384					}
385				});
386			}
387
388			function bindRailClickHandler() {
389				function stopPropagation(e) { e.stopPropagation(); }
390
391				$scrollbarY.on('click' + eventClassName, stopPropagation);
392				$scrollbarYRail.on('click' + eventClassName, function (e) {
393					var halfOfScrollbarLength = int(scrollbarYHeight / 2);
394					var positionTop = e.pageY - $scrollbarYRail.offset().top - halfOfScrollbarLength;
395					var maxPositionTop = containerHeight - scrollbarYHeight;
396					var positionRatio = positionTop / maxPositionTop;
397
398					if (positionRatio < 0) {
399						positionRatio = 0;
400					} else if (positionRatio > 1) {
401						positionRatio = 1;
402					}
403
404					$this.scrollTop((contentHeight - containerHeight) * positionRatio);
405				});
406			}
407
408			function bindScrollHandler() {
409				$this.on('scroll' + eventClassName, function (e) {
410					updateGeometry();
411				});
412			}
413
414			function destroy() {
415				$this.unbind(eventClassName);
416				$(window).unbind(eventClassName);
417				$(ownerDocument).unbind(eventClassName);
418				$this.data('perfect-scrollbar', null);
419				$this.data('perfect-scrollbar-update', null);
420				$this.data('perfect-scrollbar-destroy', null);
421				$scrollbarY.remove();
422				$scrollbarYRail.remove();
423
424				// clean all variables
425				$scrollbarYRail =
426				$scrollbarY =
427				scrollbarYActive =
428				containerWidth =
429				containerHeight =
430				contentWidth =
431				contentHeight =
432				scrollbarYHeight =
433				scrollbarYTop =
434				scrollbarYRight =
435				isScrollbarYUsingRight =
436				scrollbarYLeft =
437				isRtl =
438				eventClassName = null;
439			}
440
441			var supportsTouch = (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch);
442			var supportsIePointer = window.navigator.msMaxTouchPoints !== null;
443
444			function initialize() {
445				updateGeometry();
446				bindScrollHandler();
447				bindMouseScrollYHandler();
448				bindRailClickHandler();
449				bindMouseWheelHandler();
450
451				if (settings.useKeyboard) {
452					bindKeyboardHandler();
453				}
454				$this.data('perfect-scrollbar', $this);
455				$this.data('perfect-scrollbar-update', updateGeometry);
456				$this.data('perfect-scrollbar-destroy', destroy);
457			}
458
459			initialize();
460
461			return $this;
462		});
463	};
464});
465
466(function($) {
467
468/*! jQuery UI - v1.11.4 - 2015-03-11
469* http://jqueryui.com
470* Includes: effect.js
471* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
472
473var baseEasings = {};
474$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
475	baseEasings[ name ] = function( p ) { return Math.pow( p, i + 2 ) };
476});
477$.extend( baseEasings, {
478	Sine: function( p ) { return 1 - Math.cos( p * Math.PI / 2 ) },
479	Circ: function( p ) { return 1 - Math.sqrt( 1 - p * p ) },
480	Elastic: function( p ) { return p === 0 || p === 1 ? p : -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 ) },
481	Back: function( p ) { return p * p * ( 3 * p - 2 ) },
482	Bounce: function( p ) {
483		var pow2, bounce = 4;
484		while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 );
485		return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
486	}
487});
488$.each( baseEasings, function( name, easeIn ) {
489	$.easing[ "easeIn" + name ] = easeIn;
490	$.easing[ "easeOut" + name ] = function( p ) { return 1 - easeIn( 1 - p ) };
491	$.easing[ "easeInOut" + name ] = function( p ) { return p < 0.5 ? easeIn( p * 2 ) / 2 : 1 - easeIn( p * -2 + 2 ) / 2 };
492});
493
494})(window.jq183 || 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.