PageSourceSearch

https://www.openbook.org.tw/sites/all/themes/theme946/js/jquery.ui.totop.js?tm8hh8

js openbook.org.tw collected 2026-10-02 04:34:28 UTC 2,433 bytes, 73 lines download raw bytes

1(function($) {
2	$.fn.UItoTop = function(options) {
3		var defaults = {
4			text: '',
5			min: 500,
6			scrollSpeed: 800,
7			containerID: 'toTop',
8			containerHoverID: 'toTopHover',
9			easingType: 'linear',
10			min_width: parseInt($('body').css("min-width"),10),
11			main_width: parseInt($('body').css("min-width"),10)/2
12		};
13
14		var settings = $.extend(defaults, options);
15		var containerIDhash = '#' + settings.containerID;
16		var containerHoverIDHash = '#' + settings.containerHoverID;
17
18		$('body').append('<a href="#" id="' + settings.containerID + '">' + settings.text + '</a>');
19
20		var button_width = parseInt($(containerIDhash).css("width")) + 90
21		var button_width_1 = parseInt($(containerIDhash).css("width")) + 20
22		var max_width = defaults.min_width + button_width;
23		var margin_right_1 = -(defaults.main_width + button_width_1)
24		var margin_right_2 = -(defaults.main_width - 20)
25		
26		function top() {
27			if(($(window).width() <= max_width) && ($(window).width() >= defaults.min_width)) {
28				$(containerIDhash).stop().animate({marginRight: margin_right_2, right: '50%'});
29			} else {
30				if($(window).width() <= defaults.min_width) {
31					$(containerIDhash).stop().css({marginRight: 0, right: 10})
32				} else {
33					$(containerIDhash).stop().animate({marginRight: margin_right_1, right: '50%'})
34				}
35			}
36		}
37		top()
38		$(containerIDhash).hide().click(function() {
39			$('html, body').stop().animate({scrollTop: 0}, settings.scrollSpeed, settings.easingType);
40			$('#' + settings.containerHoverID, this).stop().animate({'opacity': 0}, settings.inDelay, settings.easingType);
41			return false;
42		})
43
44		.prepend('<span id="' + settings.containerHoverID + '"></span>')
45		.hover(function() {
46				$(containerHoverIDHash, this).stop().animate({
47					'opacity': 1
48				}, 600, 'linear');
49			}, function() {
50				$(containerHoverIDHash, this).stop().animate({
51					'opacity': 0
52				}, 700, 'linear');
53			});
54
55		$(window).scroll(function() {
56			var sd = $(window).scrollTop();
57			if(typeof document.body.style.maxHeight === "undefined") {
58				$(containerIDhash).css({
59					'position': 'absolute',
60					'top': $(window).scrollTop() + $(window).height() - 50
61				});
62			}
63			if (sd > settings.min) {
64				$(containerIDhash).stop(true, true).fadeIn(600);
65			} else {
66				$(containerIDhash).fadeOut(800);
67			}
68		});
69		$(window).resize(function() {
70			top()
71		})
72};
73})(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.