|
SpeedScript is a Javascript Library I am working on to make my life(and possibly yours) easier when coding.
While at first glance it is basic functions, it saves alot of time when coding. The functions are very re-useable for multiple projects.
It is curently only in version 1 because it is very small at the moment, but I plan on expanding it, and maybe getting some contributions from other coders.
Enjoy.
function $write(x){ document.write(x); }
function $getId(x){ return document.getElementById(x); }
function $getTag(x){ return document.getElementsByTagName(x); }
function $show(x){ $getId(x).style.display = 'block'; }
function $hide(x){ $getId(x).style.display = 'none'; }
function $showHide(x){ if($getId(x).style.display == 'none') $show(x); else $hide(x); }
function $showTime(){ var today=new Date(); var h=today.getHours(); if(h>12){ var ap = "PM"; h = h - 12 } else { var ap = "AM"; } var m=today.getMinutes(); if (m<10){ m="0" + i; } return h+':'+m }
function $setCookie(_name,_value){ document.cookie = _name+"="+escape(_value)+";expires="+(new Date()).toGMTString().replace(/\d{4}/,"2050"); }
function $getCookie(_name){ if(document.cookie.match(new RegExp(_name+"=(.+?)($|;)","gi"))) return unescape(RegExp.$1); return null; }
function $deleteCookie(_name){ document.cookie = _name+"=;expires="+(new Date()).toGMTString().replace(/\d{4}/,"2004"); }
function $showYt(id,w,h,a){ if(a == true) var video = '<object id="player" width="'+w+'" height="'+h+'"><param name="movie" value="http://www.youtube.com/v/'+id+'&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed id="player" src="http://www.youtube.com/v/'+id+'&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+w+'" height="'+h+'"></embed></object>'; else var video = '<object id="player" width="'+w+'" height="'+h+'"><param name="movie" value="http://www.youtube.com/v/'+id+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed id="player" src="http://www.youtube.com/v/'+id+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+w+'" height="'+h+'"></embed></object>'; return video }
function $randNum(min,max){ var randomNum = Math.random() * (max-min); return(Math.round(randomNum) + min); }
function $refresh(){ if(location.reload){ location.reload(); } else { location.href = location.href; } }
|
k
|
|
|
|
I'm going to rape you on MSN for abusing it!
|
|
|
|
I'm going to rape you on MSN for abusing it! The $ sign?
|
|
|
|
|
I'm going to rape you on MSN for abusing it! The $ sign? That and just the JS in general
|
|
|