User:Anpang/ChocBeta.js

// Chocolate, a utility user script // v1.1.0 (12 December 2023)

// Objects to Chocolate are prefixed with "choc".

// variables const chocPath = "https://en.wikipedia.org/w/index.php?title=User:Anpang01/Chocolate"; const chocVersion = "1.1.0";

let chocEnabled = [ "Wiktionary", "Wikidata", "ExtraSandbox", "NoSiteSub", "NoCopyWarn", "WhatWiki" ]; // will make cool Special:ChocolatePreferences page later

// functions function chocCapitalize(string) { return string.charAt(0).toUpperCase + string.slice(1); }

// load css importStylesheet("User:Anpang01/Chocolate.css");

// add icon $("body").append(`				 ${chocVersion} `);

// Special:ChocolatePreferences if(mw.config.get("wgPageName") == "Special:ChocolatePreferences") { $("#firstHeading").text("Chocolate preferences"); $("#mw-content-text").text("Chocolate preferences are coming soon."); }

// link-related modules if (chocEnabled.includes("Wiktionary")) { $("#p-cactions > div > ul").append(`									 Wiktionary 						`); } if (chocEnabled.includes("Wikidata")) { $("#p-cactions > div > ul").append(`									 Wikidata 						`); }

if (chocEnabled.includes("ExtraSandbox")) { $("#pt-sandbox").append(`					 (2) 			`); }

// "no" modules if (chocEnabled.includes("NoSiteSub")) { $("#siteSub").remove; } if (chocEnabled.includes("NoCopyWarn")) { $("#editpage-copywarn").remove; }

// other if (chocEnabled.includes("WhatWiki")) { const subdomain = window.location.host.split(".")[0]; const after = window.location.host.split(".")[1]; $(`			[${subdomain.toUpperCase} ${chocCapitalize(after)}]	`).appendTo('#firstHeading'); }