alchemy_cms 2.0.7 → 2.1.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -4
- data/.travis.yml +1 -1
- data/Gemfile +7 -2
- data/README.md +6 -6
- data/Rakefile +26 -18
- data/alchemy_cms.gemspec +14 -14
- data/{assets/stylesheets → app/assets/images/alchemy}/Jcrop.gif +0 -0
- data/{assets/images → app/assets/images/alchemy}/ajax_loader.gif +0 -0
- data/{assets/images → app/assets/images/alchemy}/alchemy-logo.png +0 -0
- data/{assets/images → app/assets/images/alchemy}/flags.png +0 -0
- data/{assets/images → app/assets/images/alchemy}/gui/navi-tab.png +0 -0
- data/{assets/images → app/assets/images/alchemy}/gui/shading_90.png +0 -0
- data/{assets/images → app/assets/images/alchemy}/gui/toggle.png +0 -0
- data/{assets/images → app/assets/images/alchemy}/icons.png +0 -0
- data/{assets/images → app/assets/images/alchemy}/image_loader.gif +0 -0
- data/{assets/images → app/assets/images/alchemy}/jquery-sb/select_arrow.gif +0 -0
- data/{assets/images → app/assets/images/alchemy}/jquery-sb/select_arrow_bg.gif +0 -0
- data/{assets/images → app/assets/images/alchemy}/jquery-sb/select_arrow_bg_hover.gif +0 -0
- data/{assets/images → app/assets/images/alchemy}/placeholder.png +0 -0
- data/{assets/images/gui → app/assets/images/alchemy}/shading.png +0 -0
- data/{assets/images → app/assets/images/alchemy}/swfupload/browse_button.png +0 -0
- data/{assets/stylesheets/default/img → app/assets/images/alchemy}/tabs.gif +0 -0
- data/{assets/images/jquery-ui → app/assets/images/alchemy}/ui-icons_666666_256x240.png +0 -0
- data/app/assets/javascripts/alchemy/alchemy.base.js +212 -0
- data/app/assets/javascripts/alchemy/alchemy.buttons.js +36 -0
- data/app/assets/javascripts/alchemy/alchemy.dirty.js +91 -0
- data/app/assets/javascripts/alchemy/alchemy.dragndrop.js +114 -0
- data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.element_editor_selector.js +0 -0
- data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.growler.js +0 -0
- data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.image_cropper.js +0 -0
- data/app/assets/javascripts/alchemy/alchemy.js +26 -0
- data/app/assets/javascripts/alchemy/alchemy.js_extensions.js +17 -0
- data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.link_overlay.js +1 -1
- data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.page_sorter.js +0 -0
- data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.preview.js +0 -0
- data/app/assets/javascripts/alchemy/alchemy.windows.js +438 -0
- data/app/assets/stylesheets/alchemy/_defaults.scss +160 -0
- data/app/assets/stylesheets/alchemy/alchemy.css +9 -0
- data/{assets/stylesheets/alchemy.css → app/assets/stylesheets/alchemy/base.css.scss} +216 -353
- data/{assets/stylesheets/elements.css → app/assets/stylesheets/alchemy/elements.css.scss} +41 -70
- data/{assets/stylesheets/flags.css → app/assets/stylesheets/alchemy/flags.css.scss} +1 -1
- data/{assets/stylesheets/jquery-ui-1.8.7.alchemy.css → app/assets/stylesheets/alchemy/jquery-ui.alchemy.css} +15 -15
- data/{assets/stylesheets/jquery.Jcrop.css → app/assets/stylesheets/alchemy/jquery.Jcrop.css.scss} +3 -3
- data/{assets/stylesheets/jquery.sb.css → app/assets/stylesheets/alchemy/jquery.sb.css.scss} +19 -29
- data/{assets/stylesheets → app/assets/stylesheets/alchemy}/print.css +6 -1
- data/{assets/stylesheets → app/assets/stylesheets/alchemy}/standard_set.css +0 -0
- data/{assets/stylesheets/alchemy_tinymce_content.css → app/assets/stylesheets/alchemy/tinymce_content.css} +0 -0
- data/{assets/stylesheets/alchemy_tinymce_dialog.css → app/assets/stylesheets/alchemy/tinymce_dialog.css} +2 -2
- data/app/controllers/admin/attachments_controller.rb +2 -8
- data/app/controllers/admin/clipboard_controller.rb +2 -2
- data/app/controllers/admin/contents_controller.rb +4 -16
- data/app/controllers/admin/elements_controller.rb +2 -2
- data/app/controllers/admin/essence_audios_controller.rb +0 -3
- data/app/controllers/admin/essence_files_controller.rb +0 -11
- data/app/controllers/admin/essence_flashes_controller.rb +0 -3
- data/app/controllers/admin/essence_pictures_controller.rb +2 -7
- data/app/controllers/admin/essence_videos_controller.rb +0 -3
- data/app/controllers/admin/languages_controller.rb +4 -10
- data/app/controllers/admin/pages_controller.rb +6 -4
- data/app/controllers/admin/pictures_controller.rb +13 -18
- data/app/controllers/admin/trash_controller.rb +0 -5
- data/app/controllers/admin/users_controller.rb +2 -3
- data/app/controllers/alchemy_controller.rb +18 -30
- data/app/controllers/pages_controller.rb +21 -24
- data/app/helpers/admin/elements_helper.rb +5 -0
- data/app/helpers/admin/pages_helper.rb +36 -1
- data/app/helpers/alchemy_helper.rb +39 -17
- data/app/models/attachment.rb +2 -2
- data/app/models/essence_file.rb +1 -1
- data/app/models/page.rb +1 -1
- data/app/sweepers/pages_sweeper.rb +10 -0
- data/app/views/admin/attachments/destroy.js.erb +4 -0
- data/app/views/admin/clipboard/insert.js.erb +12 -19
- data/app/views/admin/contents/create.js.erb +1 -1
- data/app/views/admin/contents/destroy.js.erb +7 -0
- data/app/views/admin/contents/order.js.erb +6 -0
- data/app/views/admin/elements/_element.html.erb +4 -2
- data/app/views/admin/elements/create.js.erb +19 -26
- data/app/views/admin/elements/fold.js.erb +1 -1
- data/app/views/admin/elements/index.html.erb +1 -1
- data/app/views/admin/essence_files/assign.js.erb +8 -0
- data/app/views/admin/essence_pictures/save_link.js.erb +3 -0
- data/app/views/admin/index.html.erb +37 -27
- data/app/views/admin/languages/destroy.js.erb +1 -0
- data/app/views/admin/pages/_page.html.erb +1 -1
- data/app/views/admin/pages/_sitemap.html.erb +1 -1
- data/app/views/admin/pages/edit.html.erb +2 -2
- data/app/views/admin/pages/update.js.erb +1 -1
- data/app/views/admin/partials/_upload_form.html.erb +11 -11
- data/app/views/admin/pictures/archive_overlay.js.erb +1 -0
- data/app/views/admin/pictures/flush.js.erb +2 -0
- data/app/views/admin/pictures/update.js.erb +1 -0
- data/app/views/admin/trash/clear.js.erb +3 -0
- data/app/views/alchemy/error_notice.js.erb +1 -0
- data/app/views/alchemy/permission_denied.js.erb +2 -0
- data/app/views/alchemy/redirect.js.erb +1 -0
- data/app/views/alchemy/remote_errors.js.erb +3 -0
- data/app/views/alchemy/update.js.erb +5 -0
- data/app/views/essences/_essence_file_editor.html.erb +0 -1
- data/app/views/essences/_essence_file_view.html.erb +1 -5
- data/app/views/essences/_essence_picture_tools.html.erb +1 -1
- data/app/views/layouts/alchemy.html.erb +22 -9
- data/app/views/pages/show.rss.builder +1 -1
- data/config/alchemy/elements.yml +0 -5
- data/config/alchemy/page_layouts.yml +1 -1
- data/config/asset_packages.yml +17 -19
- data/config/authorization_rules.rb +1 -0
- data/config/locales/de.yml +0 -1
- data/config/routes.rb +1 -1
- data/lib/alchemy/tinymce.rb +51 -0
- data/lib/alchemy/version.rb +3 -3
- data/lib/alchemy_cms.rb +4 -2
- data/script/rails +6 -0
- data/spec/controllers/admin/clipboard_controller_spec.rb +15 -13
- data/spec/controllers/admin/contents_controller_spec.rb +4 -4
- data/spec/controllers/admin/trash_controller_spec.rb +6 -9
- data/spec/controllers/pages_controller_spec.rb +9 -8
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +3 -3
- data/spec/dummy/config/application.rb +12 -6
- data/spec/dummy/config/database.yml +3 -0
- data/spec/dummy/config/environments/development.rb +7 -3
- data/spec/dummy/config/environments/production.rb +23 -12
- data/spec/dummy/config/environments/test.rb +5 -1
- data/spec/dummy/config/initializers/secret_token.rb +1 -1
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +1 -1
- data/spec/dummy/config/routes.rb +1 -1
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/factories.rb +8 -8
- data/spec/helpers/admin/elements_helper_spec.rb +2 -2
- data/spec/helpers/contents_helper_spec.rb +1 -1
- data/spec/helpers/elements_helper_spec.rb +6 -6
- data/spec/helpers/essences_helper_spec.rb +1 -1
- data/spec/helpers/pages_helper_spec.rb +37 -37
- data/spec/integration/pages_controller_spec.rb +29 -26
- data/spec/integration/security_spec.rb +2 -1
- data/spec/models/content_spec.rb +1 -1
- data/spec/models/element_spec.rb +11 -11
- data/spec/models/language_spec.rb +5 -5
- data/spec/models/page_spec.rb +54 -54
- data/spec/models/user_spec.rb +2 -1
- data/spec/routing_spec.rb +1 -1
- data/{assets/javascripts/jquery.js → vendor/assets/javascripts/jquery-1.6.2.min.js} +0 -0
- data/{assets/javascripts/jquery-ui.js → vendor/assets/javascripts/jquery-ui-custom-1.8.16.min.js} +0 -0
- data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.Jcrop.min.js +0 -0
- data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.dialogextend.min.js +7 -7
- data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.in-place-edit.js +0 -0
- data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.sb.min.js +0 -0
- data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.scrollTo-1.4.2-min.js +10 -10
- data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.ui.nestedSortable.js +0 -0
- data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.ui.tabspaging.js +0 -0
- data/{assets → vendor/assets}/javascripts/swfupload/fileprogress.js +202 -202
- data/{assets → vendor/assets}/javascripts/swfupload/handlers.js +171 -171
- data/{assets → vendor/assets}/javascripts/swfupload/queue.js +97 -97
- data/{assets → vendor/assets}/javascripts/swfupload/swfupload.js +980 -980
- data/{assets → vendor/assets}/javascripts/swfupload/swfupload.swf +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/jquery.tinymce.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/langs/de.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/langs/en.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/license.txt +504 -504
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/alchemy_link/editor_plugin.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/alchemy_link/langs/de.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/alchemy_link/langs/en.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +110 -110
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +0 -0
- data/{assets/javascripts/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css → vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css.erb} +8 -8
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/inlinepopups/template.htm +387 -387
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/editor_plugin.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/js/pastetext.js +36 -36
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/js/pasteword.js +51 -51
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/langs/de_dlg.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/langs/en_dlg.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/pastetext.htm +26 -26
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/pasteword.htm +21 -21
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/cell.htm +180 -180
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/css/cell.css +16 -16
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/css/row.css +25 -25
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/css/table.css +13 -13
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/editor_plugin.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/js/cell.js +319 -319
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/js/merge_cells.js +27 -27
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/js/row.js +237 -237
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/js/table.js +450 -450
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/langs/de_dlg.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/langs/en_dlg.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/merge_cells.htm +32 -32
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/row.htm +158 -158
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/table.htm +188 -188
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/about.htm +52 -52
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/anchor.htm +26 -26
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/charmap.htm +51 -51
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/color_picker.htm +74 -74
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/editor_template.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/image.htm +80 -80
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/flash.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/iframe.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/pagebreak.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/quicktime.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/realmedia.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/shockwave.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/trans.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/video.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/windowsmedia.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/about.js +73 -73
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/anchor.js +43 -43
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/charmap.js +355 -355
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/color_picker.js +329 -329
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/image.js +251 -251
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/link.js +153 -153
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/source_editor.js +56 -56
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/langs/de.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/langs/de_dlg.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/langs/en.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/link.htm +57 -57
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/shortcuts.htm +47 -47
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/content.css +50 -50
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +117 -117
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +214 -214
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/content.css +48 -48
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +117 -117
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +217 -217
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +7 -7
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +5 -5
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/source_editor.htm +25 -25
- data/{assets → vendor/assets}/javascripts/tiny_mce/tiny_mce.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/tiny_mce_popup.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/utils/editable_selects.js +70 -70
- data/{assets → vendor/assets}/javascripts/tiny_mce/utils/form_utils.js +210 -210
- data/{assets → vendor/assets}/javascripts/tiny_mce/utils/mctabs.js +161 -161
- data/{assets → vendor/assets}/javascripts/tiny_mce/utils/validate.js +252 -252
- metadata +338 -369
- data/app/views/elements/_download_editor.html.erb +0 -1
- data/app/views/elements/_download_view.html.erb +0 -3
- data/assets/javascripts/alchemy.js +0 -903
- data/assets/javascripts/jquery.rails.js +0 -315
- data/assets/stylesheets/ie6.css +0 -18
- data/config/initializers/tinymce_hammer.rb +0 -31
@@ -1,329 +1,329 @@
|
|
1
|
-
tinyMCEPopup.requireLangPack();
|
2
|
-
|
3
|
-
var detail = 50, strhex = "0123456789ABCDEF", i, isMouseDown = false, isMouseOver = false;
|
4
|
-
|
5
|
-
var colors = [
|
6
|
-
"#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
|
7
|
-
"#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
|
8
|
-
"#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
|
9
|
-
"#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033",
|
10
|
-
"#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399",
|
11
|
-
"#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff",
|
12
|
-
"#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333",
|
13
|
-
"#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399",
|
14
|
-
"#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff",
|
15
|
-
"#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633",
|
16
|
-
"#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699",
|
17
|
-
"#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff",
|
18
|
-
"#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633",
|
19
|
-
"#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999",
|
20
|
-
"#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff",
|
21
|
-
"#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933",
|
22
|
-
"#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999",
|
23
|
-
"#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff",
|
24
|
-
"#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33",
|
25
|
-
"#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99",
|
26
|
-
"#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff",
|
27
|
-
"#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33",
|
28
|
-
"#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99",
|
29
|
-
"#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff",
|
30
|
-
"#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
|
31
|
-
"#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
|
32
|
-
"#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
|
33
|
-
];
|
34
|
-
|
35
|
-
var named = {
|
36
|
-
'#F0F8FF':'Alice Blue','#FAEBD7':'Antique White','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',
|
37
|
-
'#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'Blanched Almond','#0000FF':'Blue','#8A2BE2':'Blue Violet','#A52A2A':'Brown',
|
38
|
-
'#DEB887':'Burly Wood','#5F9EA0':'Cadet Blue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'Cornflower Blue',
|
39
|
-
'#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'Dark Blue','#008B8B':'Dark Cyan','#B8860B':'Dark Golden Rod',
|
40
|
-
'#A9A9A9':'Dark Gray','#A9A9A9':'Dark Grey','#006400':'Dark Green','#BDB76B':'Dark Khaki','#8B008B':'Dark Magenta','#556B2F':'Dark Olive Green',
|
41
|
-
'#FF8C00':'Darkorange','#9932CC':'Dark Orchid','#8B0000':'Dark Red','#E9967A':'Dark Salmon','#8FBC8F':'Dark Sea Green','#483D8B':'Dark Slate Blue',
|
42
|
-
'#2F4F4F':'Dark Slate Gray','#2F4F4F':'Dark Slate Grey','#00CED1':'Dark Turquoise','#9400D3':'Dark Violet','#FF1493':'Deep Pink','#00BFFF':'Deep Sky Blue',
|
43
|
-
'#696969':'Dim Gray','#696969':'Dim Grey','#1E90FF':'Dodger Blue','#B22222':'Fire Brick','#FFFAF0':'Floral White','#228B22':'Forest Green',
|
44
|
-
'#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'Ghost White','#FFD700':'Gold','#DAA520':'Golden Rod','#808080':'Gray','#808080':'Grey',
|
45
|
-
'#008000':'Green','#ADFF2F':'Green Yellow','#F0FFF0':'Honey Dew','#FF69B4':'Hot Pink','#CD5C5C':'Indian Red','#4B0082':'Indigo','#FFFFF0':'Ivory',
|
46
|
-
'#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'Lavender Blush','#7CFC00':'Lawn Green','#FFFACD':'Lemon Chiffon','#ADD8E6':'Light Blue',
|
47
|
-
'#F08080':'Light Coral','#E0FFFF':'Light Cyan','#FAFAD2':'Light Golden Rod Yellow','#D3D3D3':'Light Gray','#D3D3D3':'Light Grey','#90EE90':'Light Green',
|
48
|
-
'#FFB6C1':'Light Pink','#FFA07A':'Light Salmon','#20B2AA':'Light Sea Green','#87CEFA':'Light Sky Blue','#778899':'Light Slate Gray','#778899':'Light Slate Grey',
|
49
|
-
'#B0C4DE':'Light Steel Blue','#FFFFE0':'Light Yellow','#00FF00':'Lime','#32CD32':'Lime Green','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon',
|
50
|
-
'#66CDAA':'Medium Aqua Marine','#0000CD':'Medium Blue','#BA55D3':'Medium Orchid','#9370D8':'Medium Purple','#3CB371':'Medium Sea Green','#7B68EE':'Medium Slate Blue',
|
51
|
-
'#00FA9A':'Medium Spring Green','#48D1CC':'Medium Turquoise','#C71585':'Medium Violet Red','#191970':'Midnight Blue','#F5FFFA':'Mint Cream','#FFE4E1':'Misty Rose','#FFE4B5':'Moccasin',
|
52
|
-
'#FFDEAD':'Navajo White','#000080':'Navy','#FDF5E6':'Old Lace','#808000':'Olive','#6B8E23':'Olive Drab','#FFA500':'Orange','#FF4500':'Orange Red','#DA70D6':'Orchid',
|
53
|
-
'#EEE8AA':'Pale Golden Rod','#98FB98':'Pale Green','#AFEEEE':'Pale Turquoise','#D87093':'Pale Violet Red','#FFEFD5':'Papaya Whip','#FFDAB9':'Peach Puff',
|
54
|
-
'#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'Powder Blue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'Rosy Brown','#4169E1':'Royal Blue',
|
55
|
-
'#8B4513':'Saddle Brown','#FA8072':'Salmon','#F4A460':'Sandy Brown','#2E8B57':'Sea Green','#FFF5EE':'Sea Shell','#A0522D':'Sienna','#C0C0C0':'Silver',
|
56
|
-
'#87CEEB':'Sky Blue','#6A5ACD':'Slate Blue','#708090':'Slate Gray','#708090':'Slate Grey','#FFFAFA':'Snow','#00FF7F':'Spring Green',
|
57
|
-
'#4682B4':'Steel Blue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet',
|
58
|
-
'#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'White Smoke','#FFFF00':'Yellow','#9ACD32':'Yellow Green'
|
59
|
-
};
|
60
|
-
|
61
|
-
var namedLookup = {};
|
62
|
-
|
63
|
-
function init() {
|
64
|
-
var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')), key, value;
|
65
|
-
|
66
|
-
tinyMCEPopup.resizeToInnerSize();
|
67
|
-
|
68
|
-
generatePicker();
|
69
|
-
generateWebColors();
|
70
|
-
generateNamedColors();
|
71
|
-
|
72
|
-
if (inputColor) {
|
73
|
-
changeFinalColor(inputColor);
|
74
|
-
|
75
|
-
col = convertHexToRGB(inputColor);
|
76
|
-
|
77
|
-
if (col)
|
78
|
-
updateLight(col.r, col.g, col.b);
|
79
|
-
}
|
80
|
-
|
81
|
-
for (key in named) {
|
82
|
-
value = named[key];
|
83
|
-
namedLookup[value.replace(/\s+/, '').toLowerCase()] = key.replace(/#/, '').toLowerCase();
|
84
|
-
}
|
85
|
-
}
|
86
|
-
|
87
|
-
function toHexColor(color) {
|
88
|
-
var matches, red, green, blue, toInt = parseInt;
|
89
|
-
|
90
|
-
function hex(value) {
|
91
|
-
value = parseInt(value).toString(16);
|
92
|
-
|
93
|
-
return value.length > 1 ? value : '0' + value; // Padd with leading zero
|
94
|
-
};
|
95
|
-
|
96
|
-
color = color.replace(/[\s#]+/g, '').toLowerCase();
|
97
|
-
color = namedLookup[color] || color;
|
98
|
-
matches = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)|([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})|([a-f0-9])([a-f0-9])([a-f0-9])$/.exec(color);
|
99
|
-
|
100
|
-
if (matches) {
|
101
|
-
if (matches[1]) {
|
102
|
-
red = toInt(matches[1]);
|
103
|
-
green = toInt(matches[2]);
|
104
|
-
blue = toInt(matches[3]);
|
105
|
-
} else if (matches[4]) {
|
106
|
-
red = toInt(matches[4], 16);
|
107
|
-
green = toInt(matches[5], 16);
|
108
|
-
blue = toInt(matches[6], 16);
|
109
|
-
} else if (matches[7]) {
|
110
|
-
red = toInt(matches[7] + matches[7], 16);
|
111
|
-
green = toInt(matches[8] + matches[8], 16);
|
112
|
-
blue = toInt(matches[9] + matches[9], 16);
|
113
|
-
}
|
114
|
-
|
115
|
-
return '#' + hex(red) + hex(green) + hex(blue);
|
116
|
-
}
|
117
|
-
|
118
|
-
return '';
|
119
|
-
}
|
120
|
-
|
121
|
-
function insertAction() {
|
122
|
-
var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');
|
123
|
-
|
124
|
-
tinyMCEPopup.restoreSelection();
|
125
|
-
|
126
|
-
if (f)
|
127
|
-
f(toHexColor(color));
|
128
|
-
|
129
|
-
tinyMCEPopup.close();
|
130
|
-
}
|
131
|
-
|
132
|
-
function showColor(color, name) {
|
133
|
-
if (name)
|
134
|
-
document.getElementById("colorname").innerHTML = name;
|
135
|
-
|
136
|
-
document.getElementById("preview").style.backgroundColor = color;
|
137
|
-
document.getElementById("color").value = color.toUpperCase();
|
138
|
-
}
|
139
|
-
|
140
|
-
function convertRGBToHex(col) {
|
141
|
-
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
|
142
|
-
|
143
|
-
if (!col)
|
144
|
-
return col;
|
145
|
-
|
146
|
-
var rgb = col.replace(re, "$1,$2,$3").split(',');
|
147
|
-
if (rgb.length == 3) {
|
148
|
-
r = parseInt(rgb[0]).toString(16);
|
149
|
-
g = parseInt(rgb[1]).toString(16);
|
150
|
-
b = parseInt(rgb[2]).toString(16);
|
151
|
-
|
152
|
-
r = r.length == 1 ? '0' + r : r;
|
153
|
-
g = g.length == 1 ? '0' + g : g;
|
154
|
-
b = b.length == 1 ? '0' + b : b;
|
155
|
-
|
156
|
-
return "#" + r + g + b;
|
157
|
-
}
|
158
|
-
|
159
|
-
return col;
|
160
|
-
}
|
161
|
-
|
162
|
-
function convertHexToRGB(col) {
|
163
|
-
if (col.indexOf('#') != -1) {
|
164
|
-
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
|
165
|
-
|
166
|
-
r = parseInt(col.substring(0, 2), 16);
|
167
|
-
g = parseInt(col.substring(2, 4), 16);
|
168
|
-
b = parseInt(col.substring(4, 6), 16);
|
169
|
-
|
170
|
-
return {r : r, g : g, b : b};
|
171
|
-
}
|
172
|
-
|
173
|
-
return null;
|
174
|
-
}
|
175
|
-
|
176
|
-
function generatePicker() {
|
177
|
-
var el = document.getElementById('light'), h = '', i;
|
178
|
-
|
179
|
-
for (i = 0; i < detail; i++){
|
180
|
-
h += '<div id="gs'+i+'" style="background-color:#000000; width:15px; height:3px; border-style:none; border-width:0px;"'
|
181
|
-
+ ' onclick="changeFinalColor(this.style.backgroundColor)"'
|
182
|
-
+ ' onmousedown="isMouseDown = true; return false;"'
|
183
|
-
+ ' onmouseup="isMouseDown = false;"'
|
184
|
-
+ ' onmousemove="if (isMouseDown && isMouseOver) changeFinalColor(this.style.backgroundColor); return false;"'
|
185
|
-
+ ' onmouseover="isMouseOver = true;"'
|
186
|
-
+ ' onmouseout="isMouseOver = false;"'
|
187
|
-
+ '></div>';
|
188
|
-
}
|
189
|
-
|
190
|
-
el.innerHTML = h;
|
191
|
-
}
|
192
|
-
|
193
|
-
function generateWebColors() {
|
194
|
-
var el = document.getElementById('webcolors'), h = '', i;
|
195
|
-
|
196
|
-
if (el.className == 'generated')
|
197
|
-
return;
|
198
|
-
|
199
|
-
// TODO: VoiceOver doesn't seem to support legend as a label referenced by labelledby.
|
200
|
-
h += '<div role="listbox" aria-labelledby="webcolors_title" tabindex="0"><table role="presentation" border="0" cellspacing="1" cellpadding="0">'
|
201
|
-
+ '<tr>';
|
202
|
-
|
203
|
-
for (i=0; i<colors.length; i++) {
|
204
|
-
h += '<td bgcolor="' + colors[i] + '" width="10" height="10">'
|
205
|
-
+ '<a href="javascript:insertAction();" role="option" tabindex="-1" aria-labelledby="web_colors_' + i + '" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');" style="display:block;width:10px;height:10px;overflow:hidden;">';
|
206
|
-
if (tinyMCEPopup.editor.forcedHighContrastMode) {
|
207
|
-
h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';
|
208
|
-
}
|
209
|
-
h += '<span class="mceVoiceLabel" style="display:none;" id="web_colors_' + i + '">' + colors[i].toUpperCase() + '</span>';
|
210
|
-
h += '</a></td>';
|
211
|
-
if ((i+1) % 18 == 0)
|
212
|
-
h += '</tr><tr>';
|
213
|
-
}
|
214
|
-
|
215
|
-
h += '</table></div>';
|
216
|
-
|
217
|
-
el.innerHTML = h;
|
218
|
-
el.className = 'generated';
|
219
|
-
|
220
|
-
paintCanvas(el);
|
221
|
-
enableKeyboardNavigation(el.firstChild);
|
222
|
-
}
|
223
|
-
|
224
|
-
function paintCanvas(el) {
|
225
|
-
tinyMCEPopup.getWin().tinymce.each(tinyMCEPopup.dom.select('canvas.mceColorSwatch', el), function(canvas) {
|
226
|
-
var context;
|
227
|
-
if (canvas.getContext && (context = canvas.getContext("2d"))) {
|
228
|
-
context.fillStyle = canvas.getAttribute('data-color');
|
229
|
-
context.fillRect(0, 0, 10, 10);
|
230
|
-
}
|
231
|
-
});
|
232
|
-
}
|
233
|
-
function generateNamedColors() {
|
234
|
-
var el = document.getElementById('namedcolors'), h = '', n, v, i = 0;
|
235
|
-
|
236
|
-
if (el.className == 'generated')
|
237
|
-
return;
|
238
|
-
|
239
|
-
for (n in named) {
|
240
|
-
v = named[n];
|
241
|
-
h += '<a href="javascript:insertAction();" role="option" tabindex="-1" aria-labelledby="named_colors_' + i + '" onfocus="showColor(\'' + n + '\',\'' + v + '\');" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '">';
|
242
|
-
if (tinyMCEPopup.editor.forcedHighContrastMode) {
|
243
|
-
h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';
|
244
|
-
}
|
245
|
-
h += '<span class="mceVoiceLabel" style="display:none;" id="named_colors_' + i + '">' + v + '</span>';
|
246
|
-
h += '</a>';
|
247
|
-
i++;
|
248
|
-
}
|
249
|
-
|
250
|
-
el.innerHTML = h;
|
251
|
-
el.className = 'generated';
|
252
|
-
|
253
|
-
paintCanvas(el);
|
254
|
-
enableKeyboardNavigation(el);
|
255
|
-
}
|
256
|
-
|
257
|
-
function enableKeyboardNavigation(el) {
|
258
|
-
tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
|
259
|
-
root: el,
|
260
|
-
items: tinyMCEPopup.dom.select('a', el)
|
261
|
-
}, tinyMCEPopup.dom);
|
262
|
-
}
|
263
|
-
|
264
|
-
function dechex(n) {
|
265
|
-
return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16);
|
266
|
-
}
|
267
|
-
|
268
|
-
function computeColor(e) {
|
269
|
-
var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB;
|
270
|
-
|
271
|
-
x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0);
|
272
|
-
y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0);
|
273
|
-
|
274
|
-
partWidth = document.getElementById('colors').width / 6;
|
275
|
-
partDetail = detail / 2;
|
276
|
-
imHeight = document.getElementById('colors').height;
|
277
|
-
|
278
|
-
r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255;
|
279
|
-
g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth);
|
280
|
-
b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth);
|
281
|
-
|
282
|
-
coef = (imHeight - y) / imHeight;
|
283
|
-
r = 128 + (r - 128) * coef;
|
284
|
-
g = 128 + (g - 128) * coef;
|
285
|
-
b = 128 + (b - 128) * coef;
|
286
|
-
|
287
|
-
changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b));
|
288
|
-
updateLight(r, g, b);
|
289
|
-
}
|
290
|
-
|
291
|
-
function updateLight(r, g, b) {
|
292
|
-
var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color;
|
293
|
-
|
294
|
-
for (i=0; i<detail; i++) {
|
295
|
-
if ((i>=0) && (i<partDetail)) {
|
296
|
-
finalCoef = i / partDetail;
|
297
|
-
finalR = dechex(255 - (255 - r) * finalCoef);
|
298
|
-
finalG = dechex(255 - (255 - g) * finalCoef);
|
299
|
-
finalB = dechex(255 - (255 - b) * finalCoef);
|
300
|
-
} else {
|
301
|
-
finalCoef = 2 - i / partDetail;
|
302
|
-
finalR = dechex(r * finalCoef);
|
303
|
-
finalG = dechex(g * finalCoef);
|
304
|
-
finalB = dechex(b * finalCoef);
|
305
|
-
}
|
306
|
-
|
307
|
-
color = finalR + finalG + finalB;
|
308
|
-
|
309
|
-
setCol('gs' + i, '#'+color);
|
310
|
-
}
|
311
|
-
}
|
312
|
-
|
313
|
-
function changeFinalColor(color) {
|
314
|
-
if (color.indexOf('#') == -1)
|
315
|
-
color = convertRGBToHex(color);
|
316
|
-
|
317
|
-
setCol('preview', color);
|
318
|
-
document.getElementById('color').value = color;
|
319
|
-
}
|
320
|
-
|
321
|
-
function setCol(e, c) {
|
322
|
-
try {
|
323
|
-
document.getElementById(e).style.backgroundColor = c;
|
324
|
-
} catch (ex) {
|
325
|
-
// Ignore IE warning
|
326
|
-
}
|
327
|
-
}
|
328
|
-
|
329
|
-
tinyMCEPopup.onInit.add(init);
|
1
|
+
tinyMCEPopup.requireLangPack();
|
2
|
+
|
3
|
+
var detail = 50, strhex = "0123456789ABCDEF", i, isMouseDown = false, isMouseOver = false;
|
4
|
+
|
5
|
+
var colors = [
|
6
|
+
"#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
|
7
|
+
"#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
|
8
|
+
"#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
|
9
|
+
"#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033",
|
10
|
+
"#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399",
|
11
|
+
"#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff",
|
12
|
+
"#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333",
|
13
|
+
"#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399",
|
14
|
+
"#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff",
|
15
|
+
"#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633",
|
16
|
+
"#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699",
|
17
|
+
"#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff",
|
18
|
+
"#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633",
|
19
|
+
"#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999",
|
20
|
+
"#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff",
|
21
|
+
"#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933",
|
22
|
+
"#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999",
|
23
|
+
"#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff",
|
24
|
+
"#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33",
|
25
|
+
"#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99",
|
26
|
+
"#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff",
|
27
|
+
"#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33",
|
28
|
+
"#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99",
|
29
|
+
"#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff",
|
30
|
+
"#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
|
31
|
+
"#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
|
32
|
+
"#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
|
33
|
+
];
|
34
|
+
|
35
|
+
var named = {
|
36
|
+
'#F0F8FF':'Alice Blue','#FAEBD7':'Antique White','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',
|
37
|
+
'#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'Blanched Almond','#0000FF':'Blue','#8A2BE2':'Blue Violet','#A52A2A':'Brown',
|
38
|
+
'#DEB887':'Burly Wood','#5F9EA0':'Cadet Blue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'Cornflower Blue',
|
39
|
+
'#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'Dark Blue','#008B8B':'Dark Cyan','#B8860B':'Dark Golden Rod',
|
40
|
+
'#A9A9A9':'Dark Gray','#A9A9A9':'Dark Grey','#006400':'Dark Green','#BDB76B':'Dark Khaki','#8B008B':'Dark Magenta','#556B2F':'Dark Olive Green',
|
41
|
+
'#FF8C00':'Darkorange','#9932CC':'Dark Orchid','#8B0000':'Dark Red','#E9967A':'Dark Salmon','#8FBC8F':'Dark Sea Green','#483D8B':'Dark Slate Blue',
|
42
|
+
'#2F4F4F':'Dark Slate Gray','#2F4F4F':'Dark Slate Grey','#00CED1':'Dark Turquoise','#9400D3':'Dark Violet','#FF1493':'Deep Pink','#00BFFF':'Deep Sky Blue',
|
43
|
+
'#696969':'Dim Gray','#696969':'Dim Grey','#1E90FF':'Dodger Blue','#B22222':'Fire Brick','#FFFAF0':'Floral White','#228B22':'Forest Green',
|
44
|
+
'#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'Ghost White','#FFD700':'Gold','#DAA520':'Golden Rod','#808080':'Gray','#808080':'Grey',
|
45
|
+
'#008000':'Green','#ADFF2F':'Green Yellow','#F0FFF0':'Honey Dew','#FF69B4':'Hot Pink','#CD5C5C':'Indian Red','#4B0082':'Indigo','#FFFFF0':'Ivory',
|
46
|
+
'#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'Lavender Blush','#7CFC00':'Lawn Green','#FFFACD':'Lemon Chiffon','#ADD8E6':'Light Blue',
|
47
|
+
'#F08080':'Light Coral','#E0FFFF':'Light Cyan','#FAFAD2':'Light Golden Rod Yellow','#D3D3D3':'Light Gray','#D3D3D3':'Light Grey','#90EE90':'Light Green',
|
48
|
+
'#FFB6C1':'Light Pink','#FFA07A':'Light Salmon','#20B2AA':'Light Sea Green','#87CEFA':'Light Sky Blue','#778899':'Light Slate Gray','#778899':'Light Slate Grey',
|
49
|
+
'#B0C4DE':'Light Steel Blue','#FFFFE0':'Light Yellow','#00FF00':'Lime','#32CD32':'Lime Green','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon',
|
50
|
+
'#66CDAA':'Medium Aqua Marine','#0000CD':'Medium Blue','#BA55D3':'Medium Orchid','#9370D8':'Medium Purple','#3CB371':'Medium Sea Green','#7B68EE':'Medium Slate Blue',
|
51
|
+
'#00FA9A':'Medium Spring Green','#48D1CC':'Medium Turquoise','#C71585':'Medium Violet Red','#191970':'Midnight Blue','#F5FFFA':'Mint Cream','#FFE4E1':'Misty Rose','#FFE4B5':'Moccasin',
|
52
|
+
'#FFDEAD':'Navajo White','#000080':'Navy','#FDF5E6':'Old Lace','#808000':'Olive','#6B8E23':'Olive Drab','#FFA500':'Orange','#FF4500':'Orange Red','#DA70D6':'Orchid',
|
53
|
+
'#EEE8AA':'Pale Golden Rod','#98FB98':'Pale Green','#AFEEEE':'Pale Turquoise','#D87093':'Pale Violet Red','#FFEFD5':'Papaya Whip','#FFDAB9':'Peach Puff',
|
54
|
+
'#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'Powder Blue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'Rosy Brown','#4169E1':'Royal Blue',
|
55
|
+
'#8B4513':'Saddle Brown','#FA8072':'Salmon','#F4A460':'Sandy Brown','#2E8B57':'Sea Green','#FFF5EE':'Sea Shell','#A0522D':'Sienna','#C0C0C0':'Silver',
|
56
|
+
'#87CEEB':'Sky Blue','#6A5ACD':'Slate Blue','#708090':'Slate Gray','#708090':'Slate Grey','#FFFAFA':'Snow','#00FF7F':'Spring Green',
|
57
|
+
'#4682B4':'Steel Blue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet',
|
58
|
+
'#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'White Smoke','#FFFF00':'Yellow','#9ACD32':'Yellow Green'
|
59
|
+
};
|
60
|
+
|
61
|
+
var namedLookup = {};
|
62
|
+
|
63
|
+
function init() {
|
64
|
+
var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')), key, value;
|
65
|
+
|
66
|
+
tinyMCEPopup.resizeToInnerSize();
|
67
|
+
|
68
|
+
generatePicker();
|
69
|
+
generateWebColors();
|
70
|
+
generateNamedColors();
|
71
|
+
|
72
|
+
if (inputColor) {
|
73
|
+
changeFinalColor(inputColor);
|
74
|
+
|
75
|
+
col = convertHexToRGB(inputColor);
|
76
|
+
|
77
|
+
if (col)
|
78
|
+
updateLight(col.r, col.g, col.b);
|
79
|
+
}
|
80
|
+
|
81
|
+
for (key in named) {
|
82
|
+
value = named[key];
|
83
|
+
namedLookup[value.replace(/\s+/, '').toLowerCase()] = key.replace(/#/, '').toLowerCase();
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
function toHexColor(color) {
|
88
|
+
var matches, red, green, blue, toInt = parseInt;
|
89
|
+
|
90
|
+
function hex(value) {
|
91
|
+
value = parseInt(value).toString(16);
|
92
|
+
|
93
|
+
return value.length > 1 ? value : '0' + value; // Padd with leading zero
|
94
|
+
};
|
95
|
+
|
96
|
+
color = color.replace(/[\s#]+/g, '').toLowerCase();
|
97
|
+
color = namedLookup[color] || color;
|
98
|
+
matches = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)|([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})|([a-f0-9])([a-f0-9])([a-f0-9])$/.exec(color);
|
99
|
+
|
100
|
+
if (matches) {
|
101
|
+
if (matches[1]) {
|
102
|
+
red = toInt(matches[1]);
|
103
|
+
green = toInt(matches[2]);
|
104
|
+
blue = toInt(matches[3]);
|
105
|
+
} else if (matches[4]) {
|
106
|
+
red = toInt(matches[4], 16);
|
107
|
+
green = toInt(matches[5], 16);
|
108
|
+
blue = toInt(matches[6], 16);
|
109
|
+
} else if (matches[7]) {
|
110
|
+
red = toInt(matches[7] + matches[7], 16);
|
111
|
+
green = toInt(matches[8] + matches[8], 16);
|
112
|
+
blue = toInt(matches[9] + matches[9], 16);
|
113
|
+
}
|
114
|
+
|
115
|
+
return '#' + hex(red) + hex(green) + hex(blue);
|
116
|
+
}
|
117
|
+
|
118
|
+
return '';
|
119
|
+
}
|
120
|
+
|
121
|
+
function insertAction() {
|
122
|
+
var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');
|
123
|
+
|
124
|
+
tinyMCEPopup.restoreSelection();
|
125
|
+
|
126
|
+
if (f)
|
127
|
+
f(toHexColor(color));
|
128
|
+
|
129
|
+
tinyMCEPopup.close();
|
130
|
+
}
|
131
|
+
|
132
|
+
function showColor(color, name) {
|
133
|
+
if (name)
|
134
|
+
document.getElementById("colorname").innerHTML = name;
|
135
|
+
|
136
|
+
document.getElementById("preview").style.backgroundColor = color;
|
137
|
+
document.getElementById("color").value = color.toUpperCase();
|
138
|
+
}
|
139
|
+
|
140
|
+
function convertRGBToHex(col) {
|
141
|
+
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
|
142
|
+
|
143
|
+
if (!col)
|
144
|
+
return col;
|
145
|
+
|
146
|
+
var rgb = col.replace(re, "$1,$2,$3").split(',');
|
147
|
+
if (rgb.length == 3) {
|
148
|
+
r = parseInt(rgb[0]).toString(16);
|
149
|
+
g = parseInt(rgb[1]).toString(16);
|
150
|
+
b = parseInt(rgb[2]).toString(16);
|
151
|
+
|
152
|
+
r = r.length == 1 ? '0' + r : r;
|
153
|
+
g = g.length == 1 ? '0' + g : g;
|
154
|
+
b = b.length == 1 ? '0' + b : b;
|
155
|
+
|
156
|
+
return "#" + r + g + b;
|
157
|
+
}
|
158
|
+
|
159
|
+
return col;
|
160
|
+
}
|
161
|
+
|
162
|
+
function convertHexToRGB(col) {
|
163
|
+
if (col.indexOf('#') != -1) {
|
164
|
+
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
|
165
|
+
|
166
|
+
r = parseInt(col.substring(0, 2), 16);
|
167
|
+
g = parseInt(col.substring(2, 4), 16);
|
168
|
+
b = parseInt(col.substring(4, 6), 16);
|
169
|
+
|
170
|
+
return {r : r, g : g, b : b};
|
171
|
+
}
|
172
|
+
|
173
|
+
return null;
|
174
|
+
}
|
175
|
+
|
176
|
+
function generatePicker() {
|
177
|
+
var el = document.getElementById('light'), h = '', i;
|
178
|
+
|
179
|
+
for (i = 0; i < detail; i++){
|
180
|
+
h += '<div id="gs'+i+'" style="background-color:#000000; width:15px; height:3px; border-style:none; border-width:0px;"'
|
181
|
+
+ ' onclick="changeFinalColor(this.style.backgroundColor)"'
|
182
|
+
+ ' onmousedown="isMouseDown = true; return false;"'
|
183
|
+
+ ' onmouseup="isMouseDown = false;"'
|
184
|
+
+ ' onmousemove="if (isMouseDown && isMouseOver) changeFinalColor(this.style.backgroundColor); return false;"'
|
185
|
+
+ ' onmouseover="isMouseOver = true;"'
|
186
|
+
+ ' onmouseout="isMouseOver = false;"'
|
187
|
+
+ '></div>';
|
188
|
+
}
|
189
|
+
|
190
|
+
el.innerHTML = h;
|
191
|
+
}
|
192
|
+
|
193
|
+
function generateWebColors() {
|
194
|
+
var el = document.getElementById('webcolors'), h = '', i;
|
195
|
+
|
196
|
+
if (el.className == 'generated')
|
197
|
+
return;
|
198
|
+
|
199
|
+
// TODO: VoiceOver doesn't seem to support legend as a label referenced by labelledby.
|
200
|
+
h += '<div role="listbox" aria-labelledby="webcolors_title" tabindex="0"><table role="presentation" border="0" cellspacing="1" cellpadding="0">'
|
201
|
+
+ '<tr>';
|
202
|
+
|
203
|
+
for (i=0; i<colors.length; i++) {
|
204
|
+
h += '<td bgcolor="' + colors[i] + '" width="10" height="10">'
|
205
|
+
+ '<a href="javascript:insertAction();" role="option" tabindex="-1" aria-labelledby="web_colors_' + i + '" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');" style="display:block;width:10px;height:10px;overflow:hidden;">';
|
206
|
+
if (tinyMCEPopup.editor.forcedHighContrastMode) {
|
207
|
+
h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';
|
208
|
+
}
|
209
|
+
h += '<span class="mceVoiceLabel" style="display:none;" id="web_colors_' + i + '">' + colors[i].toUpperCase() + '</span>';
|
210
|
+
h += '</a></td>';
|
211
|
+
if ((i+1) % 18 == 0)
|
212
|
+
h += '</tr><tr>';
|
213
|
+
}
|
214
|
+
|
215
|
+
h += '</table></div>';
|
216
|
+
|
217
|
+
el.innerHTML = h;
|
218
|
+
el.className = 'generated';
|
219
|
+
|
220
|
+
paintCanvas(el);
|
221
|
+
enableKeyboardNavigation(el.firstChild);
|
222
|
+
}
|
223
|
+
|
224
|
+
function paintCanvas(el) {
|
225
|
+
tinyMCEPopup.getWin().tinymce.each(tinyMCEPopup.dom.select('canvas.mceColorSwatch', el), function(canvas) {
|
226
|
+
var context;
|
227
|
+
if (canvas.getContext && (context = canvas.getContext("2d"))) {
|
228
|
+
context.fillStyle = canvas.getAttribute('data-color');
|
229
|
+
context.fillRect(0, 0, 10, 10);
|
230
|
+
}
|
231
|
+
});
|
232
|
+
}
|
233
|
+
function generateNamedColors() {
|
234
|
+
var el = document.getElementById('namedcolors'), h = '', n, v, i = 0;
|
235
|
+
|
236
|
+
if (el.className == 'generated')
|
237
|
+
return;
|
238
|
+
|
239
|
+
for (n in named) {
|
240
|
+
v = named[n];
|
241
|
+
h += '<a href="javascript:insertAction();" role="option" tabindex="-1" aria-labelledby="named_colors_' + i + '" onfocus="showColor(\'' + n + '\',\'' + v + '\');" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '">';
|
242
|
+
if (tinyMCEPopup.editor.forcedHighContrastMode) {
|
243
|
+
h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';
|
244
|
+
}
|
245
|
+
h += '<span class="mceVoiceLabel" style="display:none;" id="named_colors_' + i + '">' + v + '</span>';
|
246
|
+
h += '</a>';
|
247
|
+
i++;
|
248
|
+
}
|
249
|
+
|
250
|
+
el.innerHTML = h;
|
251
|
+
el.className = 'generated';
|
252
|
+
|
253
|
+
paintCanvas(el);
|
254
|
+
enableKeyboardNavigation(el);
|
255
|
+
}
|
256
|
+
|
257
|
+
function enableKeyboardNavigation(el) {
|
258
|
+
tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
|
259
|
+
root: el,
|
260
|
+
items: tinyMCEPopup.dom.select('a', el)
|
261
|
+
}, tinyMCEPopup.dom);
|
262
|
+
}
|
263
|
+
|
264
|
+
function dechex(n) {
|
265
|
+
return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16);
|
266
|
+
}
|
267
|
+
|
268
|
+
function computeColor(e) {
|
269
|
+
var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB;
|
270
|
+
|
271
|
+
x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0);
|
272
|
+
y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0);
|
273
|
+
|
274
|
+
partWidth = document.getElementById('colors').width / 6;
|
275
|
+
partDetail = detail / 2;
|
276
|
+
imHeight = document.getElementById('colors').height;
|
277
|
+
|
278
|
+
r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255;
|
279
|
+
g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth);
|
280
|
+
b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth);
|
281
|
+
|
282
|
+
coef = (imHeight - y) / imHeight;
|
283
|
+
r = 128 + (r - 128) * coef;
|
284
|
+
g = 128 + (g - 128) * coef;
|
285
|
+
b = 128 + (b - 128) * coef;
|
286
|
+
|
287
|
+
changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b));
|
288
|
+
updateLight(r, g, b);
|
289
|
+
}
|
290
|
+
|
291
|
+
function updateLight(r, g, b) {
|
292
|
+
var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color;
|
293
|
+
|
294
|
+
for (i=0; i<detail; i++) {
|
295
|
+
if ((i>=0) && (i<partDetail)) {
|
296
|
+
finalCoef = i / partDetail;
|
297
|
+
finalR = dechex(255 - (255 - r) * finalCoef);
|
298
|
+
finalG = dechex(255 - (255 - g) * finalCoef);
|
299
|
+
finalB = dechex(255 - (255 - b) * finalCoef);
|
300
|
+
} else {
|
301
|
+
finalCoef = 2 - i / partDetail;
|
302
|
+
finalR = dechex(r * finalCoef);
|
303
|
+
finalG = dechex(g * finalCoef);
|
304
|
+
finalB = dechex(b * finalCoef);
|
305
|
+
}
|
306
|
+
|
307
|
+
color = finalR + finalG + finalB;
|
308
|
+
|
309
|
+
setCol('gs' + i, '#'+color);
|
310
|
+
}
|
311
|
+
}
|
312
|
+
|
313
|
+
function changeFinalColor(color) {
|
314
|
+
if (color.indexOf('#') == -1)
|
315
|
+
color = convertRGBToHex(color);
|
316
|
+
|
317
|
+
setCol('preview', color);
|
318
|
+
document.getElementById('color').value = color;
|
319
|
+
}
|
320
|
+
|
321
|
+
function setCol(e, c) {
|
322
|
+
try {
|
323
|
+
document.getElementById(e).style.backgroundColor = c;
|
324
|
+
} catch (ex) {
|
325
|
+
// Ignore IE warning
|
326
|
+
}
|
327
|
+
}
|
328
|
+
|
329
|
+
tinyMCEPopup.onInit.add(init);
|