Glaisher has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/290632

Change subject: Use ListToggle to generate select checkboxes in Special:Nuke
......................................................................

Use ListToggle to generate select checkboxes in Special:Nuke

ListToggle was introduced in 1.27 and it looks like this extension has
dropped support for older versions. Since ext.nuke did what ListToggle does,
ext.nuke module has been removed completely.
Bonus:
 - Non-working links are no longer visible for no-JS users.
 - Browser back button works correctly now even after selecting a link here

Change-Id: I5bcfa944478a71112324ca684daa9235718c7d2b
---
M Nuke_body.php
D ext.nuke.js
M extension.json
M i18n/en.json
M i18n/qqq.json
5 files changed, 5 insertions(+), 64 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Nuke 
refs/changes/32/290632/1

diff --git a/Nuke_body.php b/Nuke_body.php
index d882ebe..4e3db91 100644
--- a/Nuke_body.php
+++ b/Nuke_body.php
@@ -158,8 +158,6 @@
 
                $nuke = $this->getPageTitle();
 
-               $out->addModules( 'ext.nuke' );
-
                $out->addHTML(
                        Xml::openElement( 'form', [
                                        'action' => $nuke->getLocalURL( 
'action=delete' ),
@@ -175,24 +173,11 @@
                        )
                );
 
-               // Select: All, None, Invert
-               $links = [];
-               $links[] = '<a href="#" id="toggleall">' .
-                       $this->msg( 'powersearch-toggleall' )->escaped() . 
'</a>';
-               $links[] = '<a href="#" id="togglenone">' .
-                       $this->msg( 'powersearch-togglenone' )->escaped() . 
'</a>';
-               $links[] = '<a href="#" id="toggleinvert">' .
-                       $this->msg( 'nuke-toggleinvert' )->escaped() . '</a>';
-               $out->addHTML(
-                       Xml::tags( 'p',
-                               null,
-                               $this->msg( 'nuke-select' )
-                                       ->rawParams( 
$this->getLanguage()->commaList( $links ) )->escaped()
-                       )
-               );
+               $listToggle = new ListToggle( $this->getOutput() );
 
-               // Delete button
+               // Select checkboxes and delete button
                $out->addHTML(
+                       $listToggle->getHTML() .
                        Xml::submitButton( $this->msg( 'nuke-submit-delete' 
)->text() )
                );
 
@@ -237,6 +222,7 @@
                        "</ul>\n" .
                        Xml::submitButton( wfMessage( 'nuke-submit-delete' 
)->text() ) .
                        '</form>'
+                       . $listToggle->getHTML()
                );
        }
 
diff --git a/ext.nuke.js b/ext.nuke.js
deleted file mode 100644
index ff5aecf..0000000
--- a/ext.nuke.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * JavaScript for the Nuke MediaWiki extension.
- * @see https://www.mediawiki.org/wiki/Extension:Nuke
- *
- * @licence GNU GPL v2 or later
- * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
- */
-
-( function ( $ ) {
-       'use strict';
-
-       $( document ).ready( function () {
-
-               function selectPages( check ) {
-                       $( 'input[type=checkbox]' ).prop( 'checked', check );
-               }
-
-               $( '#toggleall' ).click( function () {
-                       selectPages( true );
-               } );
-               $( '#togglenone' ).click( function () {
-                       selectPages( false );
-               } );
-               $( '#toggleinvert' ).click( function () {
-                       $( 'input[type="checkbox"]' ).each( function () {
-                               $( this ).prop( 'checked', !$( this ).is( 
':checked' ) );
-                       } );
-               } );
-       } );
-}( jQuery ) );
diff --git a/extension.json b/extension.json
index c897547..a96f924 100644
--- a/extension.json
+++ b/extension.json
@@ -22,17 +22,6 @@
                        "NukeHooks::nukeContributionsLinks"
                ]
        },
-       "ResourceModules": {
-               "ext.nuke": {
-                       "scripts": [
-                               "ext.nuke.js"
-                       ]
-               }
-       },
-       "ResourceFileModulePaths": {
-               "localBasePath": "",
-               "remoteExtPath": "Nuke"
-       },
        "GroupPermissions": {
                "sysop": {
                        "nuke": true
diff --git a/i18n/en.json b/i18n/en.json
index b6b8c0d..ebb76f6 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -15,10 +15,8 @@
        "nuke-multiplepeople": "Mass deletion of recently added pages",
        "nuke-tools": "This tool allows for mass deletions of pages recently 
added by a given user or an IP address.\nInput the username or IP address to 
get a list of pages to delete, or leave blank for all users.",
        "nuke-submit-user": "Go",
-       "nuke-toggleinvert": "Invert",
        "nuke-submit-delete": "Delete selected",
        "right-nuke": "Mass delete pages",
-       "nuke-select": "Select: $1",
        "nuke-userorip": "Username, IP address or blank:",
        "nuke-maxpages": "Maximum number of pages:",
        "nuke-editby": "Created by 
[[Special:Contributions/$1|{{GENDER:$1|$1}}]]",
@@ -31,4 +29,4 @@
        "nuke-namespace": "Limit to namespace:",
        "nuke-linkoncontribs": "mass delete",
        "nuke-linkoncontribs-text": "Mass delete pages where this user is the 
only author"
-}
\ No newline at end of file
+}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 94f0989..0e89832 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -24,10 +24,8 @@
        "nuke-multiplepeople": "Reason for deletion in logs, when pages created 
by multiple users were deleted.\n\n{{msg-mw|nuke-defaultreason}} is used when 
pages created by only 1 user are deleted.",
        "nuke-tools": "Used as intro text for the Nuke (mass deletion) form.",
        "nuke-submit-user": "{{Identical|Go}}",
-       "nuke-toggleinvert": "Used to invert checkbox 
selection.\n{{Identical|Invert}}",
        "nuke-submit-delete": "Submit button to delete the selected pages.",
        "right-nuke": "{{doc-right|nuke}}",
-       "nuke-select": "Parameters:\n* $1 - two links: 
{{msg-mw|Powersearch-toggleall}} and {{msg-mw|Powersearch-togglenone}} which 
respectively selects all pages and de-selects all\npages\n{{Identical|Select}}",
        "nuke-userorip": "Used as label for \"target\" input box.",
        "nuke-maxpages": "Used as label for \"nuke limit\" input box.",
        "nuke-editby": "This message is followed by {{msg-mw|Comma-separator}} 
and {{msg-mw|Nuke-viewchanges}}.\n\nParameters:\n* $1 - a username",

-- 
To view, visit https://gerrit.wikimedia.org/r/290632
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5bcfa944478a71112324ca684daa9235718c7d2b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Nuke
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to