User:Anpang/Chocolate.js

// Chocolate, a utility user script // v1.1.1 (16 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.1";

let chocEnabled = [ "Wiktionary", "Wikidata", "ExtraSandbox", "NoSiteSub", "NoCopyWarn", "WhatWiki", "ShowPrintFooter" ]; // 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 and preferences link $("body").append(`				 ${chocVersion} `);

$("#pt-preferences").append(`					 (C) 		 `);

// 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'); }

if(chocEnabled.includes("ShowPrintFooter")) { $(".printfooter").addClass("choc-printfooter"); }