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.

document.addEventListener("redwarn:preInit", function() { console.log("redwarn preinit called"); });

mw.hook( 'wikipage.content' ).add( function () { console.log("wikipage.content", arguments) } );

mw.hook( 'wikipage.diff' ).add( function () { console.log("wikipage.diff", arguments) } );



// common.js link at hotbar.

$("#p-personal #pt-logout").before("<li id=\"pt-commonjs\"><a href=\"/wiki/Special:MyPage/common.js\">common.js</a></li>");

$("#p-personal #pt-logout").before("<li id=\"pt-rwjs\"><a href=\"/wiki/Special:MyPage/redwarnConfig.js\">redwarnConfig.js</a></li>");



// Add (nr) 'no redirect' links after redirects.

mw.hook( 'wikipage.content' ).add( function ( $el ) {

  $el.find( '.mw-redirect' ).each( function (i, e) {

    var sub = document.createElement("sub");

    sub.append("(");

    var link = document.createElement("a");

    var url = new URL(e.getAttribute("href"), window.location.href);

    url.searchParams.set("redirect", "no");

    link.setAttribute("href", url.toString());

    link.innerText = "nr";

    sub.appendChild(link);

    sub.append(")");

    e.insertAdjacentElement("afterend", sub);

  } );

} );



// GTT

mw.loader.load( '/?title=User:Chlod/Scripts/GoToTitle.js&action=raw&ctype=text/javascript' ); // Backlink: [[User:Chlod/Scripts/GoToTitle.js]]



mw.util.addPortletLink(

    'p-tb',

    "/wiki/Special:MyPage/common.js",

    'common.js', 't-common.js', 'Open your common.js'

);



// importScript("User:RedWarn/.js"); // [[User:RedWarn/]]

// importScript("User:RedWarn/beta.js"); // [[User:RedWarn/beta]]

//importScript("User:TheresNoTime/linkThings.js");



// mw.loader.load("http://localhost:45000/coordinator.js");

// mw.loader.load("http://localhost:45000/cte-core.js");



// RedWarn for Testing

mw.loader.load("http://localhost:45991/build.php");



// RedWarn

window.rw_debug = true;



// Ultraviolet

// mw.loader.load("http://localhost:45991/ultraviolet.js");

// importScript("User:10nm/beta.js");



mw.loader.load("http://localhost:45000/deputy.js");

// mw.loader.load("http://localhost:45000/deputy-ante.js");

// mw.loader.load("http://localhost:45000/deputy-ccrf-loader.js");

// mw.loader.load( '/?title=User:Chlod/Scripts/Deputy.js&action=raw&ctype=text/javascript' ); // Backlink: [[User:Chlod/Scripts/Deputy.js]]

if ( window.location.search.indexOf( '?deputy-noisolation=1' ) === -1 ) {

	mw.hook( 'infringementAssistant.preload' ).add( function() {

		window.InfringementAssistant.wikiConfig.ia.rootPage.set(new mw.Title("User:Chlod/Scripts/Deputy/tests/Problems"));

	} );

	var ccrfOverrides = { 

		cci: {

			rootPage: "User:Chlod/Scripts/Deputy/tests",

			requestsHeader: "Requests",

			requestsTemplate: "{{subst:CCI-request\n|user = $1\n|evidence = $2\n}}"

		},

		ccrf: {

			pageDeletionFilters: {

				source: '([#:]G12)|(copyright\\s*(infringement|vio(lation)?|policy))', flags: 'gi'

			},

			revisionDeletionFilters: {

				source: '([#:]RD1)|(copyright\\s*(infringement|vio(lation)?|policy))', flags: 'gi'

			},

			warningFilters: {

				source: '<!--\\s*Template:uw-(.+?)\\s*-->', flags: 'gi'

			}

		}

	};

	mw.hook( 'ccrf.preload' ).add( function() {

		window.deputyWikiConfigOverride = ccrfOverrides;

	} );

	mw.hook( 'ccrf.loader.preload' ).add( function() {

		window.deputyWikiConfigOverride = ccrfOverrides;

	} );

	mw.hook( 'deputy.preload' ).add( function () {

		// Replace resource root to load local development assets

		window.deputy.resourceRoot = { type: "url", url: new URL( "http://localhost:45000/" ) };

		window.deputy.getWikiConfig().then( function (wikiConfig) {

			// Override root pages for testing

			wikiConfig.core.dispatchRoot.set(new URL("https://deputy.toolforge.org/"));

			wikiConfig.cci.rootPage.set(new mw.Title( 'User:Chlod/Scripts/Deputy/tests' ));

			wikiConfig.ia.rootPage.set(new mw.Title("User:Chlod/Scripts/Deputy/tests/Problems"));

			wikiConfig.ia.hideTemplate.reset();

			wikiConfig.ia.hideTemplateBottom.reset();

		} );

	} );

}



function loadModule( src ) {

    var e = document.createElement( 'script' );

    e.setAttribute( 'type', 'module' );

    e.setAttribute( 'src', src );

    document.head.appendChild( e );

}



// Userscript development

// loadModule( 'http://localhost:5173/@vite/client' );

// loadModule( 'http://localhost:5173/@id/mediawiki-userscript/hmr-listener' );

loadModule( 'http://localhost:5173/src/main.ts' );
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.

