Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
Line 5: | Line 5: | ||
for (i in versions) { | for (i in versions) { | ||
var v = versions[i] | var v = versions[i] | ||
− | + | $("div.show_only_" + v).hide(delay); | |
− | + | $("#button_show_only_" + v).css("font-weight","normal"); | |
− | + | #console.log("Hiding version " + v + "!!") | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
+ | $("div.show_only_" + ver).show(delay); | ||
+ | $("#button_show_only_" + ver).css("font-weight","bold"); | ||
+ | console.log("Showing version " + ver) | ||
} | } | ||
Revision as of 11:25, 27 July 2024
/* Any JavaScript here will be loaded for all users on every page load. */
function show_only_version(ver, delay) {
var versions = ["v5", "v4", "touch"];
for (i in versions) {
var v = versions[i]
$("div.show_only_" + v).hide(delay);
$("#button_show_only_" + v).css("font-weight","normal");
#console.log("Hiding version " + v + "!!")
}
$("div.show_only_" + ver).show(delay);
$("#button_show_only_" + ver).css("font-weight","bold");
console.log("Showing version " + ver)
}
function show_only_branch(branch, delay) {
var branches = ["stable", "testing"];
for (i in branches) {
var b = branches[i]
if (b==branch) {
$("div.show_only_" + b).show(delay);
$("#button_show_only_" + b).css("font-weight","bold");
console.log("Showing branch " + b + "!!")
}
else {
$("div.show_only_" + b).hide(delay);
$("#button_show_only_" + b).css("font-weight","normal");
console.log("Hiding branch " + b + "!!")
}
}
}
$(document).ready(function() {
console.log("READY!! Running custom JS ...")
$("#button_show_only_v5").click(function(){
show_only_version("v5", 500)
});
$("#button_show_only_v4").click(function(){
show_only_version("v4", 500)
});
$("#button_show_only_touch").click(function(){
show_only_version("touch", 500)
});
$("#button_show_only_stable").click(function(){
show_only_branch("stable", 500)
});
$("#button_show_only_testing").click(function(){
show_only_branch("testing", 500)
});
show_only_version("v5", 0);
show_only_branch("stable", 0);
});
/* Matomo */
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(["setCookieDomain", "*.zynthian.org"]);
_paq.push(["setDomains", ["*.zynthian.org","*.blog.zynthian.org","*.discourse.zynthian.org","*.shop.zynthian.org","*.wiki.zynthian.org"]]);
_paq.push(["enableCrossDomainLinking"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://matomo.evolus.net/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
/* End Matomo Code */