Jump to content

User:Fetchie Mankala/monobook.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
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.
importScript('User:Tim_Song/afchelper4.js'); // Yet another AfC helper script v4.
importScript('User:The_Earwig/afc-helper.js'); // AfC Redirect Helper script.

importScript('User:GoldenRing/generate-diffs.js');

importScript('User:Fox Wilson/delsort-monobook.js'); // Deletion sorting script [[WP:FWDS]]

//Interiot's javascript edit counter
if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
  mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript'); }
// [[User:Lupin/popups.js]]

mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');
importScript('User:Tim_Song/afchelper4.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:Quarl/util.js');
importScript('User:Quarl/wikipage.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');


importScript('User:Voice_of_All/Addtabs/monobook.js');
importScript('User:Misza13/statusChanger.js');
importScript('User:S/tags.js');
// [[User:Henrik/live-edit-counter]]
importScript('User:Henrik/js/live-edit-counter.js');
popupFixDabs=true;

/*
==wikEd==
*/
importScript('User:Cacycle/wikEd.js'); //i use this and it's awesome, duh
var wikEdConfig = {};
wikEdConfig.showSourceButton = true; 
wikEdConfig.regExTypoFix = true;
wikEdConfig.showTableModeButton = true;
wikEdConfig.showUsingButton = true;
wikEdConfig.summaryUsing = '(using [[User:Cacycle/wikEd|wikEd]])';
/*
===Custom functions===
*/
 
wikEd = {
    config: {
        // define custom buttons [id, class, Tool tip, image url, width, height, alt text, onClick with parameters]
        button: {
            100: ['WrapInCode', 'wikEdButton', 'Wrap selection in <code>...</code>', '/media/wikipedia/commons/6/67/WikEd_logo.png', '16', '16', 'DIV', 'WikEdEditButton(this, this.id, null, WrapInCode);' ],
            101: ['WrapInNowiki', 'wikEdButton', 'Wrap selection in <nowiki>...</nowiki>', '/media/wikipedia/commons/5/5a/WikEd_nowiki.png', '16', '16', 'Test', 'WikEdEditButton(this, this.id, null, WrapInNowiki);' ]
        },
        // define custom button bars [id outer, class outer, id inner, class inner, height, grip title, button numbers]
        buttonBar: {
            'custom2': ['wikEdButtonBarCustom1',  'wikEdButtonBarCustom1',  'wikEdButtonsCustom1',  'wikEdButtonsCustom1',  44, 'My custom buttons', [100, 'br', 101] ]
        }
    }
}
 
// define the function which is called upon clicking the custom button
// this example code adds or removes div tags around the selected text
 
function WrapInCode(obj) {
  // select the appropriate text change target (whole, selection, cursor, focusWord, focusLine, selectionWord, or selectionLine)
  //   focus... is the text under the cursor; ...Word and ...Line extend the target to the start/end of the word or line
  WikEdGetText(obj, 'selection, cursor');
  if (obj.selection.plain != '') {
    obj.changed = obj.selection;
  } else {
    obj.changed = obj.cursor;
  }
 
  // make the changes to the plain target text
  if ( /&lt;code&gt;([\s\S]*?)&lt;\/code&gt;/i.test(obj.changed.plain) ) {
    // remove the previously added formatting
    obj.changed.plain = obj.changed.plain.replace(/&lt;code&gt;([\s\S]*?)&lt;\/code&gt;/gi, '$1');
  } else {
    // add the text formatting
    obj.changed.plain = '&lt;code&gt;' + obj.changed.plain + '&lt;/code&gt;';
    // Move spaces outside
    obj.changed.plain = obj.changed.plain.replace(/(&lt;code&gt;)( *)([\s\S]*?)( *)(&lt;\/code&gt;)/, '$2$1$3$5$4');
  }
  // keep the changed text selected, needed to remove the formatting with a second custom button click
  obj.changed.keepSel = true;
  return;
}
 
function WrapInNowiki(obj) {
  // select the appropriate text change target (whole, selection, cursor, focusWord, focusLine, selectionWord, or selectionLine)
  //   focus... is the text under the cursor; ...Word and ...Line extend the target to the start/end of the word or line
  WikEdGetText(obj, 'selection, cursor');
  if (obj.selection.plain != '') {
    obj.changed = obj.selection;
  } else {
    obj.changed = obj.cursor;
  }
 
  // make the changes to the plain target text
  if ( /&lt;nowiki&gt;([\s\S]*?)&lt;\/nowiki&gt;/i.test(obj.changed.plain) ) {
    // remove the previously added formatting
    obj.changed.plain = obj.changed.plain.replace(/&lt;nowiki&gt;([\s\S]*?)&lt;\/nowiki&gt;/gi, '$1');
  } else {
    // add the text formatting
    obj.changed.plain = '&lt;nowiki&gt;' + obj.changed.plain + '&lt;/nowiki&gt;';
    // Move spaces outside
    obj.changed.plain = obj.changed.plain.replace(/(&lt;nowiki&gt;)( *)([\s\S]*?)( *)(&lt;\/nowiki&gt;)/, '$2$1$3$5$4');
  }
  // keep the changed text selected, needed to remove the formatting with a second custom button click
  obj.changed.keepSel = true;
  return;
}
/*
===Default edit summaries===
*/
 
