kuji-mercury-rails 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. data/LICENSE +25 -0
  2. data/POST_INSTALL +15 -0
  3. data/app/controllers/mercury/images_controller.rb +19 -0
  4. data/app/controllers/mercury_controller.rb +34 -0
  5. data/app/models/mercury/image.rb +16 -0
  6. data/app/views/layouts/mercury.html.erb +33 -0
  7. data/app/views/mercury/lightviews/about.html +11 -0
  8. data/app/views/mercury/modals/character.html +255 -0
  9. data/app/views/mercury/modals/htmleditor.html +13 -0
  10. data/app/views/mercury/modals/link.html +75 -0
  11. data/app/views/mercury/modals/media.html +82 -0
  12. data/app/views/mercury/modals/table.html +84 -0
  13. data/app/views/mercury/palettes/backcolor.html +73 -0
  14. data/app/views/mercury/palettes/forecolor.html +73 -0
  15. data/app/views/mercury/panels/history.html +3 -0
  16. data/app/views/mercury/panels/notes.html +3 -0
  17. data/app/views/mercury/panels/snippets.html +12 -0
  18. data/app/views/mercury/selects/formatblock.html +11 -0
  19. data/app/views/mercury/selects/style.html +5 -0
  20. data/app/views/mercury/snippets/example/options.html.erb +34 -0
  21. data/app/views/mercury/snippets/example/preview.html.erb +1 -0
  22. data/config/engine.rb +41 -0
  23. data/db/migrate/20110526035601_create_mercury_images.rb +11 -0
  24. data/features/loading/loading.feature +22 -0
  25. data/features/loading/navigating.feature +77 -0
  26. data/features/loading/user_interface.feature +67 -0
  27. data/features/regions/editable/advanced_editing.feature +0 -0
  28. data/features/regions/editable/basic_editing.feature +195 -0
  29. data/features/regions/editable/inserting_links.feature +98 -0
  30. data/features/regions/editable/inserting_media.feature +110 -0
  31. data/features/regions/editable/inserting_snippets.feature +102 -0
  32. data/features/regions/editable/inserting_special_characters.feature +24 -0
  33. data/features/regions/editable/inserting_tables.feature +109 -0
  34. data/features/regions/editable/pasting.feature +0 -0
  35. data/features/regions/editable/uploading_images.feature +0 -0
  36. data/features/regions/image/uploading_images.feature +0 -0
  37. data/features/regions/markupable/advanced_editing.feature +0 -0
  38. data/features/regions/markupable/basic_editing.feature +0 -0
  39. data/features/regions/markupable/inserting_links.feature +0 -0
  40. data/features/regions/markupable/inserting_media.feature +0 -0
  41. data/features/regions/markupable/inserting_snippets.feature +0 -0
  42. data/features/regions/markupable/inserting_special_characters.feature +0 -0
  43. data/features/regions/markupable/inserting_tables.feature +0 -0
  44. data/features/regions/markupable/uploading_images.feature +0 -0
  45. data/features/regions/simple/basic_editing.feature +5 -0
  46. data/features/regions/snippetable/advanced_editing.feature +0 -0
  47. data/features/regions/snippetable/basic_editing.feature +0 -0
  48. data/features/regions/snippetable/inserting_snippets.feature +0 -0
  49. data/features/saving/saving.feature +33 -0
  50. data/features/step_definitions/debug_steps.rb +14 -0
  51. data/features/step_definitions/mercury_steps.rb +438 -0
  52. data/features/step_definitions/web_steps.rb +211 -0
  53. data/features/support/env.rb +46 -0
  54. data/features/support/mercury_contents.rb +25 -0
  55. data/features/support/mercury_selectors.rb +148 -0
  56. data/features/support/paths.rb +38 -0
  57. data/features/support/selectors.rb +44 -0
  58. data/lib/generators/mercury/install/install_generator.rb +49 -0
  59. data/lib/generators/mercury/install/templates/mongoid_paperclip_image.rb +17 -0
  60. data/lib/mercury-rails.rb +3 -0
  61. data/lib/mercury/authentication.rb +8 -0
  62. data/spec/javascripts/mercury/dialog_spec.js.coffee +281 -0
  63. data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +37 -0
  64. data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +37 -0
  65. data/spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee +25 -0
  66. data/spec/javascripts/mercury/dialogs/snippetpanel_spec.js.coffee +30 -0
  67. data/spec/javascripts/mercury/dialogs/style_spec.js.coffee +25 -0
  68. data/spec/javascripts/mercury/history_buffer_spec.js.coffee +76 -0
  69. data/spec/javascripts/mercury/lightview_spec.js.coffee +497 -0
  70. data/spec/javascripts/mercury/mercury_spec.js.coffee +132 -0
  71. data/spec/javascripts/mercury/modal_spec.js.coffee +504 -0
  72. data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +30 -0
  73. data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +29 -0
  74. data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +220 -0
  75. data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +167 -0
  76. data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +52 -0
  77. data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +160 -0
  78. data/spec/javascripts/mercury/native_extensions_spec.js.coffee +60 -0
  79. data/spec/javascripts/mercury/page_editor_spec.js.coffee +757 -0
  80. data/spec/javascripts/mercury/palette_spec.js.coffee +49 -0
  81. data/spec/javascripts/mercury/panel_spec.js.coffee +183 -0
  82. data/spec/javascripts/mercury/region_spec.js.coffee +298 -0
  83. data/spec/javascripts/mercury/regions/editable_spec.js.coffee +561 -0
  84. data/spec/javascripts/mercury/regions/image_spec.js.coffee +34 -0
  85. data/spec/javascripts/mercury/regions/markupable_spec.js.coffee +367 -0
  86. data/spec/javascripts/mercury/regions/simple_spec.js.coffee +33 -0
  87. data/spec/javascripts/mercury/regions/snippetable_spec.js.coffee +370 -0
  88. data/spec/javascripts/mercury/select_spec.js.coffee +49 -0
  89. data/spec/javascripts/mercury/snippet_spec.js.coffee +253 -0
  90. data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +184 -0
  91. data/spec/javascripts/mercury/statusbar_spec.js.coffee +150 -0
  92. data/spec/javascripts/mercury/table_editor_spec.js.coffee +194 -0
  93. data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +90 -0
  94. data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +360 -0
  95. data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +118 -0
  96. data/spec/javascripts/mercury/toolbar_spec.js.coffee +222 -0
  97. data/spec/javascripts/mercury/tooltip_spec.js.coffee +186 -0
  98. data/spec/javascripts/mercury/uploader_spec.js.coffee +530 -0
  99. data/spec/javascripts/spec_helper.js +513 -0
  100. data/spec/javascripts/templates/mercury/dialog.html +2 -0
  101. data/spec/javascripts/templates/mercury/dialogs/backcolor.html +5 -0
  102. data/spec/javascripts/templates/mercury/dialogs/forecolor.html +5 -0
  103. data/spec/javascripts/templates/mercury/dialogs/formatblock.html +3 -0
  104. data/spec/javascripts/templates/mercury/dialogs/snippetpanel.html +16 -0
  105. data/spec/javascripts/templates/mercury/dialogs/style.html +3 -0
  106. data/spec/javascripts/templates/mercury/lightview.html +13 -0
  107. data/spec/javascripts/templates/mercury/modal.html +13 -0
  108. data/spec/javascripts/templates/mercury/modals/htmleditor.html +5 -0
  109. data/spec/javascripts/templates/mercury/modals/insertcharacter.html +5 -0
  110. data/spec/javascripts/templates/mercury/modals/insertlink.html +30 -0
  111. data/spec/javascripts/templates/mercury/modals/insertmedia.html +35 -0
  112. data/spec/javascripts/templates/mercury/modals/insertsnippet.html +6 -0
  113. data/spec/javascripts/templates/mercury/modals/inserttable.html +27 -0
  114. data/spec/javascripts/templates/mercury/page_editor.html +35 -0
  115. data/spec/javascripts/templates/mercury/palette.html +16 -0
  116. data/spec/javascripts/templates/mercury/panel.html +16 -0
  117. data/spec/javascripts/templates/mercury/region.html +2 -0
  118. data/spec/javascripts/templates/mercury/regions/editable.html +3 -0
  119. data/spec/javascripts/templates/mercury/regions/image.html +1 -0
  120. data/spec/javascripts/templates/mercury/regions/simple.html +3 -0
  121. data/spec/javascripts/templates/mercury/regions/snippetable.html +4 -0
  122. data/spec/javascripts/templates/mercury/select.html +16 -0
  123. data/spec/javascripts/templates/mercury/snippet.html +1 -0
  124. data/spec/javascripts/templates/mercury/snippet_toolbar.html +16 -0
  125. data/spec/javascripts/templates/mercury/statusbar.html +8 -0
  126. data/spec/javascripts/templates/mercury/table_editor.html +65 -0
  127. data/spec/javascripts/templates/mercury/toolbar.button.html +64 -0
  128. data/spec/javascripts/templates/mercury/toolbar.button_group.html +9 -0
  129. data/spec/javascripts/templates/mercury/toolbar.expander.html +18 -0
  130. data/spec/javascripts/templates/mercury/toolbar.html +11 -0
  131. data/spec/javascripts/templates/mercury/tooltip.html +12 -0
  132. data/spec/javascripts/templates/mercury/uploader.html +11 -0
  133. data/vendor/assets/images/mercury/button.png +0 -0
  134. data/vendor/assets/images/mercury/close.png +0 -0
  135. data/vendor/assets/images/mercury/default-snippet.png +0 -0
  136. data/vendor/assets/images/mercury/loading-dark.gif +0 -0
  137. data/vendor/assets/images/mercury/loading-light.gif +0 -0
  138. data/vendor/assets/images/mercury/missing-image.png +0 -0
  139. data/vendor/assets/images/mercury/search-icon.png +0 -0
  140. data/vendor/assets/images/mercury/temp-logo.png +0 -0
  141. data/vendor/assets/images/mercury/toolbar/editable/buttons.png +0 -0
  142. data/vendor/assets/images/mercury/toolbar/primary/_expander.png +0 -0
  143. data/vendor/assets/images/mercury/toolbar/primary/_pressed.png +0 -0
  144. data/vendor/assets/images/mercury/toolbar/primary/historypanel.png +0 -0
  145. data/vendor/assets/images/mercury/toolbar/primary/insertcharacter.png +0 -0
  146. data/vendor/assets/images/mercury/toolbar/primary/insertlink.png +0 -0
  147. data/vendor/assets/images/mercury/toolbar/primary/insertmedia.png +0 -0
  148. data/vendor/assets/images/mercury/toolbar/primary/inserttable.png +0 -0
  149. data/vendor/assets/images/mercury/toolbar/primary/inspectorpanel.png +0 -0
  150. data/vendor/assets/images/mercury/toolbar/primary/notespanel.png +0 -0
  151. data/vendor/assets/images/mercury/toolbar/primary/preview.png +0 -0
  152. data/vendor/assets/images/mercury/toolbar/primary/redo.png +0 -0
  153. data/vendor/assets/images/mercury/toolbar/primary/save.png +0 -0
  154. data/vendor/assets/images/mercury/toolbar/primary/snippetpanel.png +0 -0
  155. data/vendor/assets/images/mercury/toolbar/primary/undo.png +0 -0
  156. data/vendor/assets/images/mercury/toolbar/snippetable/buttons.png +0 -0
  157. data/vendor/assets/javascripts/mercury.js +479 -0
  158. data/vendor/assets/javascripts/mercury/dependencies/jquery-1.7.js +9300 -0
  159. data/vendor/assets/javascripts/mercury/dependencies/jquery-ui-1.8.13.custom.js +1328 -0
  160. data/vendor/assets/javascripts/mercury/dependencies/jquery.additions.js +206 -0
  161. data/vendor/assets/javascripts/mercury/dependencies/jquery.htmlClean.js +527 -0
  162. data/vendor/assets/javascripts/mercury/dependencies/liquidmetal.js +88 -0
  163. data/vendor/assets/javascripts/mercury/dependencies/showdown.js +1340 -0
  164. data/vendor/assets/javascripts/mercury/dialog.js.coffee +159 -0
  165. data/vendor/assets/javascripts/mercury/dialogs/backcolor.js.coffee +6 -0
  166. data/vendor/assets/javascripts/mercury/dialogs/forecolor.js.coffee +6 -0
  167. data/vendor/assets/javascripts/mercury/dialogs/formatblock.js.coffee +4 -0
  168. data/vendor/assets/javascripts/mercury/dialogs/snippetpanel.js.coffee +10 -0
  169. data/vendor/assets/javascripts/mercury/dialogs/style.js.coffee +4 -0
  170. data/vendor/assets/javascripts/mercury/finalize.js.coffee +3 -0
  171. data/vendor/assets/javascripts/mercury/history_buffer.js.coffee +30 -0
  172. data/vendor/assets/javascripts/mercury/lightview.js.coffee +205 -0
  173. data/vendor/assets/javascripts/mercury/locales/ar.locale.js.coffee +207 -0
  174. data/vendor/assets/javascripts/mercury/locales/da.locale.js.coffee +211 -0
  175. data/vendor/assets/javascripts/mercury/locales/de.locale.js.coffee +206 -0
  176. data/vendor/assets/javascripts/mercury/locales/es.locale.js.coffee +211 -0
  177. data/vendor/assets/javascripts/mercury/locales/example.local.js.coffee +211 -0
  178. data/vendor/assets/javascripts/mercury/locales/fr.locale.js.coffee +211 -0
  179. data/vendor/assets/javascripts/mercury/locales/it.locale.js.coffee +208 -0
  180. data/vendor/assets/javascripts/mercury/locales/ko.local.js.coffee +206 -0
  181. data/vendor/assets/javascripts/mercury/locales/nl.locale.js.coffee +206 -0
  182. data/vendor/assets/javascripts/mercury/locales/pt.locale.js.coffee +211 -0
  183. data/vendor/assets/javascripts/mercury/locales/sv.local.js.coffee +209 -0
  184. data/vendor/assets/javascripts/mercury/locales/swedish_chef.locale.js.coffee +213 -0
  185. data/vendor/assets/javascripts/mercury/mercury.js.coffee +109 -0
  186. data/vendor/assets/javascripts/mercury/modal.js.coffee +198 -0
  187. data/vendor/assets/javascripts/mercury/modals/htmleditor.js.coffee +11 -0
  188. data/vendor/assets/javascripts/mercury/modals/insertcharacter.js.coffee +4 -0
  189. data/vendor/assets/javascripts/mercury/modals/insertlink.js.coffee +92 -0
  190. data/vendor/assets/javascripts/mercury/modals/insertmedia.js.coffee +81 -0
  191. data/vendor/assets/javascripts/mercury/modals/insertsnippet.js.coffee +12 -0
  192. data/vendor/assets/javascripts/mercury/modals/inserttable.js.coffee +54 -0
  193. data/vendor/assets/javascripts/mercury/native_extensions.js.coffee +55 -0
  194. data/vendor/assets/javascripts/mercury/page_editor.js.coffee +225 -0
  195. data/vendor/assets/javascripts/mercury/palette.js.coffee +29 -0
  196. data/vendor/assets/javascripts/mercury/panel.js.coffee +115 -0
  197. data/vendor/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +28 -0
  198. data/vendor/assets/javascripts/mercury/plugins/save_as_xml/plugin.js +9 -0
  199. data/vendor/assets/javascripts/mercury/region.js.coffee +107 -0
  200. data/vendor/assets/javascripts/mercury/regions/editable.js.coffee +600 -0
  201. data/vendor/assets/javascripts/mercury/regions/image.js.coffee +114 -0
  202. data/vendor/assets/javascripts/mercury/regions/markupable.js.coffee +398 -0
  203. data/vendor/assets/javascripts/mercury/regions/simple.js.coffee +325 -0
  204. data/vendor/assets/javascripts/mercury/regions/snippetable.js.coffee +124 -0
  205. data/vendor/assets/javascripts/mercury/select.js.coffee +44 -0
  206. data/vendor/assets/javascripts/mercury/snippet.js.coffee +106 -0
  207. data/vendor/assets/javascripts/mercury/snippet_toolbar.js.coffee +72 -0
  208. data/vendor/assets/javascripts/mercury/statusbar.js.coffee +51 -0
  209. data/vendor/assets/javascripts/mercury/support/history.js +1 -0
  210. data/vendor/assets/javascripts/mercury/table_editor.js.coffee +265 -0
  211. data/vendor/assets/javascripts/mercury/toolbar.button.js.coffee +173 -0
  212. data/vendor/assets/javascripts/mercury/toolbar.button_group.js.coffee +42 -0
  213. data/vendor/assets/javascripts/mercury/toolbar.expander.js.coffee +56 -0
  214. data/vendor/assets/javascripts/mercury/toolbar.js.coffee +86 -0
  215. data/vendor/assets/javascripts/mercury/tooltip.js.coffee +74 -0
  216. data/vendor/assets/javascripts/mercury/uploader.js.coffee +244 -0
  217. data/vendor/assets/javascripts/mercury_loader.js +193 -0
  218. data/vendor/assets/javascripts/mercury_overrides.js +6 -0
  219. data/vendor/assets/stylesheets/mercury.css +28 -0
  220. data/vendor/assets/stylesheets/mercury/all_images.css.erb +89 -0
  221. data/vendor/assets/stylesheets/mercury/dialog.css +212 -0
  222. data/vendor/assets/stylesheets/mercury/form.css +118 -0
  223. data/vendor/assets/stylesheets/mercury/lightview.css +151 -0
  224. data/vendor/assets/stylesheets/mercury/mercury.css +37 -0
  225. data/vendor/assets/stylesheets/mercury/modal.css +183 -0
  226. data/vendor/assets/stylesheets/mercury/statusbar.css +32 -0
  227. data/vendor/assets/stylesheets/mercury/toolbar.css +304 -0
  228. data/vendor/assets/stylesheets/mercury/tooltip.css +26 -0
  229. data/vendor/assets/stylesheets/mercury/uploader.css +111 -0
  230. data/vendor/assets/stylesheets/mercury_overrides.css +17 -0
  231. metadata +572 -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,28 @@
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
+ *= require_self
26
+ *= require mercury/mercury
27
+ */
28
+
@@ -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,212 @@
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 span {
82
+ display: block;
83
+ width: 100%;
84
+ }
85
+ .mercury-panel h1 a.mercury-panel-close {
86
+ position: absolute;
87
+ right: -5px;
88
+ top: -4px;
89
+ width: 42px;
90
+ height: 42px;
91
+ cursor: default;
92
+ background-repeat: no-repeat;
93
+ background-position: center;
94
+ }
95
+ .mercury-panel h4,
96
+ .mercury-panel h5,
97
+ .mercury-panel h6 {
98
+ margin: 0;
99
+ }
100
+ .mercury-panel .mercury-panel-pane {
101
+ box-sizing: border-box;
102
+ -moz-box-sizing: border-box;
103
+ -webkit-box-sizing: border-box;
104
+ padding: 15px;
105
+ overflow-y: auto;
106
+ overflow-x: hidden;
107
+ width: 100%;
108
+ }
109
+ .mercury-panel .mercury-panel-pane h3 {
110
+ margin: 10px -15px;
111
+ font-size: 9.5pt;
112
+ font-weight: normal;
113
+ padding: 8px 14px;
114
+ }
115
+ /*
116
+ * Specific Dialogs (eg. color palettes, selects)
117
+ *----------------------------------------------------------------------------*/
118
+ .mercury-color-picker {
119
+ width: 170px;
120
+ height: auto;
121
+ padding: 1px;
122
+ cursor: default;
123
+ }
124
+ .mercury-color-picker .picker {
125
+ float: left;
126
+ width: 15px;
127
+ height: 15px;
128
+ margin: 1px;
129
+ }
130
+ .mercury-color-picker .picker:hover {
131
+ outline: 1px solid #333;
132
+ }
133
+ .mercury-color-picker .last-picked {
134
+ position: relative;
135
+ top: 1px;
136
+ width: 166px;
137
+ border: 1px solid #333;
138
+ border-radius: 2px;
139
+ margin: 1px 1px 2px 1px;
140
+ -moz-border-radius: 2px;
141
+ clear: left;
142
+ text-align: center;
143
+ }
144
+ .mercury-select-options {
145
+ margin: 10px 0;
146
+ white-space: nowrap;
147
+ }
148
+ .mercury-select-options * {
149
+ cursor: default;
150
+ padding: 0 10px;
151
+ margin: 0;
152
+ line-height: 1.6em;
153
+ }
154
+ .mercury-select-options div:hover,
155
+ .mercury-select-options h1:hover,
156
+ .mercury-select-options h2:hover,
157
+ .mercury-select-options h3:hover,
158
+ .mercury-select-options h4:hover,
159
+ .mercury-select-options h5:hover,
160
+ .mercury-select-options h6:hover,
161
+ .mercury-select-options pre:hover {
162
+ background-color: #E2E1E2 !important;
163
+ color: #000 !important;
164
+ }
165
+ .mercury-select-options div[data-tag=pre] {
166
+ font-family: monospace;
167
+ }
168
+ /*
169
+ * Specific Panels (eg. snippets, notes, todos)
170
+ *----------------------------------------------------------------------------*/
171
+ .mercury-snippet-panel {
172
+ width: 300px;
173
+ }
174
+ .mercury-snippet-panel input.filter {
175
+ outline: none;
176
+ font-size: 1em;
177
+ border-radius: 30px;
178
+ moz-border-radius: 30px;
179
+ box-sizing: border-box;
180
+ -moz-box-sizing: border-box;
181
+ -webkit-box-sizing: border-box;
182
+ width: 100%;
183
+ padding-left: 20px;
184
+ background-color: #FFF;
185
+ background-repeat: no-repeat;
186
+ }
187
+ .mercury-snippet-panel ul {
188
+ font-size: .9em;
189
+ padding: 10px 0 0 0;
190
+ margin: 0;
191
+ list-style-type: none;
192
+ }
193
+ .mercury-snippet-panel ul li {
194
+ clear: both;
195
+ padding-top: 20px;
196
+ }
197
+ .mercury-snippet-panel ul li img {
198
+ float: left;
199
+ }
200
+ .mercury-snippet-panel ul li h4,
201
+ .mercury-snippet-panel ul li .description {
202
+ float: right;
203
+ width: 245px;
204
+ }
205
+ .mercury-snippet-panel ul li h4 {
206
+ margin-bottom: 5px;
207
+ }
208
+ /* history / notes */
209
+ .mercury-history-panel,
210
+ .mercury-notes-panel {
211
+ width: 250px;
212
+ }