mirador_rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +13 -0
  7. data/README.md +97 -0
  8. data/Rakefile +6 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/lib/mirador_rails.rb +16 -0
  12. data/lib/mirador_rails/version.rb +3 -0
  13. data/lib/mirador_rails/view_helpers.rb +30 -0
  14. data/mirador_rails.gemspec +30 -0
  15. data/vendor/assets/images/border_type_1.png +0 -0
  16. data/vendor/assets/images/border_type_2.png +0 -0
  17. data/vendor/assets/images/border_type_3.png +0 -0
  18. data/vendor/assets/images/debut_dark.png +0 -0
  19. data/vendor/assets/javascripts/mirador.js +1 -0
  20. data/vendor/assets/javascripts/mirador.min.js +88 -0
  21. data/vendor/assets/javascripts/mirador.min.js.map +1 -0
  22. data/vendor/assets/locales/ar/translation.json +42 -0
  23. data/vendor/assets/locales/de/translation.json +77 -0
  24. data/vendor/assets/locales/en/translation.json +82 -0
  25. data/vendor/assets/locales/es/translation.json +35 -0
  26. data/vendor/assets/locales/fr/translation.json +77 -0
  27. data/vendor/assets/locales/ga/translation.json +39 -0
  28. data/vendor/assets/locales/ja/translation.json +82 -0
  29. data/vendor/assets/locales/ko/translation.json +74 -0
  30. data/vendor/assets/locales/nl/translation.json +39 -0
  31. data/vendor/assets/locales/zh-CN/translation.json +74 -0
  32. data/vendor/assets/locales/zh-TW/translation.json +74 -0
  33. data/vendor/assets/locales/zh/translation.json +74 -0
  34. data/vendor/assets/plugins/plugins/advlist/plugin.js +97 -0
  35. data/vendor/assets/plugins/plugins/advlist/plugin.min.js +1 -0
  36. data/vendor/assets/plugins/plugins/anchor/plugin.js +45 -0
  37. data/vendor/assets/plugins/plugins/anchor/plugin.min.js +1 -0
  38. data/vendor/assets/plugins/plugins/autolink/plugin.js +194 -0
  39. data/vendor/assets/plugins/plugins/autolink/plugin.min.js +1 -0
  40. data/vendor/assets/plugins/plugins/autoresize/plugin.js +152 -0
  41. data/vendor/assets/plugins/plugins/autoresize/plugin.min.js +1 -0
  42. data/vendor/assets/plugins/plugins/autosave/plugin.js +165 -0
  43. data/vendor/assets/plugins/plugins/autosave/plugin.min.js +1 -0
  44. data/vendor/assets/plugins/plugins/bbcode/plugin.js +123 -0
  45. data/vendor/assets/plugins/plugins/bbcode/plugin.min.js +1 -0
  46. data/vendor/assets/plugins/plugins/charmap/plugin.js +370 -0
  47. data/vendor/assets/plugins/plugins/charmap/plugin.min.js +1 -0
  48. data/vendor/assets/plugins/plugins/code/plugin.js +60 -0
  49. data/vendor/assets/plugins/plugins/code/plugin.min.js +1 -0
  50. data/vendor/assets/plugins/plugins/colorpicker/plugin.js +112 -0
  51. data/vendor/assets/plugins/plugins/colorpicker/plugin.min.js +1 -0
  52. data/vendor/assets/plugins/plugins/compat3x/css/dialog.css +118 -0
  53. data/vendor/assets/plugins/plugins/compat3x/img/buttons.png +0 -0
  54. data/vendor/assets/plugins/plugins/compat3x/img/icons.gif +0 -0
  55. data/vendor/assets/plugins/plugins/compat3x/img/items.gif +0 -0
  56. data/vendor/assets/plugins/plugins/compat3x/img/menu_arrow.gif +0 -0
  57. data/vendor/assets/plugins/plugins/compat3x/img/menu_check.gif +0 -0
  58. data/vendor/assets/plugins/plugins/compat3x/img/progress.gif +0 -0
  59. data/vendor/assets/plugins/plugins/compat3x/img/tabs.gif +0 -0
  60. data/vendor/assets/plugins/plugins/compat3x/plugin.js +297 -0
  61. data/vendor/assets/plugins/plugins/compat3x/plugin.min.js +1 -0
  62. data/vendor/assets/plugins/plugins/compat3x/tiny_mce_popup.js +542 -0
  63. data/vendor/assets/plugins/plugins/compat3x/utils/editable_selects.js +70 -0
  64. data/vendor/assets/plugins/plugins/compat3x/utils/form_utils.js +210 -0
  65. data/vendor/assets/plugins/plugins/compat3x/utils/mctabs.js +164 -0
  66. data/vendor/assets/plugins/plugins/compat3x/utils/validate.js +252 -0
  67. data/vendor/assets/plugins/plugins/contextmenu/plugin.js +87 -0
  68. data/vendor/assets/plugins/plugins/contextmenu/plugin.min.js +1 -0
  69. data/vendor/assets/plugins/plugins/directionality/plugin.js +64 -0
  70. data/vendor/assets/plugins/plugins/directionality/plugin.min.js +1 -0
  71. data/vendor/assets/plugins/plugins/emoticons/img/smiley-cool.gif +0 -0
  72. data/vendor/assets/plugins/plugins/emoticons/img/smiley-cry.gif +0 -0
  73. data/vendor/assets/plugins/plugins/emoticons/img/smiley-embarassed.gif +0 -0
  74. data/vendor/assets/plugins/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
  75. data/vendor/assets/plugins/plugins/emoticons/img/smiley-frown.gif +0 -0
  76. data/vendor/assets/plugins/plugins/emoticons/img/smiley-innocent.gif +0 -0
  77. data/vendor/assets/plugins/plugins/emoticons/img/smiley-kiss.gif +0 -0
  78. data/vendor/assets/plugins/plugins/emoticons/img/smiley-laughing.gif +0 -0
  79. data/vendor/assets/plugins/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
  80. data/vendor/assets/plugins/plugins/emoticons/img/smiley-sealed.gif +0 -0
  81. data/vendor/assets/plugins/plugins/emoticons/img/smiley-smile.gif +0 -0
  82. data/vendor/assets/plugins/plugins/emoticons/img/smiley-surprised.gif +0 -0
  83. data/vendor/assets/plugins/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
  84. data/vendor/assets/plugins/plugins/emoticons/img/smiley-undecided.gif +0 -0
  85. data/vendor/assets/plugins/plugins/emoticons/img/smiley-wink.gif +0 -0
  86. data/vendor/assets/plugins/plugins/emoticons/img/smiley-yell.gif +0 -0
  87. data/vendor/assets/plugins/plugins/emoticons/plugin.js +65 -0
  88. data/vendor/assets/plugins/plugins/emoticons/plugin.min.js +1 -0
  89. data/vendor/assets/plugins/plugins/example/dialog.html +8 -0
  90. data/vendor/assets/plugins/plugins/example/plugin.js +68 -0
  91. data/vendor/assets/plugins/plugins/example/plugin.min.js +1 -0
  92. data/vendor/assets/plugins/plugins/example_dependency/plugin.js +22 -0
  93. data/vendor/assets/plugins/plugins/example_dependency/plugin.min.js +1 -0
  94. data/vendor/assets/plugins/plugins/fullpage/plugin.js +490 -0
  95. data/vendor/assets/plugins/plugins/fullpage/plugin.min.js +1 -0
  96. data/vendor/assets/plugins/plugins/fullscreen/plugin.js +136 -0
  97. data/vendor/assets/plugins/plugins/fullscreen/plugin.min.js +1 -0
  98. data/vendor/assets/plugins/plugins/hr/plugin.js +30 -0
  99. data/vendor/assets/plugins/plugins/hr/plugin.min.js +1 -0
  100. data/vendor/assets/plugins/plugins/image/plugin.js +439 -0
  101. data/vendor/assets/plugins/plugins/image/plugin.min.js +1 -0
  102. data/vendor/assets/plugins/plugins/importcss/plugin.js +195 -0
  103. data/vendor/assets/plugins/plugins/importcss/plugin.min.js +1 -0
  104. data/vendor/assets/plugins/plugins/insertdatetime/plugin.js +121 -0
  105. data/vendor/assets/plugins/plugins/insertdatetime/plugin.min.js +1 -0
  106. data/vendor/assets/plugins/plugins/layer/plugin.js +225 -0
  107. data/vendor/assets/plugins/plugins/layer/plugin.min.js +1 -0
  108. data/vendor/assets/plugins/plugins/legacyoutput/plugin.js +211 -0
  109. data/vendor/assets/plugins/plugins/legacyoutput/plugin.min.js +1 -0
  110. data/vendor/assets/plugins/plugins/link/plugin.js +400 -0
  111. data/vendor/assets/plugins/plugins/link/plugin.min.js +1 -0
  112. data/vendor/assets/plugins/plugins/lists/plugin.js +791 -0
  113. data/vendor/assets/plugins/plugins/lists/plugin.min.js +1 -0
  114. data/vendor/assets/plugins/plugins/media/moxieplayer.swf +0 -0
  115. data/vendor/assets/plugins/plugins/media/plugin.js +774 -0
  116. data/vendor/assets/plugins/plugins/media/plugin.min.js +1 -0
  117. data/vendor/assets/plugins/plugins/nonbreaking/plugin.js +53 -0
  118. data/vendor/assets/plugins/plugins/nonbreaking/plugin.min.js +1 -0
  119. data/vendor/assets/plugins/plugins/noneditable/plugin.js +540 -0
  120. data/vendor/assets/plugins/plugins/noneditable/plugin.min.js +1 -0
  121. data/vendor/assets/plugins/plugins/pagebreak/plugin.js +88 -0
  122. data/vendor/assets/plugins/plugins/pagebreak/plugin.min.js +1 -0
  123. data/vendor/assets/plugins/plugins/paste/classes/Clipboard.js +634 -0
  124. data/vendor/assets/plugins/plugins/paste/classes/Plugin.js +110 -0
  125. data/vendor/assets/plugins/plugins/paste/classes/Quirks.js +159 -0
  126. data/vendor/assets/plugins/plugins/paste/classes/Utils.js +130 -0
  127. data/vendor/assets/plugins/plugins/paste/classes/WordFilter.js +493 -0
  128. data/vendor/assets/plugins/plugins/paste/plugin.dev.js +120 -0
  129. data/vendor/assets/plugins/plugins/paste/plugin.js +1625 -0
  130. data/vendor/assets/plugins/plugins/paste/plugin.min.js +1 -0
  131. data/vendor/assets/plugins/plugins/preview/plugin.js +88 -0
  132. data/vendor/assets/plugins/plugins/preview/plugin.min.js +1 -0
  133. data/vendor/assets/plugins/plugins/print/plugin.js +32 -0
  134. data/vendor/assets/plugins/plugins/print/plugin.min.js +1 -0
  135. data/vendor/assets/plugins/plugins/save/plugin.js +94 -0
  136. data/vendor/assets/plugins/plugins/save/plugin.min.js +1 -0
  137. data/vendor/assets/plugins/plugins/searchreplace/plugin.js +594 -0
  138. data/vendor/assets/plugins/plugins/searchreplace/plugin.min.js +1 -0
  139. data/vendor/assets/plugins/plugins/spellchecker/classes/DomTextMatcher.js +470 -0
  140. data/vendor/assets/plugins/plugins/spellchecker/classes/Plugin.js +436 -0
  141. data/vendor/assets/plugins/plugins/spellchecker/plugin.dev.js +117 -0
  142. data/vendor/assets/plugins/plugins/spellchecker/plugin.js +996 -0
  143. data/vendor/assets/plugins/plugins/spellchecker/plugin.min.js +1 -0
  144. data/vendor/assets/plugins/plugins/tabfocus/plugin.js +120 -0
  145. data/vendor/assets/plugins/plugins/tabfocus/plugin.min.js +1 -0
  146. data/vendor/assets/plugins/plugins/table/classes/CellSelection.js +176 -0
  147. data/vendor/assets/plugins/plugins/table/classes/Dialogs.js +749 -0
  148. data/vendor/assets/plugins/plugins/table/classes/Plugin.js +422 -0
  149. data/vendor/assets/plugins/plugins/table/classes/Quirks.js +372 -0
  150. data/vendor/assets/plugins/plugins/table/classes/TableGrid.js +864 -0
  151. data/vendor/assets/plugins/plugins/table/plugin.dev.js +118 -0
  152. data/vendor/assets/plugins/plugins/table/plugin.js +2680 -0
  153. data/vendor/assets/plugins/plugins/table/plugin.min.js +1 -0
  154. data/vendor/assets/plugins/plugins/template/plugin.js +262 -0
  155. data/vendor/assets/plugins/plugins/template/plugin.min.js +1 -0
  156. data/vendor/assets/plugins/plugins/textcolor/plugin.js +272 -0
  157. data/vendor/assets/plugins/plugins/textcolor/plugin.min.js +1 -0
  158. data/vendor/assets/plugins/plugins/textpattern/plugin.js +268 -0
  159. data/vendor/assets/plugins/plugins/textpattern/plugin.min.js +1 -0
  160. data/vendor/assets/plugins/plugins/visualblocks/css/visualblocks.css +135 -0
  161. data/vendor/assets/plugins/plugins/visualblocks/img/address.gif +0 -0
  162. data/vendor/assets/plugins/plugins/visualblocks/img/article.gif +0 -0
  163. data/vendor/assets/plugins/plugins/visualblocks/img/aside.gif +0 -0
  164. data/vendor/assets/plugins/plugins/visualblocks/img/blockquote.gif +0 -0
  165. data/vendor/assets/plugins/plugins/visualblocks/img/div.gif +0 -0
  166. data/vendor/assets/plugins/plugins/visualblocks/img/dl.gif +0 -0
  167. data/vendor/assets/plugins/plugins/visualblocks/img/figure.gif +0 -0
  168. data/vendor/assets/plugins/plugins/visualblocks/img/h1.gif +0 -0
  169. data/vendor/assets/plugins/plugins/visualblocks/img/h2.gif +0 -0
  170. data/vendor/assets/plugins/plugins/visualblocks/img/h3.gif +0 -0
  171. data/vendor/assets/plugins/plugins/visualblocks/img/h4.gif +0 -0
  172. data/vendor/assets/plugins/plugins/visualblocks/img/h5.gif +0 -0
  173. data/vendor/assets/plugins/plugins/visualblocks/img/h6.gif +0 -0
  174. data/vendor/assets/plugins/plugins/visualblocks/img/hgroup.gif +0 -0
  175. data/vendor/assets/plugins/plugins/visualblocks/img/ol.gif +0 -0
  176. data/vendor/assets/plugins/plugins/visualblocks/img/p.gif +0 -0
  177. data/vendor/assets/plugins/plugins/visualblocks/img/pre.gif +0 -0
  178. data/vendor/assets/plugins/plugins/visualblocks/img/section.gif +0 -0
  179. data/vendor/assets/plugins/plugins/visualblocks/img/ul.gif +0 -0
  180. data/vendor/assets/plugins/plugins/visualblocks/plugin.js +86 -0
  181. data/vendor/assets/plugins/plugins/visualblocks/plugin.min.js +1 -0
  182. data/vendor/assets/plugins/plugins/visualchars/plugin.js +88 -0
  183. data/vendor/assets/plugins/plugins/visualchars/plugin.min.js +1 -0
  184. data/vendor/assets/plugins/plugins/wordcount/plugin.js +69 -0
  185. data/vendor/assets/plugins/plugins/wordcount/plugin.min.js +1 -0
  186. data/vendor/assets/skins/skins/lightgray/content.inline.min.css +1 -0
  187. data/vendor/assets/skins/skins/lightgray/content.min.css +1 -0
  188. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.eot +0 -0
  189. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.svg +62 -0
  190. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.ttf +0 -0
  191. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.woff +0 -0
  192. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.eot +0 -0
  193. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.svg +63 -0
  194. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.ttf +0 -0
  195. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.woff +0 -0
  196. data/vendor/assets/skins/skins/lightgray/img/anchor.gif +0 -0
  197. data/vendor/assets/skins/skins/lightgray/img/loader.gif +0 -0
  198. data/vendor/assets/skins/skins/lightgray/img/object.gif +0 -0
  199. data/vendor/assets/skins/skins/lightgray/img/trans.gif +0 -0
  200. data/vendor/assets/skins/skins/lightgray/skin.ie7.min.css +1 -0
  201. data/vendor/assets/skins/skins/lightgray/skin.min.css +1 -0
  202. data/vendor/assets/stylesheets/mirador-combined.css +3969 -0
  203. data/vendor/assets/stylesheets/mirador.css +11 -0
  204. data/vendor/assets/themes/themes/modern/theme.js +617 -0
  205. data/vendor/assets/themes/themes/modern/theme.min.js +1 -0
  206. metadata +318 -0
