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 saveAs(text, filename){ | |
var pom = document.createElement('a'); | |
pom.setAttribute('href', 'data:text/plain;charset=urf-8,'+encodeURIComponent(text)); | |
pom.setAttribute('download', filename); | |
pom.click(); | |
}; |
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 toFunc(v){ | |
if(typeof(v) == "function") return v; | |
if(typeof(v) == "string"){ | |
if( | |
window[v] != undefined && | |
typeof(window[v]) == "function" | |
){ | |
return window[v]; | |
} | |
try { |
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 formatNumber(v, format){ | |
if(format.indexOf(".")>-1){ | |
var neg = false; | |
if(v<0)neg = true; | |
v = Math.abs(v); | |
var bd = format.indexOf("."); | |
var ad = format.length-bd-1; | |
var b = Math.floor(v); | |
var a = v - b; | |
b+=""; |
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
var $_GET = (function(){ | |
var params = {}; | |
if(location.href.indexOf("?") > -1){ | |
var string = location.href.split("?")[1]; | |
if(string.indexOf("#") > -1){ | |
string = string.split("#")[0]; | |
} | |
var kvp = string.split("&"); | |
for(var i=0; i<kvp.length; i++){ | |
var k = kvp[i].split("=")[0]; |
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
Math.__proto__.randInt = function(min, max){ | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
}; |
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.replaceAll = function(search, replacement) { | |
var target = this; | |
return target.replace(new RegExp(search, 'g'), replacement); | |
}; |
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 getScrollbarWidth () { | |
var inner = document.createElement('p'); | |
inner.style.width = "100%"; | |
inner.style.height = "200px"; | |
var outer = document.createElement('div'); | |
outer.style.position = "absolute"; | |
outer.style.top = "0px"; | |
outer.style.left = "0px"; | |
outer.style.visibility = "hidden"; | |
outer.style.width = "200px"; |
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.hasAttr=function(a){var b=$(this).attr(a);return void 0!==typeof b&&b!==!1}; |
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
Date.valid = function(str){ | |
var d = new Date(str); | |
return (Object.prototype.toString.call(d) === "[object Date]" && !isNaN(d.getTime())); | |
} |
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 validColor(color){ | |
if(color=="")return false; | |
var $div = $("<div>"); | |
$div.css("border", "1px solid "+color); | |
return ($div.css("border-color")!="") | |
} |
OlderNewer