Logo Albion iconAlbion Online Deadlock iconDeadlock GW2 iconGuild Wars 2 TL iconThrone & Liberty

Difference between revisions of "Common.js"

m (Protected "MediaWiki:Common.js" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
Line 5: Line 5:
 
});
 
});
 
});
 
});
 +
 +
var coll = document.getElementsByClassName("collapse");
 +
var i;
 +
for (i = 0; i < coll.length; i++) {
 +
coll[i].addEventListener("click", function() {
 +
this.classList.toggle("active");
 +
var content = this.nextElementSibling;
 +
if (content.style.display === "block") {
 +
content.style.display = "none";
 +
} else {
 +
content.style.display = "block";
 +
}
 +
});
 +
}

Revision as of 18:31, 3 September 2022

$(function() {
	$(".build-template-button").click(function(){
		navigator.clipboard.writeText($(this).prev().text());
		alert("Template code copied!");
	});
});

var coll = document.getElementsByClassName("collapse");
var i;
for (i = 0; i < coll.length; i++) {
	coll[i].addEventListener("click", function() {
		this.classList.toggle("active");
		var content = this.nextElementSibling;
		if (content.style.display === "block") {
			content.style.display = "none";
		} else {
			content.style.display = "block";
		}
	});
}
Get MetaBattle Premium
Enjoy an ad-free experience & support the website, for less than $1 per month! Upgrade to Premium
Split Metabattle Logo