From ad07466c641a6b1940dff0823838da0abc5fcec1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Sun, 26 Feb 2006 23:20:09 +0000 Subject: [PATCH] Some enhancements to allmessages filter --- includes/SpecialAllmessages.php | 6 ++--- languages/Messages.php | 2 +- skins/common/wikibits.js | 44 +++++++++++++++++++-------------- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/includes/SpecialAllmessages.php b/includes/SpecialAllmessages.php index 1b0bee592a..621a8d5602 100644 --- a/includes/SpecialAllmessages.php +++ b/includes/SpecialAllmessages.php @@ -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 = ''; + wfMsgHtml('allmessagesfilter') . " {$input}{$checkbox} " . ''; $txt .= " diff --git a/languages/Messages.php b/languages/Messages.php index 25f4bb529a..6f8bb15699 100644 --- a/languages/Messages.php +++ b/languages/Messages.php @@ -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 $1 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', diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index a43028c784..7a18c8fb7c 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -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 -- 2.20.1