(bug 19496) New pages don't have yellow background. Moving rules for .not-patrolled...
[lhc/web/wiklou.git] / skins / common / wikibits.js
index 3421aee..b81196f 100644 (file)
@@ -14,6 +14,7 @@ var is_khtml = navigator.vendor == 'KDE' ||
        ( document.childNodes && !document.all && !navigator.taintEnabled );
 // For accesskeys; note that FF3+ is included here!
 var is_ff2 = /firefox\/[2-9]|minefield\/3/.test( clientPC );
+var is_ff2_ = /firefox\/2/.test( clientPC );
 // These aren't used here, but some custom scripts rely on them
 var is_ff2_win = is_ff2 && clientPC.indexOf('windows') != -1;
 var is_ff2_x11 = is_ff2 && clientPC.indexOf('x11') != -1;
@@ -48,8 +49,9 @@ function hookEvent(hookName, hookFunct) {
 }
 
 function importScript(page) {
+       // TODO: might want to introduce a utility function to match wfUrlencode() in PHP
        var uri = wgScript + '?title=' +
-               encodeURIComponent(page.replace(/ /g,'_')).replace('%2F','/').replace('%3A',':') +
+               encodeURIComponent(page.replace(/ /g,'_')).replace(/%2F/ig,'/').replace(/%3A/ig,':') +
                '&action=raw&ctype=text/javascript';
        return importScriptURI(uri);
 }
@@ -91,8 +93,12 @@ if (typeof stylepath != 'undefined' && typeof skin != 'undefined') {
                importStylesheetURI(stylepath+'/'+skin+'/Opera6Fixes.css');
        } else if (is_opera_seven && !is_opera_95) {
                importStylesheetURI(stylepath+'/'+skin+'/Opera7Fixes.css');
+       } else if (is_opera_95) {
+               importStylesheetURI(stylepath+'/'+skin+'/Opera9Fixes.css');
        } else if (is_khtml) {
                importStylesheetURI(stylepath+'/'+skin+'/KHTMLFixes.css');
+       } else if (is_ff2_) {
+               importStylesheetURI(stylepath+'/'+skin+'/FF2Fixes.css');
        }
 }
 
@@ -108,7 +114,9 @@ function showTocToggle() {
                // Uses DOM calls to avoid document.write + XHTML issues
 
                var linkHolder = document.getElementById('toctitle');
-               if (!linkHolder) {
+               var existingLink = document.getElementById('togglelink');
+               if (!linkHolder || existingLink) {
+                       // Don't add the toggle link twice
                        return;
                }
 
@@ -426,6 +434,8 @@ function checkboxClickHandler(e) {
        }
        for (var i = start; i <= finish; ++i ) {
                checkboxes[i].checked = endState;
+               if( i > start && typeof checkboxes[i].onchange == 'function' )
+                       checkboxes[i].onchange(); // fire triggers
        }
        lastCheckbox = this.index;
        return true;
@@ -661,7 +671,7 @@ function ts_resortTable(lnk) {
                span.setAttribute('sortdir','down');
        }
 
-       for(var i in staticRows) {
+       for (var i = 0; i < staticRows.length; i++) {
                var row = staticRows[i];
                newRows.splice(row[2], 0, row);
        }
@@ -807,7 +817,7 @@ function ts_parseFloat( s ) {
        }
 
        num = parseFloat(s.replace(/,/g, ""));
-       return (isNaN(num) ? s : num);
+       return (isNaN(num) ? 0 : num);
 }
 
 function ts_currencyToSortKey( s ) {