Jump to content

User:Anpang/common.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Anpang (talk | contribs) at 03:36, 14 February 2022. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
// PREFERENCES AREA START - EDIT THIS
const enabled = ["websitedisplay",];
const preferences = {
	hey:"Preferences are coming soon, so please ignore this.",
};
// PREFERENCES AREA END - DON'T EDIT ANYTHING BELOW THIS

function capitalizeFirstLetter(string) {
  return string.charAt(0).toUpperCase() + string.slice(1);
}

if (enabled.includes("websitedisplay")) {
  const header = $("h1").text();
  const subdomain = window.location.host.split('.')[0];
  const subafters = window.location.host.split('.')[1];
  $("<span style=\"font-size:70%;color:#5c5c5c\"> [" + subdomain.toUpperCase() + " " + capitalizeFirstLetter(subafters) + "]</span>").appendTo('#firstHeading');
}