View strinToDom.func.js
This file contains 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
const stringToDOM = str => new DOMParser().parseFromString(str, 'text/html').body.childNodes[0]; |
View String.extract.func.js
This file contains 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
String.prototype.extract = function(start, finish){ | |
var s = this.indexOf(start); | |
if(s == -1) return ""; | |
var e = this.indexOf(finish, s + start.length); | |
if(e == -1) return ""; | |
return this.substring(s + start.length, e); | |
} |
View animateTransform.jquery.js
This file contains 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.animateTransform = function(/* [start,] end [, duration] [, callback] */){ | |
var start = null, end = null, duration = 400, callback = function(){}; | |
for(var i=0; i<arguments.length; i++){ | |
if(typeof(arguments[i]) == "string"){ | |
if(!start) start = arguments[i]; | |
else end = arguments[i]; | |
} else if(typeof(arguments[i]) == "number"){ | |
duration = arguments[i]; | |
} else if(typeof(arguments[i]) == "function"){ | |
callback = arguments[i]; |
View selectText.jquery.js
This file contains 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
jQuery.fn.selectText = function(){ | |
var doc = document; | |
var element = this[0]; | |
if (doc.body.createTextRange) { | |
var range = document.body.createTextRange(); | |
range.moveToElementText(element); | |
range.select(); | |
} else if (window.getSelection) { | |
var selection = window.getSelection(); | |
var range = document.createRange(); |
View attrs.jquery.js
This file contains 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.attrs = function(){ | |
var attributes = {}; | |
if(this.length){ | |
$.each( this[0].attributes, function( index, attr ) { | |
attributes[ attr.name ] = attr.value; | |
}); | |
} | |
return attributes; | |
}; |
View roundTo.func.js
This file contains 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
function roundTo(number, to){ | |
return (Math.round(number * (1/to)) / (1/to)); | |
}; |
View containsObject.func.min.js
This file contains 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
function containsObject(a,b){for(var c in a)if(!b[c]||a[c]!=b[c])return!1;return!0} |
View validCSS.func.js
This file contains 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
function validCSS(property, value){ | |
var $el = $("<div></div>"); | |
$el.css(property, value); | |
return ($el.css(property) == value); | |
} |
View betterParseFloat.func.js
This file contains 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
function betterParseFloat(num){ | |
num = (num+"").replace(new RegExp(",", 'g'), ""); // Remove commas | |
return (num.length==0)?0:(isNaN(parseFloat(num)))?betterParseFloat(num.substr(1)):parseFloat(num); | |
}; |
NewerOlder