Skip to content

Instantly share code, notes, and snippets.

@alcides
Created June 29, 2009 22:24
Show Gist options
  • Save alcides/137851 to your computer and use it in GitHub Desktop.
Save alcides/137851 to your computer and use it in GitHub Desktop.
// Prototype extra javascript stuff
// http://alcides.ideias3.com
Position.GetWindowSize = function(w) {
var width, height;
w = w ? w : window;
this.width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
this.height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
return this;
}
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
Array.prototype.haskey = function(item) {
var j = 0;
while (j < this.length) {
if (this[j] == item) {
return true;
} else { j++; }
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment