|
|
(32 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| /* Collapsible Headers */ | | /* Scroll to top and sidebar logo */ |
|
| |
|
| var coll = document.getElementsByClassName("c-header"); | | var scrollbutton = document.getElementById("scrollToTop"); |
| var i; | | var sidebarlogo = document.getElementById("sidebarlogo"); |
|
| |
|
| for (i = 0; i < coll.length; i++) {
| | window.onscroll = function() {scrollFunction()}; |
| coll[i].addEventListener("click", function() {
| | |
| var content = this.nextElementSibling;
| | function scrollFunction() { |
| if (content.style.display === "block") {
| | if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { |
| content.style.display = "none";
| | scrollbutton.style.display = "block"; |
| if (this.classList.contains("active")) {
| | sidebarlogo.style.display = "block"; |
| this.classList.remove("active");
| | } else { |
| this.classList.add("hidden");
| | scrollbutton.style.display = "none"; |
| } else {
| | sidebarlogo.style.display = "none"; |
| 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");
| |
| }
| |
| }
| |
| }); | |
| } | | } |
|
| |
|
| /* Remove extra headers from edit button fix */
| | function topFunction() { |
| | | document.body.scrollTop = 0; |
| $(function() {
| | document.documentElement.scrollTop = 0; |
| $('h2.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() {
| |
| $('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('_');
| |
| | |
| $talklink = "https://grousehouse.wiki/Talk:" + $pagetitle;
| |
| $link = $(this).children('div').children('a');
| |
| | |
| var $upload = "Upload";
| |
| | |
| if($talklink.indexOf($Upload) !== -1) {
| |
| $link.attr("href", $talklink);
| |
| } else {
| |
| $link.css("display", "none");
| |
| }
| |
| });
| |
| });
| |