User:Makyen/common.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//Items NOT IN USE

//Various reasons for disabling:

//Disabled because it is too big
//Later found User:Equazcion/Floater.js
//importStylesheet('User:Makyen/FloatHead.css'); // Forked from User:Rezonansowy/FloatHead.css

//WikiTrust  reported as non-functional and location is blocked on toolserver.org
//$.holdReady(true);
//mediaWiki.loader.load("https://toolserver.org/~netaction/wikitrust.js");

//Highlight admins:
//I don't recall actually trying this.  Looked interesting, but did not really see the point.
//importScript('User:Ais523/adminrights.js');
//actually imports from:User:Amalthea/userhighlighter.js

//On edit page Add textbox which does not contain the section header.  Used to make browser based autocomplete more useful.
//User:Svick/SectionInput.js
//Works.  Effectively splits textbox with edit summary in two one with the section, other with comment.
//Conflicts with User:Kephir/gadgets/cksyntax.js (JavaScript syntax checking)
importScript('User:Svick/SectionInput.js');

//TemplateData editor
//importScript('User:NicoV/TemplateDataEditor.js'); // Backlink: [[User:NicoV/TemplateDataEditor.js]]
//User:NicoV/TemplateDataEditor from https://fr.wikipedia.org/w/index.php?title=Utilisateur:Ltrlg/scripts/TemplateDataEditor.js&action=edit
//importScript('User:Makyen/scripts/TemplateDataEditor.js'); // Backlink: [[User:Makyen/scripts/TemplateDataEditor.js]]

//Smart watchlist:
//Need time to play with this one
//importScript('User:UncleDouggie/smart watchlist.js'); //[[User:UncleDouggie/smart watchlist.js]]

//Automatically updates your watchlist by displaying new changes as they come in at Special:Watchlist, no reloading necessary
//Works, but I don't like the fact that it burns large amounts of CPU time periodically.  Perhaps with a different computer,
//or the ability to turn it on and off.
//importScript('User:Theopolisme/Scripts/ajaxWatchlist.js'); // Backlink: [[User:Theopolisme/Scripts/ajaxWatchlist.js]]
//window.watchlistUpdateFrequency = 120000;  //in ms currently 120 seconds

//A button to go to the top of the page
//works, may be useful, but function is also provided by User:Equazcion/Floater.js
//I don't relly use this given User:Equazcion/Floater.js.
//importScript('User:Numbermaniac/goToTop.js'); // [[User:Numbermaniac/goToTop.js]]



//ENABLED


importScript('User:Makyen/OneClickArchiver.js'); // Backlink: [[User:Makyen/OneClickArchiver.js]]


//syntax highlighter
//The original location
//Getting it from here did not appear to work.
//mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&action=raw&ctype=application/javascript&smaxage=21600&maxage=86400');
//My copy
//importScript('User:Makyen/Syntax highlighter.js'); // Backlink: [[User:Makyen/Syntax highlighter.js]]
//My sandbox
//2019-07-01 This does not appear to be working properly. The Sandbox2.js version was active prior to this date.
//importScript('User:Makyen/Syntax highlighter.js/Sandbox2.js'); // Backlink: [[User:Makyen/Syntax highlighter.js/Sandbox.js]]
//Currently disabled because it is just too slow.  I need to take the time to rewrite this and/or just get the delayed callback working.
syntaxHighlighterConfig = {
    timeout: 200, //disable highlighting if it takes more than Xms (100ms is the default)
    timeout2: 500,
    useNonImmediateUpdates: true,
    inputCallbackTimeFallback: 1000
}

//MOSNUM dates enhance editor with options to convert dates.
importScript('User:Ohconfucius/script/MOSNUM dates.js');  //[[User:Ohconfucius/script/MOSNUM dates.js]]

//Additional sidebar menu of tools usually available on page history page: User:Equazcion/SidebarHistoryTools
importScript('User:Equazcion/SidebarHistoryTools.js'); // Backlink: [[User:Equazcion/SidebarHistoryTools.js]]

