1/** 2 * Copyright (c) 2007-2014 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com 3 * Licensed under MIT 4 * @author Ariel Flesler 5 * @version 1.4.14 6 */ 7; 8(function (k) { 9 'use strict'; 10 k(['jquery'], function ($) { 11 var j = $.scrollTo = function (a, b, c) { 12 return $(window).scrollTo(a, b, c) 13 }; 14 j.defaults = {axis: 'xy', duration: 0, limit: !0}; 15 j.window = function (a) { 16 return $(window)._scrollable() 17 }; 18 $.fn._scrollable = function () { 19 return this.map(function () { 20 var a = this, isWin = !a.nodeName || $.inArray(a.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body']) != -1; 21 if (!isWin)return a; 22 var b = (a.contentWindow || a).document || a.ownerDocument || a; 23 return /webkit/i.test(navigator.userAgent) || b.compatMode == 'BackCompat' ? b.body : b.documentElement 24 }) 25 }; 26 $.fn.scrollTo = function (f, g, h) { 27 if (typeof g == 'object') { 28 h = g; 29 g = 0 30 } 31 if (typeof h == 'function')h = {onAfter: h}; 32 if (f == 'max')f = 9e9; 33 h = $.extend({}, j.defaults, h); 34 g = g || h.duration; 35 h.queue = h.queue && h.axis.length > 1; 36 if (h.queue)g /= 2; 37 h.offset = both(h.offset); 38 h.over = both(h.over); 39 return this._scrollable().each(function () { 40 if (f == null)return; 41 var d = this, $elem = $(d), targ = f, toff, attr = {}, win = $elem.is('html,body'); 42 switch (typeof targ) { 43 case'number': 44 case'string': 45 if (/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)) { 46 targ = both(targ); 47 break 48 } 49 targ = win ? $(targ) : $(targ, this); 50 if (!targ.length)return; 51 case'object': 52 if (targ.is || targ.style)toff = (targ = $(targ)).offset() 53 } 54 var e = $.isFunction(h.offset) && h.offset(d, targ) || h.offset; 55 $.each(h.axis.split(''), function (i, a) { 56 var b = a == 'x' ? 'Left' : 'Top', pos = b.toLowerCase(), key = 'scroll' + b, old = d[key], max = j.max(d, a); 57 if (toff) { 58 attr[key] = toff[pos] + (win ? 0 : old - $elem.offset()[pos]); 59 if (h.margin) { 60 attr[key] -= parseInt(targ.css('margin' + b)) || 0; 61 attr[key] -= parseInt(targ.css('border' + b + 'Width')) || 0 62 } 63 attr[key] += e[pos] || 0; 64 if (h.over[pos])attr[key] += targ[a == 'x' ? 'width' : 'height']() * h.over[pos] 65 } else { 66 var c = targ[pos]; 67 attr[key] = c.slice && c.slice(-1) == '%' ? parseFloat(c) / 100 * max : c 68 } 69 if (h.limit && /^\d+$/.test(attr[key]))attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max); 70 if (!i && h.queue) { 71 if (old != attr[key])animate(h.onAfterFirst); 72 delete attr[key] 73 } 74 }); 75 animate(h.onAfter); 76 function animate(a) { 77 $elem.animate(attr, g, h.easing, a && function () { 78 a.call(this, targ, h) 79 }) 80 } 81 }).end() 82 }; 83 j.max = function (a, b) { 84 var c = b == 'x' ? 'Width' : 'Height', scroll = 'scroll' + c; 85 if (!$(a).is('html,body'))return a[scroll] - $(a)[c.toLowerCase()](); 86 var d = 'client' + c, html = a.ownerDocument.documentElement, body = a.ownerDocument.body; 87 return Math.max(html[scroll], body[scroll]) - Math.min(html[d], body[d]) 88 }; 89 function both(a) { 90 return $.isFunction(a) || $.isPlainObject(a) ? a : {top: a, left: a} 91 } 92 93 return j 94 }) 95}(typeof define === 'function' && define.amd ? define : function (a, b) { 96 if (typeof module !== 'undefined' && module.exports) { 97 module.exports = b(require('jquery')) 98 } else { 99 b(jQuery) 100 } 101}));
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.