Enumerator
Mitglied Kamel
Abend!
Ich wollte nur mal eben ein kurzes Skript posten und Euch nach Eurer Meinung fragen. Im wesentlichen habe ich einfach nur nützliche Funktionen zusammengestellt, die diverse, immer widerkehrende Aufgaben browserunabhängig und unkompliziert lösen sollen...
Was fällt Euch dazu ein? Was ist überflüssig, was sollte man ändern oder ergänzen?
Gruß
Enum
Ich wollte nur mal eben ein kurzes Skript posten und Euch nach Eurer Meinung fragen. Im wesentlichen habe ich einfach nur nützliche Funktionen zusammengestellt, die diverse, immer widerkehrende Aufgaben browserunabhängig und unkompliziert lösen sollen...
Code:
var Tool = new function()
{
this.Bless = function(ref) { return ((typeof(ref.tagName) == 'string') || (document.getElementById && (ref = document.getElementById(ref))) || (document.all && (ref = document.all[ref])))? ref: null; }
this.P4css = function(ref) { return ((typeof(ref.float) == 'string') || ((ref = this.Bless(ref)) && (ref = ref.style)))? ref: null; }
this.SnapHeight = function(ref) { return (ref = this.Bless(ref))? (typeof(ref.offsetHeight) != 'undefined')? ref.offsetHeight: (typeof(ref.height) != 'undefined')? ref.height: null: null; }
this.SnapWidth = function(ref) { return (ref = this.Bless(ref))? (typeof(ref.offsetWidth) != 'undefined')? ref.offsetWidth: (typeof(ref.width) != 'undefined')? ref.width: null: null; }
this.SnapLeft = function(ref) { return (ref = this.Bless(ref))? SnapX(ref): null; }
this.SnapTop = function(ref) { return (ref = this.Bless(ref))? SnapY(ref): null; }
this.SnapContainer = function(ref) { return (ref = this.Bless(ref))? SnapC(ref): null; }
this.SnapAbsLeft = function(ref) { if(!(ref = this.Bless(ref))) return null; var value = 0; do value += SnapX(ref); while(ref = SnapC(ref)); return value; }
this.SnapAbsTop = function(ref) { if(!(ref = this.Bless(ref))) return null; var value = 0; do value += SnapY(ref); while(ref = SnapC(ref)); return value; }
this.SnapAvaHeight = function(ref) { return window.innerHeight? window.innerHeight: (document.body && document.body.clientHeight)? document.body.clientHeight: null; }
this.SnapAvaWidth = function(ref) { return window.innerWidth? window.innerWidth: (document.body && document.body.clientWidth)? document.body.clientWidth: null; }
this.SnapName = function(ref) { return (ref = this.Bless(ref))? (typeof(ref.name) == 'string')? ref.name: (ref.getAttribute)? ref.getAttribute('name'): null: null; }
this.SnapId = function(ref) { return (ref = this.Bless(ref))? (typeof(ref.id) == 'string')? ref.id: (ref.getAttribute)? ref.getAttribute('id'): null: null; }
this.PlImg = function(src) { this.Registry.Images[(this.Registry.Images.push(new Image()) -1)].src = src.toString(); }
function SnapC(ref) { return (typeof(ref.offsetParent) != 'undefined')? ref.offsetParent: null; }
function SnapX(ref) { return (typeof(ref.offsetLeft) != 'undefined')? ref.offsetLeft: null; }
function SnapY(ref) { return (typeof(ref.offsetTop) != 'undefined')? ref.offsetTop: null; }
this.Registry = new function()
{
this.Images = new Array();
this.Strings = new Array();
}
}
Gruß
Enum