Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Andrew McGivery

Andrew McGivery Avatar
Formerly Fredy

******
Legendary Studio Member

Male
5,742


September 2005
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

Michael

Michael Avatar
*Has a custom title*



1,462


October 2007
I'm going to rape you on MSN for abusing it! >:(

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Michael Avatar
I'm going to rape you on MSN for abusing it! >:(


The $ sign? :P

Michael

Michael Avatar
*Has a custom title*



1,462


October 2007
Chris Avatar
Michael Avatar
I'm going to rape you on MSN for abusing it! >:(


The $ sign? :P


That and just the JS in general :P

newBookmarkLockedFalling