// Variablendeklaration var dynamic_default = 83; var dynamic_increment = 10; var dynamic_bigger = ['Schrift ', '', 'Schrift vergrößern', 'metanavi', '', '', '', '', '', '', ' | '] var dynamic_smaller = ['', '', 'Schrift verkleinern', 'metanavi', '', '', '', '', '', '', ''] //================================================================================================================== // Dynamic Fontsize Klasse //================================================================================================================== function dynamicFontSize( increment, bigger, smaller, def) { this.w3c = (document.getElementById); this.ms = (document.all); this.userAgent = navigator.userAgent.toLowerCase(); this.isMacIE = ((this.userAgent.indexOf('msie') != -1) && (this.userAgent.indexOf('mac') != -1) && (this.userAgent.indexOf('opera') == -1)); this.isOldOp = ((this.userAgent.indexOf('opera') != -1)&&(parseFloat(this.userAgent.substr(this.userAgent.indexOf('opera')+5)) <= 7)); if ((this.w3c || this.ms) && !this.isOldOp && !this.isMacIE) { this.name = 'dynamicFontSize'; this.cookieName = 'dynamicSize'; this.increment = increment; this.def = def; this.defPx = Math.round(16 * (def / 100)) this.base = 1; this.pref = this.getPref(); this.testHTML = ''; this.biggerLink = this.getLinkHtml( 1, bigger); this.smallerLink = this.getLinkHtml( -1, smaller); } else { this.dynaFontInit = new Function('return true;'); } this.allLinks = this.biggerLink + this.smallerLink; } //================================================================================================================== dynamicFontSize.prototype.dynaFontInit = function() { document.writeln(this.testHTML); this.body = (this.w3c) ? document.getElementsByTagName('body')[0].style : document.all.tags('body')[0].style; this.dynamicFontTestDiv = (this.w3c) ? document.getElementById( 'dynamicFontTestDiv') : document.all['dynamicFontTestDiv']; var h = ( this.dynamicFontTestDiv.clientHeight) ? parseInt( this.dynamicFontTestDiv.clientHeight): ( this.dynamicFontTestDiv.offsetHeight) ? parseInt( this.dynamicFontTestDiv.offsetHeight) : 999; if(h < this.defPx) this.base = this.defPx/h; this.body.fontSize = Math.round( this.pref * this.base) + '%'; } //================================================================================================================== dynamicFontSize.prototype.getLinkHtml = function( direction, properties) { var html = properties[0] + '' + properties[10]; } //================================================================================================================== dynamicFontSize.prototype.getPref = function() { var pref = this.getCookie( this.cookieName); if( pref) { return parseInt( pref); } else { return this.def; } } //================================================================================================================== dynamicFontSize.prototype.setSize = function( direction) { this.pref = (direction) ? this.pref+(direction * this.increment) : this.def; this.setCookie( this.cookieName, this.pref); this.body.fontSize = Math.round( this.pref * this.base) + '%'; } //================================================================================================================== dynamicFontSize.prototype.getCookie = function( cookieName) { var cookie = cookieManager.getCookie( cookieName); return (cookie) ? cookie : false; } //================================================================================================================== dynamicFontSize.prototype.setCookie = function( cookieName,cookieValue) { return cookieManager.setCookie( cookieName, cookieValue); } //================================================================================================================== var dynamicFontSizeInstance = new dynamicFontSize( dynamic_increment, dynamic_bigger, dynamic_smaller, dynamic_default); //==================================================================================================================