Code:
var getElementById = null;
(function() {
var d = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
m = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
function lz(s, n) {var p = ''; s = String(s); n -= s.length;
while(p.length < n) {p += '0';} return p + s;
}
Date.prototype.toGMTString = function() {
return [
d[this.getDay()],
', ',
lz(this.getDate(), 2),
'-',
m[this.getMonth()],
'-',
lz(this.getFullYear(), 4),
' ',
lz(this.getHours(), 2),
':',
lz(this.getMinutes(), 2),
':',
lz(this.getSeconds(), 2),
' GMT'
].join('');
};
if(document.getElementById) {
getElementById = function(id) {return document.getElementById(id);}
} else if(document.all) {
getElementById = function(id) {var r = document.all[id];
if(('number' == typeof r.length) && r.tags) {
for(var j = 0, n = r.length; j < n; ++j) {
if(r[j].id == id) {return r[j];}
}
} else if(r.id == id) {return r;}
return null;
};
} else {
getElementById = function() {return null;};
getElementById.alwaysNull = true;
}
if(!Array.prototype.push) {
Array.prototype.push = function() {
var j = 0, k = this.length, n = arguments.length;
while(j < n) {this[k++] = arguments[j++];}
return k;
};
}
})();
var setTarget = (function() {
var target = '_blank',
newByDefault = true;
function getLinks() {var e = [], r = [];
if(document.getElementsByTagName) {e = document.getElementsByTagName('*');}
if(!e.length && document.all) {e = document.all;}
for(var i = 0, m = e.length, c, l; i < m; ++i) {c = e[i];
if(/(^|\s+)new-window(\s+|$)/.test(c.className) && ('A' == c.tagName)) {
r.push(c);
} else if(/(^|\s+)new-window-container(\s+|$)/.test(c.className)) {l = [];
if(c.getElementsByTagName) {l = c.getElementsByTagName('a');}
if(!l.length && c.all && c.all.tags) {l = c.all.tags('a');}
for(var j = 0, n = l.length; j < n; ++j) {c = l[j];
if(!/(^|\s+)same-window(\s+|$)/.test(c.className)) {r.push(c);}
}
}
}
return r;
}
if((document.getElementsByTagName || (document.all && document.all.tags))
&& document.write && !getElementById.alwaysNull)
{
var cookie = /(^|;\s*)new-window=(\d)/.exec(document.cookie);
if(cookie) {cookie = !!(+cookie[2]);} else {cookie = newByDefault;}
document.write([
'<label for="new-window">',
'<input id="new-window" type="checkbox" onclick="setTarget(this);"',
(cookie ? ' checked>' : '>'),
'Open links in a new window',
'</label>'
].join(''));
document.close();
return function(e) {var d = new Date(), l = getLinks(), t = '', u;
if(e && (u = e.checked)) {t = target;}
for(var i = 0, n = l.length; i < n; ++i) {l[i].target = t;}
d.setFullYear(d.getFullYear() + 1);
document.cookie = 'new-window=' + (+u) + ';expires=' + d.toGMTString();
};
}
})();
if(setTarget) {
this.onload = (function() {var l = this.onload;
return function() {var t = getElementById('new-window');
if(t) {setTarget(t);}
if(l) {this.onload = l; this.onload();}
};
})();
}
Bookmarks