This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var protos = Object.getPrototypeOf(this); | |
Object.keys(protos).forEach(function(key) { | |
if (typeof this[key] === 'function' && key !== 'constructor') { | |
var fn = this[key]; | |
this[key] = function() { | |
var name = this.name ? this.name + '.' : ''; | |
var identity = name + key; | |
console.time(identity); | |
var ret = fn.apply(this, arguments); | |
console.timeEnd(identity); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.percentScrolledTop = function() { | |
var vals = []; | |
this.each(function() { | |
vals.push(+($(this).scrollTop() / this.scrollHeight)); | |
}); | |
return vals.length === 1 ? vals[0] : vals; | |
}; | |
$.fn.percentScrolledBottom = function() { | |
var vals = []; |
NewerOlder