wysihat-engine 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ 0.1.4 (October 5th, 2009) - Jeff Kreeftmeijer
2
+ * removed the :paste button, you can now just paste it in the editor. It will work ;)
3
+ * added a destroy function for the wysihat_files
4
+ * added a locales file to support i18n
5
+
1
6
  0.1.3 (October 5th, 2009) - Jeff Kreeftmeijer
2
7
  * added sass support
3
8
 
data/Rakefile CHANGED
@@ -37,7 +37,7 @@ task :minify do
37
37
  string << file.read
38
38
  file.close
39
39
  end
40
-
40
+
41
41
  pack.write(compressor.compress(string))
42
42
  pack.close
43
43
  end
@@ -50,7 +50,8 @@ begin
50
50
  gem.description = "A rails engine to allow users to use the WysiHat editors."
51
51
  gem.email = "jeff@80beans.com"
52
52
  gem.homepage = "http://www.80beans.com/2009/10/01/wysihat-engine/"
53
- gem.authors = ["Jeff Kreeftmeijer"]
53
+ gem.authors = ["Jeff Kreeftmeijer"]
54
+ gem.add_development_dependency "yui-compressor"
54
55
  gem.add_dependency('thoughtbot-paperclip')
55
56
  end
56
57
  rescue LoadError
data/TODO CHANGED
@@ -1,2 +1 @@
1
- * add a destroy action to the WysihatFilesController
2
- * rewrite the :paste button to use josh's solution ( http://www.80beans.com/2009/10/01/wysihat-engine/comment-page-1/#comment-1834 )
1
+ * put the facebox images & icons in a subdir
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -14,4 +14,16 @@ class WysihatFilesController < ApplicationController
14
14
  end
15
15
  end
16
16
  end
17
- end
17
+
18
+ def destroy
19
+ @wysihat_file = WysihatFile.find(params[:id])
20
+ respond_to do |wants|
21
+ wants.js {
22
+ render :update do |page|
23
+ page.remove "wysihat_file_#{@wysihat_file.id}"
24
+ end
25
+ }
26
+ end
27
+ @wysihat_file.destroy
28
+ end
29
+ end
@@ -1,3 +1,4 @@
1
1
  <li id="wysihat_file_<%= wysihat_file.id %>">
2
2
  <%= link_to_function(wysihat_file.file_file_name, "$$('iframe##{params[:editor]}')[0].insertImage(this.href); facebox.close();", :href => wysihat_file.file.url) %>
3
- </li>
3
+ <%= link_to_remote t('wysihat_files.destroy.name'), :url => wysihat_file, :method => :delete, :confirm => t('wysihat_files.destroy.sure') %>
4
+ </li>
@@ -0,0 +1,5 @@
1
+ en:
2
+ wysihat_files:
3
+ destroy:
4
+ name: delete
5
+ sure: Are you sure you want to delete this file?
@@ -62,10 +62,6 @@ div.editor_toolbar span{
62
62
  background-image: url('../images/image.png');
63
63
  }
64
64
 
65
- .editor_toolbar .paste {
66
- background-image: url('../images/paste_plain.png');
67
- }
68
-
69
65
  .editor_toolbar .html {
70
66
  background-image: url('../images/page_code.png');
71
67
  }
@@ -45,28 +45,30 @@ var WysihatHelper = {
45
45
  iframe.contentWindow.document.body.innerHTML = $('html_editor').value;
46
46
  });
47
47
  },
48
-
49
- faceboxPaste: function()
50
- {
51
- facebox.loading();
52
- new Effect.Appear($('facebox'), {duration: .3});
53
- iframe = this
54
- facebox.reveal('<textarea id=\"paste_editor\" style=\"width:100%; height:400px;\"></textarea>', null);
55
- Event.observe('paste_editor', 'change', function(event) {
56
- iframe.contentWindow.document.body.innerHTML = iframe.contentWindow.document.body.innerHTML + $('paste_editor').value.escapeHTML();
57
- });
58
- }
59
48
  }
60
49
 
61
50
  WysiHat.Editor.include(WysihatHelper);
62
51
 
