/* MozTxtAlignFix version 0.3 Beta August 03, 2005 Copyright (C) 2005 Saravana Kumar Comments/Suggestions ? saravanannkl at gmail dot com Tested with Firefox 1.0.6/Deer Park Alpha 2 and Greasemonkey 0.5 Beta. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You can download a copy of the GNU General Public License at http://www.gnu.org/licenses/gpl.txt or get a free printed copy by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // ==UserScript== // @name MozTxtAlignFix // @namespace http://saravan.blogspot.com // @description Temp. fix for Mozilla Bug # 270012 // @include http://* // @include file://* // ==/UserScript== (function() { var justifiedObjects = new Array(); var objwithLtrSpg = new Array(); var objwithWrdSpg = new Array(); var objLtrSpgVal = new Array(); var objWrdSpgVal = new Array(); var bToggled = false; var MozTxtAlignFix = { canIFix : function () { // Check the current page for Tamil Script. // Tamil alphabet KA will occur in almost all Tamil pages. // Check only for KA. Ubhayam Krupa. var allBody = document.getElementsByTagName("body") if(allBody.length==0) return false; return (allBody[0].innerHTML.indexOf(String.fromCharCode(2965))>-1); }, fixTags : function (obj) { if(!obj) return; if(obj.style) { var objStyle = window.getComputedStyle(obj, ''); if(objStyle.textAlign.length == 7) { justifiedObjects[justifiedObjects.length] = obj; obj.style.textAlign = "left"; } if(objStyle.letterSpacing.length!=0 && objStyle.letterSpacing.length!=6) { objwithLtrSpg[objwithLtrSpg.length] = obj; objLtrSpgVal[objLtrSpgVal.length] = objStyle.letterSpacing; obj.style.letterSpacing = "normal"; } if(objStyle.wordSpacing.length!=0 && objStyle.wordSpacing.length!=6) { objwithWrdSpg[objwithWrdSpg.length] = obj; objWrdSpgVal[objWrdSpgVal.length] = objStyle.wordSpacing; obj.style.wordSpacing = "normal"; } } var kids = obj.childNodes; if(!kids) return; // Do the same for Object's Children for (var i = 0; i < kids.length; i++) this.fixTags(kids[i]); }, // Inspired from Mark Pilgrim's Butler Script (http://diveintomark.org/projects/butler/butler.user.js) notifyUser : function () { if(justifiedObjects.length == 0 && objwithLtrSpg.length == 0 && objwithWrdSpg.length == 0) return; // Blogger fix. var bloggerNavBar = document.getElementById('b-navbar'); if(bloggerNavBar) bloggerNavBar.parentNode.removeChild(bloggerNavBar); var logo = document.createElement("div"); logo.innerHTML = '

Tamil fonts Enhanced by MozTxtAlignFix Script. (Undo Changes)

'; document.body.insertBefore(logo, document.body.firstChild); var a = document.getElementById('_toggle'); a.addEventListener('click', function(event) { var tgl = document.getElementById('_toggle'); if(bToggled) { for(i=0;i