MediaWiki:Common.js
From Unforgotten Realms Wiki
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */
//Sidebar Social Icon Management
var panel = document.getElementById("mw-panel");
var line1 = document.createElement("hr");
line1.id = "line1";
line1.className = "line";
panel.appendChild(line1);
var container = document.createElement("div");
container.id = "container";
var link1 = document.createElement("a");
link1.href = "http://live.urealms.com/";
var image1 = document.createElement("img");
image1.id = "image1";
image1.className = "links";
image1.src = "https://wiki.urealms.com/images/b/b0/Website_Icon.png";
image1.width = "32";
image1.height = "32";
link1.appendChild(image1);
container.appendChild(link1);
var link2 = document.createElement("a");
link2.href = "https://www.twitch.tv/urealms";
var image2 = document.createElement("img");
image2.id = "image2";
image2.className = "links"
image2.src = "https://wiki.urealms.com/images/3/3e/Twitch_Icon.png";
image2.width = "32";
image2.height = "32";
link2.appendChild(image2);
container.appendChild(link2);
var link3 = document.createElement("a");
link3.href = "https://www.youtube.com/user/BruceWillakers";
var image3 = document.createElement("img");
image3.id = "image3";
image3.className = "links"
image3.src = "https://wiki.urealms.com/images/d/d2/Youtube_Icon.png";
image3.width = "32";
image3.height = "32";
link3.appendChild(image3);
container.appendChild(link3);
var link4 = document.createElement("a");
link4.href = "https://www.patreon.com/brucewillakers";
var image4 = document.createElement("img");
image4.id = "image4";
image4.className = "links"
image4.src = "https://wiki.urealms.com/images/e/e6/Patreon_Icon.png";
image4.width = "32";
image4.height = "32";
link4.appendChild(image4);
container.appendChild(link4);
var sheet = document.createElement('style')
sheet.innerHTML = ".links {display: inline-block; margin: 3px; border: 2px solid #443924; border-radius: 5px; -webkit-transition: .25s ease-in-out;} .links:hover { border: 2px solid #877147;} #container {text-align: center; } .line { border: 1px solid #443924; } .wikiButton {-webkit-transition: .25s ease-in-out;} .wikiButton:hover { -webkit-filter: opacity(60%);}";
container.appendChild(sheet);
var line2 = document.createElement("hr");
line2.id = "line2";
line2.className = "line";
container.appendChild(line2);
panel.appendChild(container);
//Main Sidebar Management
$("#p-Coes_Quest-label").text("Coe's Quest");
$("#p-URealms-label").nextAll(".body:first").hide();
$("#p-Coes_Quest-label").nextAll(".body:first").hide();
$("#p-Community-label").nextAll(".body:first").show();
$("#p-Wiki-label").nextAll(".body:first").show();
$("#p-tb-label").nextAll(".body:first").hide();
for (var i = 0; i < $("#p-URealms-label, #p-Coes_Quest-label, #p-Wiki-label, #p-tb-label, #p-Community-label").length; i++) {
if ($("#p-URealms-label, #p-Coes_Quest-label, #p-Wiki-label, #p-tb-label, #p-Community-label").next(".body").eq(i).is(":visible")) {
$("#p-URealms-label, #p-Coes_Quest-label, #p-Wiki-label, #p-tb-label, #p-Community-label").eq(i).prepend("▾");
} else {
$("#p-URealms-label, #p-Coes_Quest-label, #p-Wiki-label, #p-tb-label, #p-Community-label").eq(i).prepend("▸");
}
}
$("#p-URealms-label, #p-Coes_Quest-label, #p-Wiki-label, #p-tb-label, #p-Community-label").click(function() {
if ($(this).text().charAt(0) == "▾") {
var string = $(this).text();
var newString = string.replace("▾", "▸");
$(this).text(newString);
} else {
var string = $(this).text();
var newString = string.replace("▸", "▾");
$(this).text(newString);
}
$(this).nextAll(".body:first").slideToggle();
});
$('div#mw-panel div.portal').css({
"-webkit-box-shadow": "none",
"-moz-box-shadow": "none",
"box-shadow": "none",
"margin": "0 0.6em 0 0.7em",
"padding": "0px",
"border": "5px solid #443924",
"border-radius": "15px",
"margin-bottom": "10px",
"background-color": "rgba(0,0,0,0.5)",
"margin-top": "-40px"
});
$('div#mw-panel').css({
"margin-top":"-40px"
});
$('.mw-wiki-logo').css({
"margin-top":"40px"
});
$('div#mw-panel div.portal h3').css({
"text-shadow": "none",
"background-image": "none",
"box-sizing": "border-box",
"background-size": "contain",
"padding-top": "10px",
"padding-bottom": "0px",
"background-position": "center",
"background-repeat": "no-repeat",
"text-align": "left",
"font-family": "Georgia",
"font-size": "1.1em",
"font-weight": "bold",
"color": "white",
"padding-bottom": "10px",
"font-weight": "normal",
"width": "100%",
"margin-bottom": "-10px",
"margin-top": "-10px",
"cursor": "default",
"border": "none",
"white-space": "nowrap",
"letter-spacing": "-0.5px"
});
$('div#mw-panel div.portal div.body ul li a ').css({
"font-size": "12.2px"
});
//Fix for Advanced Search
$('fieldset#mw-searchoptions').css({
"background-color":"transparent"
});
$('.mw-search-profile-tabs').css({
"background-color":"transparent"
});
//Remove arrow from external links
$('.mw-body .external').css({
"background-image":"none",
"padding-right":"0px"
});
//Table of contents redesign
$('.toc').css({
"background-image": "none",
"box-shadow": "none",
"background-color": "transparent",
"min-width":"200px"
});
$('.toc > ul').css({
"margin-top":"10px !important"
});
$('#toc,.toc,.mw-warning,.toccolours').css({
"background-color": "rgba(0,0,0,0.2)"
});
$(' .toc #toctitle').css({
"background-image": "none",
"text-shadow": "none",
"margin-top": "-4em",
"font-size":"0.7em"
});
$('.toc #toctitle .toctoggle').css({
"display": "block",
"margin-top": "-0.8em"
});
$('#toc,.toc').css({
"padding": "2em",
"padding-bottom": "1em"
});
$('.toc #toctitle h2,.toc #toctitle h2 > span').css({
"font-size": "2em"
});
//Background and Topbar redesign
$('div#mw-head').css({
"background-image": "url(https://wiki.urealms.com/images/b/bc/Wiki_Topbar.png)",
"background-repeat": "no-repeat",
"background-size": "100% 60%"
});
$('#right-navigation').css({
"margin-top": "5.6em",
"margin-right": "5em"
});
$('#left-navigation').css({
"margin-top": "5.6em",
"margin-left": "11.5em"
});
$('body').css({
"background-color":"transparent",
"background-image":"url(https://wiki.urealms.com/images/6/65/Wiki_Background.png)"
});
$('.mw-body').css({
"margin-top": "3.1em",
"margin-right": "2em",
"margin-left": "11em",
"border-radius": "10px",
"border-right-width": "5px",
"border-top-left-radius": "10px"
});


