function TMWTab() { var style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.MWTabClass { display:none; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.MWViewTabClass { width: 100%; height:calc(100% - var(--resgui-1row)); display:inline; float:left; clear:both; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.MWTabHeaderRow {height:var(--resgui-1row); width:100%; background:var(--tab-header-background); box-sizing: border-box; -moz-box-sizing: border-box;-webkit-box-sizing: border-box; border-bottom:1px solid var(--main-gb-color); }' document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.HeaderButton{ height:var(--resgui-1row); display:flex; flex-direction:row; flex-glow:1; flex-basis:var(--resgui-6column); align-items:center; box-sizing: border-box; -moz-box-sizing: border-box;-webkit-box-sizing: border-box; border-bottom:1px solid var(--main-gb-color); }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.HeaderButton:hover{ background:var(--tab-header-button-background-hover); transition: background-color 0.3s linear; cursor:pointer;}'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.HeaderButtonStatus{width:var(--resgui-eighthcolumn); height:100%; background:var(--tab-header-button-background-status);}'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.HeaderButtonImg {padding:5px; height:var(--resgui-icon-height); width:auto; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.HeaderButtonSpan{margin-left:0%; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.HeaderButtonPressed{ height:var(--resgui-1row); display:flex; flex-direction:row; display:flex; flex-direction:row; flex-glow:1; flex-basis:var(--resgui-6column); align-items:center; border-box; -moz-box-sizing: border-box;-webkit-box-sizing: border-box; border-bottom: 1px solid var(--main-gb-color); background: var(--main-gb-color); }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.HeaderButtonPressedStatus{width:var(--resgui-eighthcolumn); height:100%; background:var(--tab-header-button-background-status-selected); border-box; -moz-box-sizing: border-box;-webkit-box-sizing: border-box; border-bottom: 1px solid var(--tab-header-button-background-status-selected); }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.HeaderButtonPressedImg{ padding:5px; height:var(--resgui-icon-height); width:auto; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.HeaderButtonPressedSpan{text-transform: uppercase; }'; document.getElementsByTagName('head')[0].appendChild(style); var Tabs = [] var GroupIndex = 1; this.Initialize = function() { var LisTMWTabClass = document.getElementsByClassName("MWTabClass"); for(var TabIndex = 0; TabIndex < LisTMWTabClass.length; TabIndex++) { if (LisTMWTabClass[TabIndex].parentElement.MWTabGroup == undefined || LisTMWTabClass[TabIndex].parentElement.MWTabGroup == null) { LisTMWTabClass[TabIndex].parentElement.MWTabGroup ="TabGroup" + GroupIndex++; Tabs[LisTMWTabClass[TabIndex].parentElement.MWTabGroup] = new Array(); } Tabs[LisTMWTabClass[TabIndex].parentElement.MWTabGroup].push(LisTMWTabClass[TabIndex]); } for (var TabGroupIndex in Tabs) { var HeaderElement = null for(var ElementIndex in Tabs[TabGroupIndex]) { var Element = Tabs[TabGroupIndex][ElementIndex]; var attribute = Element.getAttribute("data-MWTab"); if (attribute != null) { var DataAttribute = JSON.parse(attribute); if (DataAttribute.IsHeader == true) { Element.innerHTML =""; Element.className = Element.className.replace("MWTabClass",""); Element.className += " MWTabHeaderRow"; Element.TabCollection = new Array(); HeaderElement = Element; } else { $MWTab.DrawTab(HeaderElement, Element, DataAttribute); } } } $MWGUI.ScanElements(); } } this.DrawTab = function(HeaderElement, Element, DataAttribute) { var divButton = document.createElement("div"); if (DataAttribute.IDHeaderButton) divButton.id = DataAttribute.IDHeaderButton; HeaderElement.appendChild(divButton); divButton.ContentElement = Element; divButton.HeaderElement = HeaderElement; divButton.DataAttribute = DataAttribute; divButton.addEventListener("click", function() { if (!this.IsPressed) { for(ButtonIndex in this.HeaderElement.TabCollection) { if (this.HeaderElement.TabCollection[ButtonIndex].IsPressed) { this.HeaderElement.TabCollection[ButtonIndex].className = this.HeaderElement.TabCollection[ButtonIndex].className.replace("HeaderButtonPressed","HeaderButton"); this.HeaderElement.TabCollection[ButtonIndex].childNodes[0].className = this.HeaderElement.TabCollection[ButtonIndex].childNodes[0].className.replace("HeaderButtonPressedStatus","HeaderButtonStatus"); if(this.DataAttribute.Icon != null) { this.HeaderElement.TabCollection[ButtonIndex].childNodes[1].className = this.HeaderElement.TabCollection[ButtonIndex].childNodes[1].className.replace("HeaderButtonPressedImg","HeaderButtonImg"); this.HeaderElement.TabCollection[ButtonIndex].childNodes[2].className = this.HeaderElement.TabCollection[ButtonIndex].childNodes[2].className.replace("HeaderButtonPressedSpan","HeaderButtonSpan"); } else { this.HeaderElement.TabCollection[ButtonIndex].childNodes[1].className = this.HeaderElement.TabCollection[ButtonIndex].childNodes[1].className.replace("HeaderButtonPressedSpan","HeaderButtonSpan"); } this.HeaderElement.TabCollection[ButtonIndex].IsPressed = false; this.HeaderElement.TabCollection[ButtonIndex].ContentElement.className = this.HeaderElement.TabCollection[ButtonIndex].ContentElement.className.replace("MWViewTabClass","MWTabClass"); } } this.IsPressed = true; this.className = this.className.replace("HeaderButton", "HeaderButtonPressed"); this.childNodes[0].className = this.childNodes[0].className.replace("HeaderButtonStatus", "HeaderButtonPressedStatus"); if(this.DataAttribute.Icon != null) { this.childNodes[1].className = this.childNodes[1].className.replace("HeaderButtonImg", "HeaderButtonPressedImg"); this.childNodes[2].className = this.childNodes[2].className.replace("HeaderButtonSpan", "HeaderButtonPressedSpan"); } else { this.childNodes[1].className = this.childNodes[1].className.replace("HeaderButtonSpan", "HeaderButtonPressedSpan"); } this.ContentElement.className = this.ContentElement.className.replace("MWTabClass","MWViewTabClass"); if (this.DataAttribute.iframesrc != null) { for (var childIndex = 0 ; childIndex