Opera7 compatibility cvs upcvs upcvs upcvs up! some IE ameliorations, still
[old-projects.git] / philter / philter / include / philter.js
index 29ee024..f7a9c6a 100644 (file)
@@ -6,6 +6,14 @@
 * Copyright: See COPYING files that comes with this distribution
 ********************************************************************************/
 
+function ta_onfocus(obj) {
+    obj.setAttribute('rows', '10');
+}
+
+function ta_onblur(obj) {
+    obj.setAttribute('rows', '2');
+}
+
 function text_onfocus(object,val) {
     if(object.value == val)
         object.value = '';
@@ -21,6 +29,13 @@ function cleanChilds(Node, nbChilds) {
         Node.removeChild(Node.childNodes[nbChilds]);
 }
 
+function getElement(obj, index) {
+    if(document.getElementById)
+        return document.getElementById(obj);
+    if(document.all)
+        return document.all[obj];
+}
+
 /********** ORDER FORM FUNCTIONS **********/
 
 function order_up() {
@@ -127,7 +142,7 @@ function createActionRow(Node,data) {
 }
 
 function newAction() {
-    createActionRow(document.all['actions_row'], 0);
+    createActionRow(getElement('actionsRow'), [-1]);
 }
 
 /********** RULE.MATCH FORM FUNCTIONS **********/
@@ -170,7 +185,7 @@ function createMatchRow(Node,data) {
 }
 
 function newMatch() {
-    createMatchRow(document.all['matches_row'], 0);
+    createMatchRow(getElement('matchesRow'), [-1]);
 }
 
 /********** RULE FORM FUNCTIONS **********/
@@ -183,23 +198,24 @@ function changeRow(sel, funcs) {
 
 function createRuleForm() {
     var i;
-    var sel = document.all['order[select]'];
+    var sel = getElement('order[select]');
     var index = sel.options[sel.selectedIndex].value;
 
     actions_i = matches_i = 0;
     current_rule = filter[index];
 
-    document.all['rule[id]'].value = index;
-    document.all['rule[name]'].value = current_rule.name;
-    document.all['rule[all]'][1-current_rule.all].checked = true;
-    document.all['rule[block]'].checked = current_rule.block;
+    getElement('rule[id]').value = index;
+    getElement('rule[name]').value = current_rule.name;
+    var c = (current_rule.all ? '1' : '0');
+    getElement('rule[all'+c+']').checked = true;
+    getElement('rule[block]').checked = current_rule.block;
 
-    var mr = document.all['matches_row'];
+    var mr = getElement('matchesRow');
     cleanChilds(mr,0);
     for(i=0; i<current_rule.matches.length; i++)
         createMatchRow(mr, current_rule.matches[i]);
     
-    var ar = document.all['actions_row'];
+    var ar = getElement('actionsRow');
     cleanChilds(ar,0);
     for(i=0; i<current_rule.actions.length; i++)
         createActionRow(ar, current_rule.actions[i]);