Difference between revisions of "MediaWiki: Common.js"

From Genesys Documentation
Jump to: navigation, search
Line 13: Line 13:
 
var apps = [];
 
var apps = [];
 
console.log('YAMLBOX ON');
 
console.log('YAMLBOX ON');
var boxElements = document.getElementsByClassName("yamlbox");
+
var boxElements = document.getElementsByClassName("yamlhead");
 
for (var i = 0; i < boxElements.length; i++) {
 
for (var i = 0; i < boxElements.length; i++) {
  
Line 19: Line 19:
 
     boxElements[i].onclick = function () {
 
     boxElements[i].onclick = function () {
 
         console.log('click', currentId);
 
         console.log('click', currentId);
         var chilDivs = this.getElementsByClassName("yaml-details");
+
         var chilDivs = this.getParent().getElementsByClassName("yaml-details");
 
         console.log('click', currentId, chilDivs);
 
         console.log('click', currentId, chilDivs);
 
         var classes = chilDivs[0].getAttribute('class');
 
         var classes = chilDivs[0].getAttribute('class');

Revision as of 12:54, October 8, 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("yamlhead");
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.getParent().getElementsByClassName("yaml-details");
        console.log('click', currentId, chilDivs);
        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'));
        }
    };
}
}());
Retrieved from "https://all.docs.genesys.com/MediaWiki:Common.js (2025-06-19 10:39:48)"