split code into several files

This commit is contained in:
Fabian Jakobs 2010-04-06 09:16:03 +02:00
commit 828b4a184a
6 changed files with 850 additions and 702 deletions

48
lib.js Normal file
View file

@ -0,0 +1,48 @@
function addListener(elem, type, callback) {
if (elem.addEventListener) {
return elem.addEventListener(type, callback, false);
}
if (elem.attachEvent) {
elem.attachEvent("on" + type, function() {
callback(window.event);
});
}
}
function setText(elem, text) {
if (elem.innerText !== undefined) {
elem.innerText = text;
}
if (elem.textContent !== undefined) {
elem.textContent = text;
}
}
function stopEvent(e) {
stopPropagation(e);
preventDefault(e);
return false;
}
function stopPropagation(e) {
if (e.stopPropagation)
e.stopPropagation();
else
e.cancelBubble = true;
}
function preventDefault (e)
{
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
}
inherits = function (ctor, superCtor) {
var tempCtor = function(){};
tempCtor.prototype = superCtor.prototype;
ctor.super_ = superCtor.prototype;
ctor.prototype = new tempCtor();
ctor.prototype.constructor = ctor;
};