Jump to content

User:Lfstevens/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.
// <nowiki>
/**
 * Wikignome gadget
 *
 * See User:EpochFail/Wikignome for more information
 **/
mw.loader.load( "https://meta.wikimedia.org/w/index.php?title=User:Zhaofeng_Li/Reflinks.js&action=raw&ctype=text/javascript" );
migrateIIJ = { auto_replace: true }; importScript('User:Utcursch/Migrate Infobox Indian Jurisdiction to Infobox settlement/main.js');
importScript('User:Ucucha/duplinks.js'); // [[User:Ucucha/duplinks]]
importScript('User:Dr_pda/prosesize.js'); //[[User:Dr_pda/prosesize.js]]
importScript('User:Dr pda/persondata.js'); //[[User:Dr pda/persondata.js]]
importScript('User:Cameltrader/Advisor.js'); //[[User:Cameltrader/Advisor]]
importScript('User:Splarka/dabfinder.js'); //[[User:Splarka/dabfinder.js]]
importScript('User:Plastikspork/date.js'); //[[User:Plastikspork/date.js]]
importScript('Wikipedia:AutoEd/core.js'); //Imports the "framework" script needed to make this function
importScript('Wikipedia:AutoEd/extrabreaks.js');
importScript('Wikipedia:AutoEd/headlines.js');
importScript('Wikipedia:AutoEd/htmltowikitext.js');
importScript('Wikipedia:AutoEd/isbn.js');
importScript('Wikipedia:AutoEd/links.js');
importScript('Wikipedia:AutoEd/templates.js');
importScript('Wikipedia:AutoEd/unicodecontrolchars.js');
importScript('Wikipedia:AutoEd/whitespace.js');
importScript('Wikipedia:AutoEd/wikilinks.js');
importScript('User:GregU/dashes.js'); //[[User:GregU/dashes.js]]
importScript('User:Frietjes/findargdups.js'); // [[User:Frietjes/findargdups]]	
importScript('User:Svick/HarvErrors.js'); // Backlink: [[User:Svick/HarvErrors.js]]

popupFixDabs=true		
autoEdClick = true;
autoEdTag = "Cleaned up using [[WP:AutoEd|AutoEd]], [[User:GregU/dashes.js]]";
autoEdLinkHover = "Run AutoEd";
autoEdLinkName = "auto ed";
autoEdLinkLocation = "p-cactions";
function autoEdFunctions() { //Activates individual modules when "auto ed" tab is clicked
    var txt = document.editform.wpTextbox1;
    txt.value = autoEdExtraBreaks(txt.value);
    txt.value = autoEdHeadlines(txt.value);
    txt.value = autoEdHTMLtoWikitext(txt.value);
    txt.value = autoEdISBN(txt.value);
    txt.value = autoEdLinks(txt.value);
    txt.value = autoEdTemplates(txt.value);
    txt.value = autoEdUnicodeControlChars(txt.value);
    txt.value = autoEdWhitespace(txt.value);
    txt.value = autoEdWikilinks(txt.value);
    var str = txt.value.
                  replace(/&mdash;/g, '—').
                  replace(/&ndash;/g, '–').     // simplify core regexes
                  replace(/&minus;/g, '−');
    txt.value = autoEdDashes( str );
}
// Add [[WP:Reflinks]] launcher in the toolbox on left
//addOnloadHook(function () {
// mw.util.addPortletLink(
//  "p-tb",     // toolbox portlet
//  "http://toolserver.org/~dispenser/cgi-bin/webreflinks.py/" + wgPageName
//   + "?client=script&citeweb=on&overwrite=&limit=20&lang=" + wgContentLanguage,
//  "Reflinks"  // link label
//)});

/**
 * TemplateScript adds configurable templates and scripts to the sidebar, and adds an example regex editor.
 * @see https://meta.wikimedia.org/wiki/TemplateScript
 */
// <pre>
subst = 'subst:welcome';
tildes = '~' + '~' + '~' + '~';
welcome = '{{' + subst + '}} ' + tildes;
$.getScript('//tools.wmflabs.org/meta/scripts/pathoschild.templatescript.js', function() {
	pathoschild.TemplateScript.Add([
		{ name: 'welcome', template: welcome, position: 'after', editSummary: 'welcome!', forNamespaces: 3, forActions: 'edit' },
		// add your own templates or scripts here
	]);
});

if(window.checkLinksToCitations === undefined)
    window.checkLinksToCitations = true;
 
jQuery(document).ready(function($) {
    // first check: do links in Harvard citations point to a valid citation?
    links = document.links;
    for (i=0; i < links.length; i++)
    {
        href = links[i].getAttribute('href');
        if (href.indexOf('#CITEREF') == 0)
            if (document.getElementById(href.substring(1)) == null)
                links[i].parentNode.innerHTML +=
                    " <strong class=error>Harv error: link to " +
                    href +
                    " doesn't point to any citation.</strong>";
    }
 
    // second check: do CITEREF IDs have Harvard citations pointing to them?
    if(window.checkLinksToCitations) {
        cites = jQuery('.citation');
        for(i=0; i < cites.length; i++) {
            id = cites[i].getAttribute('id');
            // we only need to check citations with a
            if(!id || id.indexOf('CITEREF') !== 0)
                continue;
            // don't do cites that are inside a ref
            parentid = cites[i].parentNode.parentNode.getAttribute('id');
            if(parentid && parentid.indexOf('cite_note') === 0)
                continue;
            // check for links to this citation
            query = 'a[href|="#' + id + '"]';
            if(jQuery(query).length == 0) {
                cites[i].innerHTML +=
                    " <strong class=error>Harv error: There is no link pointing to this citation.</strong>";
            }
        }
    }
});
// </nowiki>
importScript('User:MPGuy2824/MoveToDraft.js'); // Backlink: [[User:MPGuy2824/MoveToDraft.js]]
mw.loader.load( '/w/index.php?title=User:Trappist_the_monk/HarvErrors.js&action=raw&ctype=text/javascript' );