User:Technical 13/Scripts/OneClickArchiver

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search



OneClickArchiver
File:OneClickArchiver screenshot.png
Archive progress screenshot (bottom, click to see full).
The "Archive" link (top) shows at the extreme
right side of the screen.
Description Adds archive links to discussions, allowing one-click archiving of individual sections
Author Equazcion (original)
Technical 13 (updates)
Status Stable
Updated April 20, 2024
    (0 days ago)
Browser support Firefox, Chrome, Opera
Skin support Vector
Source
Beta
User:Technical_13/Scripts/OneClickArchiver.js
User:Technical_13/SandBox/OneClickArchiver.js
GitHub repository OneClickArchiver on GitHub

OneClickArchiver allows you to instantly archive a single discussion with a click, via an "archive" link that displays for each section on discussion pages.

Noticeboards and other high-traffic discussion pages, normally archived automatically by bots, have gotten long and less manageable recently due to bot instability. OneClickArchiver was created to better enable experienced editors to clear out old discussions themselves, without having to rely on bots. Any discussion page can be set up to use OneClickArchiver.

Use of this tool does not obviate your responsibility to understand when archiving a thread is appropriate. In particular:
  • Public noticeboards should only be archived by experienced editors. Respect a public page's posted archiving policy; if you are unsure, ask.
  • It is rarely appropriate to archive threads in another user's talk page
Pending tasks for Technical 13/Scripts/OneClickArchiver: edit this list - add to watchlist - purge
User:Technical 13/Scripts/OneClickArchiver/to do

Archive page[edit]

This script uses a page's MiszaBot configuration (see User:MiszaBot/config) to determine the archive page. You can enable OneClickArchiver support on a page without a MiszaBot configuration (such as your own user talk page) by using {{Archive basics}} and including its two required parameters. Clicking the archive link on pages without a MiszaBot configuration or {{Archive basics}} (with both required parameters) will not successfully perform an archive.

Further technical notes[edit]

  • Template:New! Activates only on pages that are not in Category:Pages that should not be manually archived and...
  • Template:New! The script will prepend {{Clear}} to the top of each section on the archive page to prevent bleed from one section to another.
  • Template:New! The script now respects {{subst:Do not archive until}} and will refuse to allow semi-automated archiving of those sections.
    • The script will remove the HTML comment when archiving sections that are past the DNAU date. Template:New!
  • Template:New! The script now will look for ClueBot III's |headerlevel= and will add archive links on that page only for the headerlevel.
  • Template:New! The script now checks to make sure that the destination archive is a direct subpage. If it is not, it will tell you what it found and what it expected to find so that you can quickly edit the archiving template to correct the problem.
  • Template:New! The script now has the ability to toggle the links off with a link in the toolbar or with the Alt+ Shift+O access key.
    • Template:New! OneClickArchiver now uses user.options to remember if the links should be shown or not by default.
  • Its speed depends largely on the size of the archive and origin pages. Most pages archive quickly, but noticeboards that tend to get very long, like WP:ANI, can show a significant delay (in the neighborhood of 10-30 seconds, depending on how fast the servers are responding that day). The script code itself executes instantly, but the API's response time for page edits can cause delays.

Installation[edit]

To use this script: Copy the line below, then click here, paste the line, and hit Save page.

User:Technical 13/Scripts/Nav

/* This script adds Contributions and Statistics tabs to User and User talk pages. For Vector skin.

To use this script, place the following line in your vector.js page:

   importScript('User:Equazcion/ContribsTabVector.js');

Add any or all of these lines after the importScript line above to set various options (the default values are shown):

   var contribsTab = true;                    // Turns the Contributions tab on or off (set to false; for off)
   var contribsTabStats = true;               // Turns the Statistics tab on or off (set to false; for off)
   var contribsTabNumber = 50;                // Number of contributions to display in the Contributions tab. Can be 1 to 5000.
   var contribsTabName = "Contributions";     // Custom name for Contributions tab. Replace quoted text with your desired name.
   var contribsTabStatsName = "Statistics";   // Custom name for Statistics tab. Replace quoted text with your desired name.

-- End of documentation -- */

if (wgNamespaceNumber == 2 || wgNamespaceNumber == 3) { // Don't do anything unless we're in user or usertalk space

 // Set default options for any that haven't been set
 if (contribsTabName == null) var contribsTabName = "Contributions";
 if (contribsTabNumber == null) var contribsTabNumber = 50;
 if (contribsTabStats == null) var contribsTabStats = true;
 if (contribsTab == null) var contribsTab = true;
 if (contribsTabStatsName == null) var contribsTabStatsName = "Statistics";
 
 // Get the current page's username
 var username = wgTitle.split("/")[0];
 // Grab leftmost tab
 var contribsTabMain = $('#left-navigation li:not(.selected)').slice(0,1).css('opacity','0.9');
 
 if (contribsTab) { // Construct the contribs tab, if it's not turned off
    // Clone main page tab, remove 'new' class in case it was red
    var tabContribs = contribsTabMain.clone(true).attr('id', contribsTabMain.attr('id')+'-').css('opacity','0.9').removeClass('new');
    // Construct contribs URL
    if (wgNoticeProject == 'commons') {
        var contribsTabURL = 'http://commons.wikimedia.org/w/index.php?title=Special:Contributions&target=' +
                          username + '&limit=' + contribsTabNumber + '&uselang=' + wgPageContentLanguage;
    } else {
        var contribsTabURL = 'http://' + wgPageContentLanguage + wgNoticeProject + '.org/w/index.php?title=Special:Contributions&target=' +
                          username + '&limit=' + contribsTabNumber + '&uselang=' + wgPageContentLanguage;
    }
    // Set contribs tab URL, text, and tooltip
    tabContribs.find('a').attr('href', contribsTabURL).empty().text(contribsTabName).attr('title', "Show this user's contributions");
 }
 if (contribsTabStats) { // Construct the stats tab, if it's not turned off
    
    // Clone main page tab, remove 'new' class in case it was red
    var tabStats = contribsTabMain.clone(true).attr('id', contribsTabMain.attr('id')+'-').css('opacity','0.9').removeClass('new');
    
    // Construct stats URL
    var contribsTabStatsURL = 'http://toolserver.org/~tparis/pcount/index.php?name=' + username + '&lang=' + 
                               wgPageContentLanguage + '&wiki=' + wgNoticeProject;
    // Set stats tab URL, text, and tooltip
    tabStats.find('a').attr('href', contribsTabStatsURL).empty().text(contribsTabStatsName).attr('title', "Show this user's editing statistics");
 }
 // Place constructed tabs before the first right-hand tab (done here for easy ordering)
 if (contribsTabStats) tabStats.insertBefore($('#right-navigation li').slice(0,1));
 if (contribsTab) tabContribs.insertBefore($('#right-navigation li').slice(0,1));

}