Author(s) | Ahecht, based on code by Andy M. Wang |
---|---|
Status | Stable |
Version | 2 |
Updated | April 18, 2024 (0 days ago) |
Source Beta |
User:Ahecht/Scripts/pageswap.js User:Ahecht/sandbox/Scripts/pageswap.js |
Ahecht's pageswap is a script that allows a user to
swap the histories of two pages (with reasonable restrictions), sometimes known as a history swap, sometimes called a round-robin move. This script was originally based on
User:Andy M. Wang/pageswap, and is designed for easier usage in answering
requested moves. The script requires the user to have suppressredirect
and move-subpages
rights. The script will add a "Swap" tab to the top of the page near the "new section" button (or to the tools menu in Vector 2022), as well as a "Swap" link within "The page cannot be moved" error messages.
To use this script: Copy the line below, then [[ click here]], paste the line, and hit Publish changes.
{{
subst:Iusc|User:Ahecht/Scripts/pageswap.js|User:Ahecht/Scripts/pageswap}}
This script contains all the features of Andy's script, plus the following:
Editors can specify a default move reason via moveReasonDefault in
their common.js above the line that loads pageswap. This is helpful for those who use pageswap who frequently perform similar actions with the same move summary (For example, var moveReasonDefault = "Requested at [[WP:RMTR]]";
). If the swap is initiated from
Special:MovePage with a pre-filled reason, that reason will be used as the default.
Editors can have the post-move cleanup options ("Leave redirect to new talk page" and "Fix self redirects") default to unchecked by adding var pagemoveDoPostMoveCleanup = false;
in
their common.js above the line that loads pageswap. Even when these options are checked, editors will still have to correct other issues listed in
§ Out of scope themselves.
Because the round-robin move involves three distinct moves, in which each move step might fail for legitimate reasons, (target of a subpage is create-protected, a talk page is move-protected, or a target namespaces does not have subpages enabled, the target doesn't actually exist, etc) much of the script involves various checks to try to ensure that the three moves can happen unimpeded to the best of its ability. The script will detect the existence of talk pages and subpages and prompt the user, and will prompt to create red-linked talk pages. The script will not move subpages if the number of subpages of a namespace exceeds 100 pages. (In this case, attempt to perform the move manually, moving batches of 100 at a time.)
Editors can specify a default move reason (see "Options" section above). If the swap is initiated from Special:MovePage with a pre-filled reason, that reason will be used as the default.
The prefix for the intermediate title (C) used for page B (as described at
WP:PMVR#rr) is hard-coded as "Draft:Move/"
per convention.
Page swapping is enabled for most namespaces that can handle them. The ability to swap a page in a subject space with one in a talk space is currently disabled. Users who are unable to suppressredirect
or move-subpages
have the swap functionality disabled.
Have any suggestions for the scripts? Please leave a message on my talk page.
The live script is at User:Ahecht/Scripts/pageswap.js. Latest version published on April 18, 2024.
errorbox
class on
Special:MovePage per
phab:T300314.Author(s) | Ahecht, based on code by Andy M. Wang |
---|---|
Status | Stable |
Version | 2 |
Updated | April 18, 2024 (0 days ago) |
Source Beta |
User:Ahecht/Scripts/pageswap.js User:Ahecht/sandbox/Scripts/pageswap.js |
Ahecht's pageswap is a script that allows a user to
swap the histories of two pages (with reasonable restrictions), sometimes known as a history swap, sometimes called a round-robin move. This script was originally based on
User:Andy M. Wang/pageswap, and is designed for easier usage in answering
requested moves. The script requires the user to have suppressredirect
and move-subpages
rights. The script will add a "Swap" tab to the top of the page near the "new section" button (or to the tools menu in Vector 2022), as well as a "Swap" link within "The page cannot be moved" error messages.
To use this script: Copy the line below, then [[ click here]], paste the line, and hit Publish changes.
{{
subst:Iusc|User:Ahecht/Scripts/pageswap.js|User:Ahecht/Scripts/pageswap}}
This script contains all the features of Andy's script, plus the following:
Editors can specify a default move reason via moveReasonDefault in
their common.js above the line that loads pageswap. This is helpful for those who use pageswap who frequently perform similar actions with the same move summary (For example, var moveReasonDefault = "Requested at [[WP:RMTR]]";
). If the swap is initiated from
Special:MovePage with a pre-filled reason, that reason will be used as the default.
Editors can have the post-move cleanup options ("Leave redirect to new talk page" and "Fix self redirects") default to unchecked by adding var pagemoveDoPostMoveCleanup = false;
in
their common.js above the line that loads pageswap. Even when these options are checked, editors will still have to correct other issues listed in
§ Out of scope themselves.
Because the round-robin move involves three distinct moves, in which each move step might fail for legitimate reasons, (target of a subpage is create-protected, a talk page is move-protected, or a target namespaces does not have subpages enabled, the target doesn't actually exist, etc) much of the script involves various checks to try to ensure that the three moves can happen unimpeded to the best of its ability. The script will detect the existence of talk pages and subpages and prompt the user, and will prompt to create red-linked talk pages. The script will not move subpages if the number of subpages of a namespace exceeds 100 pages. (In this case, attempt to perform the move manually, moving batches of 100 at a time.)
Editors can specify a default move reason (see "Options" section above). If the swap is initiated from Special:MovePage with a pre-filled reason, that reason will be used as the default.
The prefix for the intermediate title (C) used for page B (as described at
WP:PMVR#rr) is hard-coded as "Draft:Move/"
per convention.
Page swapping is enabled for most namespaces that can handle them. The ability to swap a page in a subject space with one in a talk space is currently disabled. Users who are unable to suppressredirect
or move-subpages
have the swap functionality disabled.
Have any suggestions for the scripts? Please leave a message on my talk page.
The live script is at User:Ahecht/Scripts/pageswap.js. Latest version published on April 18, 2024.
errorbox
class on
Special:MovePage per
phab:T300314.