@@ -0,0 +1 @@
1
+ tinymce.PluginManager.add("image",function(a){function b(a,b){function c(a,c){d.parentNode&&d.parentNode.removeChild(d),b({width:a,height:c})}var d=document.createElement("img");d.onload=function(){c(d.clientWidth,d.clientHeight)},d.onerror=function(){c()};var e=d.style;e.visibility="hidden",e.position="fixed",e.bottom=e.left=0,e.width=e.height="auto",document.body.appendChild(d),d.src=a}function c(a,b,c){function d(a,c){return c=c||[],tinymce.each(a,function(a){var e={text:a.text||a.title};a.menu?e.menu=d(a.menu):(e.value=a.value,b(e)),c.push(e)}),c}return d(a,c||[])}function d(b){return function(){var c=a.settings.image_list;"string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):"function"==typeof c?c(b):b(c)}}function e(d){function e(){var a,b,c,d;a=j.find("#width")[0],b=j.find("#height")[0],a&&b&&(c=a.value(),d=b.value(),j.find("#constrain")[0].checked()&&k&&l&&c&&d&&(k!=c?(d=Math.round(c/k*d),b.value(d)):(c=Math.round(d/l*c),a.value(c))),k=c,l=d)}function f(){function b(b){function c(){b.onload=b.onerror=null,a.selection&&(a.selection.select(b),a.nodeChanged())}b.onload=function(){o.width||o.height||!r||p.setAttribs(b,{width:b.clientWidth,height:b.clientHeight}),c()},b.onerror=c}i(),e(),o=tinymce.extend(o,j.toJSON()),o.alt||(o.alt=""),""===o.width&&(o.width=null),""===o.height&&(o.height=null),o.style||(o.style=null),o={src:o.src,alt:o.alt,width:o.width,height:o.height,style:o.style,"class":o["class"]},a.undoManager.transact(function(){return o.src?(q?p.setAttribs(q,o):(o.id="__mcenew",a.focus(),a.selection.setContent(p.createHTML("img",o)),q=p.get("__mcenew"),p.setAttrib(q,"id",null)),void b(q)):void(q&&(p.remove(q),a.focus(),a.nodeChanged()))})}function g(a){return a&&(a=a.replace(/px$/,"")),a}function h(c){var d=c.meta||{};if(m&&m.value(a.convertURL(this.value(),"src")),tinymce.each(d,function(a,b){j.find("#"+b).value(a)}),!d.width&&!d.height){var e=this.value(),f=new RegExp("^(?:[a-z]+:)?//","i"),g=a.settings.document_base_url;g&&!f.test(e)&&e.substring(0,g.length)!==g&&this.value(g+e),b(this.value(),function(a){a.width&&a.height&&r&&(k=a.width,l=a.height,j.find("#width").value(k),j.find("#height").value(l))})}}function i(){function b(a){return a.length>0&&/^[0-9]+$/.test(a)&&(a+="px"),a}if(a.settings.image_advtab){var c=j.toJSON(),d=p.parseStyle(c.style);delete d.margin,d["margin-top"]=d["margin-bottom"]=b(c.vspace),d["margin-left"]=d["margin-right"]=b(c.hspace),d["border-width"]=b(c.border),j.find("#style").value(p.serializeStyle(p.parseStyle(p.serializeStyle(d))))}}var j,k,l,m,n,o={},p=a.dom,q=a.selection.getNode(),r=a.settings.image_dimensions!==!1;k=p.getAttrib(q,"width"),l=p.getAttrib(q,"height"),"IMG"!=q.nodeName||q.getAttribute("data-mce-object")||q.getAttribute("data-mce-placeholder")?q=null:o={src:p.getAttrib(q,"src"),alt:p.getAttrib(q,"alt"),"class":p.getAttrib(q,"class"),width:k,height:l},d&&(m={type:"listbox",label:"Image list",values:c(d,function(b){b.value=a.convertURL(b.value||b.url,"src")},[{text:"None",value:""}]),value:o.src&&a.convertURL(o.src,"src"),onselect:function(a){var b=j.find("#alt");(!b.value()||a.lastControl&&b.value()==a.lastControl.text())&&b.value(a.control.text()),j.find("#src").value(a.control.value()).fire("change")},onPostRender:function(){m=this}}),a.settings.image_class_list&&(n={name:"class",type:"listbox",label:"Class",values:c(a.settings.image_class_list,function(b){b.value&&(b.textStyle=function(){return a.formatter.getCssText({inline:"img",classes:[b.value]})})})});var s=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:!0,onchange:h},m];a.settings.image_description!==!1&&s.push({name:"alt",type:"textbox",label:"Image description"}),r&&s.push({type:"container",label:"Dimensions",layout:"flex",direction:"row",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:3,onchange:e,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:3,onchange:e,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}),s.push(n),a.settings.image_advtab?(q&&(o.hspace=g(q.style.marginLeft||q.style.marginRight),o.vspace=g(q.style.marginTop||q.style.marginBottom),o.border=g(q.style.borderWidth),o.style=a.dom.serializeStyle(a.dom.parseStyle(a.dom.getAttrib(q,"style")))),j=a.windowManager.open({title:"Insert/edit image",data:o,bodyType:"tabpanel",body:[{title:"General",type:"form",items:s},{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox"},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,alignH:["left","right"],defaults:{type:"textbox",maxWidth:50,onchange:i},items:[{label:"Vertical space",name:"vspace"},{label:"Horizontal space",name:"hspace"},{label:"Border",name:"border"}]}]}],onSubmit:f})):j=a.windowManager.open({title:"Insert/edit image",data:o,body:s,onSubmit:f})}a.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:d(e),stateSelector:"img:not([data-mce-object],[data-mce-placeholder])"}),a.addMenuItem("image",{icon:"image",text:"Insert image",onclick:d(e),context:"insert",prependToContext:!0}),a.addCommand("mceImage",d(e))});
@@ -0,0 +1,195 @@
1
+ /**
2
+ * plugin.js
3
+ *
4
+ * Copyright, Moxiecode Systems AB
5
+ * Released under LGPL License.
6
+ *
7
+ * License: http://www.tinymce.com/license
8
+ * Contributing: http://www.tinymce.com/contributing
9
+ */
10
+
11
+ /*global tinymce:true */
12
+
13
+ tinymce.PluginManager.add('importcss', function(editor) {
14
+ var self = this, each = tinymce.each;
15
+
16
+ function compileFilter(filter) {
17
+ if (typeof(filter) == "string") {
18
+ return function(value) {
19
+ return value.indexOf(filter) !== -1;
20
+ };
21
+ } else if (filter instanceof RegExp) {
22
+ return function(value) {
23
+ return filter.test(value);
24
+ };
25
+ }
26
+
27
+ return filter;
28
+ }
29
+
30
+ function getSelectors(doc, fileFilter) {
31
+ var selectors = [], contentCSSUrls = {};
32
+
33
+ function append(styleSheet, imported) {
34
+ var href = styleSheet.href, rules;
35
+
36
+ if (!href || !fileFilter(href, imported)) {
37
+ return;
38
+ }
39
+
40
+ each(styleSheet.imports, function(styleSheet) {
41
+ append(styleSheet, true);
42
+ });
43
+
44
+ try {
45
+ rules = styleSheet.cssRules || styleSheet.rules;
46
+ } catch (e) {
47
+ // Firefox fails on rules to remote domain for example:
48
+ // @import url(//fonts.googleapis.com/css?family=Pathway+Gothic+One);
49
+ }
50
+
51
+ each(rules, function(cssRule) {
52
+ if (cssRule.styleSheet) {
53
+ append(cssRule.styleSheet, true);
54
+ } else if (cssRule.selectorText) {
55
+ each(cssRule.selectorText.split(','), function(selector) {
56
+ selectors.push(tinymce.trim(selector));
57
+ });
58
+ }
59
+ });
60
+ }
61
+
62
+ each(editor.contentCSS, function(url) {
63
+ contentCSSUrls[url] = true;
64
+ });
65
+
66
+ if (!fileFilter) {
67
+ fileFilter = function(href, imported) {
68
+ return imported || contentCSSUrls[href];
69
+ };
70
+ }
71
+
72
+ try {
73
+ each(doc.styleSheets, function(styleSheet) {
74
+ append(styleSheet);
75
+ });
76
+ } catch (e) {}
77
+
78
+ return selectors;
79
+ }
80
+
81
+ function convertSelectorToFormat(selectorText) {
82
+ var format;
83
+
84
+ // Parse simple element.class1, .class1
85
+ var selector = /^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(selectorText);
86
+ if (!selector) {
87
+ return;
88
+ }
89
+
90
+ var elementName = selector[1];
91
+ var classes = selector[2].substr(1).split('.').join(' ');
92
+ var inlineSelectorElements = tinymce.makeMap('a,img');
93
+
94
+ // element.class - Produce block formats
95
+ if (selector[1]) {
96
+ format = {
97
+ title: selectorText
98
+ };
99
+
100
+ if (editor.schema.getTextBlockElements()[elementName]) {
101
+ // Text block format ex: h1.class1
102
+ format.block = elementName;
103
+ } else if (editor.schema.getBlockElements()[elementName] || inlineSelectorElements[elementName.toLowerCase()]) {
104
+ // Block elements such as table.class and special inline elements such as a.class or img.class
105
+ format.selector = elementName;
106
+ } else {
107
+ // Inline format strong.class1
108
+ format.inline = elementName;
109
+ }
110
+ } else if (selector[2]) {
111
+ // .class - Produce inline span with classes
112
+ format = {
113
+ inline: 'span',
114
+ title: selectorText.substr(1),
115
+ classes: classes
116
+ };
117
+ }
118
+
119
+ // Append to or override class attribute
120
+ if (editor.settings.importcss_merge_classes !== false) {
121
+ format.classes = classes;
122
+ } else {
123
+ format.attributes = {"class": classes};
124
+ }
125
+
126
+ return format;
127
+ }
128
+
129
+ editor.on('renderFormatsMenu', function(e) {
130
+ var settings = editor.settings, selectors = {};
131
+ var selectorConverter = settings.importcss_selector_converter || convertSelectorToFormat;
132
+ var selectorFilter = compileFilter(settings.importcss_selector_filter), ctrl = e.control;
133
+
134
+ if (!editor.settings.importcss_append) {
135
+ ctrl.items().remove();
136
+ }
137
+
138
+ // Setup new groups collection by cloning the configured one
139
+ var groups = [];
140
+ tinymce.each(settings.importcss_groups, function(group) {
141
+ group = tinymce.extend({}, group);
142
+ group.filter = compileFilter(group.filter);
143
+ groups.push(group);
144
+ });
145
+
146
+ each(getSelectors(e.doc || editor.getDoc(), compileFilter(settings.importcss_file_filter)), function(selector) {
147
+ if (selector.indexOf('.mce-') === -1) {
148
+ if (!selectors[selector] && (!selectorFilter || selectorFilter(selector))) {
149
+ var format = selectorConverter.call(self, selector), menu;
150
+
151
+ if (format) {
152
+ var formatName = format.name || tinymce.DOM.uniqueId();
153
+
154
+ if (groups) {
155
+ for (var i = 0; i < groups.length; i++) {
156
+ if (!groups[i].filter || groups[i].filter(selector)) {
157
+ if (!groups[i].item) {
158
+ groups[i].item = {text: groups[i].title, menu: []};
159
+ }
160
+
161
+ menu = groups[i].item.menu;
162
+ break;
163
+ }
164
+ }
165
+ }
166
+
167
+ editor.formatter.register(formatName, format);
168
+
169
+ var menuItem = tinymce.extend({}, ctrl.settings.itemDefaults, {
170
+ text: format.title,
171
+ format: formatName
172
+ });
173
+
174
+ if (menu) {
175
+ menu.push(menuItem);
176
+ } else {
177
+ ctrl.add(menuItem);
178
+ }
179
+ }
180
+
181
+ selectors[selector] = true;
182
+ }
183
+ }
184
+ });
185
+
186
+ each(groups, function(group) {
187
+ ctrl.add(group.item);
188
+ });
189
+
190
+ e.control.renderNew();
191
+ });
192
+
193
+ // Expose default convertSelectorToFormat implementation
194
+ self.convertSelectorToFormat = convertSelectorToFormat;
195
+ });
@@ -0,0 +1 @@
1
+ tinymce.PluginManager.add("importcss",function(a){function b(a){return"string"==typeof a?function(b){return-1!==b.indexOf(a)}:a instanceof RegExp?function(b){return a.test(b)}:a}function c(b,c){function d(a,b){var g,h=a.href;if(h&&c(h,b)){f(a.imports,function(a){d(a,!0)});try{g=a.cssRules||a.rules}catch(i){}f(g,function(a){a.styleSheet?d(a.styleSheet,!0):a.selectorText&&f(a.selectorText.split(","),function(a){e.push(tinymce.trim(a))})})}}var e=[],g={};f(a.contentCSS,function(a){g[a]=!0}),c||(c=function(a,b){return b||g[a]});try{f(b.styleSheets,function(a){d(a)})}catch(h){}return e}function d(b){var c,d=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(b);if(d){var e=d[1],f=d[2].substr(1).split(".").join(" "),g=tinymce.makeMap("a,img");return d[1]?(c={title:b},a.schema.getTextBlockElements()[e]?c.block=e:a.schema.getBlockElements()[e]||g[e.toLowerCase()]?c.selector=e:c.inline=e):d[2]&&(c={inline:"span",title:b.substr(1),classes:f}),a.settings.importcss_merge_classes!==!1?c.classes=f:c.attributes={"class":f},c}}var e=this,f=tinymce.each;a.on("renderFormatsMenu",function(g){var h=a.settings,i={},j=h.importcss_selector_converter||d,k=b(h.importcss_selector_filter),l=g.control;a.settings.importcss_append||l.items().remove();var m=[];tinymce.each(h.importcss_groups,function(a){a=tinymce.extend({},a),a.filter=b(a.filter),m.push(a)}),f(c(g.doc||a.getDoc(),b(h.importcss_file_filter)),function(b){if(-1===b.indexOf(".mce-")&&!i[b]&&(!k||k(b))){var c,d=j.call(e,b);if(d){var f=d.name||tinymce.DOM.uniqueId();if(m)for(var g=0;g<m.length;g++)if(!m[g].filter||m[g].filter(b)){m[g].item||(m[g].item={text:m[g].title,menu:[]}),c=m[g].item.menu;break}a.formatter.register(f,d);var h=tinymce.extend({},l.settings.itemDefaults,{text:d.title,format:f});c?c.push(h):l.add(h)}i[b]=!0}}),f(m,function(a){l.add(a.item)}),g.control.renderNew()}),e.convertSelectorToFormat=d});
@@ -0,0 +1,121 @@
1
+ /**
2
+ * plugin.js
3
+ *
4
+ * Copyright, Moxiecode Systems AB
5
+ * Released under LGPL License.
6
+ *
7
+ * License: http://www.tinymce.com/license
8
+ * Contributing: http://www.tinymce.com/contributing
9
+ */
10
+
11
+ /*global tinymce:true */
12
+
13
+ tinymce.PluginManager.add('insertdatetime', function(editor) {
14
+ var daysShort = "Sun Mon Tue Wed Thu Fri Sat Sun".split(' ');
15
+ var daysLong = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(' ');
16
+ var monthsShort = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(' ');
17
+ var monthsLong = "January February March April May June July August September October November December".split(' ');
18
+ var menuItems = [], lastFormat, defaultButtonTimeFormat;
19
+
20
+ function getDateTime(fmt, date) {
21
+ function addZeros(value, len) {
22
+ value = "" + value;
23
+
24
+ if (value.length < len) {
25
+ for (var i = 0; i < (len - value.length); i++) {
26
+ value = "0" + value;
27
+ }
28
+ }
29
+
30
+ return value;
31
+ }
32
+
33
+ date = date || new Date();
34
+
35
+ fmt = fmt.replace("%D", "%m/%d/%Y");
36
+ fmt = fmt.replace("%r", "%I:%M:%S %p");
37
+ fmt = fmt.replace("%Y", "" + date.getFullYear());
38
+ fmt = fmt.replace("%y", "" + date.getYear());
39
+ fmt = fmt.replace("%m", addZeros(date.getMonth() + 1, 2));
40
+ fmt = fmt.replace("%d", addZeros(date.getDate(), 2));
41
+ fmt = fmt.replace("%H", "" + addZeros(date.getHours(), 2));
42
+ fmt = fmt.replace("%M", "" + addZeros(date.getMinutes(), 2));
43
+ fmt = fmt.replace("%S", "" + addZeros(date.getSeconds(), 2));
44
+ fmt = fmt.replace("%I", "" + ((date.getHours() + 11) % 12 + 1));
45
+ fmt = fmt.replace("%p", "" + (date.getHours() < 12 ? "AM" : "PM"));
46
+ fmt = fmt.replace("%B", "" + editor.translate(monthsLong[date.getMonth()]));
47
+ fmt = fmt.replace("%b", "" + editor.translate(monthsShort[date.getMonth()]));
48
+ fmt = fmt.replace("%A", "" + editor.translate(daysLong[date.getDay()]));
49
+ fmt = fmt.replace("%a", "" + editor.translate(daysShort[date.getDay()]));
50
+ fmt = fmt.replace("%%", "%");
51
+
52
+ return fmt;
53
+ }
54
+
55
+ function insertDateTime(format) {
56
+ var html = getDateTime(format);
57
+
58
+ if (editor.settings.insertdatetime_element) {
59
+ var computerTime;
60
+
61
+ if (/%[HMSIp]/.test(format)) {
62
+ computerTime = getDateTime("%Y-%m-%dT%H:%M");
63
+ } else {
64
+ computerTime = getDateTime("%Y-%m-%d");
65
+ }
66
+
67
+ html = '<time datetime="' + computerTime + '">' + html + '</time>';
68
+
69
+ var timeElm = editor.dom.getParent(editor.selection.getStart(), 'time');
70
+ if (timeElm) {
71
+ editor.dom.setOuterHTML(timeElm, html);
72
+ return;
73
+ }
74
+ }
75
+
76
+ editor.insertContent(html);
77
+ }
78
+
79
+ editor.addCommand('mceInsertDate', function() {
80
+ insertDateTime(editor.getParam("insertdatetime_dateformat", editor.translate("%Y-%m-%d")));
81
+ });
82
+
83
+ editor.addCommand('mceInsertTime', function() {
84
+ insertDateTime(editor.getParam("insertdatetime_timeformat", editor.translate('%H:%M:%S')));
85
+ });
86
+
87
+ editor.addButton('insertdatetime', {
88
+ type: 'splitbutton',
89
+ title: 'Insert date/time',
90
+ onclick: function() {
91
+ insertDateTime(lastFormat || defaultButtonTimeFormat);
92
+ },
93
+ menu: menuItems
94
+ });
95
+
96
+ tinymce.each(editor.settings.insertdatetime_formats || [
97
+ "%H:%M:%S",
98
+ "%Y-%m-%d",
99
+ "%I:%M:%S %p",
100
+ "%D"
101
+ ], function(fmt) {
102
+ if (!defaultButtonTimeFormat) {
103
+ defaultButtonTimeFormat = fmt;
104
+ }
105
+
106
+ menuItems.push({
107
+ text: getDateTime(fmt),
108
+ onclick: function() {
109
+ lastFormat = fmt;
110
+ insertDateTime(fmt);
111
+ }
112
+ });
113
+ });
114
+
115
+ editor.addMenuItem('insertdatetime', {
116
+ icon: 'date',
117
+ text: 'Insert date/time',
118
+ menu: menuItems,
119
+ context: 'insert'
120
+ });
121
+ });
@@ -0,0 +1 @@
1
+ tinymce.PluginManager.add("insertdatetime",function(a){function b(b,c){function d(a,b){if(a=""+a,a.length<b)for(var c=0;c<b-a.length;c++)a="0"+a;return a}return c=c||new Date,b=b.replace("%D","%m/%d/%Y"),b=b.replace("%r","%I:%M:%S %p"),b=b.replace("%Y",""+c.getFullYear()),b=b.replace("%y",""+c.getYear()),b=b.replace("%m",d(c.getMonth()+1,2)),b=b.replace("%d",d(c.getDate(),2)),b=b.replace("%H",""+d(c.getHours(),2)),b=b.replace("%M",""+d(c.getMinutes(),2)),b=b.replace("%S",""+d(c.getSeconds(),2)),b=b.replace("%I",""+((c.getHours()+11)%12+1)),b=b.replace("%p",""+(c.getHours()<12?"AM":"PM")),b=b.replace("%B",""+a.translate(i[c.getMonth()])),b=b.replace("%b",""+a.translate(h[c.getMonth()])),b=b.replace("%A",""+a.translate(g[c.getDay()])),b=b.replace("%a",""+a.translate(f[c.getDay()])),b=b.replace("%%","%")}function c(c){var d=b(c);if(a.settings.insertdatetime_element){var e;e=b(/%[HMSIp]/.test(c)?"%Y-%m-%dT%H:%M":"%Y-%m-%d"),d='<time datetime="'+e+'">'+d+"</time>";var f=a.dom.getParent(a.selection.getStart(),"time");if(f)return void a.dom.setOuterHTML(f,d)}a.insertContent(d)}var d,e,f="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),g="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),h="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),i="January February March April May June July August September October November December".split(" "),j=[];a.addCommand("mceInsertDate",function(){c(a.getParam("insertdatetime_dateformat",a.translate("%Y-%m-%d")))}),a.addCommand("mceInsertTime",function(){c(a.getParam("insertdatetime_timeformat",a.translate("%H:%M:%S")))}),a.addButton("insertdatetime",{type:"splitbutton",title:"Insert date/time",onclick:function(){c(d||e)},menu:j}),tinymce.each(a.settings.insertdatetime_formats||["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"],function(a){e||(e=a),j.push({text:b(a),onclick:function(){d=a,c(a)}})}),a.addMenuItem("insertdatetime",{icon:"date",text:"Insert date/time",menu:j,context:"insert"})});
@@ -0,0 +1,225 @@
1
+ /**
2
+ * plugin.js
3
+ *
4
+ * Copyright, Moxiecode Systems AB
5
+ * Released under LGPL License.
6
+ *
7
+ * License: http://www.tinymce.com/license
8
+ * Contributing: http://www.tinymce.com/contributing
9
+ */
10
+
11
+ /*global tinymce:true */
12
+
13
+ tinymce.PluginManager.add('layer', function(editor) {
14
+ function getParentLayer(node) {
15
+ do {
16
+ if (node.className && node.className.indexOf('mceItemLayer') != -1) {
17
+ return node;
18
+ }
19
+ } while ((node = node.parentNode));
20
+ }
21
+
22
+ function visualAid(e) {
23
+ var dom = editor.dom;
24
+
25
+ tinymce.each(dom.select('div,p', e), function(e) {
26
+ if (/^(absolute|relative|fixed)$/i.test(e.style.position)) {
27
+ if (e.hasVisual) {
28
+ dom.addClass(e, 'mceItemVisualAid');
29
+ } else {
30
+ dom.removeClass(e, 'mceItemVisualAid');
31
+ }
32
+
33
+ dom.addClass(e, 'mceItemLayer');
34
+ }
35
+ });
36
+ }
37
+
38
+ function move(d) {
39
+ var i, z = [], le = getParentLayer(editor.selection.getNode()), ci = -1, fi = -1, nl;
40
+
41
+ nl = [];
42
+ tinymce.walk(editor.getBody(), function(n) {
43
+ if (n.nodeType == 1 && /^(absolute|relative|static)$/i.test(n.style.position)) {
44
+ nl.push(n);
45
+ }
46
+ }, 'childNodes');
47
+
48
+ // Find z-indexes
49
+ for (i = 0; i < nl.length; i++) {
50
+ z[i] = nl[i].style.zIndex ? parseInt(nl[i].style.zIndex, 10) : 0;
51
+
52
+ if (ci < 0 && nl[i] == le) {
53
+ ci = i;
54
+ }
55
+ }
56
+
57
+ if (d < 0) {
58
+ // Move back
59
+
60
+ // Try find a lower one
61
+ for (i = 0; i < z.length; i++) {
62
+ if (z[i] < z[ci]) {
63
+ fi = i;
64
+ break;
65
+ }
66
+ }
67
+
68
+ if (fi > -1) {
69
+ nl[ci].style.zIndex = z[fi];
70
+ nl[fi].style.zIndex = z[ci];
71
+ } else {
72
+ if (z[ci] > 0) {
73
+ nl[ci].style.zIndex = z[ci] - 1;
74
+ }
75
+ }
76
+ } else {
77
+ // Move forward
78
+
79
+ // Try find a higher one
80
+ for (i = 0; i < z.length; i++) {
81
+ if (z[i] > z[ci]) {
82
+ fi = i;
83
+ break;
84
+ }
85
+ }
86
+
87
+ if (fi > -1) {
88
+ nl[ci].style.zIndex = z[fi];
89
+ nl[fi].style.zIndex = z[ci];
90
+ } else {
91
+ nl[ci].style.zIndex = z[ci] + 1;
92
+ }
93
+ }
94
+
95
+ editor.execCommand('mceRepaint');
96
+ }
97
+
98
+ function insertLayer() {
99
+ var dom = editor.dom, p = dom.getPos(dom.getParent(editor.selection.getNode(), '*'));
100
+ var body = editor.getBody();
101
+
102
+ editor.dom.add(body, 'div', {
103
+ style: {
104
+ position: 'absolute',
105
+ left: p.x,
106
+ top: (p.y > 20 ? p.y : 20),
107
+ width: 100,
108
+ height: 100
109
+ },
110
+ 'class': 'mceItemVisualAid mceItemLayer'
111
+ }, editor.selection.getContent() || editor.getLang('layer.content'));
112
+
113
+ // Workaround for IE where it messes up the JS engine if you insert a layer on IE 6,7
114
+ if (tinymce.Env.ie) {
115
+ dom.setHTML(body, body.innerHTML);
116
+ }
117
+ }
118
+
119
+ function toggleAbsolute() {
120
+ var le = getParentLayer(editor.selection.getNode());
121
+
122
+ if (!le) {
123
+ le = editor.dom.getParent(editor.selection.getNode(), 'DIV,P,IMG');
124
+ }
125
+
126
+ if (le) {
127
+ if (le.style.position.toLowerCase() == "absolute") {
128
+ editor.dom.setStyles(le, {
129
+ position: '',
130
+ left: '',
131
+ top: '',
132
+ width: '',
133
+ height: ''
134
+ });
135
+
136
+ editor.dom.removeClass(le, 'mceItemVisualAid');
137
+ editor.dom.removeClass(le, 'mceItemLayer');
138
+ } else {
139
+ if (!le.style.left) {
140
+ le.style.left = 20 + 'px';
141
+ }
142
+
143
+ if (!le.style.top) {
144
+ le.style.top = 20 + 'px';
145
+ }
146
+
147
+ if (!le.style.width) {
148
+ le.style.width = le.width ? (le.width + 'px') : '100px';
149
+ }
150
+
151
+ if (!le.style.height) {
152
+ le.style.height = le.height ? (le.height + 'px') : '100px';
153
+ }
154
+
155
+ le.style.position = "absolute";
156
+
157
+ editor.dom.setAttrib(le, 'data-mce-style', '');
158
+ editor.addVisual(editor.getBody());
159
+ }
160
+
161
+ editor.execCommand('mceRepaint');
162
+ editor.nodeChanged();
163
+ }
164
+ }
165
+
166
+ // Register commands
167
+ editor.addCommand('mceInsertLayer', insertLayer);
168
+
169
+ editor.addCommand('mceMoveForward', function() {
170
+ move(1);
171
+ });
172
+
173
+ editor.addCommand('mceMoveBackward', function() {
174
+ move(-1);
175
+ });
176
+
177
+ editor.addCommand('mceMakeAbsolute', function() {
178
+ toggleAbsolute();
179
+ });
180
+
181
+ // Register buttons
182
+ editor.addButton('moveforward', {title: 'layer.forward_desc', cmd: 'mceMoveForward'});
183
+ editor.addButton('movebackward', {title: 'layer.backward_desc', cmd: 'mceMoveBackward'});
184
+ editor.addButton('absolute', {title: 'layer.absolute_desc', cmd: 'mceMakeAbsolute'});
185
+ editor.addButton('insertlayer', {title: 'layer.insertlayer_desc', cmd: 'mceInsertLayer'});
186
+
187
+ editor.on('init', function() {
188
+ if (tinymce.Env.ie) {
189
+ editor.getDoc().execCommand('2D-Position', false, true);
190
+ }
191
+ });
192
+
193
+ // Remove serialized styles when selecting a layer since it might be changed by a drag operation
194
+ editor.on('mouseup', function(e) {
195
+ var layer = getParentLayer(e.target);
196
+
197
+ if (layer) {
198
+ editor.dom.setAttrib(layer, 'data-mce-style', '');
199
+ }
200
+ });
201
+
202
+ // Fixes edit focus issues with layers on Gecko
203
+ // This will enable designMode while inside a layer and disable it when outside
204
+ editor.on('mousedown', function(e) {
205
+ var node = e.target, doc = editor.getDoc(), parent;
206
+
207
+ if (tinymce.Env.gecko) {
208
+ if (getParentLayer(node)) {
209
+ if (doc.designMode !== 'on') {
210
+ doc.designMode = 'on';
211
+
212
+ // Repaint caret
213
+ node = doc.body;
214
+ parent = node.parentNode;
215
+ parent.removeChild(node);
216
+ parent.appendChild(node);
217
+ }
218
+ } else if (doc.designMode == 'on') {
219
+ doc.designMode = 'off';
220
+ }
221
+ }
222
+ });
223
+
224
+ editor.on('NodeChange', visualAid);
225
+ });