User:MarkLSteadman/common.js

importScript('User:Phe/Author fill.js'); importScript('User:Phe/Running header.js'); importScript('User:Phe/Interwiki.js'); importScript('User:Phe/Sort author.js'); importScript('User:Phe/Works about.js'); importScript('User:Inductiveload/epubExport.js');

// linter config object var myLintHints = { };

// lint in all namespaces myLintHints.rooms = "*";

// communicate user defined object mw.hook( "lintHint.config" ).fire( myLintHints );

// Add Chunked uploaad script mw.loader.load('//commons.wikimedia.org/w/index.php?title=User:Rillke/bigChunkedUpload.js&action=raw&ctype=text/javascript');

// finally, load gadget mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/lintHint/d.js&action=raw&bcache=1&maxage=86400&ctype=text/javascript" );

/** * TemplateScript adds configurable templates and scripts to the sidebar, and adds an example regex editor. * @see https://meta.wikimedia.org/wiki/TemplateScript * @update-token */ // $.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function {	/*********	** Register scripts	*********/	pathoschild.TemplateScript.add([ // page { name: 'Running header', script: set_running_header, forNamespaces: 'page' }, //{ name: 'clean up', script: cleanup, forNamespaces: 'page' }, // author namespace { name: 'Works about', script: works_about, forNamespaces: 'author' }, { name: 'Adding interwiki', script: add_interwiki, forNamespaces: 'author' }, // Wikisource:Authors-* { name: 'Sort authors', script: sort_author, enabled: mw.config.get('wgPageName').search('Wikisource:Authors-') === 0 } ]);	/*********	** Define scripts	*********/	function cleanup(editor) {		editor			// remove trailing whitespace at the end of each line			.replace(/ \n/g, '\n')			// remove trailing whitespace at the end of input			.replace(/\s+$/g, '')			// convert double-hyphen to mdash			.replace(/--/g, '—')			// remove spacing around mdash, but only if it has spaces on both sides			// (we don't want to remove the trailing space from "...as follows:— " .replace(/ +— +/g, '—') // join words that are hyphenated across a line break .replace(/-\n/g, ''); // stuff to do only if the page doesn't contain a tag: if (editor.get.indexOf(" ") === -1) { editor // remove single line breaks; preserve multiple. //.replace(/([^>\n])\n([^<\n])/g, '$1 $2') // collapse sequences of spaces into a single space .replace(/ +/g, ' '); }		editor // remove unwanted spaces around punctuation marks .replace(/ ([;:\?!,])/g, '$1') //OCR fixes // convert i9 to 19, etc.			.replace(/[il]([0-9])/g, '1$1') // "the", "them", "their", etcetera .replace(/tlie/g, 'the'); } }); //