var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } { let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opener = _____WB$wombat$assign$function_____("opener"); var __aspxCPColorTableIDSuffix = "_CT"; var __aspxCPColorCellIDSuffixPart = "_C"; var __aspxHEColorTableCellCssClassName = "dxctCell"; var __aspxHEColorTableCellDivCssClassName = "dxctCellDiv"; ASPxClientColorTable = _aspxCreateClass(ASPxClientControl, { constructor: function(name) { this.constructor.prototype.constructor.call(this, name); this.colorColCount = 8; this.colorValues = []; this.selectedIndex = -1; this.usedInDropDown = false; this.colorTableCellStyleCssText = ""; this.colorTableCellDivStyleCssText = ""; this.colorTableCellStyleCssClassName = ""; this.colorTableCellDivStyleCssClassName = ""; this.ColorChanged = new ASPxClientEvent(); this.ItemClick = new ASPxClientEvent(); }, Initialize: function() { this.constructor.prototype.Initialize.call(this); var mainElement = this.GetMainElement(); mainElement.unselectable = "on"; mainElement.rows[0].cells[0].unselectable = "on"; this.InitializeColorTableCellStyle(); this.InitializeColorsTable(); if(this.usedInDropDown) this.InitializeColorsTableEvents(); }, InitializeColorTableCellStyle: function() { var styleSheet = _aspxGetCurrentStyleSheet(); _aspxAddStyleSheetRule(styleSheet, "." + __aspxHEColorTableCellCssClassName + "_" + this.name, this.colorTableCellStyleCssText); _aspxAddStyleSheetRule(styleSheet, "." + __aspxHEColorTableCellDivCssClassName + "_" + this.name, this.colorTableCellDivStyleCssText); var colorTableElement = this.GetColorsTableElement(); var trElements = _aspxGetElementsByTagName(colorTableElement, "TR"); for (var i = 0; i < trElements.length; i++) { var tdElements = _aspxGetElementsByTagName(trElements[i], "TD"); for (var j = 0; j < tdElements.length; j++) { if (this.colorTableCellStyleCssText != "") tdElements[j].className += " " + __aspxHEColorTableCellCssClassName + "_" + this.name; if (this.colorTableCellStyleCssClassName != "") tdElements[j].className += " " + this.colorTableCellStyleCssClassName; var tdDiv = _aspxGetElementsByTagName(tdElements[j], "DIV"); if (tdDiv[0] != null) { tdDiv.className = ""; if (this.colorTableCellDivStyleCssClassName != "") tdDiv[0].className += " " + this.colorTableCellDivStyleCssClassName; if (this.colorTableCellDivStyleCssText != "") tdDiv[0].className += " " + __aspxHEColorTableCellDivCssClassName + "_" + this.name; } } } }, InitializeColorsTable: function() { var colorsTable = this.GetColorsTableElement(); colorsTable.unselectable = "on"; var colorIndex = 0; for (var i = 0; i < colorsTable.rows.length; i++) { for (var j = 0; j < colorsTable.rows[i].cells.length; j++) { var colorCell = colorsTable.rows[i].cells[j]; colorCell.id = this.GetColorCellElementID(colorIndex); colorCell.unselectable = "on"; if (__aspxWebKitFamily) colorCell.cellIndex_Safari = j; var colorDiv = colorCell.firstChild; if (colorDiv && colorDiv.tagName == "DIV") { colorDiv.style.backgroundColor = this.colorValues[colorIndex]; colorDiv.unselectable = "on"; colorIndex++; } } } }, InitializeColorsTableEvents: function(listTable, method){ var colorsTable = this.GetColorsTableElement(); colorsTable.ColorsTableId = this.name; _aspxAttachEventToElement(colorsTable, "mouseup", aspxCTMouseUp); }, FindColorIndexByColor: function(colorValue) { if (colorValue) colorValue = colorValue.toLowerCase(); for (var i = 0; i < this.colorValues.length; i++) { if (this.colorValues[i].toLowerCase() == colorValue) return i; } return -1; }, GetColorsTableElement: function() { return _aspxGetElementById(this.name + __aspxCPColorTableIDSuffix); }, GetColorCellElementID: function(colorIndex) { return this.name + __aspxCPColorCellIDSuffixPart + colorIndex.toString(); }, GetColorCellElementByIndex: function(colorIndex) { return _aspxGetElementById(this.GetColorCellElementID(colorIndex)); }, SelectColorByIndex: function(colorIndex, fireEvent) { if (this.selectedIndex != colorIndex) { var stateController = aspxGetStateController(); var element = this.GetColorCellElementByIndex(this.selectedIndex); if (element != null) stateController.DeselectElementBySrcElement(element); this.selectedIndex = colorIndex; element = this.GetColorCellElementByIndex(this.selectedIndex); if (element != null) stateController.SelectElementBySrcElement(element); if (fireEvent) this.RaiseColorChanged(); } }, OnControlClick: function(clickedElement, htmlEvent) { if (clickedElement) { if (clickedElement.tagName == "DIV") clickedElement = clickedElement.parentNode; if (clickedElement.tagName == "TD") { var cellIndex = !__aspxWebKitFamily ? clickedElement.cellIndex : clickedElement.cellIndex_Safari; var rowIndex = clickedElement.parentNode.rowIndex; var colorIndex = rowIndex * this.colorColCount + cellIndex; if (0 <= colorIndex && colorIndex < this.colorValues.length) { this.SelectColorByIndex(colorIndex, true); this.RaiseItemClick(); } } } }, RaiseColorChanged: function() { if (!this.ColorChanged.IsEmpty()) { var args = new ASPxClientEventArgs(false); this.ColorChanged.FireEvent(this, args); } }, RaiseItemClick: function() { if (!this.ItemClick.IsEmpty()) { var args = new ASPxClientEventArgs(false); this.ItemClick.FireEvent(this, args); } }, GetColor: function() { if (0 <= this.selectedIndex && this.selectedIndex < this.colorValues.length) return this.colorValues[this.selectedIndex].toUpperCase(); return ""; }, SetColor: function(value) { var colorIndex = this.FindColorIndexByColor(value); this.SelectColorByIndex(colorIndex, false); } }); function aspxCTMouseUp(evt) { var element = _aspxGetEventSource(evt); while(element != null && element.tagName != "BODY") { if(element.tagName == "TR") { var table = element.offsetParent; if(table && table.ColorsTableId) { var ct = aspxGetControlCollection().Get(table.ColorsTableId); if(ct != null && _aspxGetIsLeftButtonPressed(evt)) ct.OnControlClick(_aspxGetEventSource(evt), evt); break; } } element = element.parentNode; } } } /* playback timings (ms): RedisCDXSource: 1.692 exclusion.robots: 0.157 CDXLines.iter: 14.789 (3) exclusion.robots.policy: 0.146 PetaboxLoader3.datanode: 232.887 (4) captures_list: 269.865 LoadShardBlock: 250.639 (3) esindex: 0.011 PetaboxLoader3.resolve: 38.402 load_resource: 215.021 */