MediaWiki
Foreground.js: Difference between revisions
From Grouse House Wiki
No edit summary |
No edit summary |
||
| Line 47: | Line 47: | ||
function toggleSectionsOff() { | function toggleSectionsOff() { | ||
var sections = document.getElementsByClassName("c-header"), | var sections = document.getElementsByClassName("c-header"), | ||
len = sections !== null ? sections.length : 0, | |||
i = 0; | |||
for(i; i < len; i++) { | |||
var content = sections[i].nextElementSibling; | |||
content.style.display = "none"; | |||
sections[i].classList.remove("active"); | |||
sections[i].classList.add("hidden") | |||
} | |||
} | |||
/* Spoiler toggles */ | |||
function toggleSpoilersOn() { | |||
var sections = document.getElementsByClassName("spoilerButton"), | |||
len = sections !== null ? sections.length : 0, | |||
i = 0; | |||
for(i; i < len; i++) { | |||
var content = sections[i].nextElementSibling; | |||
content.style.display = "block"; | |||
sections[i].classList.remove("hidden"); | |||
sections[i].classList.add("active") | |||
} | |||
} | |||
function toggleSpoilersOff() { | |||
var sections = document.getElementsByClassName("spoilerButton"), | |||
len = sections !== null ? sections.length : 0, | len = sections !== null ? sections.length : 0, | ||
i = 0; | i = 0; | ||
Revision as of 00:52, 19 February 2024
/* Adding link to discussion button */
$(function() {
$('h1#firstHeading').each(function () {
var $header = $(this).children('span').html();
$pagetitle = $header.split(' ').join('_');
$url = $(location).attr('href');
$spliturl = $url.split(':').join(' ');
var main = $spliturl.indexOf("Main");
var mediawiki = $spliturl.indexOf("MediaWiki");
var special = $spliturl.indexOf("Special");
var edit = $spliturl.indexOf("edit");
if(main !== -1){
$(this).children('div').children('a').css("display", "none");
} else if(mediawiki !== -1){
$(this).children('div').children('a').css("display", "none");
} else if(special !== -1){
$(this).children('div').children('a').css("display", "none");
} else if(edit !== -1){
$(this).children('div').children('a').css("display", "none");
} else{
$talklink = "https://grousehouse.wiki/Talk:" + $pagetitle;
$link = $(this).children('div').children('a');
$link.attr("href", $talklink);
}
});
});
/* Section toggles */
function toggleSectionsOn() {
var sections = document.getElementsByClassName("c-header"),
len = sections !== null ? sections.length : 0,
i = 0;
for(i; i < len; i++) {
var content = sections[i].nextElementSibling;
content.style.display = "block";
sections[i].classList.remove("hidden");
sections[i].classList.add("active")
}
}
function toggleSectionsOff() {
var sections = document.getElementsByClassName("c-header"),
len = sections !== null ? sections.length : 0,
i = 0;
for(i; i < len; i++) {
var content = sections[i].nextElementSibling;
content.style.display = "none";
sections[i].classList.remove("active");
sections[i].classList.add("hidden")
}
}
/* Spoiler toggles */
function toggleSpoilersOn() {
var sections = document.getElementsByClassName("spoilerButton"),
len = sections !== null ? sections.length : 0,
i = 0;
for(i; i < len; i++) {
var content = sections[i].nextElementSibling;
content.style.display = "block";
sections[i].classList.remove("hidden");
sections[i].classList.add("active")
}
}
function toggleSpoilersOff() {
var sections = document.getElementsByClassName("spoilerButton"),
len = sections !== null ? sections.length : 0,
i = 0;
for(i; i < len; i++) {
var content = sections[i].nextElementSibling;
content.style.display = "none";
sections[i].classList.remove("active");
sections[i].classList.add("hidden")
}
}
