kiteditor 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. data/LICENSE +25 -0
  2. data/app/controllers/mercury/images_controller.rb +5 -0
  3. data/app/controllers/mercury_controller.rb +34 -0
  4. data/app/models/mercury/image.rb +17 -0
  5. data/app/views/layouts/mercury.html.erb +33 -0
  6. data/app/views/layouts/popup.html.haml +9 -0
  7. data/app/views/mercury/images/_list.html.haml +22 -0
  8. data/app/views/mercury/images/index.html.haml +4 -0
  9. data/app/views/mercury/images/index.js.erb +2 -0
  10. data/app/views/mercury/lightviews/about.html +11 -0
  11. data/app/views/mercury/modals/character.html +255 -0
  12. data/app/views/mercury/modals/htmleditor.html +13 -0
  13. data/app/views/mercury/modals/link.html +94 -0
  14. data/app/views/mercury/modals/media.html +1 -0
  15. data/app/views/mercury/modals/table.html +84 -0
  16. data/app/views/mercury/palettes/backcolor.html +73 -0
  17. data/app/views/mercury/palettes/forecolor.html +73 -0
  18. data/app/views/mercury/panels/history.html +3 -0
  19. data/app/views/mercury/panels/notes.html +3 -0
  20. data/app/views/mercury/panels/snippets.html +12 -0
  21. data/app/views/mercury/selects/formatblock.html +11 -0
  22. data/app/views/mercury/selects/style.html +5 -0
  23. data/app/views/mercury/snippets/example/options.html.erb +34 -0
  24. data/app/views/mercury/snippets/example/preview.html.erb +1 -0
  25. data/config/engine.rb +44 -0
  26. data/db/migrate/20110526035601_create_mercury_images.rb +11 -0
  27. data/features/loading/loading.feature +22 -0
  28. data/features/loading/navigating.feature +77 -0
  29. data/features/loading/user_interface.feature +67 -0
  30. data/features/regions/editable/advanced_editing.feature +0 -0
  31. data/features/regions/editable/basic_editing.feature +195 -0
  32. data/features/regions/editable/inserting_links.feature +98 -0
  33. data/features/regions/editable/inserting_media.feature +110 -0
  34. data/features/regions/editable/inserting_snippets.feature +102 -0
  35. data/features/regions/editable/inserting_special_characters.feature +24 -0
  36. data/features/regions/editable/inserting_tables.feature +109 -0
  37. data/features/regions/editable/pasting.feature +0 -0
  38. data/features/regions/editable/uploading_images.feature +0 -0
  39. data/features/regions/markupable/advanced_editing.feature +0 -0
  40. data/features/regions/markupable/basic_editing.feature +0 -0
  41. data/features/regions/markupable/inserting_links.feature +0 -0
  42. data/features/regions/markupable/inserting_media.feature +0 -0
  43. data/features/regions/markupable/inserting_snippets.feature +0 -0
  44. data/features/regions/markupable/inserting_special_characters.feature +0 -0
  45. data/features/regions/markupable/inserting_tables.feature +0 -0
  46. data/features/regions/markupable/uploading_images.feature +0 -0
  47. data/features/regions/snippetable/advanced_editing.feature +0 -0
  48. data/features/regions/snippetable/basic_editing.feature +0 -0
  49. data/features/regions/snippetable/inserting_snippets.feature +0 -0
  50. data/features/saving/saving.feature +33 -0
  51. data/features/step_definitions/debug_steps.rb +14 -0
  52. data/features/step_definitions/mercury_steps.rb +438 -0
  53. data/features/step_definitions/web_steps.rb +211 -0
  54. data/features/support/env.rb +46 -0
  55. data/features/support/mercury_contents.rb +25 -0
  56. data/features/support/mercury_selectors.rb +148 -0
  57. data/features/support/paths.rb +38 -0
  58. data/features/support/selectors.rb +44 -0
  59. data/lib/generators/mercury/install/install_generator.rb +49 -0
  60. data/lib/generators/mercury/install/templates/mongoid_paperclip_image.rb +17 -0
  61. data/lib/mercury/authentication.rb +8 -0
  62. data/lib/mercury-rails.rb +3 -0
  63. data/spec/javascripts/mercury/dialog_spec.js.coffee +281 -0
  64. data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +37 -0
  65. data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +37 -0
  66. data/spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee +25 -0
  67. data/spec/javascripts/mercury/dialogs/snippetpanel_spec.js.coffee +30 -0
  68. data/spec/javascripts/mercury/dialogs/style_spec.js.coffee +25 -0
  69. data/spec/javascripts/mercury/history_buffer_spec.js.coffee +76 -0
  70. data/spec/javascripts/mercury/lightview_spec.js.coffee +497 -0
  71. data/spec/javascripts/mercury/mercury_spec.js.coffee +132 -0
  72. data/spec/javascripts/mercury/modal_spec.js.coffee +504 -0
  73. data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +30 -0
  74. data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +29 -0
  75. data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +220 -0
  76. data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +167 -0
  77. data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +52 -0
  78. data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +160 -0
  79. data/spec/javascripts/mercury/native_extensions_spec.js.coffee +60 -0
  80. data/spec/javascripts/mercury/page_editor_spec.js.coffee +750 -0
  81. data/spec/javascripts/mercury/palette_spec.js.coffee +49 -0
  82. data/spec/javascripts/mercury/panel_spec.js.coffee +185 -0
  83. data/spec/javascripts/mercury/region_spec.js.coffee +298 -0
  84. data/spec/javascripts/mercury/regions/editable_spec.js.coffee +561 -0
  85. data/spec/javascripts/mercury/regions/markupable_spec.js.coffee +367 -0
  86. data/spec/javascripts/mercury/regions/snippetable_spec.js.coffee +370 -0
  87. data/spec/javascripts/mercury/select_spec.js.coffee +49 -0
  88. data/spec/javascripts/mercury/snippet_spec.js.coffee +245 -0
  89. data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +184 -0
  90. data/spec/javascripts/mercury/statusbar_spec.js.coffee +150 -0
  91. data/spec/javascripts/mercury/table_editor_spec.js.coffee +194 -0
  92. data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +90 -0
  93. data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +360 -0
  94. data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +118 -0
  95. data/spec/javascripts/mercury/toolbar_spec.js.coffee +222 -0
  96. data/spec/javascripts/mercury/tooltip_spec.js.coffee +186 -0
  97. data/spec/javascripts/mercury/uploader_spec.js.coffee +514 -0
  98. data/spec/javascripts/spec_helper.js +513 -0
  99. data/spec/javascripts/templates/mercury/dialog.html +2 -0
  100. data/spec/javascripts/templates/mercury/dialogs/backcolor.html +5 -0
  101. data/spec/javascripts/templates/mercury/dialogs/forecolor.html +5 -0
  102. data/spec/javascripts/templates/mercury/dialogs/formatblock.html +3 -0
  103. data/spec/javascripts/templates/mercury/dialogs/snippetpanel.html +16 -0
  104. data/spec/javascripts/templates/mercury/dialogs/style.html +3 -0
  105. data/spec/javascripts/templates/mercury/lightview.html +13 -0
  106. data/spec/javascripts/templates/mercury/modal.html +13 -0
  107. data/spec/javascripts/templates/mercury/modals/htmleditor.html +5 -0
  108. data/spec/javascripts/templates/mercury/modals/insertcharacter.html +5 -0
  109. data/spec/javascripts/templates/mercury/modals/insertlink.html +30 -0
  110. data/spec/javascripts/templates/mercury/modals/insertmedia.html +35 -0
  111. data/spec/javascripts/templates/mercury/modals/insertsnippet.html +6 -0
  112. data/spec/javascripts/templates/mercury/modals/inserttable.html +27 -0
  113. data/spec/javascripts/templates/mercury/page_editor.html +35 -0
  114. data/spec/javascripts/templates/mercury/palette.html +16 -0
  115. data/spec/javascripts/templates/mercury/panel.html +16 -0
  116. data/spec/javascripts/templates/mercury/region.html +2 -0
  117. data/spec/javascripts/templates/mercury/regions/editable.html +3 -0
  118. data/spec/javascripts/templates/mercury/regions/snippetable.html +4 -0
  119. data/spec/javascripts/templates/mercury/select.html +16 -0
  120. data/spec/javascripts/templates/mercury/snippet.html +1 -0
  121. data/spec/javascripts/templates/mercury/snippet_toolbar.html +16 -0
  122. data/spec/javascripts/templates/mercury/statusbar.html +8 -0
  123. data/spec/javascripts/templates/mercury/table_editor.html +65 -0
  124. data/spec/javascripts/templates/mercury/toolbar.button.html +64 -0
  125. data/spec/javascripts/templates/mercury/toolbar.button_group.html +9 -0
  126. data/spec/javascripts/templates/mercury/toolbar.expander.html +18 -0
  127. data/spec/javascripts/templates/mercury/toolbar.html +11 -0
  128. data/spec/javascripts/templates/mercury/tooltip.html +12 -0
  129. data/spec/javascripts/templates/mercury/uploader.html +11 -0
  130. data/vendor/assets/images/mercury/button.png +0 -0
  131. data/vendor/assets/images/mercury/close.png +0 -0
  132. data/vendor/assets/images/mercury/default-snippet.png +0 -0
  133. data/vendor/assets/images/mercury/loading-dark.gif +0 -0
  134. data/vendor/assets/images/mercury/loading-light.gif +0 -0
  135. data/vendor/assets/images/mercury/missing-image.png +0 -0
  136. data/vendor/assets/images/mercury/search-icon.png +0 -0
  137. data/vendor/assets/images/mercury/temp-logo.png +0 -0
  138. data/vendor/assets/images/mercury/toolbar/editable/buttons.png +0 -0
  139. data/vendor/assets/images/mercury/toolbar/primary/_expander.png +0 -0
  140. data/vendor/assets/images/mercury/toolbar/primary/_pressed.png +0 -0
  141. data/vendor/assets/images/mercury/toolbar/primary/historypanel.png +0 -0
  142. data/vendor/assets/images/mercury/toolbar/primary/insertcharacter.png +0 -0
  143. data/vendor/assets/images/mercury/toolbar/primary/insertlink.png +0 -0
  144. data/vendor/assets/images/mercury/toolbar/primary/insertmedia.png +0 -0
  145. data/vendor/assets/images/mercury/toolbar/primary/inserttable.png +0 -0
  146. data/vendor/assets/images/mercury/toolbar/primary/inspectorpanel.png +0 -0
  147. data/vendor/assets/images/mercury/toolbar/primary/notespanel.png +0 -0
  148. data/vendor/assets/images/mercury/toolbar/primary/preview.png +0 -0
  149. data/vendor/assets/images/mercury/toolbar/primary/redo.png +0 -0
  150. data/vendor/assets/images/mercury/toolbar/primary/save.png +0 -0
  151. data/vendor/assets/images/mercury/toolbar/primary/snippetpanel.png +0 -0
  152. data/vendor/assets/images/mercury/toolbar/primary/undo.png +0 -0
  153. data/vendor/assets/images/mercury/toolbar/snippetable/buttons.png +0 -0
  154. data/vendor/assets/javascripts/mercury/dependencies/jquery-1.7.js +9300 -0
  155. data/vendor/assets/javascripts/mercury/dependencies/jquery-ui-1.8.13.custom.js +1328 -0
  156. data/vendor/assets/javascripts/mercury/dependencies/jquery-ui-1.8.18.custom.min.js +356 -0
  157. data/vendor/assets/javascripts/mercury/dependencies/jquery-ui.1.8.13.custom.min.js +356 -0
  158. data/vendor/assets/javascripts/mercury/dependencies/jquery.additions.js +206 -0
  159. data/vendor/assets/javascripts/mercury/dependencies/jquery.htmlClean.js +527 -0
  160. data/vendor/assets/javascripts/mercury/dependencies/liquidmetal.js +88 -0
  161. data/vendor/assets/javascripts/mercury/dependencies/showdown.js +1340 -0
  162. data/vendor/assets/javascripts/mercury/dialog.js.coffee +159 -0
  163. data/vendor/assets/javascripts/mercury/dialogs/backcolor.js.coffee +6 -0
  164. data/vendor/assets/javascripts/mercury/dialogs/forecolor.js.coffee +6 -0
  165. data/vendor/assets/javascripts/mercury/dialogs/formatblock.js.coffee +4 -0
  166. data/vendor/assets/javascripts/mercury/dialogs/snippetpanel.js.coffee +10 -0
  167. data/vendor/assets/javascripts/mercury/dialogs/style.js.coffee +4 -0
  168. data/vendor/assets/javascripts/mercury/finalize.js.coffee +3 -0
  169. data/vendor/assets/javascripts/mercury/history_buffer.js.coffee +30 -0
  170. data/vendor/assets/javascripts/mercury/lightview.js.coffee +205 -0
  171. data/vendor/assets/javascripts/mercury/locales/da.locale.js.coffee +0 -0
  172. data/vendor/assets/javascripts/mercury/locales/de.locale.js.coffee +206 -0
  173. data/vendor/assets/javascripts/mercury/locales/es.locale.js.coffee +211 -0
  174. data/vendor/assets/javascripts/mercury/locales/example.local.js.coffee +211 -0
  175. data/vendor/assets/javascripts/mercury/locales/fr.locale.js.coffee +211 -0
  176. data/vendor/assets/javascripts/mercury/locales/it.locale.js.coffee +208 -0
  177. data/vendor/assets/javascripts/mercury/locales/ko.local.js.coffee +206 -0
  178. data/vendor/assets/javascripts/mercury/locales/nl.locale.js.coffee +206 -0
  179. data/vendor/assets/javascripts/mercury/locales/pt.locale.js.coffee +211 -0
  180. data/vendor/assets/javascripts/mercury/locales/sv.local.js.coffee +209 -0
  181. data/vendor/assets/javascripts/mercury/locales/swedish_chef.locale.js.coffee +213 -0
  182. data/vendor/assets/javascripts/mercury/mercury.js.coffee +109 -0
  183. data/vendor/assets/javascripts/mercury/modal.js.coffee +204 -0
  184. data/vendor/assets/javascripts/mercury/modals/htmleditor.js.coffee +11 -0
  185. data/vendor/assets/javascripts/mercury/modals/insertcharacter.js.coffee +4 -0
  186. data/vendor/assets/javascripts/mercury/modals/insertlink.js.coffee +95 -0
  187. data/vendor/assets/javascripts/mercury/modals/insertmedia.js.coffee +107 -0
  188. data/vendor/assets/javascripts/mercury/modals/insertsnippet.js.coffee +12 -0
  189. data/vendor/assets/javascripts/mercury/modals/inserttable.js.coffee +54 -0
  190. data/vendor/assets/javascripts/mercury/native_extensions.js.coffee +55 -0
  191. data/vendor/assets/javascripts/mercury/page_editor.js.coffee +241 -0
  192. data/vendor/assets/javascripts/mercury/palette.js.coffee +29 -0
  193. data/vendor/assets/javascripts/mercury/panel.js.coffee +115 -0
  194. data/vendor/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +28 -0
  195. data/vendor/assets/javascripts/mercury/plugins/save_as_xml/plugin.js +9 -0
  196. data/vendor/assets/javascripts/mercury/region.js.coffee +107 -0
  197. data/vendor/assets/javascripts/mercury/regions/editable.js.coffee +600 -0
  198. data/vendor/assets/javascripts/mercury/regions/markupable.js.coffee +398 -0
  199. data/vendor/assets/javascripts/mercury/regions/simple.js.coffee +339 -0
  200. data/vendor/assets/javascripts/mercury/regions/snippetable.js.coffee +124 -0
  201. data/vendor/assets/javascripts/mercury/select.js.coffee +44 -0
  202. data/vendor/assets/javascripts/mercury/snippet.js.coffee +104 -0
  203. data/vendor/assets/javascripts/mercury/snippet_toolbar.js.coffee +72 -0
  204. data/vendor/assets/javascripts/mercury/statusbar.js.coffee +51 -0
  205. data/vendor/assets/javascripts/mercury/support/history.js +1 -0
  206. data/vendor/assets/javascripts/mercury/table_editor.js.coffee +265 -0
  207. data/vendor/assets/javascripts/mercury/toolbar.button.js.coffee +173 -0
  208. data/vendor/assets/javascripts/mercury/toolbar.button_group.js.coffee +42 -0
  209. data/vendor/assets/javascripts/mercury/toolbar.expander.js.coffee +56 -0
  210. data/vendor/assets/javascripts/mercury/toolbar.js.coffee +86 -0
  211. data/vendor/assets/javascripts/mercury/tooltip.js.coffee +74 -0
  212. data/vendor/assets/javascripts/mercury/uploader.js.coffee +227 -0
  213. data/vendor/assets/javascripts/mercury.js +479 -0
  214. data/vendor/assets/javascripts/mercury_loader.js +193 -0
  215. data/vendor/assets/javascripts/mercury_overrides.js +6 -0
  216. data/vendor/assets/javascripts/popup.js +8 -0
  217. data/vendor/assets/stylesheets/mercury/all_images.css.erb +89 -0
  218. data/vendor/assets/stylesheets/mercury/dialog.css +208 -0
  219. data/vendor/assets/stylesheets/mercury/lightview.css +151 -0
  220. data/vendor/assets/stylesheets/mercury/mercury.css +151 -0
  221. data/vendor/assets/stylesheets/mercury/modal.css +183 -0
  222. data/vendor/assets/stylesheets/mercury/statusbar.css +32 -0
  223. data/vendor/assets/stylesheets/mercury/toolbar.css +304 -0
  224. data/vendor/assets/stylesheets/mercury/tooltip.css +26 -0
  225. data/vendor/assets/stylesheets/mercury/uploader.css +111 -0
  226. data/vendor/assets/stylesheets/mercury.css +28 -0
  227. data/vendor/assets/stylesheets/mercury_overrides.css +17 -0
  228. data/vendor/assets/stylesheets/popup.css.erb +37 -0
  229. metadata +634 -0