document.addEventListener("redwarn:preInit", function() { console.log("redwarn preinit called"); });

mw.hook( 'wikipage.content' ).add( function () { console.log("wikipage.content", arguments) } );

mw.hook( 'wikipage.diff' ).add( function () { console.log("wikipage.diff", arguments) } );



// common.js link at hotbar.

$("#p-personal #pt-logout").before("<li id=\"pt-commonjs\"><a href=\"/wiki/Special:MyPage/common.js\">common.js</a></li>");

$("#p-personal #pt-logout").before("<li id=\"pt-rwjs\"><a href=\"/wiki/Special:MyPage/redwarnConfig.js\">redwarnConfig.js</a></li>");



// Add (nr) 'no redirect' links after redirects.

mw.hook( 'wikipage.content' ).add( function ( $el ) {

  $el.find( '.mw-redirect' ).each( function (i, e) {

    var sub = document.createElement("sub");

    sub.append("(");

    var link = document.createElement("a");

    var url = new URL(e.getAttribute("href"), window.location.href);

    url.searchParams.set("redirect", "no");

    link.setAttribute("href", url.toString());

    link.innerText = "nr";

    sub.appendChild(link);

    sub.append(")");

    e.insertAdjacentElement("afterend", sub);

  } );

} );



// GTT

mw.loader.load( '/?title=User:Chlod/Scripts/GoToTitle.js&action=raw&ctype=text/javascript' ); // Backlink: [[User:Chlod/Scripts/GoToTitle.js]]



mw.util.addPortletLink(

    'p-tb',

    "/wiki/Special:MyPage/common.js",

    'common.js', 't-common.js', 'Open your common.js'

);



// importScript("User:RedWarn/.js"); // [[User:RedWarn/]]

// importScript("User:RedWarn/beta.js"); // [[User:RedWarn/beta]]

//importScript("User:TheresNoTime/linkThings.js");



// mw.loader.load("http://localhost:45000/coordinator.js");

// mw.loader.load("http://localhost:45000/cte-core.js");



// RedWarn for Testing

mw.loader.load("http://localhost:45991/build.php");



// RedWarn

window.rw_debug = true;



// Ultraviolet

// mw.loader.load("http://localhost:45991/ultraviolet.js");

// importScript("User:10nm/beta.js");



mw.loader.load("http://localhost:45000/deputy.js");

// mw.loader.load("http://localhost:45000/deputy-ante.js");

// mw.loader.load("http://localhost:45000/deputy-ccrf-loader.js");

// mw.loader.load( '/?title=User:Chlod/Scripts/Deputy.js&action=raw&ctype=text/javascript' ); // Backlink: [[User:Chlod/Scripts/Deputy.js]]

if ( window.location.search.indexOf( '?deputy-noisolation=1' ) === -1 ) {

	mw.hook( 'infringementAssistant.preload' ).add( function() {

		window.InfringementAssistant.wikiConfig.ia.rootPage.set(new mw.Title("User:Chlod/Scripts/Deputy/tests/Problems"));

	} );

	var ccrfOverrides = { 

		cci: {

			rootPage: "User:Chlod/Scripts/Deputy/tests",

			requestsHeader: "Requests",

			requestsTemplate: "{{subst:CCI-request\n|user = $1\n|evidence = $2\n}}"

		},

		ccrf: {

			pageDeletionFilters: {

				source: '([#:]G12)|(copyright\\s*(infringement|vio(lation)?|policy))', flags: 'gi'

			},

			revisionDeletionFilters: {

				source: '([#:]RD1)|(copyright\\s*(infringement|vio(lation)?|policy))', flags: 'gi'

			},

			warningFilters: {

				source: '<!--\\s*Template:uw-(.+?)\\s*-->', flags: 'gi'

			}

		}

	};

	mw.hook( 'ccrf.preload' ).add( function() {

		window.deputyWikiConfigOverride = ccrfOverrides;

	} );

	mw.hook( 'ccrf.loader.preload' ).add( function() {

		window.deputyWikiConfigOverride = ccrfOverrides;

	} );

	mw.hook( 'deputy.preload' ).add( function () {

		// Replace resource root to load local development assets

		window.deputy.resourceRoot = { type: "url", url: new URL( "http://localhost:45000/" ) };

		window.deputy.getWikiConfig().then( function (wikiConfig) {

			// Override root pages for testing

			wikiConfig.core.dispatchRoot.set(new URL("https://deputy.toolforge.org/"));

			wikiConfig.cci.rootPage.set(new mw.Title( 'User:Chlod/Scripts/Deputy/tests' ));

			wikiConfig.ia.rootPage.set(new mw.Title("User:Chlod/Scripts/Deputy/tests/Problems"));

			wikiConfig.ia.hideTemplate.reset();

			wikiConfig.ia.hideTemplateBottom.reset();

		} );

	} );

}



function loadModule( src ) {

    var e = document.createElement( 'script' );

    e.setAttribute( 'type', 'module' );

    e.setAttribute( 'src', src );

    document.head.appendChild( e );

}



// Userscript development

// loadModule( 'http://localhost:5173/@vite/client' );

// loadModule( 'http://localhost:5173/@id/mediawiki-userscript/hmr-listener' );

loadModule( 'http://localhost:5173/src/main.ts' );

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook