PageSourceSearch

https://locobee.com/mag/wp-content/plugins/table-of-contents-plus/front.js

js locobee.com collected 2026-10-08 03:10:18 UTC 9,047 bytes, 169 lines download raw bytes

1/*!
2 * jQuery Smooth Scroll - v1.6.0 - 2015-12-26
3 * https://github.com/kswedberg/jquery-smooth-scroll
4 * Copyright (c) 2015 Karl Swedberg
5 * Licensed MIT
6 */
7!function(a){"function"==typeof define&&define.amd?
8// AMD. Register as an anonymous module.
9define(["jquery"],a):a("object"==typeof module&&module.exports?require("jquery"):jQuery)}(function(a){function b(a){return a.replace(/(:|\.|\/)/g,"\\$1")}var c="1.6.0",d={},e={exclude:[],excludeWithin:[],offset:0,
10// one of 'top' or 'left'
11direction:"top",
12// if set, bind click events through delegation
13//  supported since jQuery 1.4.2
14delegateSelector:null,
15// jQuery set of elements you wish to scroll (for $.smoothScroll).
16//  if null (default), $('html, body').firstScrollable() is used.
17scrollElement:null,
18// only use if you want to override default behavior
19scrollTarget:null,
20// fn(opts) function to be called before scrolling occurs.
21// `this` is the element(s) being scrolled
22beforeScroll:function(){},
23// fn(opts) function to be called after scrolling occurs.
24// `this` is the triggering element
25afterScroll:function(){},easing:"swing",speed:400,
26// coefficient for "auto" speed
27autoCoefficient:2,
28// $.fn.smoothScroll only: whether to prevent the default click action
29preventDefault:!0},f=function(b){var c=[],d=!1,e=b.dir&&"left"===b.dir?"scrollLeft":"scrollTop";
30// If no scrollable elements, fall back to <body>,
31// if it's in the jQuery collection
32// (doing this because Safari sets scrollTop async,
33// so can't set it to 1 and immediately get the value.)
34// Use the first scrollable element if we're calling firstScrollable()
35return this.each(function(){var b=a(this);if(this!==document&&this!==window)
36// if scroll(Top|Left) === 0, nudge the element 1px and see if it moves
37// then put it back, of course
38return!document.scrollingElement||this!==document.documentElement&&this!==document.body?void(b[e]()>0?c.push(this):(b[e](1),d=b[e]()>0,d&&c.push(this),b[e](0))):(c.push(document.scrollingElement),!1)}),c.length||this.each(function(){"BODY"===this.nodeName&&(c=[this])}),"first"===b.el&&c.length>1&&(c=[c[0]]),c};a.fn.extend({scrollable:function(a){var b=f.call(this,{dir:a});return this.pushStack(b)},firstScrollable:function(a){var b=f.call(this,{el:"first",dir:a});return this.pushStack(b)},smoothScroll:function(c,d){if(c=c||{},"options"===c)return d?this.each(function(){var b=a(this),c=a.extend(b.data("ssOpts")||{},d);a(this).data("ssOpts",c)}):this.first().data("ssOpts");var e=a.extend({},a.fn.smoothScroll.defaults,c),f=function(c){var d=this,f=a(this),g=a.extend({},e,f.data("ssOpts")||{}),h=e.exclude,i=g.excludeWithin,j=0,k=0,l=!0,m={},n=a.smoothScroll.filterPath(location.pathname),o=a.smoothScroll.filterPath(d.pathname),p=location.hostname===d.hostname||!d.hostname,q=g.scrollTarget||o===n,r=b(d.hash);if(g.scrollTarget||p&&q&&r){for(;l&&j<h.length;)f.is(b(h[j++]))&&(l=!1);for(;l&&k<i.length;)f.closest(i[k++]).length&&(l=!1)}else l=!1;l&&(g.preventDefault&&c.preventDefault(),a.extend(m,g,{scrollTarget:g.scrollTarget||r,link:d}),a.smoothScroll(m))};return null!==c.delegateSelector?this.undelegate(c.delegateSelector,"click.smoothscroll").delegate(c.delegateSelector,"click.smoothscroll",f):this.unbind("click.smoothscroll").bind("click.smoothscroll",f),this}}),a.smoothScroll=function(b,c){if("options"===b&&"object"==typeof c)return a.extend(d,c);var e,f,g,h,i,j=0,k="offset",l="scrollTop",m={},n={};"number"==typeof b?(e=a.extend({link:null},a.fn.smoothScroll.defaults,d),g=b):(e=a.extend({link:null},a.fn.smoothScroll.defaults,b||{},d),e.scrollElement&&(k="position","static"===e.scrollElement.css("position")&&e.scrollElement.css("position","relative"))),l="left"===e.direction?"scrollLeft":l,e.scrollElement?(f=e.scrollElement,/^(?:HTML|BODY)$/.test(f[0].nodeName)||(j=f[l]())):f=a("html, body").firstScrollable(e.direction),e.beforeScroll.call(f,e),g="number"==typeof b?b:c||a(e.scrollTarget)[k]()&&a(e.scrollTarget)[k]()[e.direction]||0,m[l]=g+j+e.offset,h=e.speed,"auto"===h&&(i=Math.abs(m[l]-f[l]()),h=i/e.autoCoefficient),n={duration:h,easing:e.easing,complete:function(){e.afterScroll.call(e.link,e)}},e.step&&(n.step=e.step),f.length?f.stop().animate(m,n):e.afterScroll.call(e.link,e)},a.smoothScroll.version=c,a.smoothScroll.filterPath=function(a){return a=a||"",a.replace(/^\//,"").replace(/(?:index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},
39// default options
40a.fn.smoothScroll.defaults=e});
41
42/**
43 * jQuery Cookie plugin
44 *
45 * Copyright (c) 2010 Klaus Hartl (stilbuero.de)
46 * Dual licensed under the MIT and GPL licenses:
47 * http://www.opensource.org/licenses/mit-license.php
48 * http://www.gnu.org/licenses/gpl.html
49 *
50 */
51jQuery.cookie=function(a,b,c){if(arguments.length>
511&&String(b)!=="[object Object]"){c=jQuery.extend({},c);if(b===null||b===undefined){c.expires=-1}if(typeof c.expires==="number"){var d=c.expires,e=c.expires=new Date;e.setDate(e.getDate()+d)}b=String(b);return document.cookie=[encodeURIComponent(a),"=",c.raw?b:encodeURIComponent(b),c.expires?"; expires="+c.expires.toUTCString():"",c.path?"; path="+c.path:"",c.domain?"; domain="+c.domain:"",c.secure?"; secure":""].join("")}c=b||{};var f,g=c.raw?function(a){return a}:decodeURIComponent;return(f=(new RegExp("(?:^|; )"+encodeURIComponent(a)+"=([^;]*)")).exec(document.cookie))?g(f[1]):null}
52
53jQuery(document).ready(function($) {
54	if ( typeof tocplus != 'undefined' ) {
55		$.fn.shrinkTOCWidth = function() {
56			$(this).css({
57				width: 'auto',
58				display: 'table'
59			});
60			if ( /MSIE 7\./.test(navigator.userAgent) )
61				$(this).css('width', '');
62		}
63	
64		if ( tocplus.smooth_scroll == 1 ) {
65			var target = hostname = pathname = qs = hash = null;
66	
67			$('.single .main-content a').click(function(event) {
68				hostname = $(this).prop('hostname');
69				pathname = $(this).prop('pathname');
70				qs = $(this).prop('search');
71				hash = $(this).prop('hash');
72	
73				// ie strips out the preceeding / from pathname
74				if ( pathname.length > 0 ) {
75					if ( pathname.charAt(0) != '/' ) {
76						pathname = '/' + pathname;
77					}
78				}
79				
80				if ( (window.location.hostname == hostname) && (window.location.pathname == pathname) && (window.location.search == qs) && (hash !== '') ) {
81					// escape jquery selector chars, but keep the #
82					var hash_selector = hash.replace(/([ !"$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g, '\\$1');
83					// check if element exists with id=__
84					if ( $( hash_selector ).length > 0 )
85						target = hash;
86					else {
87						// must be an anchor (a name=__)
88						anchor = hash;
89						anchor = anchor.replace('#', '');
90						target = 'a[name="' + anchor  + '"]';
91						// verify it exists
92						if ( $(target).length == 0 )
93							target = '';
94					}
95					
96					// check offset setting
97					if (typeof tocplus.smooth_scroll_offset != 'undefined') {
98						offset = -1 * tocplus.smooth_scroll_offset;
99					}
100					else {
101						if ($('#wpadminbar').length > 0) {
102							if ($('#wpadminbar').is(':visible'))
103								offset = -30;	// admin bar exists, give it the default
104							else
105								offset = 0;		// there is an admin bar but it's hidden, so no offset!
106						}
107						else
108							offset = 0;			// no admin bar, so no offset!						
109					}
110					
111					if ( target ) {
112						$.smoothScroll({
113							scrollTarget: target,
114							offset: offset
115						});
116					}
117				}
118			});
119		}
120
121		if ( typeof tocplus.visibility_show != 'undefined' ) {
122			var invert = ( typeof tocplus.visibility_hide_by_default != 'undefined' ) ? true : false ;
123			
124		
125			if ( $.cookie )
126				var visibility_text = ($.cookie('tocplus_hidetoc')) ? tocplus.visibility_show : tocplus.visibility_hide ;
127			else
128				var visibility_text = tocplus.visibility_hide;
129			
130			if ( invert )
131				visibility_text = (visibility_text == tocplus.visibility_hide) ? tocplus.visibility_show : tocplus.visibility_hide;
132				
133			$('#toc_container p.toc_title').append(' <span class="toc_toggle">[<a href="#">' + visibility_text + '</a>]</span>');
134			if ( visibility_text == tocplus.visibility_show ) {
135				$('ul.toc_list').hide();
136				$('#toc_container').addClass('contracted').shrinkTOCWidth();
137			}
138	
139			$('span.toc_toggle a').click(function(event) {
140				event.preventDefault();
141				switch( $(this).html() ) {
142					case $('<div/>').html(tocplus.visibility_hide).text():
143						$(this).html(tocplus.visibility_show);
144						if ( $.cookie ) {
145							if ( invert )
146								$.cookie('tocplus_hidetoc', null, { path: '/' });
147							else
148								$.cookie('tocplus_hidetoc', '1', { expires: 30, path: '/' });
149						}
150						$('ul.toc_list').hide('fast');
151						$('#toc_container').addClass('contracted').shrinkTOCWidth();
152						break;
153					
154					case $('<div/>').html(tocplus.visibility_show).text():	// do next
155					default:
156						$(this).html(tocplus.visibility_hide);
157						if ( $.cookie ) {
158							if ( invert )
159								$.cookie('tocplus_hidetoc', '1', { expires: 30, path: '/' });
160							else 
161								$.cookie('tocplus_hidetoc', null, { path: '/' });
162						}
163						$('#toc_container').css('width', tocplus.width).removeClass('contracted');
164						$('ul.toc_list').show('fast');
165				}
166			});
167		}
168	}
169});

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.