///import core ///import uicore (function() { var utils = baidu.editor.utils, UIBase = baidu.editor.ui.UIBase, ColorPicker = (baidu.editor.ui.ColorPicker = function(options) { this.initOptions(options); this.noColorText = this.noColorText || this.editor.getLang("clearColor"); this.initUIBase(); }); ColorPicker.prototype = { getHtmlTpl: function() { return genColorPicker(this.noColorText, this.editor); }, _onTableClick: function(evt) { var tgt = evt.target || evt.srcElement; var color = tgt.getAttribute("data-color"); if (color) { this.fireEvent("pickcolor", color); } }, _onTableOver: function(evt) { var tgt = evt.target || evt.srcElement; var color = tgt.getAttribute("data-color"); if (color) { this.getDom("preview").style.backgroundColor = color; } }, _onTableOut: function() { this.getDom("preview").style.backgroundColor = ""; }, _onPickNoColor: function() { this.fireEvent("picknocolor"); } }; utils.inherits(ColorPicker, UIBase); var COLORS = ("ffffff,000000,eeece1,1f497d,4f81bd,c0504d,9bbb59,8064a2,4bacc6,f79646," + "f2f2f2,7f7f7f,ddd9c3,c6d9f0,dbe5f1,f2dcdb,ebf1dd,e5e0ec,dbeef3,fdeada," + "d8d8d8,595959,c4bd97,8db3e2,b8cce4,e5b9b7,d7e3bc,ccc1d9,b7dde8,fbd5b5," + "bfbfbf,3f3f3f,938953,548dd4,95b3d7,d99694,c3d69b,b2a2c7,92cddc,fac08f," + "a5a5a5,262626,494429,17365d,366092,953734,76923c,5f497a,31859b,e36c09," + "7f7f7f,0c0c0c,1d1b10,0f243e,244061,632423,4f6128,3f3151,205867,974806," + "c00000,ff0000,ffc000,ffff00,92d050,00b050,00b0f0,0070c0,002060,7030a0,").split( "," ); function genColorPicker(noColorText, editor) { var html = '
' + editor.getLang("themeColor") + " | |||||||||
' + editor.getLang("standardColor") + " | |||||||||
= 60 ? "border-width:1px;" : i >= 10 && i < 20 ? "border-width:1px 1px 0 1px;" : "border-width:0 1px 0 1px;") + '"' + "> | " : ""; } html += "