Difference between revisions of "MediaWiki: Common.js"
From Genesys Documentation
m (1 revision imported) |
JenkinsSBO (talk | contribs) |
||
Line 11: | Line 11: | ||
} | } | ||
}()); | }()); | ||
+ | var apps = []; | ||
+ | console.log('YAMLBOX ON'); | ||
+ | var boxElements = document.getElementsByClassName("yamlbox"); | ||
+ | for (var i = 0; i < boxElements.length; i++) { | ||
+ | |||
+ | var currentId = boxElements[i].getAttribute('id'); | ||
+ | boxElements[i].onclick = function () { | ||
+ | console.log('click', currentId); | ||
+ | var chilDivs = this.getElementsByClassName("yaml-details"); | ||
+ | var classes = chilDivs[0].getAttribute('class'); | ||
+ | if (classes.includes('yaml-hidden')) { | ||
+ | //remove hidden, replace with visible | ||
+ | chilDivs[0].setAttribute('class', classes.replace('yaml-hidden', 'yaml-show')); | ||
+ | } else { | ||
+ | chilDivs[0].setAttribute('class', classes.replace('yaml-show', 'yaml-hidden')); | ||
+ | |||
+ | } | ||
+ | |||
+ | }; | ||
+ | |||
+ | } |
Revision as of 15:48, October 7, 2020
/* Any JavaScript here will be loaded for all users on every page load. */
$(function () {
if($("div#public-uc-heading").length) {
var styles = {
float : "none",
fontSize: "50px",
marginBottom: "15px",
color: "#fff"
};
$("#firstHeading").css( styles ).prependTo("#public-uc-heading");
}
}());
var apps = [];
console.log('YAMLBOX ON');
var boxElements = document.getElementsByClassName("yamlbox");
for (var i = 0; i < boxElements.length; i++) {
var currentId = boxElements[i].getAttribute('id');
boxElements[i].onclick = function () {
console.log('click', currentId);
var chilDivs = this.getElementsByClassName("yaml-details");
var classes = chilDivs[0].getAttribute('class');
if (classes.includes('yaml-hidden')) {
//remove hidden, replace with visible
chilDivs[0].setAttribute('class', classes.replace('yaml-hidden', 'yaml-show'));
} else {
chilDivs[0].setAttribute('class', classes.replace('yaml-show', 'yaml-hidden'));
}
};
}