wikEdConfig.comboPresetOptions = {};
wikEdConfig.comboPresetOptions.summary = [
 ' ',
 'TALK PAGES:',
 'reply',
 ' ',
 'REMOVE/REVERT:',
 'revert unexplained removal',
 'revert [[WP:V|unsourced]]',
 'revert [[WP:ELNO|external links]]',
 ' ',
 'GENERAL CLEANUP/EDITING:',
 'rm [[WP:WHITE|whitespace]]',
 'rm [[WP:V|unsourced]]',
 'rm spam',
 'rm [[WP:REDNOT|red links]]',
 'copyedit',
 'update links',
 'fix links',
 'rm unsourced sentence',
 'rm entire [[WP:V|unsourced]] paragraph',
 ' ',
 'DASHES/QUOTES/REFS/MOS:',
 'single to double [[WP:MOS#Quotation marks|quotation marks]]',
 'curly to straight [[WP:MOS#Quotation marks|quotation marks]]',
 'fix [[WP:MOS#Quotation marks|quotation marks]]',
 '[[MOS:LQ|logical quotation]]',
 'move quotation marks outside of links',
 'fix [[MOS:DASH|dashes]]',
 'punctuation',
 'commas',
 '[[WP:REFPUNC|reference punctuation]]',
 'rewrite [[WP:MOS#Contractions|contractions]]',
 'remove "™" and "®" per [[Wikipedia:Manual of Style/Trademarks]]',
 '{{[[WP:Citation Needed|citation needed]]}}',
 'rm [[WP:WEASEL|weasel words]]',
 ' ',
 'TECHNICAL:',
 'fix [[Wikipedia:Double redirects|double redirect]] after page move',
 'update [[WP:DEFAULTSORT|DEFAULTSORT]]',
 'update [[WP:HATNOTE|hatnote]] to use {{[[Template:About|about]]}}',
 'update [[WP:HATNOTE|hatnote]] to use {{[[Template:For|for]]}}',
 'update [[WP:HATNOTE|hatnote]] to use {{[[Template:Redirect|redirect]]}}',
 'Cleaned up using [[WP:AutoEd|AutoEd]]',
 '[[Wikipedia:RegExTypoFix|RegExTypoFix]] using [[User:Cacycle/wikEd|wikEd]]',
 '(using [[User:Cacycle/wikEd|wikEd]])',
 'edit wikEd RegEx defaults',
 'edit wikEd edit summaries'
];
 
/*
===Find/replace regex presets===
*/
wikEdConfig.comboPresetOptions.find = [ '(“|”)', "(‘|’)", "(‘|’|')",  '\'', '-', ' – ', '(™|®)'];
wikEdConfig.comboPresetOptions.replace = [ '\n',  '"', '\'', '–'];
 
/* END wikEd */
 
 
 
/*
== AutoEd ==
=== AutoEd modules ===
*/
//i use this
importScript('Wikipedia:AutoEd/core.js');
importScript('Wikipedia:AutoEd/fullwidth.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/unicodehex.js');
importScript('Wikipedia:AutoEd/unicodify.js');
importScript('Wikipedia:AutoEd/wikilinks.js');
//importScript('Wikipedia:AutoEd/dashes.js');
importScript("User:GregU/dashes.js"); 
//importScript('Wikipedia:AutoEd/extrabreaks.js');
//importScript('Wikipedia:AutoEd/tablestowikitext.js'); 
//importScript('Wikipedia:AutoEd/whitespace.js'); 
 
/*
=== AutoEd functions ===
*/ 
function autoEdFunctions() { //Activates individual modules when "auto ed" tab is clicked
var txt = document.editform.wpTextbox1;
txt.value = autoEdFullwidth(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 = autoEdUnicodeHex(txt.value);
txt.value = autoEdUnicodify(txt.value);
txt.value = autoEdWikilinks(txt.value);
txt.value = autoEdDashes(txt.value);
//txt.value = autoEdExtraBreaks(txt.value);
//txt.value = autoEdTablestoWikitext(txt.value);
txt.value = autoEdWhitespace(txt.value); 
}
 
autoEdClick = false; //for compatibility with wikEd
/* END AutoEd */
 
 
 
/*
==Gary King scripts==
[[User:Gary King/Scripts]]
*/
importScript('User:Gary King/comments in local time.js'); //[[User:Gary King/comments in local time.js]]; a little buggy but very useful
importScript('User:Gary_King/comment_highlighter.js'); //useful; Highlights recent comments yellow, while your own comments are highlighted in blue. (Requires User:Gary King/comments in local time.js for now).
 
//importScript('User:Gary_King/prose_size.js'); //[[User:Gary_King/prose_size.js]]
/* END Gary King scripts */
importScript('User:Bellezzasolo/Scripts/arb.js');