63
52
  Event.observe(window, 'load', function() {
64
- $$('textarea').each(function(i){
53
+ $$('textarea.wysihat_editor').each(function(i){
65
54
  var editor = WysiHat.Editor.attach(i.id);
66
55
  var toolbar = new WysiHat.Toolbar(editor);
67
56
  toolbars[i.id] = toolbar;
57
+
58
+ editor.outputFilter = function(text) {
59
+ return text.formatHTMLOutput().sanitize({
60
+ tags: ['span', 'p', 'br', 'strong', 'em', 'a'],
61
+ attributes: ['id', 'href']
62
+ });
63
+ };
64
+
65
+ editor.observe("wysihat:paste", function(event) {
66
+ setTimeout(function() {
67
+ event.target.reload();
68
+ }, 1);
69
+ });
68
70
  });
69
-
71
+
70
72
  $$('form').each().onsubmit = function(){
71
73
  editor.save();
72
74
  };
@@ -1 +1 @@
1
- var Facebox=Class.create({initialize:function(a){this.settings={loading_image:"/images/loading.gif",close_image:"/images/closelabel.gif",image_types:new RegExp("."+["png","jpg","jpeg","gif"].join("|")+"$","i"),inited:true,facebox_html:' <div id="facebox" style="display:none;"> <div class="popup"> <table id="facebox_table"> <tbody> <tr> <td class="tl"/><td class="b"/><td class="tr"/> </tr> <tr> <td class="b"/> <td class="body"> <div class="content"> </div> <div class="footer"> <a href="#" class="close"> <img src="/images/closelabel.gif" title="close" class="close_image" /> </a> </div> </td> <td class="b"/> </tr> <tr> <td class="bl"/><td class="b"/><td class="br"/> </tr> </tbody> </table> </div> </div>'};if(a){Object.extend(this.settings,a)}$(document.body).insert({bottom:this.settings.facebox_html});this.preload=[new Image(),new Image()];this.preload[0].src=this.settings.close_image;this.preload[1].src=this.settings.loading_image;f=this;$$("#facebox .b:first, #facebox .bl, #facebox .br, #facebox .tl, #facebox .tr").each(function(b){f.preload.push(new Image());f.preload.slice(-1).src=b.getStyle("background-image").replace(/url\((.+)\)/,"$1")});this.facebox=$("facebox");this.keyPressListener=this.watchKeyPress.bindAsEventListener(this);this.watchClickEvents();fb=this;Event.observe($$("#facebox .close").first(),"click",function(b){Event.stop(b);fb.close()});Event.observe($$("#facebox .close_image").first(),"click",function(b){Event.stop(b);fb.close()})},watchKeyPress:function(a){if(a.keyCode==27||!Event.element(a).descendantOf(this.facebox)){this.close()}},watchClickEvents:function(b){var a=this;$$("a[rel=facebox]").each(function(d,c){Event.observe(d,"click",function(g){Event.stop(g);a.click_handler(d,g)})})},loading:function(){if($$("#facebox .loading").length==1){return true}contentWrapper=$$("#facebox .content").first();contentWrapper.childElements().each(function(c,b){c.remove()});contentWrapper.insert({bottom:'<div class="loading"><img src="'+this.settings.loading_image+'"/></div>'});var a=document.viewport.getScrollOffsets();this.facebox.setStyle({top:a.top+(document.viewport.getHeight()/10)+"px",left:document.viewport.getWidth()/2-(this.facebox.getWidth()/2)+"px"});Event.observe(document,"keypress",this.keyPressListener);Event.observe(document,"click",this.keyPressListener)},reveal:function(b,a){this.loading();load=$$("#facebox .loading").first();if(load){load.remove()}contentWrapper=$$("#facebox .content").first();if(a){contentWrapper.addClassName(a)}contentWrapper.update(b);$$("#facebox .body").first().childElements().each(function(d,c){d.show()});if(!this.facebox.visible()){new Effect.Appear(this.facebox,{duration:0.3})}this.facebox.setStyle({left:document.viewport.getWidth()/2-(this.facebox.getWidth()/2)+"px"});Event.observe(document,"keypress",this.keyPressListener);Event.observe(document,"click",this.keyPressListener)},close:function(){new Effect.Fade("facebox",{duration:0.3})},click_handler:function(c,i){this.loading();Event.stop(i);var k=c.rel.match(/facebox\[\.(\w+)\]/);if(k){k=k[1]}new Effect.Appear(this.facebox,{duration:0.3});if(c.href.match(/#/)){var a=window.location.href.split("#")[0];var j=c.href.replace(a+"#","");var l=$(j);var h=new Element(l.tagName);h.innerHTML=l.innerHTML;this.reveal(h,k)}else{if(c.href.match(this.settings.image_types)){var g=new Image();b=this;g.onload=function(){b.reveal('<div class="image"><img src="'+g.src+'" /></div>',k)};g.src=c.href}else{var b=this;var a=c.href;new Ajax.Request(a,{method:"get",onFailure:function(d){b.reveal(d.responseText,k)},onSuccess:function(d){b.reveal(d.responseText,k)}})}}}});var facebox;document.observe("dom:loaded",function(){facebox=new Facebox()});var WysiHat={};WysiHat.Editor={attach:function(a,c,e){c=$H(c);a=$(a);a.hide();var b=c.get("model")||WysiHat.iFrame;var d=e;return b.create(a,function(h){var g=h.getDocument();var i=h.getWindow();h.load();Event.observe(i,"focus",function(j){h.focus()});Event.observe(i,"blur",function(j){h.blur()});h._observeEvents();if(Prototype.Browser.Gecko){h.execCommand("undo",false,null)}if(d){d(h)}h.focus()})},include:function(a){this.includedModules=this.includedModules||$A([]);this.includedModules.push(a)},extend:function(b){var a=this.includedModules||$A([]);a.each(function(c){Object.extend(b,c)})}};WysiHat.Commands=(function(){function l(){this.execCommand("bold",false,null)}function w(){return this.queryCommandState("bold")}function H(){this.execCommand("underline",false,null)}function x(){return this.queryCommandState("underline")}function t(){this.execCommand("italic",false,null)}function F(){return this.queryCommandState("italic")}function v(){this.execCommand("strikethrough",false,null)}function g(){this.execCommand("blockquote",false,null)}function q(I){this.execCommand("fontname",false,I)}function m(){var I=this.selection.getNode();return Element.getStyle(I,"fontFamily")}function u(I){this.execCommand("fontsize",false,I)}function c(){var I=this.selection.getNode();return r(Element.getStyle(I,"fontSize"))}function G(I){this.execCommand("forecolor",false,I)}function k(){var I=this.selection.getNode();return y(Element.getStyle(I,"color"))}function p(I){if(Prototype.Browser.Gecko){this.execCommand("hilitecolor",false,I)}else{this.execCommand("backcolor",false,I)}}function a(){var I=this.selection.getNode();return y(Element.getStyle(I,"backgroundColor"))}function E(I){this.execCommand("justify"+I)}function d(){var I=this.selection.getNode();return Element.getStyle(I,"textAlign")}function j(I){this.execCommand("createLink",false,I)}function i(){var I=this.selection.getNode();if(this.linkSelected()){this.selection.selectNode(I)}this.execCommand("unlink",false,null)}function C(){var I=this.selection.getNode();return I?I.tagName.toUpperCase()=="A":false}function o(){this.execCommand("insertorderedlist",false,null)}function n(){this.execCommand("insertunorderedlist",false,null)}function e(I){this.execCommand("insertImage",false,I)}function b(J){if(Prototype.Browser.IE){var I=this._selection.getRange();I.pasteHTML(J);I.collapse(false);I.select()}else{this.execCommand("insertHTML",false,J)}}function A(M,L,K){var I=this.getDocument();if(Prototype.Browser.IE){this.selection.restore()}var J=this.commands.get(M);if(J){J.bind(this)(K)}else{I.execCommand(M,L,K)}}function h(K){var I=this.getDocument();var J=this.queryCommands.get(K);if(J){return J.bind(this)()}else{return I.queryCommandState(K)}}var B=$w("xxx-small xx-small x-small small medium large x-large xx-large");var D=$w("9px 10px 13px 16px 18px 24px 32px 48px");if(Prototype.Browser.WebKit){B.shift();B.push("-webkit-xxx-large")}function r(J){var I=B.indexOf(J);if(I>=0){return I}I=D.indexOf(J);if(I>=0){return I}return parseInt(J)}function y(M){if(!M||M.match(/[0-9a-f]{6}/i)){return M}var J=M.toLowerCase().match(/^(rgba?|hsla?)\(([\s\.\-,%0-9]+)\)/);if(J){var P=J[2].split(/\s*,\s*/),K=P.length,V=J[1];if((V=="rgb"&&K==3)||(V=="rgba"&&K==4)){var I=P[0];if(I.charAt(I.length-1)=="%"){var Q=P.map(function(L){return parseFloat(L)*2.56});if(K==4){Q[3]=P[3]}return z(Q)}return z(P)}if((V=="hsl"&&K==3)||(V=="hsla"&&K==4)){var R=((parseFloat(P[0])%360)+360)%360/360,N=parseFloat(P[1])/100,O=parseFloat(P[2])/100,T=O<=0.5?O*(N+1):O+N-O*N,U=2*O-T,Q=[s(U,T,R+1/3)*256,s(U,T,R)*256,s(U,T,R-1/3)*256,1];if(K==4){Q[3]=P[3]}return z(Q)}}return null}function z(J){var I=J.slice(0,3).map(function(K){var L=parseInt(K).toString(16);return L.length<2?"0"+L:L});return"#"+I.join("")}function s(J,I,K){if(K<0){++K}if(K>1){--K}var L=6*K;if(L<1){return J+(I-J)*L}if(2*K<1){return I}if(3*K<2){return J+(I-J)*(2/3-K)*6}return J}return{boldSelection:l,boldSelected:w,underlineSelection:H,underlineSelected:x,italicSelection:t,italicSelected:F,strikethroughSelection:v,blockquoteSelection:g,fontSelection:q,fontSelected:m,fontSizeSelection:u,fontSizeSelected:c,colorSelection:G,colorSelected:k,backgroundColorSelection:p,backgroundColorSelected:a,alignSelection:E,alignSelected:d,linkSelection:j,unlinkSelection:i,linkSelected:C,insertOrderedList:o,insertUnorderedList:n,insertImage:e,insertHTML:b,execCommand:A,queryCommandState:h,commands:$H({}),queryCommands:$H({link:C})}})();WysiHat.Editor.include(WysiHat.Commands);WysiHat.Events=(function(){var a=["click","dblclick","mousedown","mouseup","mouseover","mousemove","mouseout","keypress","keydown","keyup"];function b(j,k){a.each(function(l){Event.observe(j,l,function(m){k.fire("wysihat:"+l)})})}function g(l,j,k){Event.observe(j,"keydown",function(m){if(m.keyCode==86){k.fire("wysihat:paste")}});Event.observe(l,"paste",function(m){k.fire("wysihat:paste")})}function c(k,j){Event.observe(k,"focus",function(l){j.fire("wysihat:focus")});Event.observe(k,"blur",function(l){j.fire("wysihat:blur")})}function i(j,k){Event.observe(j,"mouseup",function(m){var l=k.selection.getRange();if(!l.collapsed){k.fire("wysihat:select")}})}function e(j,k){var l=k.rawContent();Event.observe(j,"keyup",function(n){var m=k.rawContent();if(l!=m){k.fire("wysihat:change");l=m}})}function d(j,l){var m=l.selection.getRange();var k=function(o){var n=l.selection.getRange();if(m!=n){l.fire("wysihat:cursormove");m=n}};Event.observe(j,"keyup",k);Event.observe(j,"mouseup",k)}function h(){if(this._observers_setup){return}var j=this.getDocument();var k=this.getWindow();b(j,this);g(k,j,this);c(k,this);i(j,this);e(j,this);d(j,this);this._observers_setup=true}return{_observeEvents:h}})();WysiHat.Editor.include(WysiHat.Events);WysiHat.Persistence=(function(){function h(i){return i.formatHTMLOutput()}function a(i){return i.formatHTMLInput()}function e(){return this.outputFilter(this.rawContent())}function d(i){this.setRawContent(this.inputFilter(i))}function c(){this.textarea.value=this.content()}function g(){this.setContent(this.textarea.value)}function b(){this.selection.setBookmark();this.save();this.load();this.selection.moveToBookmark()}return{outputFilter:h,inputFilter:a,content:e,setContent:d,save:c,load:g,reload:b}})();WysiHat.Editor.include(WysiHat.Persistence);WysiHat.Window=(function(){function c(){return this.contentDocument||this.contentWindow.document}function b(){if(this.contentDocument){return this.contentDocument.defaultView}else{if(this.contentWindow.document){return this.contentWindow}else{return null}}}function a(){this.getWindow().focus();if(this.hasFocus){return}this.hasFocus=true}function d(){this.hasFocus=false}return{getDocument:c,getWindow:b,focus:a,blur:d}})();WysiHat.Editor.include(WysiHat.Window);WysiHat.iFrame={create:function(a,c){var b=new Element("iframe",{id:a.id+"_editor","class":"editor"});Object.extend(b,WysiHat.iFrame.Methods);WysiHat.Editor.extend(b);b.attach(a,c);a.insert({before:b});return b}};WysiHat.iFrame.Methods={attach:function(a,b){this.textarea=a;this.observe("load",function(){try{var c=this.getDocument()}catch(d){return}this.selection=new WysiHat.Selection(this);if(this.ready&&c.designMode=="on"){return}this.setStyle({});c.designMode="on";b(this);this.ready=true;this.fire("wysihat:ready")})},unattach:function(){this.remove()},whenReady:function(b){if(this.ready){b(this)}else{var a=this;a.observe("wysihat:ready",function(){b(a)})}return this},setStyle:function(e){var a=this.getDocument();var c=this;if(!this.ready){return setTimeout(function(){c.setStyle(e)},1)}if(Prototype.Browser.IE){var d=a.createStyleSheet();d.addRule("body","border: 0");d.addRule("p","margin: 0");$H(e).each(function(h){var g=h.first().underscore().dasherize()+": "+h.last();d.addRule("body",g)})}else{if(Prototype.Browser.Opera){var d=Element("style").update("p { margin: 0; }");var b=a.getElementsByTagName("head")[0];b.appendChild(d)}else{Element.setStyle(a.body,e)}}return this},linkStyleSheet:function(a){this.whenReady(function(d){var b=d.getDocument();if(b.createStyleSheet){b.createStyleSheet(css)}else{var c=b.documentElement.getElementsByTagName("head")[0];if(!c){c=b.createElement("head");b.documentElement.insertBefore(c,b.getElementsByTagName("body")[0])}var e='<link href="'+a+'" media="screen" rel="stylesheet" type="text/css"/>';c=$(c);if(c.insert){$(c).insert(e)}else{c.innerHTML=c.innerHTML+e}}})},getStyle:function(b){var a=this.getDocument();return Element.getStyle(a.body,b)},rawContent:function(){var a=this.getDocument();if(a.body){return a.body.innerHTML}else{return""}},setRawContent:function(b){var a=this.getDocument();if(a.body){a.body.innerHTML=b}}};WysiHat.Editable={create:function(a,c){var b=new Element("div",{id:a.id+"_editor","class":"editor",contenteditable:"true"});b.textarea=a;WysiHat.Editor.extend(b);Object.extend(b,WysiHat.Editable.Methods);c(b);a.insert({before:b});return b}};WysiHat.Editable.Methods={getDocument:function(){return document},getWindow:function(){return window},rawContent:function(){return this.innerHTML},setRawContent:function(a){this.innerHTML=a}};Object.extend(String.prototype,(function(){function a(){var k=String(this);k=k.tidyXHTML();if(Prototype.Browser.WebKit){k=k.replace(/(<div>)+/g,"\n");k=k.replace(/(<\/div>)+/g,"");k=k.replace(/<p>\s*<\/p>/g,"");k=k.replace(/<br \/>(\n)*/g,"\n")}else{if(Prototype.Browser.Gecko){k=k.replace(/<p>/g,"");k=k.replace(/<\/p>(\n)?/g,"\n");k=k.replace(/<br \/>(\n)*/g,"\n")}else{if(Prototype.Browser.IE||Prototype.Browser.Opera){k=k.replace(/<p>(&nbsp;|&#160;|\s)<\/p>/g,"<p></p>");k=k.replace(/<br \/>/g,"");k=k.replace(/<p>/g,"");k=k.replace(/&nbsp;/g,"");k=k.replace(/<\/p>(\n)?/g,"\n");k=k.gsub(/^<p>/,"");k=k.gsub(/<\/p>$/,"")}}}k=k.gsub(/<b>/,"<strong>");k=k.gsub(/<\/b>/,"</strong>");k=k.gsub(/<i>/,"<em>");k=k.gsub(/<\/i>/,"</em>");k=k.replace(/\n\n+/g,"</p>\n\n<p>");k=k.gsub(/(([^\n])(\n))(?=([^\n]))/,"#{2}<br />\n");k="<p>"+k+"</p>";k=k.replace(/<p>\s*/g,"<p>");k=k.replace(/\s*<\/p>/g,"</p>");var e=Element("body");e.innerHTML=k;if(Prototype.Browser.WebKit||Prototype.Browser.Gecko){var j;do{j=false;e.select("span").each(function(i){if(i.hasClassName("Apple-style-span")){i.removeClassName("Apple-style-span");if(i.className==""){i.removeAttribute("class")}j=true}else{if(i.getStyle("fontWeight")=="bold"){i.setStyle({fontWeight:""});if(i.style.length==0){i.removeAttribute("style")}i.update("<strong>"+i.innerHTML+"</strong>");j=true}else{if(i.getStyle("fontStyle")=="italic"){i.setStyle({fontStyle:""});if(i.style.length==0){i.removeAttribute("style")}i.update("<em>"+i.innerHTML+"</em>");j=true}else{if(i.getStyle("textDecoration")=="underline"){i.setStyle({textDecoration:""});if(i.style.length==0){i.removeAttribute("style")}i.update("<u>"+i.innerHTML+"</u>");j=true}else{if(i.attributes.length==0){i.replace(i.innerHTML);j=true}}}}}})}while(j)}var h=$A(["BR","IMG"]);for(var d=0;d<e.descendants().length;d++){var g=e.descendants()[d];if(g.innerHTML.blank()&&!h.include(g.nodeName)&&g.id!="bookmark"){g.remove()}}k=e.innerHTML;k=k.tidyXHTML();k=k.replace(/<br \/>(\n)*/g,"<br />\n");k=k.replace(/<\/p>\n<p>/g,"</p>\n\n<p>");k=k.replace(/<p>\s*<\/p>/g,"");k=k.replace(/\s*$/g,"");return k}function b(){var e=String(this);var d=Element("body");d.innerHTML=e;if(Prototype.Browser.Gecko||Prototype.Browser.WebKit){d.select("strong").each(function(g){g.replace('<span style="font-weight: bold;">'+g.innerHTML+"</span>")});d.select("em").each(function(g){g.replace('<span style="font-style: italic;">'+g.innerHTML+"</span>")});d.select("u").each(function(g){g.replace('<span style="text-decoration: underline;">'+g.innerHTML+"</span>")})}if(Prototype.Browser.WebKit){d.select("span").each(function(g){if(g.getStyle("fontWeight")=="bold"){g.addClassName("Apple-style-span")}if(g.getStyle("fontStyle")=="italic"){g.addClassName("Apple-style-span")}if(g.getStyle("textDecoration")=="underline"){g.addClassName("Apple-style-span")}})}e=d.innerHTML;e=e.tidyXHTML();e=e.replace(/<\/p>(\n)*<p>/g,"\n\n");e=e.replace(/(\n)?<br( \/)?>(\n)?/g,"\n");e=e.replace(/^<p>/g,"");e=e.replace(/<\/p>$/g,"");if(Prototype.Browser.Gecko){e=e.replace(/\n/g,"<br>");e=e+"<br>"}else{if(Prototype.Browser.WebKit){e=e.replace(/\n/g,"</div><div>");e="<div>"+e+"</div>";e=e.replace(/<div><\/div>/g,"<div><br></div>")}else{if(Prototype.Browser.IE||Prototype.Browser.Opera){e=e.replace(/\n/g,"</p>\n<p>");e="<p>"+e+"</p>";e=e.replace(/<p><\/p>/g,"<p>&nbsp;</p>");e=e.replace(/(<p>&nbsp;<\/p>)+$/g,"")}}}return e}function c(){var d=String(this);d=d.gsub(/\r\n?/,"\n");d=d.gsub(/<([A-Z]+)([^>]*)>/,function(e){return"<"+e[1].toLowerCase()+e[2]+">"});d=d.gsub(/<\/([A-Z]+)>/,function(e){return"</"+e[1].toLowerCase()+">"});d=d.replace(/<br>/g,"<br />");return d}return{formatHTMLOutput:a,formatHTMLInput:b,tidyXHTML:c}})());Object.extend(String.prototype,{sanitize:function(a){return Element("div").update(this).sanitize(a).innerHTML.tidyXHTML()}});Element.addMethods({sanitize:function(c,b){c=$(c);b=$H(b);var a=$A(b.get("tags")||[]);var d=$A(b.get("attributes")||[]);var e=Element(c.nodeName);$A(c.childNodes).each(function(i){if(i.nodeType==1){var g=$(i).sanitize(b).childNodes;if(a.include(i.nodeName.toLowerCase())){var h=Element(i.nodeName);d.each(function(j){if((value=i.readAttribute(j))){h.writeAttribute(j,value)}});e.appendChild(h);$A(g).each(function(j){h.appendChild(j)})}else{$A(g).each(function(j){e.appendChild(j)})}}else{if(i.nodeType==3){e.appendChild(i)}}});return e}});if(typeof Range=="undefined"){Range=function(a){this.ownerDocument=a;this.startContainer=this.ownerDocument.documentElement;this.startOffset=0;this.endContainer=this.ownerDocument.documentElement;this.endOffset=0;this.collapsed=true;this.commonAncestorContainer=this._commonAncestorContainer(this.startContainer,this.endContainer);this.detached=false;this.START_TO_START=0;this.START_TO_END=1;this.END_TO_END=2;this.END_TO_START=3};Range.CLONE_CONTENTS=0;Range.DELETE_CONTENTS=1;Range.EXTRACT_CONTENTS=2;if(!document.createRange){document.createRange=function(){return new Range(this)}}Object.extend(Range.prototype,(function(){function r(){return e(this,Range.CLONE_CONTENTS)}function x(){try{var z=new Range(this.ownerDocument);z.startContainer=this.startContainer;z.startOffset=this.startOffset;z.endContainer=this.endContainer;z.endOffset=this.endOffset;z.collapsed=this.collapsed;z.commonAncestorContainer=this.commonAncestorContainer;z.detached=this.detached;return z}catch(y){return null}}function b(y){if(y){this.endContainer=this.startContainer;this.endOffset=this.startOffset;this.collapsed=true}else{this.startContainer=this.endContainer;this.startOffset=this.endOffset;this.collapsed=true}}function a(z,E){try{var A,D,C,y;A=this.commonAncestorContainer;D=E.commonAncestorContainer;C=A;while(C.parentNode){C=C.parentNode}y=D;while(y.parentNode){y=y.parentNode}switch(z){case this.START_TO_START:return p(this,this.startContainer,this.startOffset,E.startContainer,E.startOffset);break;case this.START_TO_END:return p(this,this.startContainer,this.startOffset,E.endContainer,E.endOffset);break;case this.END_TO_END:return p(this,this.endContainer,this.endOffset,E.endContainer,E.endOffset);break;case this.END_TO_START:return p(this,this.endContainer,this.endOffset,E.startContainer,E.startOffset);break}}catch(B){}return null}function w(){try{e(this,Range.DELETE_CONTENTS)}catch(y){}}function v(){this.detached=true}function o(){try{return e(this,Range.EXTRACT_CONTENTS)}catch(y){return null}}function k(y){try{var C,z,B;switch(this.startContainer.nodeType){case Node.CDATA_SECTION_NODE:case Node.TEXT_NODE:z=this.startContainer.splitText(this.startOffset);this.startContainer.parentNode.insertBefore(y,z);break;default:if(this.startContainer.childNodes.length==0){B=null}else{B=this.startContainer.childNodes(this.startOffset)}this.startContainer.insertBefore(y,B)}}catch(A){}}function d(y){this.setStartBefore(y);this.setEndAfter(y)}function u(y){this.setStart(y,0);this.setEnd(y,y.childNodes.length)}function q(y,C){try{var z,B;this.startContainer=y;this.startOffset=C;z=this.endContainer;while(z.parentNode){z=z.parentNode}B=this.startContainer;while(B.parentNode){B=B.parentNode}if(B!=z){this.collapse(true)}else{if(p(this,this.startContainer,this.startOffset,this.endContainer,this.endOffset)>0){this.collapse(true)}}this.collapsed=t(this);this.commonAncestorContainer=s(this.startContainer,this.endContainer)}catch(A){}}function n(y){this.setStart(y.parentNode,h(y)+1)}function j(y){this.setStart(y.parentNode,h(y))}function i(y,A){try{this.endContainer=y;this.endOffset=A;endRootContainer=this.endContainer;while(endRootContainer.parentNode){endRootContainer=endRootContainer.parentNode}startRootContainer=this.startContainer;while(startRootContainer.parentNode){startRootContainer=startRootContainer.parentNode}if(startRootContainer!=endRootContainer){this.collapse(false)}else{if(p(this,this.startContainer,this.startOffset,this.endContainer,this.endOffset)>0){this.collapse(false)}}this.collapsed=t(this);this.commonAncestorContainer=s(this.startContainer,this.endContainer)}catch(z){}}function g(y){this.setEnd(y.parentNode,h(y)+1)}function l(y){this.setEnd(y.parentNode,h(y))}function m(z){try{var B,y;while(z.firstChild){z.removeChild(z.firstChild)}y=this.extractContents();this.insertNode(z);z.appendChild(y);this.selectNode(z)}catch(A){}}function p(D,B,E,z,C){var G,A,y,F,H;if(B==z){if(E==C){return 0}else{if(E<C){return -1}else{return 1}}}G=z;while(G&&G.parentNode!=B){G=G.parentNode}if(G){A=0;y=B.firstChild;while(y!=G&&A<E){A++;y=y.nextSibling}if(E<=A){return -1}else{return 1}}G=B;while(G&&G.parentNode!=z){G=G.parentNode}if(G){A=0;y=z.firstChild;while(y!=G&&A<C){A++;y=y.nextSibling}if(A<C){return -1}else{return 1}}F=D._commonAncestorContainer(B,z);H=B;while(H&&H.parentNode!=F){H=H.parentNode}if(!H){H=F}childB=z;while(childB&&childB.parentNode!=F){childB=childB.parentNode}if(!childB){childB=F}if(H==childB){return 0}y=F.firstChild;while(y){if(y==H){return -1}if(y==childB){return 1}y=y.nextSibling}return null}function s(A,z){var B=A,y;while(B){y=z;while(y&&B!=y){y=y.parentNode}if(B==y){break}B=B.parentNode}if(!B&&A.ownerDocument){return A.ownerDocument.documentElement}return B}function t(y){return(y.startContainer==y.endContainer&&y.startOffset==y.endOffset)}function c(y){switch(y.nodeType){case Node.CDATA_SECTION_NODE:case Node.COMMENT_NODE:case Node.ELEMENT_NODE:case Node.PROCESSING_INSTRUCTION_NODE:return true;default:return false}}function e(F,N){try{var E,D=null,A=null,y,K,R,O;var P,H,B;var C,L,z;var J,I;var M,G;if(F.collapsed){return null}E=F.commonAncestorContainer;if(F.startContainer!=E){D=F.startContainer;while(D.parentNode!=E){D=D.parentNode}}if(F.endContainer!=E){A=F.endContainer;while(A.parentNode!=E){A=A.parentNode}}if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){y=F.ownerDocument.createDocumentFragment()}if(F.startContainer==F.endContainer){switch(F.startContainer.nodeType){case Node.CDATA_SECTION_NODE:case Node.COMMENT_NODE:case Node.TEXT_NODE:if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){R=F.startContainer.cloneNode();R.deleteData(F.endOffset,F.startContainer.data.length-F.endOffset);R.deleteData(0,F.startOffset);y.appendChild(R)}if(N==Range.EXTRACT_CONTENTS||N==Range.DELETE_CONTENTS){F.startContainer.deleteData(F.startOffset,F.endOffset-F.startOffset)}break;case Node.PROCESSING_INSTRUCTION_NODE:break;default:K=F.startContainer.firstChild;for(O=0;O<F.startOffset;O++){K=K.nextSibling}while(K&&O<F.endOffset){J=K.nextSibling;if(N==Range.EXTRACT_CONTENTS){y.appendChild(K)}else{if(N==Range.CLONE_CONTENTS){y.appendChild(K.cloneNode())}else{F.startContainer.removeChild(K)}}K=J;O++}}F.collapse(true);return y}if(F.startContainer!=E){switch(F.startContainer.nodeType){case Node.CDATA_SECTION_NODE:case Node.COMMENT_NODE:case Node.TEXT_NODE:if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){R=F.startContainer.cloneNode(true);R.deleteData(0,F.startOffset);P=R}if(N==Range.EXTRACT_CONTENTS||N==Range.DELETE_CONTENTS){F.startContainer.deleteData(F.startOffset,F.startContainer.data.length-F.startOffset)}break;case Node.PROCESSING_INSTRUCTION_NODE:break;default:if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){P=F.startContainer.cloneNode(false)}K=F.startContainer.firstChild;for(O=0;O<F.startOffset;O++){K=K.nextSibling}while(K&&O<F.endOffset){J=K.nextSibling;if(N==Range.EXTRACT_CONTENTS){y.appendChild(K)}else{if(N==Range.CLONE_CONTENTS){y.appendChild(K.cloneNode())}else{F.startContainer.removeChild(K)}}K=J;O++}}H=F.startContainer.parentNode;K=F.startContainer.nextSibling;for(;H!=E;H=H.parentNode){if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){B=H.cloneNode(false);B.appendChild(P);P=B}for(;K;K=J){J=K.nextSibling;if(N==Range.EXTRACT_CONTENTS){P.appendChild(K)}else{if(N==Range.CLONE_CONTENTS){P.appendChild(K.cloneNode(true))}else{H.removeChild(K)}}}K=H.nextSibling}}if(F.endContainer!=E){switch(F.endContainer.nodeType){case Node.CDATA_SECTION_NODE:case Node.COMMENT_NODE:case Node.TEXT_NODE:if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){R=F.endContainer.cloneNode(true);R.deleteData(F.endOffset,F.endContainer.data.length-F.endOffset);C=R}if(N==Range.EXTRACT_CONTENTS||N==Range.DELETE_CONTENTS){F.endContainer.deleteData(0,F.endOffset)}break;case Node.PROCESSING_INSTRUCTION_NODE:break;default:if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){C=F.endContainer.cloneNode(false)}K=F.endContainer.firstChild;if(K&&F.endOffset){for(O=0;O+1<F.endOffset;O++){J=K.nextSibling;if(!J){break}K=J}for(;K;K=I){I=K.previousSibling;if(N==Range.EXTRACT_CONTENTS){C.insertBefore(K,C.firstChild)}else{if(N==Range.CLONE_CONTENTS){C.insertBefore(K.cloneNode(True),C.firstChild)}else{F.endContainer.removeChild(K)}}}}}L=F.endContainer.parentNode;K=F.endContainer.previousSibling;for(;L!=E;L=L.parentNode){if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){z=C.cloneNode(false);z.appendChild(C);C=z}for(;K;K=I){I=K.previousSibling;if(N==Range.EXTRACT_CONTENTS){C.insertBefore(K,C.firstChild)}else{if(N==Range.CLONE_CONTENTS){C.appendChild(K.cloneNode(true),C.firstChild)}else{L.removeChild(K)}}}K=L.previousSibling}}if(F.startContainer==E){M=F.startContainer.firstChild;for(O=0;O<F.startOffset;O++){M=M.nextSibling}}else{M=F.startContainer;while(M.parentNode!=E){M=M.parentNode}M=M.nextSibling}if(F.endContainer==E){G=F.endContainer.firstChild;for(O=0;O<F.endOffset;O++){G=G.nextSibling}}else{G=F.endContainer;while(G.parentNode!=E){G=G.parentNode}}if((N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS)&&P){y.appendChild(P)}if(M){for(K=M;K&&K!=G;K=J){J=K.nextSibling;if(N==Range.EXTRACT_CONTENTS){y.appendChild(K)}else{if(N==Range.CLONE_CONTENTS){y.appendChild(K.cloneNode(true))}else{E.removeChild(K)}}}}if((N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS)&&C){y.appendChild(C)}if(N==Range.EXTRACT_CONTENTS||N==Range.DELETE_CONTENTS){if(!D&&!A){F.collapse(true)}else{if(D){F.startContainer=D.parentNode;F.endContainer=D.parentNode;F.startOffset=F.endOffset=F._nodeIndex(D)+1}else{if(A){F.startContainer=A.parentNode;F.endContainer=A.parentNode;F.startOffset=F.endOffset=F._nodeIndex(A)}}}}return y}catch(Q){return null}}function h(y){var z=0;while(y.previousSibling){z++;y=y.previousSibling}return z}return{setStart:q,setEnd:i,setStartBefore:j,setStartAfter:n,setEndBefore:l,setEndAfter:g,collapse:b,selectNode:d,selectNodeContents:u,compareBoundaryPoints:a,deleteContents:w,extractContents:o,cloneContents:r,insertNode:k,surroundContents:m,cloneRange:x,toString:toString,detach:v,_commonAncestorContainer:s}})())}if(!window.getSelection){window.getSelection=function(){return Selection.getInstance()};SelectionImpl=function(){this.anchorNode=null;this.anchorOffset=0;this.focusNode=null;this.focusOffset=0;this.isCollapsed=true;this.rangeCount=0;this.ranges=[]};Object.extend(SelectionImpl.prototype,(function(){function l(o){return true}function k(){return true}function i(){return true}function h(){return true}function c(){return true}function b(){this.anchorNode=null;this.anchorOffset=0;this.focusNode=null;this.focusOffset=0;this.isCollapsed=true;this.rangeCount=0;this.ranges=[]}function n(t){if(t.startContainer.nodeType!=Node.TEXT_NODE){var v=this._getRightStart(t.startContainer);var o=0}else{var v=t.startContainer;var o=t.startOffset}if(t.endContainer.nodeType!=Node.TEXT_NODE){var p=this._getRightEnd(t.endContainer);var s=p.data.length}else{var p=t.endContainer;var s=t.endOffset}var q=this._selectStart(v,o);var u=this._selectEnd(p,s);q.setEndPoint("EndToStart",u);q.select();document.selection._selectedRange=t}function g(p,o){if(p.nodeType!=Node.TEXT_NODE){if(p.nodeType==Node.ELEMENT_NODE){p=p.childNodes(o)}return a(p)}else{return null}}function m(o,p){if(o.nodeType!=Node.TEXT_NODE){if(o.nodeType==Node.ELEMENT_NODE){o=o.childNodes(p)}return e(o)}else{return null}}function d(v,u){var q=document.body.createTextRange();if(v.nodeType==Node.TEXT_NODE){var s=u,p=v;var o=null,t=true;while(p.previousSibling){switch(p.previousSibling.nodeType){case Node.ELEMENT_NODE:o=p.previousSibling;t=false;break;case Node.TEXT_NODE:s+=p.previousSibling.data.length}if(o!=null){break}p=p.previousSibling}if(o==null){o=v.parentNode}q.moveToElementText(o);q.collapse(t);q.move("Character",s);return q}else{return null}}function j(o,v){var s=document.body.createTextRange(),q=o;if(o.nodeType==3){var t=o.data.length-v;var p=null,u=false;while(q.nextSibling){switch(q.nextSibling.nodeType){case Node.ELEMENT_NODE:p=q.nextSibling;u=true;break;case Node.TEXT_NODE:t+=q.nextSibling.data.length;break}if(p!=null){break}q=q.nextSibling}if(p==null){p=o.parentNode;u=false}switch(p.nodeName.toLowerCase()){case"p":case"div":case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":t++}s.moveToElementText(p);s.collapse(u);s.move("Character",-t);return s}return null}function e(p){var o=[];var q=null;while(p){o=[];q=p;while(q){while(q){if(q.nodeType==3&&q.data.replace(/^\s+|\s+$/,"").length){return q}if(q.previousSibling){o.push(q.previousSibling)}q=q.lastChild}q=o.pop()}p=p.previousSibling}return null}function a(p){var o=[];var q=null;while(p){o=[];q=p;while(q){while(q){if(q.nodeType==3&&q.data.replace(/^\s+|\s+$/,"").length){return q}if(q.nextSibling){o.push(q.nextSibling)}q=q.firstChild}q=o.pop()}p=p.nextSibling}return null}return{removeAllRanges:b,_addRange:n,_getRightStart:g,_getRightEnd:m,_selectStart:d,_selectEnd:j}})());Selection=new function(){var a=null;this.getInstance=function(){if(a==null){return(a=new SelectionImpl())}else{return a}}}}Object.extend(Range.prototype,(function(){function a(){var b=this.commonAncestorContainer;if(this.startContainer==this.endContainer){if(this.startOffset-this.endOffset<2){b=this.startContainer.childNodes[this.startOffset]}}while(b.nodeType==Node.TEXT_NODE){b=b.parentNode}return b}return{getNode:a}})());WysiHat.Selection=Class.create((function(){function g(n){this.window=n.getWindow();this.document=n.getDocument();if(Prototype.Browser.IE){n.observe("wysihat:cursormove",i.bind(this));n.observe("wysihat:focus",m)}}function e(){return this.window.getSelection?this.window.getSelection():this.document.selection}function a(){var n=null,o=this.getSelection();try{if(o.getRangeAt){n=o.getRangeAt(0)}else{n=o.createRange()}}catch(p){return null}if(Prototype.Browser.WebKit){n.setStart(o.baseNode,o.baseOffset);n.setEnd(o.extentNode,o.extentOffset)}return n}function d(p){var o=this.getSelection();if(Prototype.Browser.IE){var n=h(this.document,p);n.select()}else{if(Prototype.Browser.WebKit){o.setBaseAndExtent(p,0,p,p.innerText.length)}else{if(Prototype.Browser.Opera){n=this.document.createRange();n.selectNode(p);o.removeAllRanges();o.addRange(n)}else{var n=h(this.document,p);o.removeAllRanges();o.addRange(n)}}}}function c(){var n=null,s=[],q,p;var t=this.getRange();if(!t){return null}var u;if(t.parentElement){u=t.parentElement()}else{u=t.commonAncestorContainer}if(u){while(u.nodeType!=1){u=u.parentNode}if(u.nodeName.toLowerCase()!="body"){p=u;do{p=p.parentNode;s[s.length]=p}while(p.nodeName.toLowerCase()!="body")}q=u.all||u.getElementsByTagName("*");for(var r=0;r<q.length;r++){s[s.length]=q[r]}n=[u];for(var v=0,o;v<s.length;v++){o=h(this.document,s[v]);if(o&&b(t,o)){n[n.length]=s[v]}}}return n.first()}function h(n,p){if(n.body.createTextRange){var o=n.body.createTextRange();o.moveToElementText(p)}else{if(n.createRange){var o=n.createRange();o.selectNodeContents(p)}}return o}function b(o,n){if(o.compareEndPoints){return !(n.compareEndPoints("StartToStart",o)==1&&n.compareEndPoints("EndToEnd",o)==1&&n.compareEndPoints("StartToEnd",o)==1&&n.compareEndPoints("EndToStart",o)==1||n.compareEndPoints("StartToStart",o)==-1&&n.compareEndPoints("EndToEnd",o)==-1&&n.compareEndPoints("StartToEnd",o)==-1&&n.compareEndPoints("EndToStart",o)==-1)}else{if(o.compareBoundaryPoints){return !(n.compareBoundaryPoints(0,o)==1&&n.compareBoundaryPoints(2,o)==1&&n.compareBoundaryPoints(1,o)==1&&n.compareBoundaryPoints(3,o)==1||n.compareBoundaryPoints(0,o)==-1&&n.compareBoundaryPoints(2,o)==-1&&n.compareBoundaryPoints(1,o)==-1&&n.compareBoundaryPoints(3,o)==-1)}}return null}function l(){var p=this.document.getElementById("bookmark");if(p){p.parentNode.removeChild(p)}p=this.document.createElement("span");p.id="bookmark";p.innerHTML="&nbsp;";if(Prototype.Browser.IE){var n=this.document.selection.createRange();var o=this.document.createElement("div");o.appendChild(p);n.collapse();n.pasteHTML(o.innerHTML)}else{var n=this.getRange();n.insertNode(p)}}function k(){var p=this.document.getElementById("bookmark");if(!p){return}if(Prototype.Browser.IE){var n=this.getRange();n.moveToElementText(p);n.collapse();n.select()}else{if(Prototype.Browser.WebKit){var o=this.getSelection();o.setBaseAndExtent(p,0,p,0)}else{var n=this.getRange();n.setStartBefore(p)}}p.parentNode.removeChild(p)}var j=null;function i(){j=this.getRange()}function m(){if(j){j.select()}}return{initialize:g,getSelection:e,getRange:a,getNode:c,selectNode:d,setBookmark:l,moveToBookmark:k,restore:m}})());WysiHat.Toolbar=Class.create((function(){function e(l){this.editor=l;this.element=this.createToolbarElement()}function a(){var l=new Element("div",{"class":"editor_toolbar"});this.editor.insert({before:l});return l}function d(m){var l=this;$A(m).each(function(n){l.addButton(n)})}function j(m,o){m=$H(m);if(!m.get("name")){m.set("name",m.get("label").toLowerCase())}var l=m.get("name");var n=this.createButtonElement(this.element,m);var o=this.buttonHandler(l,m);this.observeButtonClick(n,o);var o=this.buttonStateHandler(l,m);this.observeStateChanges(n,l,o)}function i(n,l){var m=Element("a",{"class":"button",href:"#"});m.update("<span>"+l.get("label")+"</span>");m.addClassName(l.get("name"));n.appendChild(m);return m}function k(m,l){if(l.handler){return l.handler}else{if(l.get("handler")){return l.get("handler")}else{return function(n){n.execCommand(m)}}}}function g(l,m){var n=this;l.observe("click",function(o){m(n.editor);n.editor.fire("wysihat:change");n.editor.fire("wysihat:cursormove");Event.stop(o)})}function c(m,l){if(l.query){return l.query}else{if(l.get("query")){return l.get("query")}else{return function(n){return n.queryCommandState(m)}}}}function h(n,m,o){var p=this;var l=false;p.editor.observe("wysihat:cursormove",function(q){var r=o(p.editor);if(r!=l){l=r;p.updateButtonState(n,m,r)}})}function b(m,l,n){if(n){m.addClassName("selected")}else{m.removeClassName("selected")}}return{initialize:e,createToolbarElement:a,addButtonSet:d,addButton:j,createButtonElement:i,buttonHandler:k,observeButtonClick:g,buttonStateHandler:c,observeStateChanges:h,updateButtonState:b}})());WysiHat.Toolbar.ButtonSets={};WysiHat.Toolbar.ButtonSets.Basic=$A([{label:"Bold"},{label:"Underline"},{label:"Italic"}]);var toolbars=[];var WysihatHelper={faceboxFile:function(){facebox.loading();new Effect.Appear($("facebox"),{duration:0.3});var b=facebox;var a="/wysihat_files/?editor="+this.id;new Ajax.Request(a,{method:"get",onFailure:function(c){b.reveal(c.responseText,null)},onSuccess:function(c){b.reveal(c.responseText,null)}})},faceboxLink:function(){if(this.linkSelected()){this.unlinkSelection()}else{facebox.loading();new Effect.Appear($("facebox"),{duration:0.3});iframe=this;facebox.reveal('<input type="text" id="link_field" style="width:100%;"/>',null);Event.observe("link_field","change",function(a){iframe.linkSelection($("link_field").value)})}},faceboxHTML:function(){facebox.loading();new Effect.Appear($("facebox"),{duration:0.3});iframe=this;facebox.reveal('<textarea id="html_editor" style="width:100%; height:400px;">'+iframe.contentWindow.document.body.innerHTML+"</textarea>",null);Event.observe("html_editor","change",function(a){iframe.contentWindow.document.body.innerHTML=$("html_editor").value})},faceboxPaste:function(){facebox.loading();new Effect.Appear($("facebox"),{duration:0.3});iframe=this;facebox.reveal('<textarea id="paste_editor" style="width:100%; height:400px;"></textarea>',null);Event.observe("paste_editor","change",function(a){iframe.contentWindow.document.body.innerHTML=iframe.contentWindow.document.body.innerHTML+$("paste_editor").value.escapeHTML()})}};WysiHat.Editor.include(WysihatHelper);Event.observe(window,"load",function(){$$("textarea").each(function(a){var b=WysiHat.Editor.attach(a.id);var c=new WysiHat.Toolbar(b);toolbars[a.id]=c});$$("form").each().onsubmit=function(){editor.save()}});function addButtons(b,a){Event.observe(window,"load",function(){a.each(function(c){switch(c.toLowerCase()){case"image":toolbars[b].addButton({label:c.gsub("_","-").camelize().capitalize(),handler:function(d){return d.faceboxFile(d)}});break;case"link":toolbars[b].addButton({label:c.gsub("_","-").camelize().capitalize(),handler:function(d){return d.faceboxLink(d)}});break;case"html":toolbars[b].addButton({label:c.gsub("_","-").camelize().capitalize(),handler:function(d){return d.faceboxHTML(d)}});break;case"paste":toolbars[b].addButton({label:c.gsub("_","-").camelize().capitalize(),handler:function(d){return d.faceboxPaste(d)}});break;default:toolbars[b].addButton({label:c.gsub("_","-").camelize().capitalize()})}})})};
1
+ var Facebox=Class.create({initialize:function(a){this.settings={loading_image:"/images/loading.gif",close_image:"/images/closelabel.gif",image_types:new RegExp("."+["png","jpg","jpeg","gif"].join("|")+"$","i"),inited:true,facebox_html:' <div id="facebox" style="display:none;"> <div class="popup"> <table id="facebox_table"> <tbody> <tr> <td class="tl"/><td class="b"/><td class="tr"/> </tr> <tr> <td class="b"/> <td class="body"> <div class="content"> </div> <div class="footer"> <a href="#" class="close"> <img src="/images/closelabel.gif" title="close" class="close_image" /> </a> </div> </td> <td class="b"/> </tr> <tr> <td class="bl"/><td class="b"/><td class="br"/> </tr> </tbody> </table> </div> </div>'};if(a){Object.extend(this.settings,a)}$(document.body).insert({bottom:this.settings.facebox_html});this.preload=[new Image(),new Image()];this.preload[0].src=this.settings.close_image;this.preload[1].src=this.settings.loading_image;f=this;$$("#facebox .b:first, #facebox .bl, #facebox .br, #facebox .tl, #facebox .tr").each(function(b){f.preload.push(new Image());f.preload.slice(-1).src=b.getStyle("background-image").replace(/url\((.+)\)/,"$1")});this.facebox=$("facebox");this.keyPressListener=this.watchKeyPress.bindAsEventListener(this);this.watchClickEvents();fb=this;Event.observe($$("#facebox .close").first(),"click",function(b){Event.stop(b);fb.close()});Event.observe($$("#facebox .close_image").first(),"click",function(b){Event.stop(b);fb.close()})},watchKeyPress:function(a){if(a.keyCode==27||!Event.element(a).descendantOf(this.facebox)){this.close()}},watchClickEvents:function(b){var a=this;$$("a[rel=facebox]").each(function(d,c){Event.observe(d,"click",function(g){Event.stop(g);a.click_handler(d,g)})})},loading:function(){if($$("#facebox .loading").length==1){return true}contentWrapper=$$("#facebox .content").first();contentWrapper.childElements().each(function(c,b){c.remove()});contentWrapper.insert({bottom:'<div class="loading"><img src="'+this.settings.loading_image+'"/></div>'});var a=document.viewport.getScrollOffsets();this.facebox.setStyle({top:a.top+(document.viewport.getHeight()/10)+"px",left:document.viewport.getWidth()/2-(this.facebox.getWidth()/2)+"px"});Event.observe(document,"keypress",this.keyPressListener);Event.observe(document,"click",this.keyPressListener)},reveal:function(b,a){this.loading();load=$$("#facebox .loading").first();if(load){load.remove()}contentWrapper=$$("#facebox .content").first();if(a){contentWrapper.addClassName(a)}contentWrapper.update(b);$$("#facebox .body").first().childElements().each(function(d,c){d.show()});if(!this.facebox.visible()){new Effect.Appear(this.facebox,{duration:0.3})}this.facebox.setStyle({left:document.viewport.getWidth()/2-(this.facebox.getWidth()/2)+"px"});Event.observe(document,"keypress",this.keyPressListener);Event.observe(document,"click",this.keyPressListener)},close:function(){new Effect.Fade("facebox",{duration:0.3})},click_handler:function(c,i){this.loading();Event.stop(i);var k=c.rel.match(/facebox\[\.(\w+)\]/);if(k){k=k[1]}new Effect.Appear(this.facebox,{duration:0.3});if(c.href.match(/#/)){var a=window.location.href.split("#")[0];var j=c.href.replace(a+"#","");var l=$(j);var h=new Element(l.tagName);h.innerHTML=l.innerHTML;this.reveal(h,k)}else{if(c.href.match(this.settings.image_types)){var g=new Image();b=this;g.onload=function(){b.reveal('<div class="image"><img src="'+g.src+'" /></div>',k)};g.src=c.href}else{var b=this;var a=c.href;new Ajax.Request(a,{method:"get",onFailure:function(d){b.reveal(d.responseText,k)},onSuccess:function(d){b.reveal(d.responseText,k)}})}}}});var facebox;document.observe("dom:loaded",function(){facebox=new Facebox()});var WysiHat={};WysiHat.Editor={attach:function(a,c,e){c=$H(c);a=$(a);a.hide();var b=c.get("model")||WysiHat.iFrame;var d=e;return b.create(a,function(h){var g=h.getDocument();var i=h.getWindow();h.load();Event.observe(i,"focus",function(j){h.focus()});Event.observe(i,"blur",function(j){h.blur()});h._observeEvents();if(Prototype.Browser.Gecko){h.execCommand("undo",false,null)}if(d){d(h)}h.focus()})},include:function(a){this.includedModules=this.includedModules||$A([]);this.includedModules.push(a)},extend:function(b){var a=this.includedModules||$A([]);a.each(function(c){Object.extend(b,c)})}};WysiHat.Commands=(function(){function l(){this.execCommand("bold",false,null)}function w(){return this.queryCommandState("bold")}function H(){this.execCommand("underline",false,null)}function x(){return this.queryCommandState("underline")}function t(){this.execCommand("italic",false,null)}function F(){return this.queryCommandState("italic")}function v(){this.execCommand("strikethrough",false,null)}function g(){this.execCommand("blockquote",false,null)}function q(I){this.execCommand("fontname",false,I)}function m(){var I=this.selection.getNode();return Element.getStyle(I,"fontFamily")}function u(I){this.execCommand("fontsize",false,I)}function c(){var I=this.selection.getNode();return r(Element.getStyle(I,"fontSize"))}function G(I){this.execCommand("forecolor",false,I)}function k(){var I=this.selection.getNode();return y(Element.getStyle(I,"color"))}function p(I){if(Prototype.Browser.Gecko){this.execCommand("hilitecolor",false,I)}else{this.execCommand("backcolor",false,I)}}function a(){var I=this.selection.getNode();return y(Element.getStyle(I,"backgroundColor"))}function E(I){this.execCommand("justify"+I)}function d(){var I=this.selection.getNode();return Element.getStyle(I,"textAlign")}function j(I){this.execCommand("createLink",false,I)}function i(){var I=this.selection.getNode();if(this.linkSelected()){this.selection.selectNode(I)}this.execCommand("unlink",false,null)}function C(){var I=this.selection.getNode();return I?I.tagName.toUpperCase()=="A":false}function o(){this.execCommand("insertorderedlist",false,null)}function n(){this.execCommand("insertunorderedlist",false,null)}function e(I){this.execCommand("insertImage",false,I)}function b(J){if(Prototype.Browser.IE){var I=this._selection.getRange();I.pasteHTML(J);I.collapse(false);I.select()}else{this.execCommand("insertHTML",false,J)}}function A(M,L,K){var I=this.getDocument();if(Prototype.Browser.IE){this.selection.restore()}var J=this.commands.get(M);if(J){J.bind(this)(K)}else{I.execCommand(M,L,K)}}function h(K){var I=this.getDocument();var J=this.queryCommands.get(K);if(J){return J.bind(this)()}else{return I.queryCommandState(K)}}var B=$w("xxx-small xx-small x-small small medium large x-large xx-large");var D=$w("9px 10px 13px 16px 18px 24px 32px 48px");if(Prototype.Browser.WebKit){B.shift();B.push("-webkit-xxx-large")}function r(J){var I=B.indexOf(J);if(I>=0){return I}I=D.indexOf(J);if(I>=0){return I}return parseInt(J)}function y(M){if(!M||M.match(/[0-9a-f]{6}/i)){return M}var J=M.toLowerCase().match(/^(rgba?|hsla?)\(([\s\.\-,%0-9]+)\)/);if(J){var P=J[2].split(/\s*,\s*/),K=P.length,V=J[1];if((V=="rgb"&&K==3)||(V=="rgba"&&K==4)){var I=P[0];if(I.charAt(I.length-1)=="%"){var Q=P.map(function(L){return parseFloat(L)*2.56});if(K==4){Q[3]=P[3]}return z(Q)}return z(P)}if((V=="hsl"&&K==3)||(V=="hsla"&&K==4)){var R=((parseFloat(P[0])%360)+360)%360/360,N=parseFloat(P[1])/100,O=parseFloat(P[2])/100,T=O<=0.5?O*(N+1):O+N-O*N,U=2*O-T,Q=[s(U,T,R+1/3)*256,s(U,T,R)*256,s(U,T,R-1/3)*256,1];if(K==4){Q[3]=P[3]}return z(Q)}}return null}function z(J){var I=J.slice(0,3).map(function(K){var L=parseInt(K).toString(16);return L.length<2?"0"+L:L});return"#"+I.join("")}function s(J,I,K){if(K<0){++K}if(K>1){--K}var L=6*K;if(L<1){return J+(I-J)*L}if(2*K<1){return I}if(3*K<2){return J+(I-J)*(2/3-K)*6}return J}return{boldSelection:l,boldSelected:w,underlineSelection:H,underlineSelected:x,italicSelection:t,italicSelected:F,strikethroughSelection:v,blockquoteSelection:g,fontSelection:q,fontSelected:m,fontSizeSelection:u,fontSizeSelected:c,colorSelection:G,colorSelected:k,backgroundColorSelection:p,backgroundColorSelected:a,alignSelection:E,alignSelected:d,linkSelection:j,unlinkSelection:i,linkSelected:C,insertOrderedList:o,insertUnorderedList:n,insertImage:e,insertHTML:b,execCommand:A,queryCommandState:h,commands:$H({}),queryCommands:$H({link:C})}})();WysiHat.Editor.include(WysiHat.Commands);WysiHat.Events=(function(){var a=["click","dblclick","mousedown","mouseup","mouseover","mousemove","mouseout","keypress","keydown","keyup"];function b(j,k){a.each(function(l){Event.observe(j,l,function(m){k.fire("wysihat:"+l)})})}function g(l,j,k){Event.observe(j,"keydown",function(m){if(m.keyCode==86){k.fire("wysihat:paste")}});Event.observe(l,"paste",function(m){k.fire("wysihat:paste")})}function c(k,j){Event.observe(k,"focus",function(l){j.fire("wysihat:focus")});Event.observe(k,"blur",function(l){j.fire("wysihat:blur")})}function i(j,k){Event.observe(j,"mouseup",function(m){var l=k.selection.getRange();if(!l.collapsed){k.fire("wysihat:select")}})}function e(j,k){var l=k.rawContent();Event.observe(j,"keyup",function(n){var m=k.rawContent();if(l!=m){k.fire("wysihat:change");l=m}})}function d(j,l){var m=l.selection.getRange();var k=function(o){var n=l.selection.getRange();if(m!=n){l.fire("wysihat:cursormove");m=n}};Event.observe(j,"keyup",k);Event.observe(j,"mouseup",k)}function h(){if(this._observers_setup){return}var j=this.getDocument();var k=this.getWindow();b(j,this);g(k,j,this);c(k,this);i(j,this);e(j,this);d(j,this);this._observers_setup=true}return{_observeEvents:h}})();WysiHat.Editor.include(WysiHat.Events);WysiHat.Persistence=(function(){function h(i){return i.formatHTMLOutput()}function a(i){return i.formatHTMLInput()}function e(){return this.outputFilter(this.rawContent())}function d(i){this.setRawContent(this.inputFilter(i))}function c(){this.textarea.value=this.content()}function g(){this.setContent(this.textarea.value)}function b(){this.selection.setBookmark();this.save();this.load();this.selection.moveToBookmark()}return{outputFilter:h,inputFilter:a,content:e,setContent:d,save:c,load:g,reload:b}})();WysiHat.Editor.include(WysiHat.Persistence);WysiHat.Window=(function(){function c(){return this.contentDocument||this.contentWindow.document}function b(){if(this.contentDocument){return this.contentDocument.defaultView}else{if(this.contentWindow.document){return this.contentWindow}else{return null}}}function a(){this.getWindow().focus();if(this.hasFocus){return}this.hasFocus=true}function d(){this.hasFocus=false}return{getDocument:c,getWindow:b,focus:a,blur:d}})();WysiHat.Editor.include(WysiHat.Window);WysiHat.iFrame={create:function(a,c){var b=new Element("iframe",{id:a.id+"_editor","class":"editor"});Object.extend(b,WysiHat.iFrame.Methods);WysiHat.Editor.extend(b);b.attach(a,c);a.insert({before:b});return b}};WysiHat.iFrame.Methods={attach:function(a,b){this.textarea=a;this.observe("load",function(){try{var c=this.getDocument()}catch(d){return}this.selection=new WysiHat.Selection(this);if(this.ready&&c.designMode=="on"){return}this.setStyle({});c.designMode="on";b(this);this.ready=true;this.fire("wysihat:ready")})},unattach:function(){this.remove()},whenReady:function(b){if(this.ready){b(this)}else{var a=this;a.observe("wysihat:ready",function(){b(a)})}return this},setStyle:function(e){var a=this.getDocument();var c=this;if(!this.ready){return setTimeout(function(){c.setStyle(e)},1)}if(Prototype.Browser.IE){var d=a.createStyleSheet();d.addRule("body","border: 0");d.addRule("p","margin: 0");$H(e).each(function(h){var g=h.first().underscore().dasherize()+": "+h.last();d.addRule("body",g)})}else{if(Prototype.Browser.Opera){var d=Element("style").update("p { margin: 0; }");var b=a.getElementsByTagName("head")[0];b.appendChild(d)}else{Element.setStyle(a.body,e)}}return this},linkStyleSheet:function(a){this.whenReady(function(d){var b=d.getDocument();if(b.createStyleSheet){b.createStyleSheet(css)}else{var c=b.documentElement.getElementsByTagName("head")[0];if(!c){c=b.createElement("head");b.documentElement.insertBefore(c,b.getElementsByTagName("body")[0])}var e='<link href="'+a+'" media="screen" rel="stylesheet" type="text/css"/>';c=$(c);if(c.insert){$(c).insert(e)}else{c.innerHTML=c.innerHTML+e}}})},getStyle:function(b){var a=this.getDocument();return Element.getStyle(a.body,b)},rawContent:function(){var a=this.getDocument();if(a.body){return a.body.innerHTML}else{return""}},setRawContent:function(b){var a=this.getDocument();if(a.body){a.body.innerHTML=b}}};WysiHat.Editable={create:function(a,c){var b=new Element("div",{id:a.id+"_editor","class":"editor",contenteditable:"true"});b.textarea=a;WysiHat.Editor.extend(b);Object.extend(b,WysiHat.Editable.Methods);c(b);a.insert({before:b});return b}};WysiHat.Editable.Methods={getDocument:function(){return document},getWindow:function(){return window},rawContent:function(){return this.innerHTML},setRawContent:function(a){this.innerHTML=a}};Object.extend(String.prototype,(function(){function a(){var k=String(this);k=k.tidyXHTML();if(Prototype.Browser.WebKit){k=k.replace(/(<div>)+/g,"\n");k=k.replace(/(<\/div>)+/g,"");k=k.replace(/<p>\s*<\/p>/g,"");k=k.replace(/<br \/>(\n)*/g,"\n")}else{if(Prototype.Browser.Gecko){k=k.replace(/<p>/g,"");k=k.replace(/<\/p>(\n)?/g,"\n");k=k.replace(/<br \/>(\n)*/g,"\n")}else{if(Prototype.Browser.IE||Prototype.Browser.Opera){k=k.replace(/<p>(&nbsp;|&#160;|\s)<\/p>/g,"<p></p>");k=k.replace(/<br \/>/g,"");k=k.replace(/<p>/g,"");k=k.replace(/&nbsp;/g,"");k=k.replace(/<\/p>(\n)?/g,"\n");k=k.gsub(/^<p>/,"");k=k.gsub(/<\/p>$/,"")}}}k=k.gsub(/<b>/,"<strong>");k=k.gsub(/<\/b>/,"</strong>");k=k.gsub(/<i>/,"<em>");k=k.gsub(/<\/i>/,"</em>");k=k.replace(/\n\n+/g,"</p>\n\n<p>");k=k.gsub(/(([^\n])(\n))(?=([^\n]))/,"#{2}<br />\n");k="<p>"+k+"</p>";k=k.replace(/<p>\s*/g,"<p>");k=k.replace(/\s*<\/p>/g,"</p>");var e=Element("body");e.innerHTML=k;if(Prototype.Browser.WebKit||Prototype.Browser.Gecko){var j;do{j=false;e.select("span").each(function(i){if(i.hasClassName("Apple-style-span")){i.removeClassName("Apple-style-span");if(i.className==""){i.removeAttribute("class")}j=true}else{if(i.getStyle("fontWeight")=="bold"){i.setStyle({fontWeight:""});if(i.style.length==0){i.removeAttribute("style")}i.update("<strong>"+i.innerHTML+"</strong>");j=true}else{if(i.getStyle("fontStyle")=="italic"){i.setStyle({fontStyle:""});if(i.style.length==0){i.removeAttribute("style")}i.update("<em>"+i.innerHTML+"</em>");j=true}else{if(i.getStyle("textDecoration")=="underline"){i.setStyle({textDecoration:""});if(i.style.length==0){i.removeAttribute("style")}i.update("<u>"+i.innerHTML+"</u>");j=true}else{if(i.attributes.length==0){i.replace(i.innerHTML);j=true}}}}}})}while(j)}var h=$A(["BR","IMG"]);for(var d=0;d<e.descendants().length;d++){var g=e.descendants()[d];if(g.innerHTML.blank()&&!h.include(g.nodeName)&&g.id!="bookmark"){g.remove()}}k=e.innerHTML;k=k.tidyXHTML();k=k.replace(/<br \/>(\n)*/g,"<br />\n");k=k.replace(/<\/p>\n<p>/g,"</p>\n\n<p>");k=k.replace(/<p>\s*<\/p>/g,"");k=k.replace(/\s*$/g,"");return k}function b(){var e=String(this);var d=Element("body");d.innerHTML=e;if(Prototype.Browser.Gecko||Prototype.Browser.WebKit){d.select("strong").each(function(g){g.replace('<span style="font-weight: bold;">'+g.innerHTML+"</span>")});d.select("em").each(function(g){g.replace('<span style="font-style: italic;">'+g.innerHTML+"</span>")});d.select("u").each(function(g){g.replace('<span style="text-decoration: underline;">'+g.innerHTML+"</span>")})}if(Prototype.Browser.WebKit){d.select("span").each(function(g){if(g.getStyle("fontWeight")=="bold"){g.addClassName("Apple-style-span")}if(g.getStyle("fontStyle")=="italic"){g.addClassName("Apple-style-span")}if(g.getStyle("textDecoration")=="underline"){g.addClassName("Apple-style-span")}})}e=d.innerHTML;e=e.tidyXHTML();e=e.replace(/<\/p>(\n)*<p>/g,"\n\n");e=e.replace(/(\n)?<br( \/)?>(\n)?/g,"\n");e=e.replace(/^<p>/g,"");e=e.replace(/<\/p>$/g,"");if(Prototype.Browser.Gecko){e=e.replace(/\n/g,"<br>");e=e+"<br>"}else{if(Prototype.Browser.WebKit){e=e.replace(/\n/g,"</div><div>");e="<div>"+e+"</div>";e=e.replace(/<div><\/div>/g,"<div><br></div>")}else{if(Prototype.Browser.IE||Prototype.Browser.Opera){e=e.replace(/\n/g,"</p>\n<p>");e="<p>"+e+"</p>";e=e.replace(/<p><\/p>/g,"<p>&nbsp;</p>");e=e.replace(/(<p>&nbsp;<\/p>)+$/g,"")}}}return e}function c(){var d=String(this);d=d.gsub(/\r\n?/,"\n");d=d.gsub(/<([A-Z]+)([^>]*)>/,function(e){return"<"+e[1].toLowerCase()+e[2]+">"});d=d.gsub(/<\/([A-Z]+)>/,function(e){return"</"+e[1].toLowerCase()+">"});d=d.replace(/<br>/g,"<br />");return d}return{formatHTMLOutput:a,formatHTMLInput:b,tidyXHTML:c}})());Object.extend(String.prototype,{sanitize:function(a){return Element("div").update(this).sanitize(a).innerHTML.tidyXHTML()}});Element.addMethods({sanitize:function(c,b){c=$(c);b=$H(b);var a=$A(b.get("tags")||[]);var d=$A(b.get("attributes")||[]);var e=Element(c.nodeName);$A(c.childNodes).each(function(i){if(i.nodeType==1){var g=$(i).sanitize(b).childNodes;if(a.include(i.nodeName.toLowerCase())){var h=Element(i.nodeName);d.each(function(j){if((value=i.readAttribute(j))){h.writeAttribute(j,value)}});e.appendChild(h);$A(g).each(function(j){h.appendChild(j)})}else{$A(g).each(function(j){e.appendChild(j)})}}else{if(i.nodeType==3){e.appendChild(i)}}});return e}});if(typeof Range=="undefined"){Range=function(a){this.ownerDocument=a;this.startContainer=this.ownerDocument.documentElement;this.startOffset=0;this.endContainer=this.ownerDocument.documentElement;this.endOffset=0;this.collapsed=true;this.commonAncestorContainer=this._commonAncestorContainer(this.startContainer,this.endContainer);this.detached=false;this.START_TO_START=0;this.START_TO_END=1;this.END_TO_END=2;this.END_TO_START=3};Range.CLONE_CONTENTS=0;Range.DELETE_CONTENTS=1;Range.EXTRACT_CONTENTS=2;if(!document.createRange){document.createRange=function(){return new Range(this)}}Object.extend(Range.prototype,(function(){function r(){return e(this,Range.CLONE_CONTENTS)}function x(){try{var z=new Range(this.ownerDocument);z.startContainer=this.startContainer;z.startOffset=this.startOffset;z.endContainer=this.endContainer;z.endOffset=this.endOffset;z.collapsed=this.collapsed;z.commonAncestorContainer=this.commonAncestorContainer;z.detached=this.detached;return z}catch(y){return null}}function b(y){if(y){this.endContainer=this.startContainer;this.endOffset=this.startOffset;this.collapsed=true}else{this.startContainer=this.endContainer;this.startOffset=this.endOffset;this.collapsed=true}}function a(z,E){try{var A,D,C,y;A=this.commonAncestorContainer;D=E.commonAncestorContainer;C=A;while(C.parentNode){C=C.parentNode}y=D;while(y.parentNode){y=y.parentNode}switch(z){case this.START_TO_START:return p(this,this.startContainer,this.startOffset,E.startContainer,E.startOffset);break;case this.START_TO_END:return p(this,this.startContainer,this.startOffset,E.endContainer,E.endOffset);break;case this.END_TO_END:return p(this,this.endContainer,this.endOffset,E.endContainer,E.endOffset);break;case this.END_TO_START:return p(this,this.endContainer,this.endOffset,E.startContainer,E.startOffset);break}}catch(B){}return null}function w(){try{e(this,Range.DELETE_CONTENTS)}catch(y){}}function v(){this.detached=true}function o(){try{return e(this,Range.EXTRACT_CONTENTS)}catch(y){return null}}function k(y){try{var C,z,B;switch(this.startContainer.nodeType){case Node.CDATA_SECTION_NODE:case Node.TEXT_NODE:z=this.startContainer.splitText(this.startOffset);this.startContainer.parentNode.insertBefore(y,z);break;default:if(this.startContainer.childNodes.length==0){B=null}else{B=this.startContainer.childNodes(this.startOffset)}this.startContainer.insertBefore(y,B)}}catch(A){}}function d(y){this.setStartBefore(y);this.setEndAfter(y)}function u(y){this.setStart(y,0);this.setEnd(y,y.childNodes.length)}function q(y,C){try{var z,B;this.startContainer=y;this.startOffset=C;z=this.endContainer;while(z.parentNode){z=z.parentNode}B=this.startContainer;while(B.parentNode){B=B.parentNode}if(B!=z){this.collapse(true)}else{if(p(this,this.startContainer,this.startOffset,this.endContainer,this.endOffset)>0){this.collapse(true)}}this.collapsed=t(this);this.commonAncestorContainer=s(this.startContainer,this.endContainer)}catch(A){}}function n(y){this.setStart(y.parentNode,h(y)+1)}function j(y){this.setStart(y.parentNode,h(y))}function i(y,A){try{this.endContainer=y;this.endOffset=A;endRootContainer=this.endContainer;while(endRootContainer.parentNode){endRootContainer=endRootContainer.parentNode}startRootContainer=this.startContainer;while(startRootContainer.parentNode){startRootContainer=startRootContainer.parentNode}if(startRootContainer!=endRootContainer){this.collapse(false)}else{if(p(this,this.startContainer,this.startOffset,this.endContainer,this.endOffset)>0){this.collapse(false)}}this.collapsed=t(this);this.commonAncestorContainer=s(this.startContainer,this.endContainer)}catch(z){}}function g(y){this.setEnd(y.parentNode,h(y)+1)}function l(y){this.setEnd(y.parentNode,h(y))}function m(z){try{var B,y;while(z.firstChild){z.removeChild(z.firstChild)}y=this.extractContents();this.insertNode(z);z.appendChild(y);this.selectNode(z)}catch(A){}}function p(D,B,E,z,C){var G,A,y,F,H;if(B==z){if(E==C){return 0}else{if(E<C){return -1}else{return 1}}}G=z;while(G&&G.parentNode!=B){G=G.parentNode}if(G){A=0;y=B.firstChild;while(y!=G&&A<E){A++;y=y.nextSibling}if(E<=A){return -1}else{return 1}}G=B;while(G&&G.parentNode!=z){G=G.parentNode}if(G){A=0;y=z.firstChild;while(y!=G&&A<C){A++;y=y.nextSibling}if(A<C){return -1}else{return 1}}F=D._commonAncestorContainer(B,z);H=B;while(H&&H.parentNode!=F){H=H.parentNode}if(!H){H=F}childB=z;while(childB&&childB.parentNode!=F){childB=childB.parentNode}if(!childB){childB=F}if(H==childB){return 0}y=F.firstChild;while(y){if(y==H){return -1}if(y==childB){return 1}y=y.nextSibling}return null}function s(A,z){var B=A,y;while(B){y=z;while(y&&B!=y){y=y.parentNode}if(B==y){break}B=B.parentNode}if(!B&&A.ownerDocument){return A.ownerDocument.documentElement}return B}function t(y){return(y.startContainer==y.endContainer&&y.startOffset==y.endOffset)}function c(y){switch(y.nodeType){case Node.CDATA_SECTION_NODE:case Node.COMMENT_NODE:case Node.ELEMENT_NODE:case Node.PROCESSING_INSTRUCTION_NODE:return true;default:return false}}function e(F,N){try{var E,D=null,A=null,y,K,R,O;var P,H,B;var C,L,z;var J,I;var M,G;if(F.collapsed){return null}E=F.commonAncestorContainer;if(F.startContainer!=E){D=F.startContainer;while(D.parentNode!=E){D=D.parentNode}}if(F.endContainer!=E){A=F.endContainer;while(A.parentNode!=E){A=A.parentNode}}if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){y=F.ownerDocument.createDocumentFragment()}if(F.startContainer==F.endContainer){switch(F.startContainer.nodeType){case Node.CDATA_SECTION_NODE:case Node.COMMENT_NODE:case Node.TEXT_NODE:if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){R=F.startContainer.cloneNode();R.deleteData(F.endOffset,F.startContainer.data.length-F.endOffset);R.deleteData(0,F.startOffset);y.appendChild(R)}if(N==Range.EXTRACT_CONTENTS||N==Range.DELETE_CONTENTS){F.startContainer.deleteData(F.startOffset,F.endOffset-F.startOffset)}break;case Node.PROCESSING_INSTRUCTION_NODE:break;default:K=F.startContainer.firstChild;for(O=0;O<F.startOffset;O++){K=K.nextSibling}while(K&&O<F.endOffset){J=K.nextSibling;if(N==Range.EXTRACT_CONTENTS){y.appendChild(K)}else{if(N==Range.CLONE_CONTENTS){y.appendChild(K.cloneNode())}else{F.startContainer.removeChild(K)}}K=J;O++}}F.collapse(true);return y}if(F.startContainer!=E){switch(F.startContainer.nodeType){case Node.CDATA_SECTION_NODE:case Node.COMMENT_NODE:case Node.TEXT_NODE:if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){R=F.startContainer.cloneNode(true);R.deleteData(0,F.startOffset);P=R}if(N==Range.EXTRACT_CONTENTS||N==Range.DELETE_CONTENTS){F.startContainer.deleteData(F.startOffset,F.startContainer.data.length-F.startOffset)}break;case Node.PROCESSING_INSTRUCTION_NODE:break;default:if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){P=F.startContainer.cloneNode(false)}K=F.startContainer.firstChild;for(O=0;O<F.startOffset;O++){K=K.nextSibling}while(K&&O<F.endOffset){J=K.nextSibling;if(N==Range.EXTRACT_CONTENTS){y.appendChild(K)}else{if(N==Range.CLONE_CONTENTS){y.appendChild(K.cloneNode())}else{F.startContainer.removeChild(K)}}K=J;O++}}H=F.startContainer.parentNode;K=F.startContainer.nextSibling;for(;H!=E;H=H.parentNode){if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){B=H.cloneNode(false);B.appendChild(P);P=B}for(;K;K=J){J=K.nextSibling;if(N==Range.EXTRACT_CONTENTS){P.appendChild(K)}else{if(N==Range.CLONE_CONTENTS){P.appendChild(K.cloneNode(true))}else{H.removeChild(K)}}}K=H.nextSibling}}if(F.endContainer!=E){switch(F.endContainer.nodeType){case Node.CDATA_SECTION_NODE:case Node.COMMENT_NODE:case Node.TEXT_NODE:if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){R=F.endContainer.cloneNode(true);R.deleteData(F.endOffset,F.endContainer.data.length-F.endOffset);C=R}if(N==Range.EXTRACT_CONTENTS||N==Range.DELETE_CONTENTS){F.endContainer.deleteData(0,F.endOffset)}break;case Node.PROCESSING_INSTRUCTION_NODE:break;default:if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){C=F.endContainer.cloneNode(false)}K=F.endContainer.firstChild;if(K&&F.endOffset){for(O=0;O+1<F.endOffset;O++){J=K.nextSibling;if(!J){break}K=J}for(;K;K=I){I=K.previousSibling;if(N==Range.EXTRACT_CONTENTS){C.insertBefore(K,C.firstChild)}else{if(N==Range.CLONE_CONTENTS){C.insertBefore(K.cloneNode(True),C.firstChild)}else{F.endContainer.removeChild(K)}}}}}L=F.endContainer.parentNode;K=F.endContainer.previousSibling;for(;L!=E;L=L.parentNode){if(N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS){z=C.cloneNode(false);z.appendChild(C);C=z}for(;K;K=I){I=K.previousSibling;if(N==Range.EXTRACT_CONTENTS){C.insertBefore(K,C.firstChild)}else{if(N==Range.CLONE_CONTENTS){C.appendChild(K.cloneNode(true),C.firstChild)}else{L.removeChild(K)}}}K=L.previousSibling}}if(F.startContainer==E){M=F.startContainer.firstChild;for(O=0;O<F.startOffset;O++){M=M.nextSibling}}else{M=F.startContainer;while(M.parentNode!=E){M=M.parentNode}M=M.nextSibling}if(F.endContainer==E){G=F.endContainer.firstChild;for(O=0;O<F.endOffset;O++){G=G.nextSibling}}else{G=F.endContainer;while(G.parentNode!=E){G=G.parentNode}}if((N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS)&&P){y.appendChild(P)}if(M){for(K=M;K&&K!=G;K=J){J=K.nextSibling;if(N==Range.EXTRACT_CONTENTS){y.appendChild(K)}else{if(N==Range.CLONE_CONTENTS){y.appendChild(K.cloneNode(true))}else{E.removeChild(K)}}}}if((N==Range.EXTRACT_CONTENTS||N==Range.CLONE_CONTENTS)&&C){y.appendChild(C)}if(N==Range.EXTRACT_CONTENTS||N==Range.DELETE_CONTENTS){if(!D&&!A){F.collapse(true)}else{if(D){F.startContainer=D.parentNode;F.endContainer=D.parentNode;F.startOffset=F.endOffset=F._nodeIndex(D)+1}else{if(A){F.startContainer=A.parentNode;F.endContainer=A.parentNode;F.startOffset=F.endOffset=F._nodeIndex(A)}}}}return y}catch(Q){return null}}function h(y){var z=0;while(y.previousSibling){z++;y=y.previousSibling}return z}return{setStart:q,setEnd:i,setStartBefore:j,setStartAfter:n,setEndBefore:l,setEndAfter:g,collapse:b,selectNode:d,selectNodeContents:u,compareBoundaryPoints:a,deleteContents:w,extractContents:o,cloneContents:r,insertNode:k,surroundContents:m,cloneRange:x,toString:toString,detach:v,_commonAncestorContainer:s}})())}if(!window.getSelection){window.getSelection=function(){return Selection.getInstance()};SelectionImpl=function(){this.anchorNode=null;this.anchorOffset=0;this.focusNode=null;this.focusOffset=0;this.isCollapsed=true;this.rangeCount=0;this.ranges=[]};Object.extend(SelectionImpl.prototype,(function(){function l(o){return true}function k(){return true}function i(){return true}function h(){return true}function c(){return true}function b(){this.anchorNode=null;this.anchorOffset=0;this.focusNode=null;this.focusOffset=0;this.isCollapsed=true;this.rangeCount=0;this.ranges=[]}function n(t){if(t.startContainer.nodeType!=Node.TEXT_NODE){var v=this._getRightStart(t.startContainer);var o=0}else{var v=t.startContainer;var o=t.startOffset}if(t.endContainer.nodeType!=Node.TEXT_NODE){var p=this._getRightEnd(t.endContainer);var s=p.data.length}else{var p=t.endContainer;var s=t.endOffset}var q=this._selectStart(v,o);var u=this._selectEnd(p,s);q.setEndPoint("EndToStart",u);q.select();document.selection._selectedRange=t}function g(p,o){if(p.nodeType!=Node.TEXT_NODE){if(p.nodeType==Node.ELEMENT_NODE){p=p.childNodes(o)}return a(p)}else{return null}}function m(o,p){if(o.nodeType!=Node.TEXT_NODE){if(o.nodeType==Node.ELEMENT_NODE){o=o.childNodes(p)}return e(o)}else{return null}}function d(v,u){var q=document.body.createTextRange();if(v.nodeType==Node.TEXT_NODE){var s=u,p=v;var o=null,t=true;while(p.previousSibling){switch(p.previousSibling.nodeType){case Node.ELEMENT_NODE:o=p.previousSibling;t=false;break;case Node.TEXT_NODE:s+=p.previousSibling.data.length}if(o!=null){break}p=p.previousSibling}if(o==null){o=v.parentNode}q.moveToElementText(o);q.collapse(t);q.move("Character",s);return q}else{return null}}function j(o,v){var s=document.body.createTextRange(),q=o;if(o.nodeType==3){var t=o.data.length-v;var p=null,u=false;while(q.nextSibling){switch(q.nextSibling.nodeType){case Node.ELEMENT_NODE:p=q.nextSibling;u=true;break;case Node.TEXT_NODE:t+=q.nextSibling.data.length;break}if(p!=null){break}q=q.nextSibling}if(p==null){p=o.parentNode;u=false}switch(p.nodeName.toLowerCase()){case"p":case"div":case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":t++}s.moveToElementText(p);s.collapse(u);s.move("Character",-t);return s}return null}function e(p){var o=[];var q=null;while(p){o=[];q=p;while(q){while(q){if(q.nodeType==3&&q.data.replace(/^\s+|\s+$/,"").length){return q}if(q.previousSibling){o.push(q.previousSibling)}q=q.lastChild}q=o.pop()}p=p.previousSibling}return null}function a(p){var o=[];var q=null;while(p){o=[];q=p;while(q){while(q){if(q.nodeType==3&&q.data.replace(/^\s+|\s+$/,"").length){return q}if(q.nextSibling){o.push(q.nextSibling)}q=q.firstChild}q=o.pop()}p=p.nextSibling}return null}return{removeAllRanges:b,_addRange:n,_getRightStart:g,_getRightEnd:m,_selectStart:d,_selectEnd:j}})());Selection=new function(){var a=null;this.getInstance=function(){if(a==null){return(a=new SelectionImpl())}else{return a}}}}Object.extend(Range.prototype,(function(){function a(){var b=this.commonAncestorContainer;if(this.startContainer==this.endContainer){if(this.startOffset-this.endOffset<2){b=this.startContainer.childNodes[this.startOffset]}}while(b.nodeType==Node.TEXT_NODE){b=b.parentNode}return b}return{getNode:a}})());WysiHat.Selection=Class.create((function(){function g(n){this.window=n.getWindow();this.document=n.getDocument();if(Prototype.Browser.IE){n.observe("wysihat:cursormove",i.bind(this));n.observe("wysihat:focus",m)}}function e(){return this.window.getSelection?this.window.getSelection():this.document.selection}function a(){var n=null,o=this.getSelection();try{if(o.getRangeAt){n=o.getRangeAt(0)}else{n=o.createRange()}}catch(p){return null}if(Prototype.Browser.WebKit){n.setStart(o.baseNode,o.baseOffset);n.setEnd(o.extentNode,o.extentOffset)}return n}function d(p){var o=this.getSelection();if(Prototype.Browser.IE){var n=h(this.document,p);n.select()}else{if(Prototype.Browser.WebKit){o.setBaseAndExtent(p,0,p,p.innerText.length)}else{if(Prototype.Browser.Opera){n=this.document.createRange();n.selectNode(p);o.removeAllRanges();o.addRange(n)}else{var n=h(this.document,p);o.removeAllRanges();o.addRange(n)}}}}function c(){var n=null,s=[],q,p;var t=this.getRange();if(!t){return null}var u;if(t.parentElement){u=t.parentElement()}else{u=t.commonAncestorContainer}if(u){while(u.nodeType!=1){u=u.parentNode}if(u.nodeName.toLowerCase()!="body"){p=u;do{p=p.parentNode;s[s.length]=p}while(p.nodeName.toLowerCase()!="body")}q=u.all||u.getElementsByTagName("*");for(var r=0;r<q.length;r++){s[s.length]=q[r]}n=[u];for(var v=0,o;v<s.length;v++){o=h(this.document,s[v]);if(o&&b(t,o)){n[n.length]=s[v]}}}return n.first()}function h(n,p){if(n.body.createTextRange){var o=n.body.createTextRange();o.moveToElementText(p)}else{if(n.createRange){var o=n.createRange();o.selectNodeContents(p)}}return o}function b(o,n){if(o.compareEndPoints){return !(n.compareEndPoints("StartToStart",o)==1&&n.compareEndPoints("EndToEnd",o)==1&&n.compareEndPoints("StartToEnd",o)==1&&n.compareEndPoints("EndToStart",o)==1||n.compareEndPoints("StartToStart",o)==-1&&n.compareEndPoints("EndToEnd",o)==-1&&n.compareEndPoints("StartToEnd",o)==-1&&n.compareEndPoints("EndToStart",o)==-1)}else{if(o.compareBoundaryPoints){return !(n.compareBoundaryPoints(0,o)==1&&n.compareBoundaryPoints(2,o)==1&&n.compareBoundaryPoints(1,o)==1&&n.compareBoundaryPoints(3,o)==1||n.compareBoundaryPoints(0,o)==-1&&n.compareBoundaryPoints(2,o)==-1&&n.compareBoundaryPoints(1,o)==-1&&n.compareBoundaryPoints(3,o)==-1)}}return null}function l(){var p=this.document.getElementById("bookmark");if(p){p.parentNode.removeChild(p)}p=this.document.createElement("span");p.id="bookmark";p.innerHTML="&nbsp;";if(Prototype.Browser.IE){var n=this.document.selection.createRange();var o=this.document.createElement("div");o.appendChild(p);n.collapse();n.pasteHTML(o.innerHTML)}else{var n=this.getRange();n.insertNode(p)}}function k(){var p=this.document.getElementById("bookmark");if(!p){return}if(Prototype.Browser.IE){var n=this.getRange();n.moveToElementText(p);n.collapse();n.select()}else{if(Prototype.Browser.WebKit){var o=this.getSelection();o.setBaseAndExtent(p,0,p,0)}else{var n=this.getRange();n.setStartBefore(p)}}p.parentNode.removeChild(p)}var j=null;function i(){j=this.getRange()}function m(){if(j){j.select()}}return{initialize:g,getSelection:e,getRange:a,getNode:c,selectNode:d,setBookmark:l,moveToBookmark:k,restore:m}})());WysiHat.Toolbar=Class.create((function(){function e(l){this.editor=l;this.element=this.createToolbarElement()}function a(){var l=new Element("div",{"class":"editor_toolbar"});this.editor.insert({before:l});return l}function d(m){var l=this;$A(m).each(function(n){l.addButton(n)})}function j(m,o){m=$H(m);if(!m.get("name")){m.set("name",m.get("label").toLowerCase())}var l=m.get("name");var n=this.createButtonElement(this.element,m);var o=this.buttonHandler(l,m);this.observeButtonClick(n,o);var o=this.buttonStateHandler(l,m);this.observeStateChanges(n,l,o)}function i(n,l){var m=Element("a",{"class":"button",href:"#"});m.update("<span>"+l.get("label")+"</span>");m.addClassName(l.get("name"));n.appendChild(m);return m}function k(m,l){if(l.handler){return l.handler}else{if(l.get("handler")){return l.get("handler")}else{return function(n){n.execCommand(m)}}}}function g(l,m){var n=this;l.observe("click",function(o){m(n.editor);n.editor.fire("wysihat:change");n.editor.fire("wysihat:cursormove");Event.stop(o)})}function c(m,l){if(l.query){return l.query}else{if(l.get("query")){return l.get("query")}else{return function(n){return n.queryCommandState(m)}}}}function h(n,m,o){var p=this;var l=false;p.editor.observe("wysihat:cursormove",function(q){var r=o(p.editor);if(r!=l){l=r;p.updateButtonState(n,m,r)}})}function b(m,l,n){if(n){m.addClassName("selected")}else{m.removeClassName("selected")}}return{initialize:e,createToolbarElement:a,addButtonSet:d,addButton:j,createButtonElement:i,buttonHandler:k,observeButtonClick:g,buttonStateHandler:c,observeStateChanges:h,updateButtonState:b}})());WysiHat.Toolbar.ButtonSets={};WysiHat.Toolbar.ButtonSets.Basic=$A([{label:"Bold"},{label:"Underline"},{label:"Italic"}]);var toolbars=[];var WysihatHelper={faceboxFile:function(){facebox.loading();new Effect.Appear($("facebox"),{duration:0.3});var b=facebox;var a="/wysihat_files/?editor="+this.id;new Ajax.Request(a,{method:"get",onFailure:function(c){b.reveal(c.responseText,null)},onSuccess:function(c){b.reveal(c.responseText,null)}})},faceboxLink:function(){if(this.linkSelected()){this.unlinkSelection()}else{facebox.loading();new Effect.Appear($("facebox"),{duration:0.3});iframe=this;facebox.reveal('<input type="text" id="link_field" style="width:100%;"/>',null);Event.observe("link_field","change",function(a){iframe.linkSelection($("link_field").value)})}},faceboxHTML:function(){facebox.loading();new Effect.Appear($("facebox"),{duration:0.3});iframe=this;facebox.reveal('<textarea id="html_editor" style="width:100%; height:400px;">'+iframe.contentWindow.document.body.innerHTML+"</textarea>",null);Event.observe("html_editor","change",function(a){iframe.contentWindow.document.body.innerHTML=$("html_editor").value})},};WysiHat.Editor.include(WysihatHelper);Event.observe(window,"load",function(){$$("textarea.wysihat_editor").each(function(a){var b=WysiHat.Editor.attach(a.id);var c=new WysiHat.Toolbar(b);toolbars[a.id]=c;b.outputFilter=function(d){return d.formatHTMLOutput().sanitize({tags:["span","p","br","strong","em","a"],attributes:["id","href"]})};b.observe("wysihat:paste",function(d){setTimeout(function(){d.target.reload()},1)})});$$("form").each().onsubmit=function(){editor.save()}});function addButtons(b,a){Event.observe(window,"load",function(){a.each(function(c){switch(c.toLowerCase()){case"image":toolbars[b].addButton({label:c.gsub("_","-").camelize().capitalize(),handler:function(d){return d.faceboxFile(d)}});break;case"link":toolbars[b].addButton({label:c.gsub("_","-").camelize().capitalize(),handler:function(d){return d.faceboxLink(d)}});break;case"html":toolbars[b].addButton({label:c.gsub("_","-").camelize().capitalize(),handler:function(d){return d.faceboxHTML(d)}});break;case"paste":toolbars[b].addButton({label:c.gsub("_","-").camelize().capitalize(),handler:function(d){return d.faceboxPaste(d)}});break;default:toolbars[b].addButton({label:c.gsub("_","-").camelize().capitalize()})}})})};
@@ -50,9 +50,6 @@ div.editor_toolbar
50
50
  .image
51
51
  background-image: url('../images/image.png')
52
52
 
53
- .paste
54
- background-image: url('../images/paste_plain.png')
55
-
56
53
  .html
57
54
  background-image: url('../images/page_code.png')
58
55
 
@@ -46,7 +46,6 @@ class WysihatGenerator < Rails::Generator::Base
46
46
  m.file 'images/loading.gif', 'public/images/loading.gif'
47
47
  m.file 'images/page_code.png', 'public/images/page_code.png'
48
48
  m.file 'images/page_white_flash.png', 'public/images/page_white_flash.png'
49
- m.file 'images/paste_plain.png', 'public/images/paste_plain.png'
50
49
  m.file 'images/text_align_center.png', 'public/images/text_align_center.png'
51
50
  m.file 'images/text_align_left.png', 'public/images/text_align_left.png'
52
51
  m.file 'images/text_align_right.png', 'public/images/text_align_right.png'
@@ -22,7 +22,7 @@ module ActionView
22
22
 
23
23
  case options['buttons']
24
24
  when nil, :all
25
- options['buttons'] = [:bold, :italic, :underline, :strikethrough, :justify_left, :justify_center, :justify_right, :insert_ordered_list, :insert_unordered_list, :undo, :redo, :link, :html, :paste, :image]
25
+ options['buttons'] = [:bold, :italic, :underline, :strikethrough, :justify_left, :justify_center, :justify_right, :insert_ordered_list, :insert_unordered_list, :undo, :redo, :link, :html, :image]
26
26
  end
27
27
 
28
28
  content_tag(
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wysihat-engine}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeff Kreeftmeijer"]
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
  "app/views/wysihat_files/_wysihat_file.html.erb",
31
31
  "app/views/wysihat_files/index.html.erb",
32
32
  "app/views/wysihat_files/new.html.erb",
33
+ "config/locales/en.yml",
33
34
  "generators/wysihat/templates/css/.sass-cache/242b5853f919a8e6346032f619374fe0847bac7b/facebox.cssc",
34
35
  "generators/wysihat/templates/css/.sass-cache/242b5853f919a8e6346032f619374fe0847bac7b/wysihat.cssc",
35
36
  "generators/wysihat/templates/css/facebox.css",
@@ -47,7 +48,6 @@ Gem::Specification.new do |s|
47
48
  "generators/wysihat/templates/images/loading.gif",
48
49
  "generators/wysihat/templates/images/page_code.png",
49
50
  "generators/wysihat/templates/images/page_white_flash.png",
50
- "generators/wysihat/templates/images/paste_plain.png",
51
51
  "generators/wysihat/templates/images/text_align_center.png",
52
52
  "generators/wysihat/templates/images/text_align_left.png",
53
53
  "generators/wysihat/templates/images/text_align_right.png",
@@ -84,11 +84,14 @@ Gem::Specification.new do |s|
84
84
  s.specification_version = 3
85
85
 
86
86
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
87
+ s.add_development_dependency(%q<yui-compressor>, [">= 0"])
87
88
  s.add_runtime_dependency(%q<thoughtbot-paperclip>, [">= 0"])
88
89
  else
90
+ s.add_dependency(%q<yui-compressor>, [">= 0"])
89
91
  s.add_dependency(%q<thoughtbot-paperclip>, [">= 0"])
90
92
  end
91
93
  else
94
+ s.add_dependency(%q<yui-compressor>, [">= 0"])
92
95
  s.add_dependency(%q<thoughtbot-paperclip>, [">= 0"])
93
96
  end
94
97
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wysihat-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Kreeftmeijer
@@ -12,6 +12,16 @@ cert_chain: []
12
12
  date: 2009-10-05 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: yui-compressor
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
15
25
  - !ruby/object:Gem::Dependency
16
26
  name: thoughtbot-paperclip
17
27
  type: :runtime
@@ -45,6 +55,7 @@ files:
45
55
  - app/views/wysihat_files/_wysihat_file.html.erb
46
56
  - app/views/wysihat_files/index.html.erb
47
57
  - app/views/wysihat_files/new.html.erb
58
+ - config/locales/en.yml
48
59
  - generators/wysihat/templates/css/.sass-cache/242b5853f919a8e6346032f619374fe0847bac7b/facebox.cssc
49
60
  - generators/wysihat/templates/css/.sass-cache/242b5853f919a8e6346032f619374fe0847bac7b/wysihat.cssc
50
61
  - generators/wysihat/templates/css/facebox.css
@@ -62,7 +73,6 @@ files:
62
73
  - generators/wysihat/templates/images/loading.gif
63
74
  - generators/wysihat/templates/images/page_code.png
64
75
  - generators/wysihat/templates/images/page_white_flash.png
65
- - generators/wysihat/templates/images/paste_plain.png
66
76
  - generators/wysihat/templates/images/text_align_center.png
67
77
  - generators/wysihat/templates/images/text_align_left.png
68
78
  - generators/wysihat/templates/images/text_align_right.png