Some enhancements to allmessages filter
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Sun, 26 Feb 2006 23:20:09 +0000 (23:20 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Sun, 26 Feb 2006 23:20:09 +0000 (23:20 +0000)
includes/SpecialAllmessages.php
languages/Messages.php
skins/common/wikibits.js

index 1b0bee5..621a8d5 100644 (file)
@@ -102,14 +102,14 @@ function makeHTMLText( $messages ) {
                'onkeyup' => 'allmessagesfilter()',),
                '');
        $checkbox = wfElement( 'input', array(
-               'type'    => 'checkbox',
+               'type'    => 'button',
+               'value'   => wfMsgHtml( 'allmessagesmodified' ),
                'id'      => 'allmessagescheckbox',
                'onclick' => 'allmessagesmodified()',),
                '');
 
        $txt = '<span id="allmessagesfilter" style="display:none;">' .
-               wfMsgHtml('allmessagesfilter') . " {$input}{$checkbox} " .
-               wfMsgHtml( 'allmessagesmodified' ) . '</span>';
+               wfMsgHtml('allmessagesfilter') . " {$input}{$checkbox} " . '</span>';
 
        $txt .= "
 <table border='1' cellspacing='0' width='100%' id='allmessagestable'>
index 25f4bb5..6f8bb15 100644 (file)
@@ -1385,7 +1385,7 @@ In the latter case you can also use a link, e.g. [[{{ns:Special}}:Export/{{Media
 'allmessagestext'      => 'This is a list of system messages available in the MediaWiki: namespace.',
 'allmessagesnotsupportedUI' => 'Your current interface language <b>$1</b> is not supported by Special:AllMessages at this site.',
 'allmessagesnotsupportedDB' => 'Special:AllMessages not supported because wgUseDatabaseMessages is off.',
-'allmessagesfilter' => 'Regular expression filter:',
+'allmessagesfilter' => 'Message name filter:',
 'allmessagesmodified' => 'Show only modified',
 
 
index a43028c..7a18c8f 100644 (file)
@@ -571,13 +571,17 @@ function allmessagesforeach(items, i, j) {
        var hItem = items[i].getAttribute('id');
        if (hItem.substring(0,17) == 'sp-allmessages-i-') {
                if (items[i].firstChild && items[i].firstChild.nodeName == '#text' && items[i].firstChild.nodeValue.indexOf(text) != -1) {
-                       if ( document.getElementById( hItem.replace('i', 'r1') ).style.display != '' ) {
-                               var s = "allmessageshider(\"" + hItem + "\",'')";
+                       var itemA = document.getElementById( hItem.replace('i', 'r1') );
+                       var itemB = document.getElementById( hItem.replace('i', 'r2') );
+                       if ( itemA.style.display != '' ) {
+                               var s = "allmessageshider(\"" + hItem.replace('i', 'r1') + "\", \"" + hItem.replace('i', 'r2') + "\", '')";
                                var k = window.setTimeout(s,j++*5);
                        }
                } else {
-                       if ( document.getElementById( hItem.replace('i', 'r1') ).style.display != 'none' ) {
-                               var s = "allmessageshider(\"" + hItem + "\",'none')";
+                       var itemA = document.getElementById( hItem.replace('i', 'r1') );
+                       var itemB = document.getElementById( hItem.replace('i', 'r2') );
+                       if ( itemA.style.display != 'none' ) {
+                               var s = "allmessageshider(\"" + hItem.replace('i', 'r1') + "\", \"" + hItem.replace('i', 'r2') + "\", 'none')";
                                var k = window.setTimeout(s,j++*5);
                        }
                }
@@ -586,25 +590,28 @@ function allmessagesforeach(items, i, j) {
 }
 
 
-function allmessageshider(hItem, style) {
-                               document.getElementById( hItem.replace('i', 'r1') ).style.display = style;
-                               var row = document.getElementById( hItem.replace('i', 'r2') );
-                               if (row) { row.style.display = style; }
-                       return;
-
+function allmessageshider(idA, idB, cstyle) {
+       var itemA = document.getElementById( idA );
+       var itemB = document.getElementById( idB );
+       if (itemA) { itemA.style.display = cstyle; }
+       if (itemB) { itemB.style.display = cstyle; }
 }
 
 function allmessagesmodified() {
-       checked = document.getElementById('allmessagescheckbox').getAttribute('checked');
+       allmessages_modified = !allmessages_modified;
        k = document.getElementById('allmessagestable');
        if (!k) { return;}
-       items = k.getElementsByTagName('tr');
-       for (var i = 0; i< items.length; i++) {
-               if (items[i].getAttribute('class') == 'def') {
-                       if (checked == '') {
-                               items[i].style.display = '';
-                       } else {
-                               items[i].style.display = 'none';
+       var items = k.getElementsByTagName('tr');
+       for (var i = 0, j = 0; i< items.length; i++) {
+               if (!allmessages_modified ) {
+                       if ( items[i].style.display != '' ) {
+                               var s = "allmessageshider(\"" + items[i].getAttribute('id') + "\", null, '')";
+                               var k = window.setTimeout(s,j++*5);
+                       }
+               } else if (items[i].getAttribute('class') == 'def' && allmessages_modified) {
+                       if ( items[i].style.display != 'none' ) {
+                               var s = "allmessageshider(\"" + items[i].getAttribute('id') + "\", null, 'none')";
+                               var k = window.setTimeout(s,j++*5);
                        }
                }
        }
@@ -615,6 +622,7 @@ function allmessagesshow() {
        if (k) { k.style.display = ''; }
 
        allmessages_prev = '';
+       allmessages_modified = false;
 }
 
 hookEvent("load", allmessagesshow);
\ No newline at end of file