@@ -0,0 +1,193 @@
1
+ /*!
2
+ * Mercury Editor is a CoffeeScript and jQuery based WYSIWYG editor. Documentation and other useful information can be
3
+ * found at https://github.com/jejacks0n/mercury
4
+ *
5
+ * Supported browsers:
6
+ * - Firefox 4+
7
+ * - Chrome 10+
8
+ * - Safari 5+
9
+ *
10
+ * Copyright (c) 2011 Jeremy Jackson
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
14
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
15
+ * persons to whom the Software is furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
18
+ * Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
21
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
22
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+ *
25
+ */
26
+
27
+ // ## Default Packages
28
+ //
29
+ // Some default packages are provided for you. If you want to define your own, feel free to do so before including this
30
+ // script. These, or your own packages can be specified to the loader in query params (read below for details).
31
+ if (!window.mercuryPackages) window.mercuryPackages = {
32
+ development: {javascripts: 'mercury.js', stylesheets: 'mercury.css'},
33
+ bundled: {javascripts: 'javascripts/mercury.min.js,javascripts/mercury_dialogs.js', stylesheets: 'stylesheets/mercury.bundle.css'}
34
+ };
35
+
36
+
37
+ // ## Mercury Loader
38
+ (function() {
39
+ // Useragent detection, which we use to determine if the client is supported. We do this method instead of checking
40
+ // features because many of the features are supported in IE, but aren't implemented to the W3C spec.
41
+ var browser = {
42
+ webkit: /(webkit)[ \/]([\w.]+)/,
43
+ opera: /(opera)(?:.*version)?[ \/]([\w.]+)/,
44
+ msie: /(msie) ([\w.]+)/,
45
+ mozilla: /(mozilla)(?:.*? rv:([\w.]+))?/
46
+ };
47
+
48
+ var ua = navigator.userAgent.toLowerCase();
49
+ var match = browser.webkit.exec(ua) || browser.opera.exec(ua) || browser.msie.exec(ua) || ua.indexOf("compatible") < 0 && browser.mozilla.exec(ua) || [];
50
+ browser = {version: match[2] || "0" };
51
+ browser[match[1] || ""] = true;
52
+
53
+ // If the browser isn't supported, we don't try to do anything more. We do direct userAgent detection here because IE
54
+ // thinks it's supported but isn't -- in part because it has it's own implementation of the contentEditable spec.
55
+ if (document.getElementsByTagName && document.getElementById && document.designMode && !browser.konqueror && !browser.msie) {
56
+ // supported
57
+ } else {
58
+ return;
59
+ }
60
+
61
+ // Default options, which can be overridden by specifying them in query params to the loader script.
62
+ // You can provide any additional options to the loader, and they will be passed to the PageEditor instance when it's
63
+ // created, so for instance you could put `visible=false`, and the editor be hidden after it's created.
64
+ var options = {
65
+ // A path or url from which the javascripts and css should be loaded.
66
+ src: '/assets',
67
+ // A value defined in the packages above. Development is used by default. If you want to provide your own package
68
+ // you can just define one before including this script.
69
+ pack: 'development'
70
+ };
71
+
72
+ // Hide the document during loading so there isn't a flicker while mercury is being loaded.
73
+ var head = document.getElementsByTagName("head")[0];
74
+ if (window == top) {
75
+ var style = document.createElement('style');
76
+ var rules = document.createTextNode('body{visibility:hidden;display:none}');
77
+ style.type = 'text/css';
78
+ if (style.styleSheet) style.styleSheet.cssText = rules.nodeValue;
79
+ else style.appendChild(rules);
80
+ head.appendChild(style);
81
+ }
82
+
83
+ // Because Mercury loads the document it's going to edit into an iframe we do some tweaks to the current document to
84
+ // make that feel more seamless.
85
+ function loadMercury() {
86
+ if (document.mercuryLoaded) return;
87
+ if (timer) window.clearTimeout(timer);
88
+ document.mercuryLoaded = true;
89
+
90
+ // If the current window is the top window, it means that Mercury hasn't been loaded yet. So we load it.
91
+ if (window == top) {
92
+ var i;
93
+
94
+ // Find the loader script and determine what options were provided so the defaults can be overridden. To provide
95
+ // options just pass them in as query params (eg. `mercury_loader.js?src=/asset_path&pack=bundled`)
96
+ var scripts = document.getElementsByTagName('script');
97
+ for (i = 0; i <= scripts.length - 1; i += 1) {
98
+ var match = scripts[i].src.match(/mercury_loader\.js\??(.*)?$/);
99
+ if (!match || !match[1]) continue;
100
+
101
+ match[1].replace(/([^&=]*)=([^&=]*)/g, function (m, attr, value) {
102
+ if (['true', 'false'].indexOf(value) >= 0) value = JSON.parse(value);
103
+ options[attr] = value;
104
+ });
105
+ }
106
+
107
+ var pack = window.mercuryPackages[options.pack];
108
+ setTimeout(function() {
109
+ // Once we're ready to load Mercury we clear the document contents, and add in the css and javascript tags.
110
+ // Once the script has loaded we display the body again, and instantiate a new instance of Mercury.PageEditor.
111
+ document.body.innerHTML = '<div style="height:0;overflow:hidden;">Mercury</div>';
112
+ for (i = 0; i <= document.styleSheets.length - 1; i += 1) {
113
+ document.styleSheets[i].disabled = true;
114
+ }
115
+
116
+ // Load all the stylesheets.
117
+ var stylesheets = pack.stylesheets.split(',');
118
+ for (i = 0; i <= stylesheets.length - 1; i += 1) {
119
+ var link = document.createElement('link');
120
+ link.href = options.src + '/' + stylesheets[i];
121
+ link.media = 'screen';
122
+ link.rel = 'stylesheet';
123
+ link.type = 'text/css';
124
+ head.appendChild(link);
125
+ }
126
+
127
+ // Load all the javascripts.
128
+ var javascripts = pack.javascripts.split(',');
129
+ var loaded = 0;
130
+ function loadScript(src) {
131
+ var script = document.createElement('script');
132
+ script.src = options.src + '/' + src;
133
+ script.type = 'text/javascript';
134
+ script.charset = 'utf-8';
135
+ head.appendChild(script);
136
+ script.onload = function() {
137
+ loaded += 1;
138
+ if (loaded >= javascripts.length) {
139
+ document.body.style.visibility = 'visible';
140
+ document.body.style.display = 'block';
141
+ // Instantiate the PageEditor, passing in the options that were provided to the loader.
142
+ new Mercury.PageEditor(null, options);
143
+ // If there's a mercuryLoaded function available, call it. You can provide one before the loading script
144
+ // and it will be called after everything is loaded, but before everything is initialized. You can bind
145
+ // to the mercury:ready event or use Mercury.bind('ready', function() {}).
146
+ if (typeof(window.mercuryLoaded) == 'function') {
147
+ window.mercuryLoaded();
148
+ }
149
+ } else {
150
+ loadScript(javascripts[loaded]);
151
+ }
152
+ };
153
+ }
154
+ loadScript(javascripts[loaded]);
155
+ }, 1);
156
+ } else if (top.Mercury) {
157
+ // Since this file will be included in the iframe as well, we use it to tell Mercury that the document is ready to
158
+ // be worked on. By firing this event we're able to build the regions and get everything ready without having to
159
+ // wait for assets and slow javascripts to load or complete.
160
+ window.Mercury = top.Mercury;
161
+ Mercury.trigger('initialize:frame');
162
+ }
163
+ }
164
+
165
+ // This is a common technique for determining if the document has loaded yet, and is based on the methods used in
166
+ // Prototype.js. The following portions just call loadMercury once it's appropriate to do so.
167
+ //
168
+ // Support for the DOMContentLoaded event is based on work by Dan Webb, Matthias Miller, Dean Edwards, John Resig,
169
+ // and Diego Perini.
170
+ var timer;
171
+ function checkReadyState() {
172
+ if (document.readyState === 'complete') {
173
+ document.stopObserving('readystatechange', checkReadyState);
174
+ loadMercury();
175
+ }
176
+ }
177
+
178
+ function pollDoScroll() {
179
+ try { document.documentElement.doScroll('left'); }
180
+ catch(e) {
181
+ timer = pollDoScroll.defer();
182
+ return;
183
+ }
184
+ loadMercury();
185
+ }
186
+
187
+ if (document.addEventListener) {
188
+ document.addEventListener('DOMContentLoaded', loadMercury, false);
189
+ } else {
190
+ document.observe('readystatechange', checkReadyState);
191
+ if (window == top) { timer = pollDoScroll.defer(); }
192
+ }
193
+ })();
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Mercury Editor is a Coffeescript and jQuery based WYSIWYG editor. Documentation and other useful information can be
3
+ * found at https://github.com/jejacks0n/mercury
4
+ *
5
+ * This file is intended to provide a standard way to override or add JS that comes default with Mercury Editor.
6
+ */
@@ -0,0 +1,8 @@
1
+ //= require jquery
2
+ //= require jquery.purr
3
+ //= require best_in_place
4
+
5
+ $(document).ready(function() {
6
+ $('.best_in_place').best_in_place();
7
+ });
8
+
@@ -0,0 +1,89 @@
1
+ /*
2
+ * mercury.css
3
+ *----------------------------------------------------------------------------*/
4
+ form fieldset.buttons .commit input {
5
+ background-image: url(<%= asset_path 'mercury/button.png' %>);
6
+ }
7
+ /*
8
+ * dialog.css
9
+ *----------------------------------------------------------------------------*/
10
+ .mercury-dialog.loading,
11
+ .mercury-select.loading,
12
+ .mercury-palette.loading {
13
+ background-image: url(<%= asset_path 'mercury/loading-light.gif' %>);
14
+ }
15
+ .mercury-panel.loading {
16
+ background-image: url(<%= asset_path 'mercury/loading-dark.gif' %>);
17
+ }
18
+ .mercury-panel h1 a.mercury-panel-close {
19
+ background-image: url(<%= asset_path 'mercury/close.png' %>);
20
+ }
21
+ .mercury-snippet-panel input.filter {
22
+ background-image: url(<%= asset_path 'mercury/search-icon.png' %>);
23
+ background-position: 4px center;
24
+ }
25
+ /*
26
+ * lightview.css
27
+ *----------------------------------------------------------------------------*/
28
+ .mercury-lightview.loading {
29
+ background-image: url(<%= asset_path 'mercury/loading-dark.gif' %>);
30
+ }
31
+ .mercury-lightview h1.mercury-lightview-title a.mercury-lightview-close {
32
+ background-image: url(<%= asset_path 'mercury/close.png' %>);
33
+ }
34
+ #mercury_about {
35
+ background-image: url(<%= asset_path 'mercury/temp-logo.png' %>);
36
+ background-position: 0 0;
37
+ }
38
+ /*
39
+ * modal.css
40
+ *----------------------------------------------------------------------------*/
41
+ .mercury-modal.loading .mercury-modal-content-container {
42
+ background-image: url(<%= asset_path 'mercury/loading-light.gif' %>);
43
+ }
44
+ /*
45
+ * toolbar.css
46
+ *----------------------------------------------------------------------------*/
47
+ .mercury-primary-toolbar .mercury-button.pressed {
48
+ background-image: url(<%= asset_path 'mercury/toolbar/primary/_pressed.png' %>);
49
+ background-position: top center;
50
+ }
51
+ .mercury-primary-toolbar .mercury-toolbar-expander {
52
+ background-image: url(<%= asset_path 'mercury/toolbar/primary/_expander.png' %>);
53
+ background-position: center 90%;
54
+ }
55
+ .mercury-primary-toolbar .mercury-save-button em,
56
+ .mercury-expander-button[data-button=save] em { background-image: url(<%= asset_path 'mercury/toolbar/primary/save.png' %>) }
57
+ .mercury-primary-toolbar .mercury-preview-button em,
58
+ .mercury-expander-button[data-button=preview] em { background-image: url(<%= asset_path 'mercury/toolbar/primary/preview.png' %>) }
59
+ .mercury-primary-toolbar .mercury-undo-button em,
60
+ .mercury-expander-button[data-button=undo] em { background-image: url(<%= asset_path 'mercury/toolbar/primary/undo.png' %>) }
61
+ .mercury-primary-toolbar .mercury-redo-button em,
62
+ .mercury-expander-button[data-button=redo] em { background-image: url(<%= asset_path 'mercury/toolbar/primary/redo.png' %>) }
63
+ .mercury-primary-toolbar .mercury-insertLink-button em,
64
+ .mercury-expander-button[data-button=insertLink] em { background-image: url(<%= asset_path 'mercury/toolbar/primary/insertlink.png' %>) }
65
+ .mercury-primary-toolbar .mercury-insertMedia-button em,
66
+ .mercury-expander-button[data-button=insertMedia] em { background-image: url(<%= asset_path 'mercury/toolbar/primary/insertmedia.png' %>) }
67
+ .mercury-primary-toolbar .mercury-insertTable-button em,
68
+ .mercury-expander-button[data-button=insertTable] em { background-image: url(<%= asset_path 'mercury/toolbar/primary/inserttable.png' %>) }
69
+ .mercury-primary-toolbar .mercury-insertCharacter-button em,
70
+ .mercury-expander-button[data-button=insertCharacter] em { background-image: url(<%= asset_path 'mercury/toolbar/primary/insertcharacter.png' %>) }
71
+ .mercury-primary-toolbar .mercury-snippetPanel-button em,
72
+ .mercury-expander-button[data-button=snippetPanel] em { background-image: url(<%= asset_path 'mercury/toolbar/primary/snippetpanel.png' %>) }
73
+ .mercury-primary-toolbar .mercury-historyPanel-button em,
74
+ .mercury-expander-button[data-button=historyPanel] em { background-image: url(<%= asset_path 'mercury/toolbar/primary/historypanel.png' %>) }
75
+ .mercury-primary-toolbar .mercury-notesPanel-button em,
76
+ .mercury-expander-button[data-button=notesPanel] em { background-image: url(<%= asset_path 'mercury/toolbar/primary/notespanel.png' %>) }
77
+ .mercury-editable-toolbar .mercury-button {
78
+ background-image: url(<%= asset_path 'mercury/toolbar/editable/buttons.png' %>);
79
+ }
80
+ .mercury-editable-toolbar .mercury-button em {
81
+ background-image: url(<%= asset_path 'mercury/toolbar/editable/buttons.png' %>);
82
+ }
83
+
84
+ .mercury-snippet-toolbar .mercury-button {
85
+ background-image: url(<%= asset_path 'mercury/toolbar/snippetable/buttons.png' %>);
86
+ }
87
+ .mercury-snippet-toolbar .mercury-button em {
88
+ background-image: url(<%= asset_path 'mercury/toolbar/snippetable/buttons.png' %>);
89
+ }
@@ -0,0 +1,208 @@
1
+ /*
2
+ * Dialogs
3
+ *----------------------------------------------------------------------------*/
4
+ .mercury-dialog,
5
+ .mercury-select,
6
+ .mercury-palette {
7
+ -webkit-user-select: none;
8
+ -moz-user-select: none;
9
+ user-select: none;
10
+ position: absolute;
11
+ z-index: 10012;
12
+ width: 30px;
13
+ height: 30px;
14
+ border: 1px solid #727272;
15
+ border-radius: 2px;
16
+ -moz-border-radius: 2px;
17
+ margin-top: -1px;
18
+ background-color: #E2E1E2;
19
+ box-shadow: 1px 1px 4px rgba(0,0,0, .5);
20
+ -moz-box-shadow: 1px 1px 4px rgba(0,0,0, .5);
21
+ font-family: Helvetica, Tahoma, Arial, sans-serif;
22
+ font-size: 8.5pt;
23
+ }
24
+ .mercury-dialog.loading,
25
+ .mercury-select.loading,
26
+ .mercury-palette.loading {
27
+ background-repeat: no-repeat;
28
+ background-position: center;
29
+ }
30
+ /*
31
+ * Selects
32
+ *----------------------------------------------------------------------------*/
33
+ .mercury-select {
34
+ border-radius: 4px;
35
+ -moz-border-radius: 4px;
36
+ overflow: auto;
37
+ background-color: #FFF;
38
+ }
39
+ /*
40
+ * Panels
41
+ *----------------------------------------------------------------------------*/
42
+ .mercury-panel {
43
+ position: absolute;
44
+ z-index: 10011;
45
+ background-color: #111;
46
+ opacity: .9;
47
+ box-shadow: 1px 1px 4px rgba(0,0,0, .5);
48
+ -moz-box-shadow: 1px 1px 4px rgba(0,0,0, .5);
49
+ border-radius: 4px;
50
+ -moz-border-radius: 4px;
51
+ color: #FFF;
52
+ font-family: Helvetica, Tahoma, Arial, sans-serif;
53
+ font-size: 9.5pt;
54
+ max-width: 500px;
55
+ }
56
+ .mercury-panel.loading {
57
+ background-repeat: no-repeat;
58
+ background-position: center;
59
+ }
60
+ .mercury-panel h1,
61
+ .mercury-panel h3 {
62
+ font-size: 9pt;
63
+ padding: 10px 15px 8px;
64
+ margin: 0;
65
+ background: #333;
66
+ white-space: nowrap;
67
+ }
68
+ .mercury-panel h1 {
69
+ -webkit-user-select: none;
70
+ -moz-user-select: none;
71
+ user-select: none;
72
+ font-size: 10pt;
73
+ -moz-border-radius-topleft: 4px;
74
+ -moz-border-radius-topright: 4px;
75
+ border-top-left-radius: 4px;
76
+ border-top-right-radius: 4px;
77
+ height: 15px;
78
+ cursor: move;
79
+ text-shadow: 1px 1px 2px rgba(0,0,0, .9);
80
+ }
81
+ .mercury-panel h1 a.mercury-panel-close {
82
+ position: absolute;
83
+ right: -5px;
84
+ top: -4px;
85
+ width: 42px;
86
+ height: 42px;
87
+ cursor: default;
88
+ background-repeat: no-repeat;
89
+ background-position: center;
90
+ }
91
+ .mercury-panel h4,
92
+ .mercury-panel h5,
93
+ .mercury-panel h6 {
94
+ margin: 0;
95
+ }
96
+ .mercury-panel .mercury-panel-pane {
97
+ box-sizing: border-box;
98
+ -moz-box-sizing: border-box;
99
+ -webkit-box-sizing: border-box;
100
+ padding: 15px;
101
+ overflow-y: auto;
102
+ overflow-x: hidden;
103
+ width: 100%;
104
+ }
105
+ .mercury-panel .mercury-panel-pane h3 {
106
+ margin: 10px -15px;
107
+ font-size: 9.5pt;
108
+ font-weight: normal;
109
+ padding: 8px 14px;
110
+ }
111
+ /*
112
+ * Specific Dialogs (eg. color palettes, selects)
113
+ *----------------------------------------------------------------------------*/
114
+ .mercury-color-picker {
115
+ width: 170px;
116
+ height: auto;
117
+ padding: 1px;
118
+ cursor: default;
119
+ }
120
+ .mercury-color-picker .picker {
121
+ float: left;
122
+ width: 15px;
123
+ height: 15px;
124
+ margin: 1px;
125
+ }
126
+ .mercury-color-picker .picker:hover {
127
+ outline: 1px solid #333;
128
+ }
129
+ .mercury-color-picker .last-picked {
130
+ position: relative;
131
+ top: 1px;
132
+ width: 166px;
133
+ border: 1px solid #333;
134
+ border-radius: 2px;
135
+ margin: 1px 1px 2px 1px;
136
+ -moz-border-radius: 2px;
137
+ clear: left;
138
+ text-align: center;
139
+ }
140
+ .mercury-select-options {
141
+ margin: 10px 0;
142
+ white-space: nowrap;
143
+ }
144
+ .mercury-select-options * {
145
+ cursor: default;
146
+ padding: 0 10px;
147
+ margin: 0;
148
+ line-height: 1.6em;
149
+ }
150
+ .mercury-select-options div:hover,
151
+ .mercury-select-options h1:hover,
152
+ .mercury-select-options h2:hover,
153
+ .mercury-select-options h3:hover,
154
+ .mercury-select-options h4:hover,
155
+ .mercury-select-options h5:hover,
156
+ .mercury-select-options h6:hover,
157
+ .mercury-select-options pre:hover {
158
+ background-color: #E2E1E2 !important;
159
+ color: #000 !important;
160
+ }
161
+ .mercury-select-options div[data-tag=pre] {
162
+ font-family: monospace;
163
+ }
164
+ /*
165
+ * Specific Panels (eg. snippets, notes, todos)
166
+ *----------------------------------------------------------------------------*/
167
+ .mercury-snippet-panel {
168
+ width: 300px;
169
+ }
170
+ .mercury-snippet-panel input.filter {
171
+ outline: none;
172
+ font-size: 1em;
173
+ border-radius: 30px;
174
+ moz-border-radius: 30px;
175
+ box-sizing: border-box;
176
+ -moz-box-sizing: border-box;
177
+ -webkit-box-sizing: border-box;
178
+ width: 100%;
179
+ padding-left: 20px;
180
+ background-color: #FFF;
181
+ background-repeat: no-repeat;
182
+ }
183
+ .mercury-snippet-panel ul {
184
+ font-size: .9em;
185
+ padding: 10px 0 0 0;
186
+ margin: 0;
187
+ list-style-type: none;
188
+ }
189
+ .mercury-snippet-panel ul li {
190
+ clear: both;
191
+ padding-top: 20px;
192
+ }
193
+ .mercury-snippet-panel ul li img {
194
+ float: left;
195
+ }
196
+ .mercury-snippet-panel ul li h4,
197
+ .mercury-snippet-panel ul li .description {
198
+ float: right;
199
+ width: 245px;
200
+ }
201
+ .mercury-snippet-panel ul li h4 {
202
+ margin-bottom: 5px;
203
+ }
204
+ /* history / notes */
205
+ .mercury-history-panel,
206
+ .mercury-notes-panel {
207
+ width: 250px;
208
+ }
@@ -0,0 +1,151 @@
1
+ /*
2
+ * Lightview
3
+ *----------------------------------------------------------------------------*/
4
+ .mercury-lightview-overlay {
5
+ position: fixed;
6
+ z-index: 10030;
7
+ top: 0;
8
+ left: 0;
9
+ width: 100%;
10
+ height: 100%;
11
+ opacity: 0;
12
+ display: none;
13
+ background: rgba(0, 0, 0, .65);
14
+ }
15
+ .mercury-lightview {
16
+ position: fixed;
17
+ z-index: 10040;
18
+ top: 20px;
19
+ background: #000;
20
+ opacity: 0;
21
+ overflow: hidden;
22
+ display: none;
23
+ -webkit-border-radius: 10px;
24
+ -moz-border-radius: 10px;
25
+ border-radius: 10px;
26
+ -moz-box-shadow: 0 0 40px rgba(0, 0, 0, .9);
27
+ box-shadow: 0 0 40px rgba(0, 0, 0, .9);
28
+ font: normal normal normal 12px/normal Helvetica, Tahoma, Arial, sans-serif;
29
+ -moz-box-sizing: border-box;
30
+ box-sizing: border-box;
31
+ color: #CCC;
32
+ }
33
+ .mercury-lightview.loading {
34
+ background-repeat: no-repeat;
35
+ background-position: center;
36
+ }
37
+ .mercury-lightview .mercury-lightview-content {
38
+ padding: 10px 20px 20px;
39
+ }
40
+ .mercury-lightview h1.mercury-lightview-title {
41
+ margin: 0;
42
+ padding: 10px 20px 8px;
43
+ border-bottom: 1px solid #222;
44
+ color: #FFF;
45
+ -webkit-user-select: none;
46
+ -moz-user-select: none;
47
+ user-select: none;
48
+ font-size: 10pt;
49
+ white-space: nowrap;
50
+ text-shadow: 1px 1px 2px rgba(100, 100, 100, .5);
51
+ }
52
+ .mercury-lightview h1.mercury-lightview-title a.mercury-lightview-close {
53
+ float: right;
54
+ width: 32px;
55
+ height: 42px;
56
+ margin: -14px -20px;
57
+ background-repeat: no-repeat;
58
+ background-position: center;
59
+ }
60
+ .mercury-lightview .mercury-display-pane-container {
61
+ overflow: auto;
62
+ margin: -10px -20px 0;
63
+ padding: 20px 20px 10px;
64
+ }
65
+ .mercury-lightview .mercury-display-pane-container .mercury-display-pane {
66
+ float: left;
67
+ }
68
+ .mercury-lightview .mercury-display-controls {
69
+ padding: 15px 0 0;
70
+ border-top: 1px solid #333;
71
+ text-align: right;
72
+ }
73
+ /*
74
+ * Forms
75
+ *----------------------------------------------------------------------------*/
76
+ .mercury-lightview form fieldset {
77
+ background: #111;
78
+ border: 1px solid #333;
79
+ }
80
+ .mercury-lightview form fieldset.buttons {
81
+ background: none;
82
+ border: none;
83
+ }
84
+ .mercury-lightview form select,
85
+ .mercury-lightview form input[type="text"],
86
+ .mercury-lightview form input[type="password"],
87
+ .mercury-lightview form textarea,
88
+ .mercury-lightview form input.text {
89
+ background: #444;
90
+ color: #FFF;
91
+ border: 2px solid #555;
92
+ -moz-box-shadow: inset 0 0 3px #000000;
93
+ -webkit-box-shadow: inset 0 0 3px #000000;
94
+ box-shadow: inset 0 0 3px #000000;
95
+ }
96
+ .mercury-lightview form input[type="button"] {
97
+ border: 2px solid #555;
98
+ border-radius: 4px;
99
+ background: #222;
100
+ color: #FFF;
101
+ }
102
+ .mercury-lightview hr {
103
+ border-color: #333;
104
+ }
105
+ /*
106
+ * Specific Lightviews
107
+ *----------------------------------------------------------------------------*/
108
+ /* about mercury */
109
+ #mercury_about {
110
+ width: 300px;
111
+ min-height: 100px;
112
+ font-size: 1.1em;
113
+ background-repeat: no-repeat;
114
+ }
115
+ #mercury_about ul {
116
+ float: left;
117
+ list-style: none;
118
+ padding: 0;
119
+ margin: 118px 0 0 0;
120
+ width: 120px;
121
+ text-align: center;
122
+ }
123
+ #mercury_about p {
124
+ margin: 0;
125
+ float: right;
126
+ width: 175px;
127
+ }
128
+ #mercury_about a {
129
+ color: #09F;
130
+ }
131
+ #mercury_about a:hover {
132
+ color: #FFF;
133
+ }
134
+ /* character */
135
+ .mercury-lightview #mercury_character .character {
136
+ border: 1px solid #444;
137
+ background: #222;
138
+ }
139
+ .mercury-lightview #mercury_character .character:hover {
140
+ background: #555;
141
+ border: 1px solid #CCC;
142
+ }
143
+ /* table */
144
+ .mercury-lightview #mercury_table #table_display {
145
+ background: #222;
146
+ border: 1px solid #444;
147
+ height: 301px;
148
+ }
149
+ .mercury-lightview #mercury_table #table_display td.selected {
150
+ background: #09F;
151
+ }