//A floating one line toolbar. Works, should be very helpful.
importScript('User:Equazcion/Floater.js'); // Backlink: [[User:Equazcion/Floater.js]]

//Mass rollback
//Untested, may require rollbacker perm.  However, I did not see that stated in the script docs.
importScript('User:Kangaroopower/MRollback.js'); //Mass Rollback Script [[User:Kangaroopower/MRollback.js]]

//highlights links that occur more than once in an article
importScript('User:Ucucha/duplinks.js'); // [[User:Ucucha/duplinks]]


//Alternate ajax preview: Need to test it to see which I would like to use.
//This one grabs refs from the rest of the page so there are not cite errors for named references
// not in a section
//Tried it.  It did not appear to work.
//importScript('User:Anomie/ajaxpreview.js); // [[User:Anomie/ajaxpreview]]

//Faster preview.  Preview shows References in section edit.
importScript('User:Js/ajaxPreview.js'); // [[user:js/ajaxPreview]]
//Config:
var ajaxPreviewPos = 'bottom'; //buttons on the bottom, replacing standard
/*
var ajaxPreviewPos = 'left'; //buttons on the left

var ajaxPreviewKey = 'o'; //"preview" button accesskey
var ajaxDiffKey = 'b'; //"changes" button accesskey
var ajaxPreviewButton = 'Ω'; //"preview" button text
var ajaxDiffButton = 'Δ'; //"changes" button text
var ajaxPreviewScrollTop = true; //scroll to the top of preview/changes area after each update
var ajaxPreviewFull = true; //always update interwikis, categories and templates as well
//You can make the script call any custom userscripts by defining the global ajaxPreviewExec() function. For example, if you use NavPopups and want popups to appear in the Ajax-updated preview, use the following code:

// code to execute after each preview update
window.ajaxPreviewExec = function(previewArea) {
  if (window.setupTooltips) {
    setupTooltips(previewArea);
    previewArea.ranSetupTooltipsAlready = false;
  }
}
*/
//And if you want tables to be sortable and collapsible elements to work as usual in the Ajax-updated preview, use the following code:

// code to execute after each preview update
window.ajaxPreviewExec = function(previewArea) {
  mw.loader.using( [
    'jquery.tablesorter',
    'jquery.makeCollapsible'
  ], function(){
    $( 'table.sortable' ).tablesorter();
    $( '#wikiPreview .collapsible' ).makeCollapsible();
  } );
}





//This script adds various classes to the "talk" tab, to style it based on the status of the talk page
// [[User:Anomie/talklink]]
importScript('User:Anomie/talklink.js'); // Linkback: [[User:Anomie/talklink.js]]
importStylesheet('User:Anomie/talklink.css'); // Linkback: [[User:Anomie/talklink.css]]

//Adds links to the personal section of the top of each page.
var ptLinksToAdd = [
        {
                label: "New pages",
                title: "Feed of recently created pages",
                url: "/wiki/Special:NewPagesFeed",
                index: 9
        },
        {
                label: "AfD",
                url: "/wiki/Wikipedia:Articles_for_Deletion",
                index: 10
        }
 ];
importScript('User:IagoQnsi/addptlinks.js'); // Backlink: [[User:IagoQnsi/addptlinks.js]] //[[User:IagoQnsi/addptlinks]]

//Place error notes for incomplete/malformed harvard citations.
//User:Ucucha/HarvErrors
importScript('User:Ucucha/HarvErrors.js'); //Backlink: [[User:Ucucha/HarvErrors.js]] [[User:Ucucha/HarvErrors]]
//The check for citations that have no links pointing to them is prone to false positives, 
//because citations do not always need to have such links. Disable such checks.
window.checkLinksToCitations = false;

//Add ability to filter various special pages lists.
mw.loader.load( '//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-rightsfilter.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400' );

