MediaWiki
Important: The status of the COVID-19 crisis constantly changes. The information in this resource is updated frequently.
Difference between revisions of "Common.js"
From Navigating COVID-19
(22 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
− | + | (function() { | |
− | + | var script = document.createElement('script'); | |
− | if(document.getElementById(' | + | script.src = 'https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript'; |
− | + | script.async = true; | |
+ | document.getElementsByTagName('head')[0].appendChild(script); | ||
+ | })(); | ||
+ | |||
+ | if (document.getElementById('pt-logout') != null) { | ||
+ | document.getElementById('ca-history').style = "display: inline !important;"; | ||
+ | if (document.getElementById('p-Editor_Tools') != null) | ||
+ | document.getElementById('p-Editor_Tools').style = "display: block;" | ||
+ | if (document.getElementById('p-tb') != null) { | ||
+ | document.getElementById('p-tb').style = "display: block !important;" | ||
+ | } | ||
+ | } else { | ||
+ | $('#drop').hide(); | ||
+ | } | ||
+ | //document.getElementsByClassName("mw-wiki-logo")[0].href = "https://www.sullivanattorneys.com"; | ||
+ | tools = document.getElementById('p-tb') | ||
+ | nav = document.getElementById('p-navigation') | ||
+ | if (tools != null && nav != null) { | ||
+ | nav.parentNode.insertBefore(tools, nav); | ||
+ | } | ||
+ | |||
+ | // Highlight current page in menu | ||
+ | var path = window.location.pathname; | ||
+ | var elements = $("[href='" + path + "']"); | ||
+ | elements.addClass('active-menu-link'); | ||
+ | elements.parent().parent().filter('.sectionContent').toggle(); | ||
+ | |||
+ | var tocElement = document.getElementById('toc'); | ||
+ | if (tocElement != null) { | ||
+ | var tocCopy = tocElement.cloneNode(true); | ||
+ | tocCopy.children[1].children[0].textContent = "Page Contents" | ||
+ | $('#toc').addClass('show-on-mobile'); | ||
+ | |||
+ | var bodyMenuTocElem = document.getElementById('bodyMenuToc'); | ||
+ | bodyMenuTocElem.after(tocCopy); | ||
+ | } | ||
+ | |||
+ | var acc = document.getElementsByClassName("sidebar-header"); | ||
+ | var i; | ||
+ | |||
+ | for (i = 0; i < acc.length; i++) { | ||
+ | |||
+ | acc[i].addEventListener("click", function() { | ||
+ | /* Toggle between adding and removing the "active" class, | ||
+ | to highlight the button that controls the panel */ | ||
+ | this.classList.toggle("active"); | ||
+ | |||
+ | /* Toggle between hiding and showing the active panel */ | ||
+ | var panel = $($(this).nextAll('.sectionContent')[0]); | ||
+ | panel.toggle() | ||
+ | |||
+ | |||
+ | var show_more_el = $($(this).nextAll('.show-more')[0])[0]; | ||
+ | show_more_el.classList.toggle("active"); | ||
+ | if (show_more_el.classList.contains('active')) { | ||
+ | show_more_el.innerText = 'Show Less'; | ||
+ | } else { | ||
+ | show_more_el.innerText = 'Show More'; | ||
+ | } | ||
+ | |||
+ | }) | ||
+ | } | ||
+ | |||
+ | // doubled | ||
+ | var showMore = document.getElementsByClassName("show-more"); | ||
+ | var i; | ||
+ | |||
+ | for (i = 0; i < showMore.length; i++) { | ||
+ | showMore[i].addEventListener("click", function() { | ||
+ | |||
+ | this.classList.toggle("active"); | ||
+ | if (this.classList.contains('active')) { | ||
+ | this.innerText = 'Show Less'; | ||
+ | } else { | ||
+ | this.innerText = 'Show More'; | ||
+ | } | ||
+ | |||
+ | |||
+ | var panel = $($(this).prevAll('.sectionContent')[0]); | ||
+ | panel.toggle() | ||
+ | |||
+ | }) | ||
+ | } | ||
+ | // end doubled | ||
+ | |||
+ | // SEE ALSO | ||
+ | |||
+ | var seeAlsoElement = document.getElementById("SEE_ALSO"); | ||
+ | if (seeAlsoElement != null) { | ||
+ | seeAlsoElement.parentElement.nextElementSibling.classList.add("see-also-list") | ||
+ | } | ||
+ | |||
+ | var seeAlsoElement = document.getElementById("See_Also"); | ||
+ | if (seeAlsoElement != null) { | ||
+ | seeAlsoElement.parentElement.nextElementSibling.classList.add("see-also-list") | ||
} | } |
Latest revision as of 15:44, 25 November 2020
/* Any JavaScript here will be loaded for all users on every page load. */ (function() { var script = document.createElement('script'); script.src = 'https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript'; script.async = true; document.getElementsByTagName('head')[0].appendChild(script); })(); if (document.getElementById('pt-logout') != null) { document.getElementById('ca-history').style = "display: inline !important;"; if (document.getElementById('p-Editor_Tools') != null) document.getElementById('p-Editor_Tools').style = "display: block;" if (document.getElementById('p-tb') != null) { document.getElementById('p-tb').style = "display: block !important;" } } else { $('#drop').hide(); } //document.getElementsByClassName("mw-wiki-logo")[0].href = "https://www.sullivanattorneys.com"; tools = document.getElementById('p-tb') nav = document.getElementById('p-navigation') if (tools != null && nav != null) { nav.parentNode.insertBefore(tools, nav); } // Highlight current page in menu var path = window.location.pathname; var elements = $("[href='" + path + "']"); elements.addClass('active-menu-link'); elements.parent().parent().filter('.sectionContent').toggle(); var tocElement = document.getElementById('toc'); if (tocElement != null) { var tocCopy = tocElement.cloneNode(true); tocCopy.children[1].children[0].textContent = "Page Contents" $('#toc').addClass('show-on-mobile'); var bodyMenuTocElem = document.getElementById('bodyMenuToc'); bodyMenuTocElem.after(tocCopy); } var acc = document.getElementsByClassName("sidebar-header"); var i; for (i = 0; i < acc.length; i++) { acc[i].addEventListener("click", function() { /* Toggle between adding and removing the "active" class, to highlight the button that controls the panel */ this.classList.toggle("active"); /* Toggle between hiding and showing the active panel */ var panel = $($(this).nextAll('.sectionContent')[0]); panel.toggle() var show_more_el = $($(this).nextAll('.show-more')[0])[0]; show_more_el.classList.toggle("active"); if (show_more_el.classList.contains('active')) { show_more_el.innerText = 'Show Less'; } else { show_more_el.innerText = 'Show More'; } }) } // doubled var showMore = document.getElementsByClassName("show-more"); var i; for (i = 0; i < showMore.length; i++) { showMore[i].addEventListener("click", function() { this.classList.toggle("active"); if (this.classList.contains('active')) { this.innerText = 'Show Less'; } else { this.innerText = 'Show More'; } var panel = $($(this).prevAll('.sectionContent')[0]); panel.toggle() }) } // end doubled // SEE ALSO var seeAlsoElement = document.getElementById("SEE_ALSO"); if (seeAlsoElement != null) { seeAlsoElement.parentElement.nextElementSibling.classList.add("see-also-list") } var seeAlsoElement = document.getElementById("See_Also"); if (seeAlsoElement != null) { seeAlsoElement.parentElement.nextElementSibling.classList.add("see-also-list") }
GET IMPORTANT UPDATES
Michael Sullivan & Associates
Learn more about our services:
SullivanAttorneys.comWorkers’ Comp, Simplified.
Sullivan On Comp