|
|
(10 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| | /* Scroll to top and sidebar logo */ |
|
| |
|
| | var scrollbutton = document.getElementById("scrollToTop"); |
| | var sidebarlogo = document.getElementById("sidebarlogo"); |
|
| |
|
| /* Remove extra headers from edit button fix */
| | window.onscroll = function() {scrollFunction()}; |
|
| |
|
| $(function() {
| | function scrollFunction() { |
| $('h2.c-header.active span.mw-headline').each(function () {
| | if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { |
| var $header = $(this);
| | scrollbutton.style.display = "block"; |
| var $headername = $header.html();
| | sidebarlogo.style.display = "block"; |
| $headernameu = $headername.split(' ').join('_');
| | } else { |
| | | scrollbutton.style.display = "none"; |
| var $secondheader = "#" + $headernameu + "_2";
| | sidebarlogo.style.display = "none"; |
| | | } |
| $("a[href*='" + $secondheader + "']").hide();
| |
| });
| |
| });
| |
| | |
| $(function() {
| |
| $('h2.c-header.hidden span.mw-headline').each(function () { | |
| var $header = $(this);
| |
| var $headername = $header.html();
| |
| $headernameu = $headername.split(' ').join('_');
| |
| | |
| var $secondheader = "#" + $headernameu + "_2";
| |
| | |
| $("a[href*='" + $secondheader + "']").hide();
| |
| }); | |
| });
| |
| | |
| $(function() {
| |
| $('h2.h-static span.mw-headline').each(function () {
| |
| var $header = $(this);
| |
| var $headername = $header.html();
| |
| $headernameu = $headername.split(' ').join('_');
| |
| | |
| var $secondheader = "#" + $headernameu + "_2";
| |
| | |
| $("a[href*='" + $secondheader + "']").hide();
| |
| });
| |
| });
| |
| | |
| $(function() {
| |
| $('h3.c-header.active span.mw-headline').each(function () {
| |
| var $header = $(this);
| |
| var $headername = $header.html();
| |
| $headernameu = $headername.split(' ').join('_');
| |
| | |
| var $secondheader = "#" + $headernameu + "_2";
| |
| | |
| $("a[href*='" + $secondheader + "']").hide();
| |
| });
| |
| });
| |
| | |
| $(function() {
| |
| $('h3.c-header.hidden span.mw-headline').each(function () {
| |
| var $header = $(this);
| |
| var $headername = $header.html();
| |
| $headernameu = $headername.split(' ').join('_');
| |
| | |
| var $secondheader = "#" + $headernameu + "_2";
| |
| | |
| $("a[href*='" + $secondheader + "']").hide();
| |
| });
| |
| });
| |
| | |
| $(function() {
| |
| $('h3.h-static span.mw-headline').each(function () {
| |
| var $header = $(this);
| |
| var $headername = $header.html();
| |
| $headernameu = $headername.split(' ').join('_');
| |
| | |
| var $secondheader = "#" + $headernameu + "_2";
| |
| | |
| $("a[href*='" + $secondheader + "']").hide();
| |
| });
| |
| });
| |
| | |
| /* 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);
| |
| }
| |
| | |
| });
| |
| });
| |
| | |
| $(function() {
| |
| var coll = document.getElementsByClassName("c-header");
| |
| var i;
| |
| | |
| for (i = 0; i < coll.length; i++) {
| |
| coll[i].addEventListener("click", function() {
| |
| var content = this.nextElementSibling;
| |
| if (content.style.display === "block") { | |
| content.style.display = "none";
| |
| if (this.classList.contains("active")) {
| |
| this.classList.remove("active");
| |
| this.classList.add("hidden");
| |
| } else {
| |
| this.classList.add("hidden");
| |
| }
| |
| } else { | |
| content.style.display = "block";
| |
| if (this.classList.contains("hidden")) {
| |
| this.classList.remove("hidden");
| |
| this.classList.add("active");
| |
| } else {
| |
| this.classList.add("active");
| |
| }
| |
| }
| |
| }); | |
| } | | } |
| });
| |
|
| |
|
| function toggleSections(){ | | function topFunction() { |
| $("h2.c-header").each(function (){
| | document.body.scrollTop = 0; |
| var content = this.next();
| | document.documentElement.scrollTop = 0; |
| content.style.display = "block";
| |
| this.classList.add("active");
| |
| this.classList.remove("hidden");
| |
| }
| |
| } | | } |