//Add link to change list style from bulleted to numbered
importScript( 'User:Technical 13/Scripts/Gadget-listStyles.js' );// [[User:Technical 13/Scripts/Gadget-listStyles]]


//Config options for Popup gadet [[Wikipedia:Tools/Navigation popups]]:
window.popupStructure = 'menus'; //Longer menus?

//Add addition page statistics and information to each page.
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Hedonil/XTools/XTools.js&action=raw&ctype=text/javascript');





//Shows what text a ref supports
importScript('User:Makyen/RefSupports.js');
//importScript('User:Makyen/RefSupports.js/Sandbox.js');





//Did not try this but source appeared to just have functions defined in main namespace.
//WhatLinksHere enhancement – Adds tabs to WhatLinksHere pages which allow a user to filter the list of links.
//[[User:Barticus88/WhatLinksHere.js]]
//importScript('User:Barticus88/WhatLinksHere.js'); // Backlink: [[User:Barticus88/WhatLinksHere.js]]

/* Disable all user scripts, except OneClickArchiver, in an efort to reduce the frequency of Firefox crashes.  
//User scripts should not be able to cause a FF crash, but I certainly getting them often at the moment.

//Smartlinking [[User:V111P/js/Smart Linking]]
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) > -1 ) {
	importScript('User:V111P/js/smartLinkingLoader.js'); // [[User:V111P/js/smartLinkingLoader.js]]
}

//table editing helpers in toolbar
importScript('User:Kephir/gadgets/table-editor.js'); // Backlink: [[User:Kephir/gadgets/table-editor.js]]

//This is now obsolete
//Test userscripts and gadget Javascript syntax prior to saving.
//Does functions, but does not check inside anonyous functions, i.e. it does not actually run the script, only checks top level syntax.
//importScript('User:Kephir/gadgets/cksyntax.js'); // [[User:Kephir/gadgets/cksyntax]]

//User:Kbh3rd/Vandal warning toolbox
// I don't recall testing this.
// Edit tools for the vandal whack-a-mole game
// [[User:Kbh3rd/whackamole.js]] - please include this line
//
importScript('User:Kbh3rd/whackamole.js'); // Backlink: [[User:Kbh3rd/whackamole.js]]

//User script sandbox – 
//Allows you to carry out experiments with user JS and CSS code locally – that is, without saving it to your user JS/CSS page first. Does not work in Internet Explorer before version 8.
mw.loader.load( "//en.wikipedia.org/w/index.php?title=User:PleaseStand/userScriptSandbox.js&action=raw&ctype=text/javascript" );

//Template parameters wizard – Helps fill parameters of templates.
//Untested
importScript('User:קיפודנחש/TemplateParamWizard.js'); // Backlink: [[User:קיפודנחש/TemplateParamWizard.js]]
//*/


/* CharInsert specific */
window.charinsertDontMove = false;
window.editToolsRecall = true;
//Add one operation <code><nowiki></nowiki></code>
window.charinsertCustom = { User: ' |  =  {{+}}  {{{+}}}  [+]  [[+]]  [[+|+]]  –  —  °  ′  ″  ≈  ≠  ≤  ≥  ±  −  ×  ÷  ←  →  ·  §  Æ  æ  Œ  œ  §  ~' + '~' + '~' + '~  &nbsp;  <ref>+</ref>  [' + '[Category:+]]  #REDIRECT [[+]] <s>+</s>  <sup>+</sup>  <sub>+</sub>  <code>+</code>  <pre>+</pre>  <blockquote>+</blockquote>  <ref name="+" />  {{#tag:ref|+|group="nb"|name=""}}  {{Reflist}}  <references />  <includeonly>+</includeonly>  <noinclude>+</noinclude>  {{DEFAULTSORT:+}}  <nowiki>+</nowiki>  <!--+-->  <span class="plainlinks">+</span>  <code><nowiki>+</nowiki></code>  {{red|+}}' };
if(window.updateEditTools) window.updateEditTools();