var cookie_name = "font_size"; var font_clicks = 0; var initialized = false; function init_prefs() { // initialize user preferences var cookie = GetCookie(cookie_name); var teller = 0; if (cookie != null) { font_cookie = unescape(cookie); cookie_elements = font_cookie.split(","); for (teller=0; teller pixels // // verhoogd. Vervolgens wordt er gekeken of het document frames // // bevat. Is dat het geval, dan worden ook de stylesheets van die // // frames gecontroleerd op de aanwezigheid van selectoren met een // // fontsize, die dan ook met pixels wordt verhoogd. // // // // N.B.: Elk frame (of iframe) *moet* een stylesheet hebben, // // anders loopt MSIE er op stuk. // // // // 20060607, Bert van Dijk, KNMI // // // ///////////////////////////////////////////////////////////////////// var pClass; var fontSz; var myRules; MSIERules = (document.styleSheets[0].rules); myRules = MSIERules ? document.styleSheets[0].rules : document.styleSheets[0].cssRules; for (j = 0; j < document.styleSheets.length; j++) { MSIERules = (document.styleSheets[j].rules); myRules = MSIERules ? document.styleSheets[j].rules : document.styleSheets[j].cssRules; for (i = 0; i < myRules.length; i++) { if (MSIERules) { if (myRules.item(i).style.fontSize) { fontSz = myRules.item(i).style.fontSize.substr(0, myRules.item(i).style.fontSize.length-2) - 1 + 1 + increment; if (font_clicks > -9 || increment > 0) { fontSzStr = fontSz+"px"; if (document.styleSheets[j]) { document.styleSheets[j].rules.item(i).style.fontSize = fontSzStr; } } } } else { pClass = myRules.item(i); if (myRules.item(i).style.fontSize) { fontSz = pClass.style.fontSize.substr(0, pClass.style.fontSize.length-2); if (document.styleSheets[j]) { if (font_clicks > -9 || increment > 0) { document.styleSheets[j].cssRules.item(i).style.fontSize = fontSz - 1 + 1 + increment; } } } } } } // // Doe dezelfde truc nog een keer voor alle frames en iframes in de pagina // if (window.frames && initialized) { for (frmcnt = 0; frmcnt < window.frames.length; frmcnt++) { frm = window.frames[frmcnt]; if (frm.document.styleSheets[0]) { myRules = MSIERules ? window.frames[frmcnt].document.styleSheets[0].rules : window.frames[frmcnt].document.styleSheets[0].cssRules; for (i = 0; i < myRules.length; i++) { if (MSIERules) { selector = myRules.item(i).selectorText.toUpperCase(); if (myRules.item(i).style.fontSize) { fontSz = myRules.item(i).style.fontSize.substr(0, myRules.item(i).style.fontSize.length-2) - 1 + 1 + increment; if (font_clicks > -9 || increment > 0) { fontSzStr = fontSz+"px"; if (window.frames[frmcnt].document.styleSheets[0]) { window.frames[frmcnt].document.styleSheets[0].rules.item(i).style.fontSize = fontSzStr; } } } } else { pClass = myRules.item(i); if (myRules.item(i).style.fontSize) { fontSz = pClass.style.fontSize.substr(0, pClass.style.fontSize.length-2); if (window.frames[frmcnt].document.styleSheets[0]) { if (font_clicks > -9 || increment > 0) { window.frames[frmcnt].document.styleSheets[0].cssRules.item(i).style.fontSize = fontSz - 1 + 1 + increment; } } } } } } } } if (initialized) { font_clicks = Math.max(-9,(font_clicks + increment)); make_cookie(); } else { initialized = true; } } function resetFontSize() { changeFontSize(-font_clicks); } addEvent(window, 'load', init_prefs);