namibia
df0489e1eeeeab5a9bd44e1d84fce49924fe1bac
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'uicolor', function( editor ) { var dialog, picker, pickerContents, // Actual UI color value. uiColor = editor.getUiColor(), pickerId = 'cke_uicolor_picker' + CKEDITOR.tools.getNextNumber(); function setNewPickerColor( color ) { // Convert HEX representation to RGB, stripping # char. if ( /^#/.test( color ) ) color = window.YAHOO.util.Color.hex2rgb( color.substr( 1 ) ); picker.setValue( color, true ); // Refresh picker UI. picker.refresh( pickerId ); } function setNewUiColor( color, force ) { if ( force || dialog._.contents.tab1.livePeview.getValue() ) editor.setUiColor( color ); // Write new config string into textbox. dialog._.contents.tab1.configBox.setValue( 'config.uiColor = "#' + picker.get( "hex" ) + '"' ); } pickerContents = { id : 'yuiColorPicker', type : 'html', html : "<div id='" + pickerId + "' class='cke_uicolor_picker' style='width: 360px; height: 200px; position: relative;'></div>", onLoad : function( event ) { var url = CKEDITOR.getUrl( '_source/' + // @Packager.RemoveLine 'plugins/uicolor/yui/' ); // Create new color picker widget. picker = new window.YAHOO.widget.ColorPicker( pickerId, { showhsvcontrols : true, showhexcontrols : true, images : { PICKER_THUMB : url + "assets/picker_thumb.png", HUE_THUMB : url + "assets/hue_thumb.png" } }); // Set actual UI color to the picker. if ( uiColor ) setNewPickerColor( uiColor ); // Subscribe to the rgbChange event. picker.on( "rgbChange", function() { // Reset predefined box. dialog._.contents.tab1.predefined.setValue( '' ); setNewUiColor( '#' + picker.get( 'hex' ) ); }); // Fix input class names. var inputs = new CKEDITOR.dom.nodeList( picker.getElementsByTagName( 'input' ) ); for ( var i = 0; i < inputs.count() ; i++ ) inputs.getItem( i ).addClass( 'cke_dialog_ui_input_text' ); } }; var skipPreviewChange = true; return { title : editor.lang.uicolor.title, minWidth : 360, minHeight : 320, onLoad : function() { dialog = this; this.setupContent(); // #3808 if ( CKEDITOR.env.ie7Compat ) dialog.parts.contents.setStyle( 'overflow', 'hidden' ); }, contents : [ { id : 'tab1', label : '', title : '', expand : true, padding : 0, elements : [ pickerContents, { id : 'tab1', type : 'vbox', children : [ { id : 'livePeview', type : 'checkbox', label : editor.lang.uicolor.preview, 'default' : 1, onLoad : function() { skipPreviewChange = true; }, onChange : function() { if ( skipPreviewChange ) return; var on = this.getValue(), color = on ? '#' + picker.get( 'hex' ) : uiColor; setNewUiColor( color, true ); } }, { type : 'hbox', children : [ { id : 'predefined', type : 'select', 'default' : '', label : editor.lang.uicolor.predefined, items : [ [ '' ], [ 'Light blue', '#9AB8F3' ], [ 'Sand', '#D2B48C' ], [ 'Metallic', '#949AAA' ], [ 'Purple', '#C2A3C7' ], [ 'Olive', '#A2C980' ], [ 'Happy green', '#9BD446' ], [ 'Jezebel Blue', '#14B8C4' ], [ 'Burn', '#FF893A' ], [ 'Easy red', '#FF6969' ], [ 'Pisces 3', '#48B4F2' ], [ 'Aquarius 5', '#487ED4' ], [ 'Absinthe', '#A8CF76' ], [ 'Scrambled Egg', '#C7A622' ], [ 'Hello monday', '#8E8D80' ], [ 'Lovely sunshine', '#F1E8B1' ], [ 'Recycled air', '#B3C593' ], [ 'Down', '#BCBCA4' ], [ 'Mark Twain', '#CFE91D' ], [ 'Specks of dust', '#D1B596' ], [ 'Lollipop', '#F6CE23' ] ], onChange : function() { var color = this.getValue(); if ( color ) { setNewPickerColor( color ); setNewUiColor( color ); // Refresh predefined preview box. CKEDITOR.document.getById( 'predefinedPreview' ).setStyle( 'background', color ); } else CKEDITOR.document.getById( 'predefinedPreview' ).setStyle( 'background', '' ); }, onShow : function() { var color = editor.getUiColor(); if ( color ) this.setValue( color ); } }, { id : 'predefinedPreview', type : 'html', html : '<div id="cke_uicolor_preview" style="border: 1px solid black; padding: 3px; width: 30px;">' + '<div id="predefinedPreview" style="width: 30px; height: 30px;"> </div>' + '</div>' } ] }, { id : 'configBox', type : 'text', label : editor.lang.uicolor.config, onShow : function() { var color = editor.getUiColor(); if ( color ) this.setValue( 'config.uiColor = "' + color + '"' ); } } ] } ] } ], buttons : [ CKEDITOR.dialog.okButton ] }; } ); |
Commits for namibiapublic/scripts/ckeditor/_source/plugins/uicolor/dialogs/uicolor.js
Revision | Author | Commited | Message |
---|---|---|---|
df0489 ... | Mark | Fri 14 Oct, 2016 10:01:00 +0000 | initial commit |