Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Include copyright in minified files. #106

  • Loading branch information...
commit 058b03661a9adc02b45ced46016c901f1faeb646 1 parent ef26584
Sam authored
8 build/build.sh
View
@@ -67,9 +67,9 @@ if $DO_JS; then
cat src/jquery.sceditor.js src/plugins/xhtml.js > minified/jquery.sceditor.xhtml.min.js
echo "Minifying SCEditor"
- uglifyjs -nc -o minified/jquery.sceditor.min.js src/jquery.sceditor.js
- uglifyjs -nc -o minified/jquery.sceditor.xhtml.min.js minified/jquery.sceditor.xhtml.min.js
- uglifyjs -nc -o minified/jquery.sceditor.bbcode.min.js minified/jquery.sceditor.bbcode.min.js
+ uglifyjs --comments '/^!/' -c -m -o minified/jquery.sceditor.min.js src/jquery.sceditor.js
+ uglifyjs --comments '/^!/' -c -m -o minified/jquery.sceditor.xhtml.min.js minified/jquery.sceditor.xhtml.min.js
+ uglifyjs --comments '/^!/' -c -m -o minified/jquery.sceditor.bbcode.min.js minified/jquery.sceditor.bbcode.min.js
echo "Minifying plugins"
for f in src/plugins/*.js
@@ -80,7 +80,7 @@ if $DO_JS; then
filename="${filename%.*}"
cp $f minified/plugins/$filename.js
- uglifyjs -nc -o minified/plugins/$filename.js minified/plugins/$filename.js
+ uglifyjs --comments '/^!p/' -c -m -o minified/plugins/$filename.js minified/plugins/$filename.js
done
fi
6 minified/jquery.sceditor.bbcode.min.js
View
4 additions, 2 deletions not shown
5 minified/jquery.sceditor.min.js
View
@@ -1,2 +1,3 @@
-(function(a,b,c){"use strict";var d={html:'<!DOCTYPE html><html><head><style>.ie * {min-height: auto !important}</style><meta http-equiv="Content-Type" content="text/html;charset={charset}" /><link rel="stylesheet" type="text/css" href="{style}" /></head><body contenteditable="true"></body></html>',toolbarButton:'<a class="sceditor-button sceditor-button-{name}" data-sceditor-command="{name}" unselectable="on"><div unselectable="on">{dispName}</div></a>',emoticon:'<img src="{url}" data-sceditor-emoticon="{key}" alt="{key}" title="{tooltip}" />',fontOpt:'<a class="sceditor-font-option" href="#" data-font="{font}"><font face="{font}">{font}</font></a>',sizeOpt:'<a class="sceditor-fontsize-option" data-size="{size}" href="#"><font size="{size}">{size}</font></a>',pastetext:'<div><label for="txt">{label}</label> <textarea cols="20" rows="7" id="txt"></textarea></div><div><input type="button" class="button" value="{insert}" /></div>',table:'<div><label for="rows">{rows}</label><input type="text" id="rows" value="2" /></div><div><label for="cols">{cols}</label><input type="text" id="cols" value="2" /></div><div><input type="button" class="button" value="{insert}" /></div>',image:'<div><label for="link">{url}</label> <input type="text" id="image" value="http://" /></div><div><label for="width">{width}</label> <input type="text" id="width" size="2" /></div><div><label for="height">{height}</label> <input type="text" id="height" size="2" /></div><div><input type="button" class="button" value="{insert}" /></div>',email:'<div><label for="email">{label}</label> <input type="text" id="email" /></div><div><input type="button" class="button" value="{insert}" /></div>',link:'<div><label for="link">{url}</label> <input type="text" id="link" value="http://" /></div><div><label for="des">{desc}</label> <input type="text" id="des" /></div><div><input type="button" class="button" value="{ins}" /></div>',youtubeMenu:'<div><label for="link">{label}</label> <input type="text" id="link" value="http://" /></div><div><input type="button" class="button" value="{insert}" /></div>',youtube:'<iframe width="560" height="315" src="http://www.youtube.com/embed/{id}?wmode=opaque" data-youtube-id="{id}" frameborder="0" allowfullscreen></iframe>'},e=function(b,c,e){var f=d[b];return a.each(c,function(a,b){f=f.replace(new RegExp("\\{"+a+"\\}","g"),b)}),e&&(f=a(f)),f};a.sceditor=function(d,f){var g=this,h=d.get?d.get(0):d,i=a(h),j,k,l,m,n,o,p,q=[],r,s,t=[],u,v=[],w=[],x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,ab,bb,cb,db,eb,fb;g.commands=a.extend(!0,{},f.commands||a.sceditor.commands),D=function(){i.data("sceditor",g),g.opts=a.extend({},a.sceditor.defaultOptions,f),g.opts.locale&&g.opts.locale!=="en"&&J(),j=a('<div class="sceditor-container" />').insertAfter(i).css("z-index",g.opts.zIndex),a.sceditor.ie&&j.addClass("ie ie"+a.sceditor.ie),C=!!i.attr("required"),i.removeAttr("required"),I(),P(),K(),H(),N(),L(),M(),a.sceditor.isWysiwygSupported||g.toggleSourceMode();var d=function(){a(b).unbind("load",d),g.opts.autofocus&&eb(),g.opts.autoExpand&&g.expandToContent(),Y()};a(b).load(d),c.readyState&&c.readyState==="complete"&&d(),_(),y.call("ready")},I=function(){var b=g.opts.plugins;b=b?b.toString().split(","):[],y=new a.sceditor.PluginManager(g),a.each(b,function(b,c){y.register(a.trim(c))})},J=function(){var b;a.sceditor.locale[g.opts.locale]?s=a.sceditor.locale[g.opts.locale]:(b=g.opts.locale.split("-"),a.sceditor.locale[b[0]]&&(s=a.sceditor.locale[b[0]])),s&&s.dateFormat&&(g.opts.dateFormat=s.dateFormat)},H=function(){var c,d,f,h;n=a("<textarea></textarea>").hide(),l=a('<iframe frameborder="0"></iframe>'),b.location.protocol==="https:"&&l.attr("src","javascript:false"),j.append(l).append(n),m=l[0],o=n[0],g.width(g.opts.width||i.width()),g.height(g.opts.height||i.height()),d=Q(),f=a(d),d.open(),d.write(e("html",{charset:g.opts.charset,style:g.opts.style})),d.close(),g.readOnly(!!g.opts.readOnly),c=f.find("body"),a.sceditor.ie&&f.find("html").addClass("ie ie"+a.sceditor.ie);if(/iPhone|iPod|iPad| wosbrowser\//i.test(navigator.userAgent)||a.sceditor.ie)c.height("100%"),a.sceditor.ie||c.bind("touchend",g.focus);u=new a.sceditor.rangeHelper(m.contentWindow),g.val(i.hide().val()),h=i.attr("tabindex"),n.attr("tabindex",h),l.attr("tabindex",h)},L=function(){var b=a(Q()),c=b.find("body");g.opts.autoUpdate&&(c.bind("blur",g.updateOriginal),n.bind("blur",g.updateOriginal)),g.opts.rtl===null&&(g.opts.rtl=n.css("direction")==="rtl"),g.rtl(!!g.opts.rtl),g.opts.autoExpand&&b.bind("keyup",g.expandToContent),g.opts.resizeEnabled&&O(),j.attr("id",g.opts.id),g.emoticons(g.opts.emoticonsEnabled)},M=function(){var d=a(Q());a(c).click(X),a(h.form).bind("reset",U).submit(g.updateOriginal),a(b).bind("resize orientationChanged",Y),d.find("body").keypress(T).keyup(bb).bind("paste",R).bind(a.sceditor.ie?"selectionchange":"keyup focus blur contextmenu mouseup touchend click",cb).bind("keydown keyup keypress focus blur contextmenu",W),n.bind("keydown keyup keypress focus blur contextmenu",W),d.keypress(T).mousedown(V).bind(a.sceditor.ie?"selectionchange":"focus blur contextmenu mouseup click",cb).bind("beforedeactivate keyup",G).keyup(bb).focus(function(){r=null}),j.bind("selectionchanged",_).bind("selectionchanged",db).bind("selectionchanged",W).bind("nodechanged",W)},K=function(){var b,c,d=g.opts.toolbar.split("|");k=a('<div class="sceditor-toolbar" unselectable="on" />'),a.each(d,function(d,f){b=a('<div class="sceditor-group" />'),a.each(f.split(","),function(d,f){if(!g.commands[f])return;c=e("toolbarButton",{name:f,dispName:g.commands[f].tooltip||f},!0),c.data("sceditor-txtmode",!!g.commands[f].txtExec),c.data("sceditor-wysiwygmode",!!g.commands[f].exec),c.click(function(){var b=a(this);return b.hasClass("disabled")||F(b,g.commands[f]),_(),!1}),g.commands[f].tooltip&&c.attr("title",g._(g.commands[f].tooltip)),g.commands[f].exec||c.addClass("disabled"),b.append(c)}),k.append(b)}),g.opts.toolbarContainer?a(g.opts.toolbarContainer).append(k):j.append(k)},N=function(){a.each(g.commands,function(b,c){c.keyPress&&q.push(c.keyPress),c.forceNewLineAfter&&a.isArray(c.forceNewLineAfter)&&(v=a.merge(v,c.forceNewLineAfter)),c.state?w.push({name:b,state:c.state}):typeof c.exec=="string"&&w.push({name:b,state:c.exec})})},O=function(){var d,e,f,h,i,k,l=a('<div class="sceditor-grip" />'),m=a('<div class="sceditor-resize-cover" />'),n=0,o=0,p=0,q=0,r=j.width(),s=j.height(),t=!1,u=g.rtl();d=g.opts.resizeMinHeight||s/1.5,e=g.opts.resizeMaxHeight||s*2.5,f=g.opts.resizeMinWidth||r/1.25,h=g.opts.resizeMaxWidth||r*1.25,i=function(c){c.type==="touchmove"&&(c=b.event);var i=q+(c.pageY-o),k=u?p-(c.pageX-n):p+(c.pageX-n);h>0&&k>h&&(k=h),e>0&&i>e&&(i=e),g.opts.resizeWidth&&k>=f&&(h<0||k<=h)&&g.width(k),g.opts.resizeHeight&&i>=d&&(e<0||i<=e)&&(g.height(i),a.sceditor.ie<7&&j.height(i)),c.preventDefault()},k=function(b){if(!t)return;t=!1,m.hide(),j.removeClass("resizing").height("auto"),a(c).unbind("touchmove mousemove",i),a(c).unbind("touchend mouseup",k),b.preventDefault()},j.append(l),j.append(m.hide()),l.bind("touchstart mousedown",function(d){d.type==="touchstart"&&(d=b.event),n=d.pageX,o=d.pageY,p=j.width(),q=j.height(),t=!0,j.addClass("resizing"),m.show(),a(c).bind("touchmove mousemove",i),a(c).bind("touchend mouseup",k),a.sceditor.ie<7&&j.height(q),d.preventDefault()})},P=function(){var b;if(!a.isPlainObject(g.opts.emoticons))return;a.each(g.opts.emoticons,function(d,e){a.each(e,function(a,e){g.opts.emoticonsRoot&&(g.opts.emoticons[d][a]=g.opts.emoticonsRoot+(e.url||e)),b=c.createElement("img"),b.src=e.url||e,t.push(b)})})},eb=function(){var b,c,d,e,f=Q(),h=f.body,i=!!g.opts.autofocusEnd;g.sourceMode()?(e=o.value.length,o.setSelectionRange?o.setSelectionRange(e,e):o.createTextRange&&(b=o.createTextRange(),b.moveEnd("character",e),b.moveStart("character",e),u.selectRange(b))):(i?a(h).append(d=f.createElement("div")):d=h.firstChild,f.createRange?(b=f.createRange(),b.setStart(d,0),b.setEnd(d,0)):(b=h.createTextRange(),b.moveToElementText(d),b.collapse(!1)),u.selectRange(b),i&&(a(f).scrollTop(h.scrollHeight),a(h).scrollTop(h.scrollHeight))),g.focus()},g.readOnly=function(a){return typeof a!="boolean"?n.attr("readonly")==="readonly":(Q().body.contentEditable=!a,a?n.attr("readonly","readonly"):n.removeAttr("readonly"),Z(a),this)},g.rtl=function(b){var c=b?"rtl":"ltr";return typeof b!="boolean"?n.attr("dir")==="rtl":(a(Q().body).attr("dir",c),n.attr("dir",c),j.removeClass("rtl").removeClass("ltr").addClass(c),this)},Z=function(b){var c=g.inSourceMode();k.find(".sceditor-button").removeClass("disabled").each(function(){var d=a(this);b===!0||c&&!d.data("sceditor-txtmode")?d.addClass("disabled"):!c&&!d.data("sceditor-wysiwygmode")&&d.addClass("disabled")})},g.width=function(a,b){return!a&&a!==0?j.width():(g.dimensions(a,null,b),this)},g.dimensions=function(a,b,c){var d,e=!1;return a=!a&&a!==0?!1:a,b=!b&&b!==0?!1:b,a===!1&&b===!1?{width:g.width(),height:g.height()}:(typeof l.data("outerWidthOffset")=="undefined"&&g.updateStyleCache(),a!==!1&&a!==g.width()&&(c!==!1&&(g.opts.width=a),a=j.width(a).width(),m.style.width=a-l.data("outerWidthOffset")+"px",o.style.width=a-n.data("outerWidthOffset")+"px",d=g.opts.toolbarContainer?0:k.outerHeight(!0),e=d!==(g.opts.toolbarContainer?0:k.outerHeight(!0))),b!==!1&&b!==g.height()&&(c!==!1&&(g.opts.height=b),b&&b.toString().indexOf("%")&&(b=j.height(b).height(),j.height("auto")),b-=g.opts.toolbarContainer?0:k.outerHeight(!0),e=!0),e&&(m.style.height=b-l.data("outerHeightOffset")+"px",o.style.height=b-n.data("outerHeightOffset")+"px"),this)},g.updateStyleCache=function(){l.data("outerWidthOffset",l.outerWidth(!0)-l.width()),n.data("outerWidthOffset",n.outerWidth(!0)-n.width()),l.data("outerHeightOffset",l.outerHeight(!0)-l.height()),n.data("outerHeightOffset",n.outerHeight(!0)-n.height())},g.height=function(a,b){return!a&&a!==0?j.height():(g.dimensions(null,a,b),this)},g.maximize=function(b){return typeof b=="undefined"?j.is(".sceditor-maximize"):(b=!!b,a.sceditor.ie<7&&a("html, body").toggleClass("sceditor-maximize",b),j.toggleClass("sceditor-maximize",b),g.width(b?"100%":g.opts.width,!1),g.height(b?"100%":g.opts.height,!1),this)},g.expandToContent=function(a){var b=Q(),c=j.height(),d=b.body.scrollHeight||b.documentElement.scrollHeight,e=c-l.height(),f=g.opts.resizeMaxHeight||(g.opts.height||i.height())*2;d+=e,a!==!0&&d>f&&(d=f),d>c&&g.height(d)},g.destroy=function(){y.destroy(),u=null,r=null,y=null,a(c).unbind("click",X),a(b).unbind("resize orientationChanged",Y),a(h.form).unbind("reset",U).unbind("submit",g.updateOriginal),a(Q().body).unbind(),a(Q()).unbind().find("*").remove(),n.unbind().remove(),j.unbind().find("*").unbind().remove(),j.remove(),i.removeData("sceditor").removeData("sceditorbbcode").show(),C&&i.attr("required","required")},g.createDropDown=function(b,c,d,e){var f=p&&p.is(".sceditor-"+c);g.closeDropDown();if(f)return;e!==!1&&a(d).find(":not(input,textarea)").filter(function(){return this.nodeType===1}).attr("unselectable","on");var h={top:b.offset().top,left:b.offset().left,marginTop:b.outerHeight()};a.extend(h,g.opts.dropDownCss),p=a('<div class="sceditor-dropdown sceditor-'+c+'" />').css(h).append(d).appendTo(a("body")).click(function(a){a.stopPropagation()})},X=function(a){a.which!==3&&g.closeDropDown()},R=function(a){function i(a,b){if(a.childNodes.length>0){while(a.firstChild)b.appendChild(a.firstChild);while(h.firstChild)a.appendChild(h.firstChild);S(a,b)}else{if(e>25){while(h.firstChild)a.appendChild(h.firstChild);u.restoreRange();return}++e,setTimeout(function(){i(a,b)},20)}}var b,d=Q().body,e=0,f=d.ownerDocument.createElement("div"),h=d.ownerDocument.createDocumentFragment();if(g.opts.disablePasting)return!1;if(!g.opts.enablePasteFiltering)return;u.saveRange(),c.body.appendChild(f);if(a&&a.clipboardData&&a.clipboardData.getData)if((b=a.clipboardData.getData("text/html"))||(b=a.clipboardData.getData("text/plain")))return f.innerHTML=b,S(d,f),a.stopPropagation(),a.preventDefault(),!1;while(d.firstChild)h.appendChild(d.firstChild);return i(d,f),g.focus(),!0},S=function(b,c){a.sceditor.dom.fixNesting(c);var d=c.innerHTML;y.hasHandler("toSource")&&(d=y.callOnlyFirst("toSource",d,a(c))),c.parentNode.removeChild(c),y.hasHandler("toWysiwyg")&&(d=y.callOnlyFirst("toWysiwyg",d,!0)),u.restoreRange(),u.insertHTML(E(d))},g.closeDropDown=function(a){p&&(p.unbind().remove(),p=null),a===!0&&g.focus()},Q=function(){return m.contentDocument?m.contentDocument:m.contentWindow&&m.contentWindow.document?m.contentWindow.document:m.document?m.document:null},g.wysiwygEditorInsertHtml=function(b,c,d){g.focus();if(!d&&(a(u.parentNode()).is("code")||a(u.parentNode()).parents("code").length!==0))return;u.insertHTML(b,c),bb()},g.wysiwygEditorInsertText=function(b,c){g.wysiwygEditorInsertHtml(a.sceditor.escapeEntities(b),a.sceditor.escapeEntities(c))},g.insertText=function(a,b){return g.inSourceMode()?g.sourceEditorInsertText(a,b):g.wysiwygEditorInsertText(a,b),this},g.sourceEditorInsertText=function(a,b){var d,e,f,g,h;h=o.scrollTop,o.focus(),typeof o.selectionStart!="undefined"?(e=o.selectionStart,f=o.selectionEnd,g=a.length,b&&(a+=o.value.substring(e,f)+b),o.value=o.value.substring(0,e)+a+o.value.substring(f,o.value.length),o.selectionStart=e+a.length-(b?b.length:0),o.selectionEnd=o.selectionStart):typeof c.selection.createRange!="undefined"?(d=c.selection.createRange(),b&&(a+=d.text+b),d.text=a,b&&d.moveEnd("character",0-b.length),d.moveStart("character",d.End-d.Start),d.select()):o.value+=a+b,o.scrollTop=h,o.focus()},g.getRangeHelper=function(){return u},g.val=function(a,b){return typeof a=="string"?(g.inSourceMode()?g.setSourceEditorValue(a):(b!==!1&&y.hasHandler("toWysiwyg")&&(a=y.callOnlyFirst("toWysiwyg",a)),g.setWysiwygEditorValue(a)),this):g.inSourceMode()?g.getSourceEditorValue(!1):g.getWysiwygEditorValue()},g.insert=function(b,c,d,e){if(g.inSourceMode())g.sourceEditorInsertText(b,c);else{if(c){var f=g.getRangeHelper().selectedHtml(),h=a("<div>").appendTo(a("body")).hide().html(f);d!==!1&&(y.hasHandler("toSource")&&(f=y.callOnlyFirst("toSource",f,h)),h.remove()),b+=f+c}y.hasHandler("toWysiwyg")&&(b=y.callOnlyFirst("toWysiwyg",b,!0)),e!==!1&&(b=E(b)),g.wysiwygEditorInsertHtml(b)}return this},g.getWysiwygEditorValue=function(b){var c,d=l.contents().find("body");return a.sceditor.ie&&g.focus(),u.saveRange(),a.sceditor.dom.fixNesting(d.get(0)),c=d.html(),b!==!1&&y.hasHandler("toSource")&&(c=y.callOnlyFirst("toSource",c,d)),u.restoreRange(),r=null,c},g.getSourceEditorValue=function(a){var b=n.val();return a!==!1&&y.hasHandler("toWysiwyg")&&(b=y.callOnlyFirst("toWysiwyg",b)),b},g.setWysiwygEditorValue=function(b){b||(b="<p>"+(a.sceditor.ie?"":"<br />")+"</p>"),Q().body.innerHTML=E(b),bb()},g.setSourceEditorValue=function(a){n.val(a)},g.updateOriginal=function(){i.val(g.val())},E=function(b){if(!g.opts.emoticonsEnabled)return b;var c=a.extend({},g.opts.emoticons.more,g.opts.emoticons.dropdown,g.opts.emoticons.hidden);return a.each(c,function(c,d){var f=a.sceditor.regexEscape(c)+"(?=([^\\<\\>]*?<(?!/code)|[^\\<\\>]*?$))",h="";g.opts.emoticonsCompat&&(f="((>|^|\\s| | | | |&nbsp;))"+f+"(?=(\\s|$|<| | | | |&nbsp;))",h="$1"),b=b.replace(new RegExp(f,"gm"),h+e("emoticon",{key:c,url:d.url||d,tooltip:d.tooltip||c}))}),b},g.inSourceMode=function(){return j.hasClass("sourceMode")},g.sourceMode=function(a){return typeof a!="boolean"?g.inSourceMode():((g.inSourceMode()&&!a||!g.inSourceMode()&&a)&&g.toggleSourceMode(),this)},g.toggleSourceMode=function(){if(!a.sceditor.isWysiwygSupported&&g.inSourceMode())return;g.inSourceMode()?g.setWysiwygEditorValue(g.getSourceEditorValue()):g.setSourceEditorValue(g.getWysiwygEditorValue()),r=null,n.toggle(),l.toggle(),g.inSourceMode()?j.removeClass("sourceMode").addClass("wysiwygMode"):j.removeClass("wysiwygMode").addClass("sourceMode"),Z(),_()},ab=function(){o.focus();if(o.selectionStart!=null)return o.value.substring(o.selectionStart,o.selectionEnd);if(c.selection.createRange)return c.selection.createRange().text},F=function(b,c){if(g.inSourceMode()){c.txtExec&&(a.isArray(c.txtExec)?g.sourceEditorInsertText.apply(g,c.txtExec):c.txtExec.call(g,b,ab()));return}if(!c.exec)return;a.isFunction(c.exec)?c.exec.call(g,b):g.execCommand(c.exec,c.hasOwnProperty("execParam")?c.execParam:null)},G=function(){a.sceditor.ie&&(r=u.selectedRange())},g.execCommand=function(b,c){var d=!1,e=a(u.parentNode());g.focus();if(e.is("code")||e.parents("code").length!==0)return;if(Q())try{d=Q().execCommand(b,!1,c)}catch(f){}!d&&g.commands[b]&&g.commands[b].errorMessage&&alert(g._(g.commands[b].errorMessage))},cb=function(){if(B)return;B=!0,setTimeout(function(){u.compare(A)||(A=u.cloneSelected(),j.trigger(a.Event("selectionchanged"))),B=!1},100)},db=function(){var b=u.parentNode();z!==b&&(j.trigger(a.Event("nodechanged",{oldNode:z,newNode:b})),z=b)},g.currentNode=function(){return z},_=function(a){var b,c,d,e,f,h=Q(),i=w.length,j=g.sourceMode();if(!g.sourceMode()&&!g.readOnly()){f=a?a.newNode:u.parentNode(),d=u.getFirstBlockParent(f);while(i--){b=0,c=w[i],e=k.find(".sceditor-button-"+c.name);if(j&&!e.data("sceditor-txtmode"))e.addClass("disabled");else if(!j&&!e.data("sceditor-wysiwygmode"))e.addClass("disabled");else{if(typeof c.state=="string")try{b=h.queryCommandEnabled(c.state)?0:-1,b>-1&&(b=h.queryCommandState(c.state)?1:0)}catch(a){}else b=c.state.call(g,f,d);b<0?e.addClass("disabled"):e.removeClass("disabled"),b>0?e.addClass("active"):e.removeClass("active")}}}else k.find(".sceditor-button").removeClass("active")},T=function(b){var c,d=q.length;g.closeDropDown(),c=a(u.parentNode());if(b.which===13)if(c.is("code,blockquote,pre")||c.parents("code,blockquote,pre").length!==0)return r=null,g.wysiwygEditorInsertHtml("<br />",null,!0),!1;if(c.is("code")||c.parents("code").length!==0)return;while(d--)q[d].call(g,b,m,n)},bb=function(){var b,c,d=Q();a.sceditor.dom.rTraverse(d.body,function(e){b=e.nodeName.toLowerCase(),a.inArray(b,v)>-1&&(c=!0);if(e.nodeType===3&&!/^\s*$/.test(e.nodeValue)||e.nodeName.toLowerCase()==="br"||a.sceditor.ie&&!e.firstChild&&!a.sceditor.dom.isInline(e,!1))return c&&a(d.body).append(a("<div>"+(a.sceditor.ie?"":"<br />")+"</div>\n")),!1})},U=function(){g.val(i.val())},V=function(){g.closeDropDown(),r=null},Y=function(){var a=g.opts.height,b=g.opts.width,c=j.parent().height();g.maximize()?g.height("100%",!1).width("100%",!1):(a&&a.toString().indexOf("%")>-1&&g.height(a),b&&b.toString().indexOf("%")>-1&&g.width(b))},g._=function(){var a=arguments;return s&&s[a[0]]&&(a[0]=s[a[0]]),a[0].replace(/\{(\d+)\}/g,function(b,c){return typeof a[c-0+1]!="undefined"?a[c-0+1]:"{"+c+"}"})},W=function(b){var c,d=a.extend({},b);y.call(d.type+"Event",b,g),delete d.type,c=a.Event((b.target===o?"scesrc":"scewys")+b.type,d),j.trigger.apply(j,[c,g]),c.isDefaultPrevented()&&b.preventDefault(),c.isImmediatePropagationStopped()&&c.stopImmediatePropagation(),c.isPropagationStopped()&&c.stopPropagation()},g.bind=function(b,c,d,e){var f=b.length;b=b.split(" ");while(f--)a.isFunction(c)&&(d||j.bind("scewys"+b[f],c),e||j.bind("scesrc"+b[f],c));return this},g.unbind=function(b,c,d,e){var f=b.length;b=b.split(" ");while(f--)a.isFunction(c)&&(d||j.unbind("scewys"+b[f],c),e||j.unbind("scesrc"+b[f],c));return this},g.blur=function(b,c,d){return a.isFunction(b)?g.bind("blur",b,c,d):g.sourceMode()?n.blur():(x||(x=a('<input style="width:0;height:0;opacity:0;border:0;padding:0;filter:alpha(opacity=0)" type="text" />').appendTo(j)),x.removeAttr("disabled").show().focus().blur().hide().attr("disabled","disabled")),this},g.focus=function(b,c,d){return a.isFunction(b)?g.bind("focus",b,c,d):g.inSourceMode()?o.focus():(m.contentWindow.focus(),Q().body.focus(),r&&(u.selectRange(r),r=null)),this},g.keyDown=function(a,b,c){return g.bind("keydown",a,b,c)},g.keyPress=function(a,b,c){return g.bind("keypress",a,b,c)},g.keyUp=function(a,b,c){return g.bind("keyup",a,b,c)},g.nodeChanged=function(a){return g.bind("nodechanged",a,!1,!0)},g.selectionChanged=function(a){return g.bind("selectionchanged",a,!1,!0)},fb=function(b){var c=0,d=String.fromCharCode(b.which);g.emoticonsCache||(g.emoticonsCache=[],a.each(a.extend({},g.opts.emoticons.more,g.opts.emoticons.dropdown,g.opts.emoticons.hidden),function(a,b){g.emoticonsCache[c++]=[a,e("emoticon",{key:a,url:b.url||b,tooltip:b.tooltip||a})]}),g.emoticonsCache.sort(function(a,b){return a[0].length-b[0].length})),g.longestEmoticonCode||(g.longestEmoticonCode=g.emoticonsCache[g.emoticonsCache.length-1][0].length);if(g.getRangeHelper().raplaceKeyword(g.emoticonsCache,!0,!0,g.longestEmoticonCode,g.opts.emoticonsCompat,d))return/^\s$/.test(d)&&g.opts.emoticonsCompat?!0:(b.preventDefault(),b.stopPropagation(),!1)},g.emoticons=function(b){if(!b&&b!==!1)return g.opts.emoticonsEnabled;var c=a(Q().body);return g.opts.emoticonsEnabled=b,b?(c.keypress(fb),g.sourceMode()||(u.saveRange(),c.html(E(c.html())),u.restoreRange())):(c.find("img[data-sceditor-emoticon]").replaceWith(function(){return a(this).data("sceditor-emoticon")}),c.unbind("keypress",fb)),this},D()},a.sceditor.ie=function(){var a,d=3,e=c.createElement("div"),f=e.getElementsByTagName("i");do e.innerHTML="<!--[if gt IE "+ ++d+"]><i></i><![endif]-->";while(f[0]);return c.all&&b.atob&&(d=10),d>4?d:a}(),a.sceditor.isWysiwygSupported=function(){var b,c=a('<div contenteditable="true">')[0].contentEditable,d=typeof c!="undefined"&&c!=="inherit",e=navigator.userAgent;if(!d)return!1;var f=/Opera Mobi|Opera Mini/i.test(e);return/Android/i.test(e)&&(f=!0,/Safari/.test(e)&&(b=/Safari\/(\d+)/.exec(e),f=!b||!b[1]?!0:b[1]<534)),/ Silk\//i.test(e)&&(b=/AppleWebKit\/(\d+)/.exec(e),f=!b||!b[1]?!0:b[1]<534),/iPhone|iPod|iPad/i.test(e)&&(f=!/OS [5-9](_\d)+ like Mac OS X/i.test(e)),/fennec/i.test(e)&&(f=!1),!f}(),a.sceditor.regexEscape=function(a){return a.replace(/[\$\?\[\]\.\*\(\)\|\\]/g,"\\$&").replace("<","&lt;").replace(">","&gt;")},a.sceditor.escapeEntities=function(a){return a?a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/ {2}/g," &nbsp;").replace(/\r\n|\r/g,"\n").replace(/\n/g,"<br />"):a},a.sceditor.locale={},a.sceditor.commands={bold:{exec:"bold",tooltip:"Bold"},italic:{exec:"italic",tooltip:"Italic"},underline:{exec:"underline",tooltip:"Underline"},strike:{exec:"strikethrough",tooltip:"Strikethrough"},subscript:{exec:"subscript",tooltip:"Subscript"},superscript:{exec:"superscript",tooltip:"Superscript"},left:{exec:"justifyleft",tooltip:"Align left"},center:{exec:"justifycenter",tooltip:"Center"},right:{exec:"justifyright",tooltip:"Align right"},justify:{exec:"justifyfull",tooltip:"Justify"},font:{_dropDown:function(b,c,d){var f=b.opts.fonts.split(","),g=a("<div />"),h=function(){return d(a(this).data("font")),b.closeDropDown(!0),!1};for(var i=0;i<f.length;i++)g.append(e("fontOpt",{font:f[i]},!0).click(h));b.createDropDown(c,"font-picker",g)},exec:function(b){var c=this;a.sceditor.command.get("font")._dropDown(c,b,function(a){c.execCommand("fontname",a)})},tooltip:"Font Name"},size:{_dropDown:function(b,c,d){var f=a("<div />"),g=function(c){d(a(this).data("size")),b.closeDropDown(!0),c.preventDefault()};for(var h=1;h<=7;h++)f.append(e("sizeOpt",{size:h},!0).click(g));b.createDropDown(c,"fontsize-picker",f)},exec:function(b){var c=this;a.sceditor.command.get("size")._dropDown(c,b,function(a){c.execCommand("fontsize",a)})},tooltip:"Font Size"},color:{_dropDown:function(b,c,d){var e,f,g,h,i={r:255,g:255,b:255},j=a("<div />"),k=b.opts.colors?b.opts.colors.split("|"):new Array(21),l=[],m=a.sceditor.command.get("color");if(!m._htmlCache){for(e=0;e<k.length;++e){h=k[e]?k[e].split(","):new Array(21),l.push('<div class="sceditor-color-column">');for(f=0;f<h.length;++f)g=h[f]||"#"+i.r.toString(16)+i.g.toString(16)+i.b.toString(16),l.push('<a href="#" class="sceditor-color-option" style="background-color: '+g+'" data-color="'+g+'"></a>'),f%5===0?(i.g-=51,i.b=255):i.b-=51;l.push("</div>"),e%5===0?(i.r-=51,i.g=255,i.b=255):(i.g=255,i.b=255)}m._htmlCache=l.join("")}j.append(m._htmlCache).find("a").click(function(c){d(a(this).attr("data-color")),b.closeDropDown(!0),c.preventDefault()}),b.createDropDown(c,"color-picker",j)},exec:function(b){var c=this;a.sceditor.command.get("color")._dropDown(c,b,function(a){c.execCommand("forecolor",a)})},tooltip:"Font Color"},removeformat:{exec:"removeformat",tooltip:"Remove Formatting"},cut:{exec:"cut",tooltip:"Cut",errorMessage:"Your browser does not allow the cut command. Please use the keyboard shortcut Ctrl/Cmd-X"},copy:{exec:"copy",tooltip:"Copy",errorMessage:"Your browser does not allow the copy command. Please use the keyboard shortcut Ctrl/Cmd-C"},paste:{exec:"paste",tooltip:"Paste",errorMessage:"Your browser does not allow the paste command. Please use the keyboard shortcut Ctrl/Cmd-V"},pastetext:{exec:function(a){var b,c=this,d=e("pastetext",{label:c._("Paste your text inside the following box:"),insert:c._("Insert")},!0);d.find(".button").click(function(a){b=d.find("#txt").val(),b&&c.wysiwygEditorInsertText(b),c.closeDropDown(!0),a.preventDefault()}),c.createDropDown(a,"pastetext",d)},tooltip:"Paste Text"},bulletlist:{exec:"insertunorderedlist",tooltip:"Bullet list"},orderedlist:{exec:"insertorderedlist",tooltip:"Numbered list"},table:{exec:function(b){var c=this,d=e("table",{rows:c._("Rows:"),cols:c._("Cols:"),insert:c._("Insert")},!0);d.find(".button").click(function(b){var e=d.find("#rows").val()-0,f=d.find("#cols").val()-0,g="<table>";if(e<1||f<1)return;for(var h=0;h<e;h++){g+="<tr>";for(var i=0;i<f;i++)g+="<td>"+(a.sceditor.ie?"":"<br />")+"</td>";g+="</tr>"}g+="</table>",c.wysiwygEditorInsertHtml(g),c.closeDropDown(!0),b.preventDefault()}),c.createDropDown(b,"inserttable",d)},tooltip:"Insert a table"},horizontalrule:{exec:"inserthorizontalrule",tooltip:"Insert a horizontal rule"},code:{forceNewLineAfter:["code"],exec:function(){this.wysiwygEditorInsertHtml("<code>","<br /></code>")},tooltip:"Code"},image:{exec:function(a){var b=this,c=e("image",{url:b._("URL:"),width:b._("Width (optional):"),height:b._("Height (optional):"),insert:b._("Insert")},!0);c.find(".button").click(function(a){var d=c.find("#image").val(),e=c.find("#width").val(),f=c.find("#height").val(),g="";e&&(g+=' width="'+e+'"'),f&&(g+=' height="'+f+'"'),d&&d!=="http://"&&b.wysiwygEditorInsertHtml("<img"+g+' src="'+d+'" />'),b.closeDropDown(!0),a.preventDefault()}),b.createDropDown(a,"insertimage",c)},tooltip:"Insert an image"},email:{exec:function(a){var b=this,c=e("email",{label:b._("E-mail:"),insert:b._("Insert")},!0);c.find(".button").click(function(a){var d=c.find("#email").val();d&&(b.focus(),b.getRangeHelper().selectedHtml()?b.execCommand("createlink","mailto:"+d):b.wysiwygEditorInsertHtml('<a href="mailto:'+d+'">'+d+"</a>")),b.closeDropDown(!0),a.preventDefault()}),b.createDropDown(a,"insertemail",c)},tooltip:"Insert an email"},link:{exec:function(a){var b=this,c=e("link",{url:b._("URL:"),desc:b._("Description (optional):"),ins:b._("Insert")},!0);c.find(".button").click(function(a){var d=c.find("#link").val(),e=c.find("#des").val();d&&d!=="http://"&&(b.focus(),!b.getRangeHelper().selectedHtml()||e?(e||(e=d),b.wysiwygEditorInsertHtml('<a href="'+d+'">'+e+"</a>")):b.execCommand("createlink",d)),b.closeDropDown(!0),a.preventDefault()}),b.createDropDown(a,"insertlink",c)},tooltip:"Insert a link"},unlink:{exec:"unlink",tooltip:"Unlink"},quote:{forceNewLineAfter:["blockquote"],exec:function(a,b,c){var d="<blockquote>",e="</blockquote>";b?(c=c?"<cite>"+c+"</cite>":"",d=d+c+b+e+"<br />",e=null):this.getRangeHelper().selectedHtml()===""&&(e="<br />"+e),this.wysiwygEditorInsertHtml(d,e)},tooltip:"Insert a Quote"},emoticon:{exec:function(b){var c,d=this,e=d.opts.emoticonsCompat?" ":"",f=a("<div />"),g=a("<div />");c=function(b,c){g.append(a("<img />").attr({src:a.isPlainObject(c)?c.url:c,alt:b,title:a.isPlainObject(c)?c.tooltip||b:b}).click(function(b){d.insert(a(this).attr("alt")+e),d.closeDropDown(!0),b.preventDefault()})),g.children().length>3&&(f.append(g),g=a("<div />"))},a.each(d.opts.emoticons.dropdown,c),g.children().length>0&&f.append(g);if(d.opts.emoticons.more){var h=a(this._('<a class="sceditor-more">{0}</a>',this._("More"))).click(function(){var e=a.extend({},d.opts.emoticons.dropdown,d.opts.emoticons.more);return f=a("<div />"),a.each(e,c),g.children().length>0&&f.append(g),d.createDropDown(b,"insertemoticon",f),!1});f.append(h)}d.createDropDown(b,"insertemoticon",f)},txtExec:function(b){a.sceditor.command.get("emoticon").exec.call(this,b)},tooltip:"Insert an emoticon"},youtube:{_dropDown:function(a,b,c){var d,f=e("youtubeMenu",{label:a._("Video URL:"),insert:a._("Insert")},!0);f.find(".button").click(function(b){var e=f.find("#link").val().replace("http://","");e!==""&&(d=e.match(/(?:v=|v\/|embed\/|youtu.be\/)(.{11})/),d&&(e=d[1]),/^[a-zA-Z0-9_\-]{11}$/.test(e)?c(e):alert("Invalid YouTube video")),a.closeDropDown(!0),b.preventDefault()}),a.createDropDown(b,"insertlink",f)},exec:function(b){var c=this;a.sceditor.command.get("youtube")._dropDown(c,b,function(a){c.wysiwygEditorInsertHtml(e("youtube",{id:a}))})},tooltip:"Insert a YouTube video"},date:{_date:function(a){var b=new Date,c=b.getYear(),d=b.getMonth()+1,e=b.getDate();return c<2e3&&(c=1900+c),d<10&&(d="0"+d),e<10&&(e="0"+e),a.opts.dateFormat.replace(/year/i,c).replace(/month/i,d).replace(/day/i,e)},exec:function(){this.insertText(a.sceditor.command.get("date")._date(this))},txtExec:function(){this.insertText(a.sceditor.command.get("date")._date(this))},tooltip:"Insert current date"},time:{_time:function(){var a=new Date,b=a.getHours(),c=a.getMinutes(),d=a.getSeconds();return b<10&&(b="0"+b),c<10&&(c="0"+c),d<10&&(d="0"+d),b+":"+c+":"+d},exec:function(){this.insertText(a.sceditor.command.get("time")._time())},txtExec:function(){this.insertText(a.sceditor.command.get("time")._time())},tooltip:"Insert current time"},ltr:{state:function(a,b){return b&&b.style.direction==="ltr"},exec:function(){var b=this,c=b.getRangeHelper().getFirstBlockParent(),d=a(c);b.focus();if(!c||d.is("body")){b.execCommand("formatBlock","p"),c=b.getRangeHelper().getFirstBlockParent(),d=a(c);if(!c||d.is("body"))return}d.css("direction")==="ltr"?d.css("direction",""):d.css("direction","ltr")},tooltip:"Left-to-Right"},rtl:{state:function(a,b){return b&&b.style.direction==="rtl"},exec:function(){var b=this,c=b.getRangeHelper().getFirstBlockParent(),d=a(c);b.focus();if(!c||d.is("body")){b.execCommand("formatBlock","p"),c=b.getRangeHelper().getFirstBlockParent(),d=a(c);if(!c||d.is("body"))return}d.css("direction")==="rtl"?d.css("direction",""):d.css("direction","rtl")},tooltip:"Right-to-Left"},print:{exec:"print",tooltip:"Print"},maximize:{state:function(){return this.maximize()},exec:function(){this.maximize(!this.maximize())},txtExec:function(){this.maximize(!this.maximize())},tooltip:"Maximize"},source:{exec:function(){this.toggleSourceMode(),this.blur()},txtExec:function(){this.toggleSourceMode(),this.blur()},tooltip:"View source"},ignore:{}},a.sceditor.rangeHelper=function(b,c){var d,e,f,g,h,i,j=!0,k="sceditor-start-marker",l="sceditor-end-marker",m="character",n=this;f=function(a,b){e=b||a.contentDocument||a.document,d=a,j=!!a.getSelection}(b,c),n.insertHTML=function(a,b){var c,d,f=n.selectedRange();b&&(a+=n.selectedHtml()+b);if(j){d=e.createElement("div"),c=e.createDocumentFragment(),d.innerHTML=a;while(d.firstChild)c.appendChild(d.firstChild);n.insertNode(c)}else{if(!f)return!1;f.pasteHTML(a)}},n.insertNode=function(a,b){if(j){var c,d,f=e.createDocumentFragment(),g=n.selectedRange();if(!g)return!1;f.appendChild(a),b&&(f.appendChild(g.extractContents()),f.appendChild(b)),d=f.lastChild,g.deleteContents(),g.insertNode(f),c=e.createRange(),c.setStartAfter(d),n.selectRange(c)}else n.insertHTML(a.outerHTML,b?b.outerHTML:null)},n.cloneSelected=function(){var a=n.selectedRange();if(a)return j?a.cloneRange():a.duplicate()},n.selectedRange=function(){var a,b,c=j?d.getSelection():e.selection;if(!c)return;c.getRangeAt&&c.rangeCount<=0&&(a=e.createRange(),a.setStart(e.body,0),c.addRange(a)),a=j?c.getRangeAt(0):c.createRange();if(a.parentElement&&(b=a.parentElement())&&b.ownerDocument!==e)return;return a},n.selectedHtml=function(){var a,b=n.selectedRange();return b?!j&&b.text!==""&&b.htmlText?b.htmlText:j?(a=e.createElement("div"),a.appendChild(b.cloneContents()),a.innerHTML):"":""},n.parentNode=function(){var a=n.selectedRange();if(a){if(j)return a.commonAncestorContainer;if(a.parentElement)return a.parentElement()}},n.getFirstBlockParent=function(b){var c=function(b){if(!a.sceditor.dom.isInline(b))return b;var d=b?b.parentNode:null;return d?c(d):null};return c(b||n.parentNode())},n.insertNodeAt=function(a,b){var c=n.selectedRange(),d=n.cloneSelected();if(!d)return!1;d.collapse(a),d.insertNode?d.insertNode(b):d.pasteHTML(b.outerHTML),n.selectRange(c)},g=function(a){n.removeMarker
-(a);var b=e.createElement("span");return b.id=a,b.style.lineHeight="0",b.style.display="none",b.className="sceditor-selection",b},n.insertMarkers=function(){n.insertNodeAt(!0,g(k)),n.insertNodeAt(!1,g(l))},n.getMarker=function(a){return e.getElementById(a)},n.removeMarker=function(a){var b=n.getMarker(a);b&&b.parentNode.removeChild(b)},n.removeMarkers=function(){n.removeMarker(k),n.removeMarker(l)},n.saveRange=function(){n.insertMarkers()},n.selectRange=function(a){j?(d.getSelection().removeAllRanges(),d.getSelection().addRange(a)):a.select()},n.restoreRange=function(){var a,b=n.selectedRange(),c=n.getMarker(k),d=n.getMarker(l);if(!c||!d||!b)return!1;j?(b=e.createRange(),b.setStartBefore(c),b.setEndAfter(d),n.selectRange(b)):(b=e.body.createTextRange(),a=e.body.createTextRange(),a.moveToElementText(c),b.setEndPoint("StartToStart",a),b.moveStart(m,0),a.moveToElementText(d),b.setEndPoint("EndToStart",a),b.moveEnd(m,0),n.selectRange(b)),n.removeMarkers()},i=function(a,b){var c=n.cloneSelected();if(!c)return!1;c.collapse(!1),j?(c.setStart(c.startContainer,c.startOffset-a),c.setEnd(c.endContainer,c.endOffset+b)):(c.moveStart(m,0-a),c.moveEnd(m,b)),n.selectRange(c)},h=function(a,b){var c="",d=n.cloneSelected();return d?(d.collapse(!1),a?j?(c=d.startContainer.textContent.substr(0,d.startOffset),c=c.substr(Math.max(0,c.length-b))):(d.moveStart(m,0-b),c=d.text):j?c=d.startContainer.textContent.substr(d.startOffset,b):(d.moveEnd(m,b),c=d.text),c):""},n.raplaceKeyword=function(b,c,d,e,f,g){d||b.sort(function(a,b){return a.length-b.length});var k,l,m,o,p,q,r,s,t=e||b[b.length-1][0].length;k=l=m="";if(f){if(!j)return!1;++t}k=h(!0,t),c&&(l=h(!1,t)),m=k+(g!=null?g:"")+l,o=b.length;while(o--){r=new RegExp("(?:[\\s    ])"+a.sceditor.regexEscape(b[o][0])+"(?=[\\s    ])"),s=k.length-1-b[o][0].length,f&&--s,s=Math.max(0,s);if(!f&&(p=m.indexOf(b[o][0],s))>-1||f&&(p=m.substr(s).search(r))>-1){f&&(p+=s+1);if(p>k.length||p+b[o][0].length+(f?1:0)<k.length)continue;return q=k.length-p,i(q,b[o][0].length-q-(g!=null&&/^\S/.test(g)?1:0)),n.insertHTML(b[o][1]),!0}}return!1},n.compare=function(a,b){return b||(b=n.selectedRange()),!a||!b?!a&&!b:j?a.compareBoundaryPoints(Range.END_TO_END,b)===0&&a.compareBoundaryPoints(Range.START_TO_START,b)===0:a.compareEndPoints("EndToEnd",b)===0&&a.compareEndPoints("StartToStart",b)===0}},a.sceditor.dom={traverse:function(a,b,c,d,e){if(a){a=e?a.lastChild:a.firstChild;while(a!=null){var f=e?a.previousSibling:a.nextSibling;if(!c&&b(a)===!1)return!1;if(!d&&this.traverse(a,b,c,d,e)===!1)return!1;if(c&&b(a)===!1)return!1;a=f}}},rTraverse:function(a,b,c,d){this.traverse(a,b,c,d,!0)},blockLevelList:"|body|hr|p|div|h1|h2|h3|h4|h5|h6|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|blockquote|center|",isInline:function(b,c){return!b||b.nodeType!==1?!0:(b=b.tagName.toLowerCase(),b==="code"?!c:a.sceditor.dom.blockLevelList.indexOf("|"+b+"|")<0)},copyCSS:function(a,b){b.style.cssText=a.style.cssText+b.style.cssText},fixNesting:function(a){var b=this,c=function(a){while(b.isInline(a.parentNode,!0))a=a.parentNode;return a};b.traverse(a,function(a){if(a.nodeType===1&&!b.isInline(a,!0)&&b.isInline(a.parentNode,!0)){var d=c(a),e=d.parentNode,f=b.extractContents(d,a),g=a;b.copyCSS(d,g),e.insertBefore(f,d),e.insertBefore(g,d)}})},findCommonAncestor:function(b,c){return a(b).parents().has(a(c)).first()},removeWhiteSpace:function(b){var c,d=/[^\S|\u00A0]+/g;this.traverse(b,function(b){c=b.nodeValue;if(b.nodeType===3&&a(b).parents("code, pre").length===0&&c){if(!b.previousSibling||!a.sceditor.dom.isInline(b.previousSibling))c=c.replace(/^[\r\n]+/,"");if(!b.nextSibling||!a.sceditor.dom.isInline(b.nextSibling))c=c.replace(/[\r\n]+$/,"");c=c.replace(/[\r\n]+/," ");if(!c.length){b.parentNode.removeChild(b);return}/\S|\u00A0/.test(c)?d.test(c)&&(c=c.replace(d," ")):c=" ",b.nodeValue=c}})},extractContents:function(a,b){var c=this,d=c.findCommonAncestor(a,b),e=d?d.get(0):null,f=!1,g=!1;return function h(d){var e=a.ownerDocument.createDocumentFragment();return c.traverse(d,function(c){if(g||c===b&&f)return g=!0,!1;c===a&&(f=!0);var d,i;f?jQuery.contains(c,b)&&c.nodeType===1?(d=h(c),i=c.cloneNode(!1),i.appendChild(d),e.appendChild(i)):e.appendChild(c):jQuery.contains(c,a)&&c.nodeType===1&&(d=h(c),i=c.cloneNode(!1),i.appendChild(d),e.appendChild(i))},!1),e}(e)}},a.sceditor.plugins={},a.sceditor.PluginManager=function(b){var c=this,d=[],e=b,f=function(a){return"signal"+a.charAt(0).toUpperCase()+a.slice(1)},g=function(a,b){a=[].slice.call(a);var c=d.length,g=f(a.shift());while(c--)if(g in d[c]){if(b)return d[c][g].apply(e,a);d[c][g].apply(e,a)}};c.call=function(){g(arguments,!1)},c.callOnlyFirst=function(){return g(arguments,!0)},c.iter=function(a){return a=f(a),function(){var b=d.length;return{callNext:function(c){while(b--)if(d[b]&&a in d[b])return d[b].apply(e,c)},hasNext:function(){var c=b;while(c--)if(d[c]&&a in d[c])return!0;return!1}}}()},c.hasHandler=function(a){var b=d.length;a=f(a);while(b--)if(a in d[b])return!0;return!1},c.exsists=function(b){return b in a.sceditor.plugins?(b=a.sceditor.plugins[b],typeof b=="function"&&typeof b.prototype=="object"):!1},c.isRegistered=function(b){var e=d.length;if(!c.exsists(b))return!1;while(e--)if(d[e]instanceof a.sceditor.plugins[b])return!0;return!1},c.register=function(b){return c.exsists(b)?(b=new a.sceditor.plugins[b],d.push(b),"init"in b&&b.init.apply(e),!0):!1},c.deregister=function(b){var f,g=d.length,h=!1;if(!c.isRegistered(b))return!1;while(g--)d[g]instanceof a.sceditor.plugins[b]&&(f=d.splice(g,1)[0],h=!0,"destroy"in f&&f.destroy.apply(e));return h},c.destroy=function(){var a=d.length;while(a--)"destroy"in d[a]&&d[a].destroy.apply(e);d=null,e=null}},a.sceditor.command={get:function(b){return a.sceditor.commands[b]||null},set:function(b,c){return!b||!c?!1:(c=a.extend(a.sceditor.commands[b]||{},c),c.remove=function(){a.sceditor.command.remove(b)},a.sceditor.commands[b]=c,this)},remove:function(b){return a.sceditor.commands[b]&&delete a.sceditor.commands[b],this}},a.sceditor.defaultOptions={toolbar:"bold,italic,underline,strike,subscript,superscript|left,center,right,justify|font,size,color,removeformat|cut,copy,paste,pastetext|bulletlist,orderedlist|table|code,quote|horizontalrule,image,email,link,unlink|emoticon,youtube,date,time|ltr,rtl|print,maximize,source",style:"jquery.sceditor.default.css",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Georgia,Impact,Sans-serif,Serif,Times New Roman,Trebuchet MS,Verdana",colors:null,locale:"en",charset:"utf-8",emoticonsCompat:!1,emoticonsEnabled:!0,emoticonsRoot:"",emoticons:{dropdown:{":)":"emoticons/smile.png",":angel:":"emoticons/angel.png",":angry:":"emoticons/angry.png","8-)":"emoticons/cool.png",":'(":"emoticons/cwy.png",":ermm:":"emoticons/ermm.png",":D":"emoticons/grin.png","<3":"emoticons/heart.png",":(":"emoticons/sad.png",":O":"emoticons/shocked.png",":P":"emoticons/tongue.png",";)":"emoticons/wink.png"},more:{":alien:":"emoticons/alien.png",":blink:":"emoticons/blink.png",":blush:":"emoticons/blush.png",":cheerful:":"emoticons/cheerful.png",":devil:":"emoticons/devil.png",":dizzy:":"emoticons/dizzy.png",":getlost:":"emoticons/getlost.png",":happy:":"emoticons/happy.png",":kissing:":"emoticons/kissing.png",":ninja:":"emoticons/ninja.png",":pinch:":"emoticons/pinch.png",":pouty:":"emoticons/pouty.png",":sick:":"emoticons/sick.png",":sideways:":"emoticons/sideways.png",":silly:":"emoticons/silly.png",":sleeping:":"emoticons/sleeping.png",":unsure:":"emoticons/unsure.png",":woot:":"emoticons/w00t.png",":wassat:":"emoticons/wassat.png"},hidden:{":whistling:":"emoticons/whistling.png",":love:":"emoticons/wub.png"}},width:null,height:null,resizeEnabled:!0,resizeMinWidth:null,resizeMinHeight:null,resizeMaxHeight:null,resizeMaxWidth:null,resizeHeight:!0,resizeWidth:!0,getHtmlHandler:null,getTextHandler:null,dateFormat:"year-month-day",toolbarContainer:null,enablePasteFiltering:!1,disablePasting:!1,readOnly:!1,rtl:!1,autofocus:!1,autofocusEnd:!0,autoExpand:!1,autoUpdate:!1,runWithoutWysiwygSupport:!1,id:null,plugins:"",zIndex:null,parserOptions:{},dropDownCss:{}},a.fn.sceditor=function(b){var c,d=[];b=b||{};if(!b.runWithoutWysiwygSupport&&!a.sceditor.isWysiwygSupported)return;return this.each(function(){c=this.jquery?this:a(this);if(c.parents(".sceditor-container").length>0)return;b==="state"?d.push(!!c.data("sceditor")):b==="instance"?d.push(c.data("sceditor")):c.data("sceditor")||new a.sceditor(this,b)}),d.length?d.length===1?d[0]:a(d):this}})(jQuery,window,document);
+/*! SCEditor | (C) 2011-2013, Sam Clarke | sceditor.com/license */
+(function(e,t,n){"use strict";var o={html:'<!DOCTYPE html><html><head><style>.ie * {min-height: auto !important}</style><meta http-equiv="Content-Type" content="text/html;charset={charset}" /><link rel="stylesheet" type="text/css" href="{style}" /></head><body contenteditable="true"></body></html>',toolbarButton:'<a class="sceditor-button sceditor-button-{name}" data-sceditor-command="{name}" unselectable="on"><div unselectable="on">{dispName}</div></a>',emoticon:'<img src="{url}" data-sceditor-emoticon="{key}" alt="{key}" title="{tooltip}" />',fontOpt:'<a class="sceditor-font-option" href="#" data-font="{font}"><font face="{font}">{font}</font></a>',sizeOpt:'<a class="sceditor-fontsize-option" data-size="{size}" href="#"><font size="{size}">{size}</font></a>',pastetext:'<div><label for="txt">{label}</label> <textarea cols="20" rows="7" id="txt"></textarea></div><div><input type="button" class="button" value="{insert}" /></div>',table:'<div><label for="rows">{rows}</label><input type="text" id="rows" value="2" /></div><div><label for="cols">{cols}</label><input type="text" id="cols" value="2" /></div><div><input type="button" class="button" value="{insert}" /></div>',image:'<div><label for="link">{url}</label> <input type="text" id="image" value="http://" /></div><div><label for="width">{width}</label> <input type="text" id="width" size="2" /></div><div><label for="height">{height}</label> <input type="text" id="height" size="2" /></div><div><input type="button" class="button" value="{insert}" /></div>',email:'<div><label for="email">{label}</label> <input type="text" id="email" /></div><div><input type="button" class="button" value="{insert}" /></div>',link:'<div><label for="link">{url}</label> <input type="text" id="link" value="http://" /></div><div><label for="des">{desc}</label> <input type="text" id="des" /></div><div><input type="button" class="button" value="{ins}" /></div>',youtubeMenu:'<div><label for="link">{label}</label> <input type="text" id="link" value="http://" /></div><div><input type="button" class="button" value="{insert}" /></div>',youtube:'<iframe width="560" height="315" src="http://www.youtube.com/embed/{id}?wmode=opaque" data-youtube-id="{id}" frameborder="0" allowfullscreen></iframe>'},i=function(t,n,i){var r=o[t];return e.each(n,function(e,t){r=r.replace(RegExp("\\{"+e+"\\}","g"),t)}),i&&(r=e(r)),r};e.sceditor=function(o,r){var s,a,c,l,d,u,p,f,h,m,g,v,y,b,x,w,C,k,E,S,D,M,T,R,H,z,O,N,I,P,W,_,A,F,L,B,j,V,q,U,Y,$,X,Q,K,G,J=this,Z=o.get?o.get(0):o,et=e(Z),tt=[],nt=[],ot=[],it=[];J.commands=e.extend(!0,{},r.commands||e.sceditor.commands),C=function(){et.data("sceditor",J),J.opts=e.extend({},e.sceditor.defaultOptions,r),J.opts.locale&&"en"!==J.opts.locale&&T(),s=e('<div class="sceditor-container" />').insertAfter(et).css("z-index",J.opts.zIndex),e.sceditor.ie&&s.addClass("ie ie"+e.sceditor.ie),w=!!et.attr("required"),et.removeAttr("required"),M(),I(),R(),D(),O(),H(),z(),e.sceditor.isWysiwygSupported||J.toggleSourceMode();var o=function(){e(t).unbind("load",o),J.opts.autofocus&&K(),J.opts.autoExpand&&J.expandToContent(),V()};e(t).load(o),n.readyState&&"complete"===n.readyState&&o(),U(),v.call("ready")},M=function(){var t=J.opts.plugins;t=t?(""+t).split(","):[],v=new e.sceditor.PluginManager(J),e.each(t,function(t,n){v.register(e.trim(n))})},T=function(){var t;e.sceditor.locale[J.opts.locale]?h=e.sceditor.locale[J.opts.locale]:(t=J.opts.locale.split("-"),e.sceditor.locale[t[0]]&&(h=e.sceditor.locale[t[0]])),h&&h.dateFormat&&(J.opts.dateFormat=h.dateFormat)},D=function(){var n,o,r,a;d=e("<textarea></textarea>").hide(),c=e('<iframe frameborder="0"></iframe>'),"https:"===t.location.protocol&&c.attr("src","javascript:false"),s.append(c).append(d),l=c[0],u=d[0],J.width(J.opts.width||et.width()),J.height(J.opts.height||et.height()),o=P(),r=e(o),o.open(),o.write(i("html",{charset:J.opts.charset,style:J.opts.style})),o.close(),J.readOnly(!!J.opts.readOnly),n=r.find("body"),e.sceditor.ie&&r.find("html").addClass("ie ie"+e.sceditor.ie),(/iPhone|iPod|iPad| wosbrowser\//i.test(navigator.userAgent)||e.sceditor.ie)&&(n.height("100%"),e.sceditor.ie||n.bind("touchend",J.focus)),m=new e.sceditor.rangeHelper(l.contentWindow),J.val(et.hide().val()),a=et.attr("tabindex"),d.attr("tabindex",a),c.attr("tabindex",a)},H=function(){var t=e(P()),n=t.find("body");J.opts.autoUpdate&&(n.bind("blur",J.updateOriginal),d.bind("blur",J.updateOriginal)),null===J.opts.rtl&&(J.opts.rtl="rtl"===d.css("direction")),J.rtl(!!J.opts.rtl),J.opts.autoExpand&&t.bind("keyup",J.expandToContent),J.opts.resizeEnabled&&N(),s.attr("id",J.opts.id),J.emoticons(J.opts.emoticonsEnabled)},z=function(){var o=e(P());e(n).click(j),e(Z.form).bind("reset",F).submit(J.updateOriginal),e(t).bind("resize orientationChanged",V),o.find("body").keypress(A).keyup($).bind("paste",W).bind(e.sceditor.ie?"selectionchange":"keyup focus blur contextmenu mouseup touchend click",X).bind("keydown keyup keypress focus blur contextmenu",B),d.bind("keydown keyup keypress focus blur contextmenu",B),o.keypress(A).mousedown(L).bind(e.sceditor.ie?"selectionchange":"focus blur contextmenu mouseup click",X).bind("beforedeactivate keyup",S).keyup($).focus(function(){f=null}),s.bind("selectionchanged",U).bind("selectionchanged",Q).bind("selectionchanged",B).bind("nodechanged",B)},R=function(){var t,n,o=J.opts.toolbar.split("|");a=e('<div class="sceditor-toolbar" unselectable="on" />'),e.each(o,function(o,r){t=e('<div class="sceditor-group" />'),e.each(r.split(","),function(o,r){J.commands[r]&&(n=i("toolbarButton",{name:r,dispName:J.commands[r].tooltip||r},!0),n.data("sceditor-txtmode",!!J.commands[r].txtExec),n.data("sceditor-wysiwygmode",!!J.commands[r].exec),n.click(function(){var t=e(this);return t.hasClass("disabled")||E(t,J.commands[r]),U(),!1}),J.commands[r].tooltip&&n.attr("title",J._(J.commands[r].tooltip)),J.commands[r].exec||n.addClass("disabled"),t.append(n))}),a.append(t)}),J.opts.toolbarContainer?e(J.opts.toolbarContainer).append(a):s.append(a)},O=function(){e.each(J.commands,function(t,n){n.keyPress&&tt.push(n.keyPress),n.forceNewLineAfter&&e.isArray(n.forceNewLineAfter)&&(ot=e.merge(ot,n.forceNewLineAfter)),n.state?it.push({name:t,state:n.state}):"string"==typeof n.exec&&it.push({name:t,state:n.exec})})},N=function(){var o,i,r,a,c,l,d=e('<div class="sceditor-grip" />'),u=e('<div class="sceditor-resize-cover" />'),p=0,f=0,h=0,m=0,g=s.width(),v=s.height(),y=!1,b=J.rtl();o=J.opts.resizeMinHeight||v/1.5,i=J.opts.resizeMaxHeight||2.5*v,r=J.opts.resizeMinWidth||g/1.25,a=J.opts.resizeMaxWidth||1.25*g,c=function(n){"touchmove"===n.type&&(n=t.event);var c=m+(n.pageY-f),l=b?h-(n.pageX-p):h+(n.pageX-p);a>0&&l>a&&(l=a),i>0&&c>i&&(c=i),J.opts.resizeWidth&&l>=r&&(0>a||a>=l)&&J.width(l),J.opts.resizeHeight&&c>=o&&(0>i||i>=c)&&(J.height(c),7>e.sceditor.ie&&s.height(c)),n.preventDefault()},l=function(t){y&&(y=!1,u.hide(),s.removeClass("resizing").height("auto"),e(n).unbind("touchmove mousemove",c),e(n).unbind("touchend mouseup",l),t.preventDefault())},s.append(d),s.append(u.hide()),d.bind("touchstart mousedown",function(o){"touchstart"===o.type&&(o=t.event),p=o.pageX,f=o.pageY,h=s.width(),m=s.height(),y=!0,s.addClass("resizing"),u.show(),e(n).bind("touchmove mousemove",c),e(n).bind("touchend mouseup",l),7>e.sceditor.ie&&s.height(m),o.preventDefault()})},I=function(){var t;e.isPlainObject(J.opts.emoticons)&&e.each(J.opts.emoticons,function(o,i){e.each(i,function(e,i){J.opts.emoticonsRoot&&(J.opts.emoticons[o][e]=J.opts.emoticonsRoot+(i.url||i)),t=n.createElement("img"),t.src=i.url||i,nt.push(t)})})},K=function(){var t,n,o,i=P(),r=i.body,s=!!J.opts.autofocusEnd;J.sourceMode()?(o=u.value.length,u.setSelectionRange?u.setSelectionRange(o,o):u.createTextRange&&(t=u.createTextRange(),t.moveEnd("character",o),t.moveStart("character",o),m.selectRange(t))):(s?e(r).append(n=i.createElement("div")):n=r.firstChild,i.createRange?(t=i.createRange(),t.setStart(n,0),t.setEnd(n,0)):(t=r.createTextRange(),t.moveToElementText(n),t.collapse(!1)),m.selectRange(t),s&&(e(i).scrollTop(r.scrollHeight),e(r).scrollTop(r.scrollHeight))),J.focus()},J.readOnly=function(e){return"boolean"!=typeof e?"readonly"===d.attr("readonly"):(P().body.contentEditable=!e,e?d.attr("readonly","readonly"):d.removeAttr("readonly"),q(e),this)},J.rtl=function(t){var n=t?"rtl":"ltr";return"boolean"!=typeof t?"rtl"===d.attr("dir"):(e(P().body).attr("dir",n),d.attr("dir",n),s.removeClass("rtl").removeClass("ltr").addClass(n),this)},q=function(t){var n=J.inSourceMode();a.find(".sceditor-button").removeClass("disabled").each(function(){var o=e(this);t===!0||n&&!o.data("sceditor-txtmode")?o.addClass("disabled"):n||o.data("sceditor-wysiwygmode")||o.addClass("disabled")})},J.width=function(e,t){return e||0===e?(J.dimensions(e,null,t),this):s.width()},J.dimensions=function(e,t,n){var o,i=!1;return e=e||0===e?e:!1,t=t||0===t?t:!1,e===!1&&t===!1?{width:J.width(),height:J.height()}:(c.data("outerWidthOffset")===void 0&&J.updateStyleCache(),e!==!1&&e!==J.width()&&(n!==!1&&(J.opts.width=e),e=s.width(e).width(),l.style.width=e-c.data("outerWidthOffset")+"px",u.style.width=e-d.data("outerWidthOffset")+"px",o=J.opts.toolbarContainer?0:a.outerHeight(!0),i=o!==(J.opts.toolbarContainer?0:a.outerHeight(!0))),t!==!1&&t!==J.height()&&(n!==!1&&(J.opts.height=t),t&&(""+t).indexOf("%")&&(t=s.height(t).height(),s.height("auto")),t-=J.opts.toolbarContainer?0:a.outerHeight(!0),i=!0),i&&(l.style.height=t-c.data("outerHeightOffset")+"px",u.style.height=t-d.data("outerHeightOffset")+"px"),this)},J.updateStyleCache=function(){c.data("outerWidthOffset",c.outerWidth(!0)-c.width()),d.data("outerWidthOffset",d.outerWidth(!0)-d.width()),c.data("outerHeightOffset",c.outerHeight(!0)-c.height()),d.data("outerHeightOffset",d.outerHeight(!0)-d.height())},J.height=function(e,t){return e||0===e?(J.dimensions(null,e,t),this):s.height()},J.maximize=function(t){return t===void 0?s.is(".sceditor-maximize"):(t=!!t,7>e.sceditor.ie&&e("html, body").toggleClass("sceditor-maximize",t),s.toggleClass("sceditor-maximize",t),J.width(t?"100%":J.opts.width,!1),J.height(t?"100%":J.opts.height,!1),this)},J.expandToContent=function(e){var t=P(),n=s.height(),o=t.body.scrollHeight||t.documentElement.scrollHeight,i=n-c.height(),r=J.opts.resizeMaxHeight||2*(J.opts.height||et.height());o+=i,e!==!0&&o>r&&(o=r),o>n&&J.height(o)},J.destroy=function(){v.destroy(),m=null,f=null,v=null,e(n).unbind("click",j),e(t).unbind("resize orientationChanged",V),e(Z.form).unbind("reset",F).unbind("submit",J.updateOriginal),e(P().body).unbind(),e(P()).unbind().find("*").remove(),d.unbind().remove(),s.unbind().find("*").unbind().remove(),s.remove(),et.removeData("sceditor").removeData("sceditorbbcode").show(),w&&et.attr("required","required")},J.createDropDown=function(t,n,o,i){var r=p&&p.is(".sceditor-"+n);if(J.closeDropDown(),!r){i!==!1&&e(o).find(":not(input,textarea)").filter(function(){return 1===this.nodeType}).attr("unselectable","on");var s={top:t.offset().top,left:t.offset().left,marginTop:t.outerHeight()};e.extend(s,J.opts.dropDownCss),p=e('<div class="sceditor-dropdown sceditor-'+n+'" />').css(s).append(o).appendTo(e("body")).click(function(e){e.stopPropagation()})}},j=function(e){3!==e.which&&J.closeDropDown()},W=function(e){function t(e,n){if(e.childNodes.length>0){for(;e.firstChild;)n.appendChild(e.firstChild);for(;a.firstChild;)e.appendChild(a.firstChild);_(e,n)}else{if(r>25){for(;a.firstChild;)e.appendChild(a.firstChild);return m.restoreRange(),void 0}++r,setTimeout(function(){t(e,n)},20)}}var o,i=P().body,r=0,s=i.ownerDocument.createElement("div"),a=i.ownerDocument.createDocumentFragment();if(J.opts.disablePasting)return!1;if(J.opts.enablePasteFiltering){if(m.saveRange(),n.body.appendChild(s),e&&e.clipboardData&&e.clipboardData.getData&&((o=e.clipboardData.getData("text/html"))||(o=e.clipboardData.getData("text/plain"))))return s.innerHTML=o,_(i,s),e.stopPropagation(),e.preventDefault(),!1;for(;i.firstChild;)a.appendChild(i.firstChild);return t(i,s),J.focus(),!0}},_=function(t,n){e.sceditor.dom.fixNesting(n);var o=n.innerHTML;v.hasHandler("toSource")&&(o=v.callOnlyFirst("toSource",o,e(n))),n.parentNode.removeChild(n),v.hasHandler("toWysiwyg")&&(o=v.callOnlyFirst("toWysiwyg",o,!0)),m.restoreRange(),m.insertHTML(k(o))},J.closeDropDown=function(e){p&&(p.unbind().remove(),p=null),e===!0&&J.focus()},P=function(){return l.contentDocument?l.contentDocument:l.contentWindow&&l.contentWindow.document?l.contentWindow.document:l.document?l.document:null},J.wysiwygEditorInsertHtml=function(t,n,o){J.focus(),(o||!e(m.parentNode()).is("code")&&0===e(m.parentNode()).parents("code").length)&&(m.insertHTML(t,n),$())},J.wysiwygEditorInsertText=function(t,n){J.wysiwygEditorInsertHtml(e.sceditor.escapeEntities(t),e.sceditor.escapeEntities(n))},J.insertText=function(e,t){return J.inSourceMode()?J.sourceEditorInsertText(e,t):J.wysiwygEditorInsertText(e,t),this},J.sourceEditorInsertText=function(e,t){var o,i,r,s,a;a=u.scrollTop,u.focus(),u.selectionStart!==void 0?(i=u.selectionStart,r=u.selectionEnd,s=e.length,t&&(e+=u.value.substring(i,r)+t),u.value=u.value.substring(0,i)+e+u.value.substring(r,u.value.length),u.selectionStart=i+e.length-(t?t.length:0),u.selectionEnd=u.selectionStart):n.selection.createRange!==void 0?(o=n.selection.createRange(),t&&(e+=o.text+t),o.text=e,t&&o.moveEnd("character",0-t.length),o.moveStart("character",o.End-o.Start),o.select()):u.value+=e+t,u.scrollTop=a,u.focus()},J.getRangeHelper=function(){return m},J.val=function(e,t){return"string"==typeof e?(J.inSourceMode()?J.setSourceEditorValue(e):(t!==!1&&v.hasHandler("toWysiwyg")&&(e=v.callOnlyFirst("toWysiwyg",e)),J.setWysiwygEditorValue(e)),this):J.inSourceMode()?J.getSourceEditorValue(!1):J.getWysiwygEditorValue()},J.insert=function(t,n,o,i){if(J.inSourceMode())J.sourceEditorInsertText(t,n);else{if(n){var r=J.getRangeHelper().selectedHtml(),s=e("<div>").appendTo(e("body")).hide().html(r);o!==!1&&(v.hasHandler("toSource")&&(r=v.callOnlyFirst("toSource",r,s)),s.remove()),t+=r+n}v.hasHandler("toWysiwyg")&&(t=v.callOnlyFirst("toWysiwyg",t,!0)),i!==!1&&(t=k(t)),J.wysiwygEditorInsertHtml(t)}return this},J.getWysiwygEditorValue=function(t){var n,o=c.contents().find("body");return e.sceditor.ie&&J.focus(),m.saveRange(),e.sceditor.dom.fixNesting(o.get(0)),n=o.html(),t!==!1&&v.hasHandler("toSource")&&(n=v.callOnlyFirst("toSource",n,o)),m.restoreRange(),f=null,n},J.getSourceEditorValue=function(e){var t=d.val();return e!==!1&&v.hasHandler("toWysiwyg")&&(t=v.callOnlyFirst("toWysiwyg",t)),t},J.setWysiwygEditorValue=function(t){t||(t="<p>"+(e.sceditor.ie?"":"<br />")+"</p>"),P().body.innerHTML=k(t),$()},J.setSourceEditorValue=function(e){d.val(e)},J.updateOriginal=function(){et.val(J.val())},k=function(t){if(!J.opts.emoticonsEnabled)return t;var n=e.extend({},J.opts.emoticons.more,J.opts.emoticons.dropdown,J.opts.emoticons.hidden);return e.each(n,function(n,o){var r=e.sceditor.regexEscape(n)+"(?=([^\\<\\>]*?<(?!/code)|[^\\<\\>]*?$))",s="";J.opts.emoticonsCompat&&(r="((>|^|\\s| | | | |&nbsp;))"+r+"(?=(\\s|$|<| | | | |&nbsp;))",s="$1"),t=t.replace(RegExp(r,"gm"),s+i("emoticon",{key:n,url:o.url||o,tooltip:o.tooltip||n}))}),t},J.inSourceMode=function(){return s.hasClass("sourceMode")},J.sourceMode=function(e){return"boolean"!=typeof e?J.inSourceMode():((J.inSourceMode()&&!e||!J.inSourceMode()&&e)&&J.toggleSourceMode(),this)},J.toggleSourceMode=function(){(e.sceditor.isWysiwygSupported||!J.inSourceMode())&&(J.inSourceMode()?J.setWysiwygEditorValue(J.getSourceEditorValue()):J.setSourceEditorValue(J.getWysiwygEditorValue()),f=null,d.toggle(),c.toggle(),J.inSourceMode()?s.removeClass("sourceMode").addClass("wysiwygMode"):s.removeClass("wysiwygMode").addClass("sourceMode"),q(),U())},Y=function(){return u.focus(),null!=u.selectionStart?u.value.substring(u.selectionStart,u.selectionEnd):n.selection.createRange?n.selection.createRange().text:void 0},E=function(t,n){return J.inSourceMode()?(n.txtExec&&(e.isArray(n.txtExec)?J.sourceEditorInsertText.apply(J,n.txtExec):n.txtExec.call(J,t,Y())),void 0):(n.exec&&(e.isFunction(n.exec)?n.exec.call(J,t):J.execCommand(n.exec,n.hasOwnProperty("execParam")?n.execParam:null)),void 0)},S=function(){e.sceditor.ie&&(f=m.selectedRange())},J.execCommand=function(t,n){var o=!1,i=e(m.parentNode());if(J.focus(),!i.is("code")&&0===i.parents("code").length){if(P())try{o=P().execCommand(t,!1,n)}catch(r){}!o&&J.commands[t]&&J.commands[t].errorMessage&&alert(J._(J.commands[t].errorMessage))}},X=function(){x||(x=!0,setTimeout(function(){m.compare(b)||(b=m.cloneSelected(),s.trigger(e.Event("selectionchanged"))),x=!1},100))},Q=function(){var t=m.parentNode();y!==t&&(s.trigger(e.Event("nodechanged",{oldNode:y,newNode:t})),y=t)},J.currentNode=function(){return y},U=function(e){var t,n,o,i,r,s=P(),c=it.length,l=J.sourceMode();if(J.sourceMode()||J.readOnly())a.find(".sceditor-button").removeClass("active");else for(r=e?e.newNode:m.parentNode(),o=m.getFirstBlockParent(r);c--;)if(t=0,n=it[c],i=a.find(".sceditor-button-"+n.name),l&&!i.data("sceditor-txtmode"))i.addClass("disabled");else if(l||i.data("sceditor-wysiwygmode")){if("string"==typeof n.state)try{t=s.queryCommandEnabled(n.state)?0:-1,t>-1&&(t=s.queryCommandState(n.state)?1:0)}catch(e){}else t=n.state.call(J,r,o);0>t?i.addClass("disabled"):i.removeClass("disabled"),t>0?i.addClass("active"):i.removeClass("active")}else i.addClass("disabled")},A=function(t){var n,o=tt.length;if(J.closeDropDown(),n=e(m.parentNode()),13===t.which&&(n.is("code,blockquote,pre")||0!==n.parents("code,blockquote,pre").length))return f=null,J.wysiwygEditorInsertHtml("<br />",null,!0),!1;if(!n.is("code")&&0===n.parents("code").length)for(;o--;)tt[o].call(J,t,l,d)},$=function(){var t,n,o=P();e.sceditor.dom.rTraverse(o.body,function(i){return t=i.nodeName.toLowerCase(),e.inArray(t,ot)>-1&&(n=!0),3===i.nodeType&&!/^\s*$/.test(i.nodeValue)||"br"===i.nodeName.toLowerCase()||e.sceditor.ie&&!i.firstChild&&!e.sceditor.dom.isInline(i,!1)?(n&&e(o.body).append(e("<div>"+(e.sceditor.ie?"":"<br />")+"</div>\n")),!1):void 0})},F=function(){J.val(et.val())},L=function(){J.closeDropDown(),f=null},V=function(){var e=J.opts.height,t=J.opts.width;J.maximize()?J.height("100%",!1).width("100%",!1):(e&&(""+e).indexOf("%")>-1&&J.height(e),t&&(""+t).indexOf("%")>-1&&J.width(t))},J._=function(){var e=arguments;return h&&h[e[0]]&&(e[0]=h[e[0]]),e[0].replace(/\{(\d+)\}/g,function(t,n){return e[n-0+1]!==void 0?e[n-0+1]:"{"+n+"}"})},B=function(t){var n,o=e.extend({},t);v.call(o.type+"Event",t,J),delete o.type,n=e.Event((t.target===u?"scesrc":"scewys")+t.type,o),s.trigger.apply(s,[n,J]),n.isDefaultPrevented()&&t.preventDefault(),n.isImmediatePropagationStopped()&&n.stopImmediatePropagation(),n.isPropagationStopped()&&n.stopPropagation()},J.bind=function(t,n,o,i){var r=t.length;for(t=t.split(" ");r--;)e.isFunction(n)&&(o||s.bind("scewys"+t[r],n),i||s.bind("scesrc"+t[r],n));return this},J.unbind=function(t,n,o,i){var r=t.length;for(t=t.split(" ");r--;)e.isFunction(n)&&(o||s.unbind("scewys"+t[r],n),i||s.unbind("scesrc"+t[r],n));return this},J.blur=function(t,n,o){return e.isFunction(t)?J.bind("blur",t,n,o):J.sourceMode()?d.blur():(g||(g=e('<input style="width:0;height:0;opacity:0;border:0;padding:0;filter:alpha(opacity=0)" type="text" />').appendTo(s)),g.removeAttr("disabled").show().focus().blur().hide().attr("disabled","disabled")),this},J.focus=function(t,n,o){return e.isFunction(t)?J.bind("focus",t,n,o):J.inSourceMode()?u.focus():(l.contentWindow.focus(),P().body.focus(),f&&(m.selectRange(f),f=null)),this},J.keyDown=function(e,t,n){return J.bind("keydown",e,t,n)},J.keyPress=function(e,t,n){return J.bind("keypress",e,t,n)},J.keyUp=function(e,t,n){return J.bind("keyup",e,t,n)},J.nodeChanged=function(e){return J.bind("nodechanged",e,!1,!0)},J.selectionChanged=function(e){return J.bind("selectionchanged",e,!1,!0)},G=function(t){var n=0,o=String.fromCharCode(t.which);return J.emoticonsCache||(J.emoticonsCache=[],e.each(e.extend({},J.opts.emoticons.more,J.opts.emoticons.dropdown,J.opts.emoticons.hidden),function(e,t){J.emoticonsCache[n++]=[e,i("emoticon",{key:e,url:t.url||t,tooltip:t.tooltip||e})]}),J.emoticonsCache.sort(function(e,t){return e[0].length-t[0].length})),J.longestEmoticonCode||(J.longestEmoticonCode=J.emoticonsCache[J.emoticonsCache.length-1][0].length),J.getRangeHelper().raplaceKeyword(J.emoticonsCache,!0,!0,J.longestEmoticonCode,J.opts.emoticonsCompat,o)?/^\s$/.test(o)&&J.opts.emoticonsCompat?!0:(t.preventDefault(),t.stopPropagation(),!1):void 0},J.emoticons=function(t){if(!t&&t!==!1)return J.opts.emoticonsEnabled;var n=e(P().body);return J.opts.emoticonsEnabled=t,t?(n.keypress(G),J.sourceMode()||(m.saveRange(),n.html(k(n.html())),m.restoreRange())):(n.find("img[data-sceditor-emoticon]").replaceWith(function(){return e(this).data("sceditor-emoticon")}),n.unbind("keypress",G)),this},C()},e.sceditor.ie=function(){var e,o=3,i=n.createElement("div"),r=i.getElementsByTagName("i");do i.innerHTML="<!--[if gt IE "+ ++o+"]><i></i><![endif]-->";while(r[0]);return n.all&&t.atob&&(o=10),o>4?o:e}(),e.sceditor.isWysiwygSupported=function(){var t,n=e('<div contenteditable="true">')[0].contentEditable,o=n!==void 0&&"inherit"!==n,i=navigator.userAgent;if(!o)return!1;var r=/Opera Mobi|Opera Mini/i.test(i);return/Android/i.test(i)&&(r=!0,/Safari/.test(i)&&(t=/Safari\/(\d+)/.exec(i),r=t&&t[1]?534>t[1]:!0)),/ Silk\//i.test(i)&&(t=/AppleWebKit\/(\d+)/.exec(i),r=t&&t[1]?534>t[1]:!0),/iPhone|iPod|iPad/i.test(i)&&(r=!/OS [5-9](_\d)+ like Mac OS X/i.test(i)),/fennec/i.test(i)&&(r=!1),!r}(),e.sceditor.regexEscape=function(e){return e.replace(/[\$\?\[\]\.\*\(\)\|\\]/g,"\\$&").replace("<","&lt;").replace(">","&gt;")},e.sceditor.escapeEntities=function(e){return e?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/ {2}/g," &nbsp;").replace(/\r\n|\r/g,"\n").replace(/\n/g,"<br />"):e},e.sceditor.locale={},e.sceditor.commands={bold:{exec:"bold",tooltip:"Bold"},italic:{exec:"italic",tooltip:"Italic"},underline:{exec:"underline",tooltip:"Underline"},strike:{exec:"strikethrough",tooltip:"Strikethrough"},subscript:{exec:"subscript",tooltip:"Subscript"},superscript:{exec:"superscript",tooltip:"Superscript"},left:{exec:"justifyleft",tooltip:"Align left"},center:{exec:"justifycenter",tooltip:"Center"},right:{exec:"justifyright",tooltip:"Align right"},justify:{exec:"justifyfull",tooltip:"Justify"},font:{_dropDown:function(t,n,o){for(var r=t.opts.fonts.split(","),s=e("<div />"),a=function(){return o(e(this).data("font")),t.closeDropDown(!0),!1},c=0;r.length>c;c++)s.append(i("fontOpt",{font:r[c]},!0).click(a));t.createDropDown(n,"font-picker",s)},exec:function(t){var n=this;e.sceditor.command.get("font")._dropDown(n,t,function(e){n.execCommand("fontname",e)})},tooltip:"Font Name"},size:{_dropDown:function(t,n,o){for(var r=e("<div />"),s=function(n){o(e(this).data("size")),t.closeDropDown(!0),n.preventDefault()},a=1;7>=a;a++)r.append(i("sizeOpt",{size:a},!0).click(s));t.createDropDown(n,"fontsize-picker",r)},exec:function(t){var n=this;e.sceditor.command.get("size")._dropDown(n,t,function(e){n.execCommand("fontsize",e)})},tooltip:"Font Size"},color:{_dropDown:function(t,n,o){var i,r,s,a,c={r:255,g:255,b:255},l=e("<div />"),d=t.opts.colors?t.opts.colors.split("|"):Array(21),u=[],p=e.sceditor.command.get("color");if(!p._htmlCache){for(i=0;d.length>i;++i){for(a=d[i]?d[i].split(","):Array(21),u.push('<div class="sceditor-color-column">'),r=0;a.length>r;++r)s=a[r]||"#"+c.r.toString(16)+c.g.toString(16)+c.b.toString(16),u.push('<a href="#" class="sceditor-color-option" style="background-color: '+s+'" data-color="'+s+'"></a>'),0===r%5?(c.g-=51,c.b=255):c.b-=51;u.push("</div>"),0===i%5?(c.r-=51,c.g=255,c.b=255):(c.g=255,c.b=255)}p._htmlCache=u.join("")}l.append(p._htmlCache).find("a").click(function(n){o(e(this).attr("data-color")),t.closeDropDown(!0),n.preventDefault()}),t.createDropDown(n,"color-picker",l)},exec:function(t){var n=this;e.sceditor.command.get("color")._dropDown(n,t,function(e){n.execCommand("forecolor",e)})},tooltip:"Font Color"},removeformat:{exec:"removeformat",tooltip:"Remove Formatting"},cut:{exec:"cut",tooltip:"Cut",errorMessage:"Your browser does not allow the cut command. Please use the keyboard shortcut Ctrl/Cmd-X"},copy:{exec:"copy",tooltip:"Copy",errorMessage:"Your browser does not allow the copy command. Please use the keyboard shortcut Ctrl/Cmd-C"},paste:{exec:"paste",tooltip:"Paste",errorMessage:"Your browser does not allow the paste command. Please use the keyboard shortcut Ctrl/Cmd-V"},pastetext:{exec:function(e){var t,n=this,o=i("pastetext",{label:n._("Paste your text inside the following box:"),insert:n._("Insert")},!0);o.find(".button").click(function(e){t=o.find("#txt").val(),t&&n.wysiwygEditorInsertText(t),n.closeDropDown(!0),e.preventDefault()}),n.createDropDown(e,"pastetext",o)},tooltip:"Paste Text"},bulletlist:{exec:"insertunorderedlist",tooltip:"Bullet list"},orderedlist:{exec:"insertorderedlist",tooltip:"Numbered list"},table:{exec:function(t){var n=this,o=i("table",{rows:n._("Rows:"),cols:n._("Cols:"),insert:n._("Insert")},!0);o.find(".button").click(function(t){var i=o.find("#rows").val()-0,r=o.find("#cols").val()-0,s="<table>";if(!(1>i||1>r)){for(var a=0;i>a;a++){s+="<tr>";for(var c=0;r>c;c++)s+="<td>"+(e.sceditor.ie?"":"<br />")+"</td>";s+="</tr>"}s+="</table>",n.wysiwygEditorInsertHtml(s),n.closeDropDown(!0),t.preventDefault()}}),n.createDropDown(t,"inserttable",o)},tooltip:"Insert a table"},horizontalrule:{exec:"inserthorizontalrule",tooltip:"Insert a horizontal rule"},code:{forceNewLineAfter:["code"],exec:function(){this.wysiwygEditorInsertHtml("<code>","<br /></code>")},tooltip:"Code"},image:{exec:function(e){var t=this,n=i("image",{url:t._("URL:"),width:t._("Width (optional):"),height:t._("Height (optional):"),insert:t._("Insert")},!0);n.find(".button").click(function(e){var o=n.find("#image").val(),i=n.find("#width").val(),r=n.find("#height").val(),s="";i&&(s+=' width="'+i+'"'),r&&(s+=' height="'+r+'"'),o&&"http://"!==o&&t.wysiwygEditorInsertHtml("<img"+s+' src="'+o+'" />'),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"insertimage",n)},tooltip:"Insert an image"},email:{exec:function(e){var t=this,n=i("email",{label:t._("E-mail:"),insert:t._("Insert")},!0);n.find(".button").click(function(e){var o=n.find("#email").val();o&&(t.focus(),t.getRangeHelper().selectedHtml()?t.execCommand("createlink","mailto:"+o):t.wysiwygEditorInsertHtml('<a href="mailto:'+o+'">'+o+"</a>")),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"insertemail",n)},tooltip:"Insert an email"},link:{exec:function(e){var t=this,n=i("link",{url:t._("URL:"),desc:t._("Description (optional):"),ins:t._("Insert")},!0);n.find(".button").click(function(e){var o=n.find("#link").val(),i=n.find("#des").val();o&&"http://"!==o&&(t.focus(),!t.getRangeHelper().selectedHtml()||i?(i||(i=o),t.wysiwygEditorInsertHtml('<a href="'+o+'">'+i+"</a>")):t.execCommand("createlink",o)),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"insertlink",n)},tooltip:"Insert a link"},unlink:{exec:"unlink",tooltip:"Unlink"},quote:{forceNewLineAfter:["blockquote"],exec:function(e,t,n){var o="<blockquote>",i="</blockquote>";t?(n=n?"<cite>"+n+"</cite>":"",o=o+n+t+i+"<br />",i=null):""===this.getRangeHelper().selectedHtml()&&(i="<br />"+i),this.wysiwygEditorInsertHtml(o,i)},tooltip:"Insert a Quote"},emoticon:{exec:function(t){var n,o=this,i=o.opts.emoticonsCompat?" ":"",r=e("<div />"),s=e("<div />");if(n=function(t,n){s.append(e("<img />").attr({src:e.isPlainObject(n)?n.url:n,alt:t,title:e.isPlainObject(n)?n.tooltip||t:t}).click(function(t){o.insert(e(this).attr("alt")+i),o.closeDropDown(!0),t.preventDefault()})),s.children().length>3&&(r.append(s),s=e("<div />"))},e.each(o.opts.emoticons.dropdown,n),s.children().length>0&&r.append(s),o.opts.emoticons.more){var a=e(this._('<a class="sceditor-more">{0}</a>',this._("More"))).click(function(){var i=e.extend({},o.opts.emoticons.dropdown,o.opts.emoticons.more);return r=e("<div />"),e.each(i,n),s.children().length>0&&r.append(s),o.createDropDown(t,"insertemoticon",r),!1});r.append(a)}o.createDropDown(t,"insertemoticon",r)},txtExec:function(t){e.sceditor.command.get("emoticon").exec.call(this,t)},tooltip:"Insert an emoticon"},youtube:{_dropDown:function(e,t,n){var o,r=i("youtubeMenu",{label:e._("Video URL:"),insert:e._("Insert")},!0);r.find(".button").click(function(t){var i=r.find("#link").val().replace("http://","");""!==i&&(o=i.match(/(?:v=|v\/|embed\/|youtu.be\/)(.{11})/),o&&(i=o[1]),/^[a-zA-Z0-9_\-]{11}$/.test(i)?n(i):alert("Invalid YouTube video")),e.closeDropDown(!0),t.preventDefault()}),e.createDropDown(t,"insertlink",r)},exec:function(t){var n=this;e.sceditor.command.get("youtube")._dropDown(n,t,function(e){n.wysiwygEditorInsertHtml(i("youtube",{id:e}))})},tooltip:"Insert a YouTube video"},date:{_date:function(e){var t=new Date,n=t.getYear(),o=t.getMonth()+1,i=t.getDate();return 2e3>n&&(n=1900+n),10>o&&(o="0"+o),10>i&&(i="0"+i),e.opts.dateFormat.replace(/year/i,n).replace(/month/i,o).replace(/day/i,i)},exec:function(){this.insertText(e.sceditor.command.get("date")._date(this))},txtExec:function(){this.insertText(e.sceditor.command.get("date")._date(this))},tooltip:"Insert current date"},time:{_time:function(){var e=new Date,t=e.getHours(),n=e.getMinutes(),o=e.getSeconds();return 10>t&&(t="0"+t),10>n&&(n="0"+n),10>o&&(o="0"+o),t+":"+n+":"+o},exec:function(){this.insertText(e.sceditor.command.get("time")._time())},txtExec:function(){this.insertText(e.sceditor.command.get("time")._time())},tooltip:"Insert current time"},ltr:{state:function(e,t){return t&&"ltr"===t.style.direction},exec:function(){var t=this,n=t.getRangeHelper().getFirstBlockParent(),o=e(n);t.focus(),(n&&!o.is("body")||(t.execCommand("formatBlock","p"),n=t.getRangeHelper().getFirstBlockParent(),o=e(n),n&&!o.is("body")))&&("ltr"===o.css("direction")?o.css("direction",""):o.css("direction","ltr"))},tooltip:"Left-to-Right"},rtl:{state:function(e,t){return t&&"rtl"===t.style.direction},exec:function(){var t=this,n=t.getRangeHelper().getFirstBlockParent(),o=e(n);t.focus(),(n&&!o.is("body")||(t.execCommand("formatBlock","p"),n=t.getRangeHelper().getFirstBlockParent(),o=e(n),n&&!o.is("body")))&&("rtl"===o.css("direction")?o.css("direction",""):o.css("direction","rtl"))},tooltip:"Right-to-Left"},print:{exec:"print",tooltip:"Print"},maximize:{state:function(){return this.maximize()},exec:function(){this.maximize(!this.maximize())},txtExec:function(){this.maximize(!this.maximize())},tooltip:"Maximize"},source:{exec:function(){this.toggleSourceMode(),this.blur()},txtExec:function(){this.toggleSourceMode(),this.blur()},tooltip:"View source"},ignore:{}},e.sceditor.rangeHelper=function(t,n){var o,i,r,s,a,c,l=!0,d="sceditor-start-marker",u="sceditor-end-marker",p="character",f=this;r=function(e,t){i=t||e.contentDocument||e.document,o=e,l=!!e.getSelection}(t,n),f.insertHTML=function(e,t){var n,o,r=f.selectedRange();if(t&&(e+=f.selectedHtml()+t),l){for(o=i.createElement("div"),n=i.createDocumentFragment(),o.innerHTML=e;o.firstChild;)n.appendChild(o.firstChild);f.insertNode(n)}else{if(!r)return!1;r.pasteHTML(e)}},f.insertNode=function(e,t){if(l){var n,o,r=i.createDocumentFragment(),s=f.selectedRange();if(!s)return!1;r.appendChild(e),t&&(r.appendChild(s.extractContents()),r.appendChild(t)),o=r.lastChild,s.deleteContents(),s.insertNode(r),n=i.createRange(),n.setStartAfter(o),f.selectRange(n)}else f.insertHTML(e.outerHTML,t?t.outerHTML:null)},f.cloneSelected=function(){var e=f.selectedRange();return e?l?e.cloneRange():e.duplicate():void 0},f.selectedRange=function(){var e,t,n=l?o.getSelection():i.selection;if(n&&(n.getRangeAt&&0>=n.rangeCount&&(e=i.createRange(),e.setStart(i.body,0),n.addRange(e)),e=l?n.getRangeAt(0):n.createRange(),!e.parentElement||!(t=e.parentElement())||t.ownerDocument===i))return e},f.selectedHtml=function(){var e,t=f.selectedRange();return t?!l&&""!==t.text&&t.htmlText?t.htmlText:l?(e=i.createElement("div"),e.appendChild(t.cloneContents()),e.innerHTML):"":""
+},f.parentNode=function(){var e=f.selectedRange();if(e){if(l)return e.commonAncestorContainer;if(e.parentElement)return e.parentElement()}},f.getFirstBlockParent=function(t){var n=function(t){if(!e.sceditor.dom.isInline(t))return t;var o=t?t.parentNode:null;return o?n(o):null};return n(t||f.parentNode())},f.insertNodeAt=function(e,t){var n=f.selectedRange(),o=f.cloneSelected();return o?(o.collapse(e),o.insertNode?o.insertNode(t):o.pasteHTML(t.outerHTML),f.selectRange(n),void 0):!1},s=function(e){f.removeMarker(e);var t=i.createElement("span");return t.id=e,t.style.lineHeight="0",t.style.display="none",t.className="sceditor-selection",t},f.insertMarkers=function(){f.insertNodeAt(!0,s(d)),f.insertNodeAt(!1,s(u))},f.getMarker=function(e){return i.getElementById(e)},f.removeMarker=function(e){var t=f.getMarker(e);t&&t.parentNode.removeChild(t)},f.removeMarkers=function(){f.removeMarker(d),f.removeMarker(u)},f.saveRange=function(){f.insertMarkers()},f.selectRange=function(e){l?(o.getSelection().removeAllRanges(),o.getSelection().addRange(e)):e.select()},f.restoreRange=function(){var e,t=f.selectedRange(),n=f.getMarker(d),o=f.getMarker(u);return n&&o&&t?(l?(t=i.createRange(),t.setStartBefore(n),t.setEndAfter(o),f.selectRange(t)):(t=i.body.createTextRange(),e=i.body.createTextRange(),e.moveToElementText(n),t.setEndPoint("StartToStart",e),t.moveStart(p,0),e.moveToElementText(o),t.setEndPoint("EndToStart",e),t.moveEnd(p,0),f.selectRange(t)),f.removeMarkers(),void 0):!1},c=function(e,t){var n=f.cloneSelected();return n?(n.collapse(!1),l?(n.setStart(n.startContainer,n.startOffset-e),n.setEnd(n.endContainer,n.endOffset+t)):(n.moveStart(p,0-e),n.moveEnd(p,t)),f.selectRange(n),void 0):!1},a=function(e,t){var n="",o=f.cloneSelected();return o?(o.collapse(!1),e?l?(n=o.startContainer.textContent.substr(0,o.startOffset),n=n.substr(Math.max(0,n.length-t))):(o.moveStart(p,0-t),n=o.text):l?n=o.startContainer.textContent.substr(o.startOffset,t):(o.moveEnd(p,t),n=o.text),n):""},f.raplaceKeyword=function(t,n,o,i,r,s){o||t.sort(function(e,t){return e.length-t.length});var d,u,p,h,m,g,v,y,b=i||t[t.length-1][0].length;if(d=u=p="",r){if(!l)return!1;++b}for(d=a(!0,b),n&&(u=a(!1,b)),p=d+(null!=s?s:"")+u,h=t.length;h--;)if(v=RegExp("(?:[\\s    ])"+e.sceditor.regexEscape(t[h][0])+"(?=[\\s    ])"),y=d.length-1-t[h][0].length,r&&--y,y=Math.max(0,y),!r&&(m=p.indexOf(t[h][0],y))>-1||r&&(m=p.substr(y).search(v))>-1){if(r&&(m+=y+1),m>d.length||m+t[h][0].length+(r?1:0)<d.length)continue;return g=d.length-m,c(g,t[h][0].length-g-(null!=s&&/^\S/.test(s)?1:0)),f.insertHTML(t[h][1]),!0}return!1},f.compare=function(e,t){return t||(t=f.selectedRange()),e&&t?l?0===e.compareBoundaryPoints(Range.END_TO_END,t)&&0===e.compareBoundaryPoints(Range.START_TO_START,t):0===e.compareEndPoints("EndToEnd",t)&&0===e.compareEndPoints("StartToStart",t):!e&&!t}},e.sceditor.dom={traverse:function(e,t,n,o,i){if(e)for(e=i?e.lastChild:e.firstChild;null!=e;){var r=i?e.previousSibling:e.nextSibling;if(!n&&t(e)===!1)return!1;if(!o&&this.traverse(e,t,n,o,i)===!1)return!1;if(n&&t(e)===!1)return!1;e=r}},rTraverse:function(e,t,n,o){this.traverse(e,t,n,o,!0)},blockLevelList:"|body|hr|p|div|h1|h2|h3|h4|h5|h6|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|blockquote|center|",isInline:function(t,n){return t&&1===t.nodeType?(t=t.tagName.toLowerCase(),"code"===t?!n:0>e.sceditor.dom.blockLevelList.indexOf("|"+t+"|")):!0},copyCSS:function(e,t){t.style.cssText=e.style.cssText+t.style.cssText},fixNesting:function(e){var t=this,n=function(e){for(;t.isInline(e.parentNode,!0);)e=e.parentNode;return e};t.traverse(e,function(e){if(1===e.nodeType&&!t.isInline(e,!0)&&t.isInline(e.parentNode,!0)){var o=n(e),i=o.parentNode,r=t.extractContents(o,e),s=e;t.copyCSS(o,s),i.insertBefore(r,o),i.insertBefore(s,o)}})},findCommonAncestor:function(t,n){return e(t).parents().has(e(n)).first()},removeWhiteSpace:function(t){var n,o=/[^\S|\u00A0]+/g;this.traverse(t,function(t){if(n=t.nodeValue,3===t.nodeType&&0===e(t).parents("code, pre").length&&n){if(t.previousSibling&&e.sceditor.dom.isInline(t.previousSibling)||(n=n.replace(/^[\r\n]+/,"")),t.nextSibling&&e.sceditor.dom.isInline(t.nextSibling)||(n=n.replace(/[\r\n]+$/,"")),n=n.replace(/[\r\n]+/," "),!n.length)return t.parentNode.removeChild(t),void 0;/\S|\u00A0/.test(n)?o.test(n)&&(n=n.replace(o," ")):n=" ",t.nodeValue=n}})},extractContents:function(e,t){var n=this,o=n.findCommonAncestor(e,t),i=o?o.get(0):null,r=!1,s=!1;return function a(o){var i=e.ownerDocument.createDocumentFragment();return n.traverse(o,function(n){if(s||n===t&&r)return s=!0,!1;n===e&&(r=!0);var o,c;r?jQuery.contains(n,t)&&1===n.nodeType?(o=a(n),c=n.cloneNode(!1),c.appendChild(o),i.appendChild(c)):i.appendChild(n):jQuery.contains(n,e)&&1===n.nodeType&&(o=a(n),c=n.cloneNode(!1),c.appendChild(o),i.appendChild(c))},!1),i}(i)}},e.sceditor.plugins={},e.sceditor.PluginManager=function(t){var n=this,o=[],i=t,r=function(e){return"signal"+e.charAt(0).toUpperCase()+e.slice(1)},s=function(e,t){e=[].slice.call(e);for(var n=o.length,s=r(e.shift());n--;)if(s in o[n]){if(t)return o[n][s].apply(i,e);o[n][s].apply(i,e)}};n.call=function(){s(arguments,!1)},n.callOnlyFirst=function(){return s(arguments,!0)},n.iter=function(e){return e=r(e),function(){var t=o.length;return{callNext:function(n){for(;t--;)if(o[t]&&e in o[t])return o[t].apply(i,n)},hasNext:function(){for(var n=t;n--;)if(o[n]&&e in o[n])return!0;return!1}}}()},n.hasHandler=function(e){var t=o.length;for(e=r(e);t--;)if(e in o[t])return!0;return!1},n.exsists=function(t){return t in e.sceditor.plugins?(t=e.sceditor.plugins[t],"function"==typeof t&&"object"==typeof t.prototype):!1},n.isRegistered=function(t){var i=o.length;if(!n.exsists(t))return!1;for(;i--;)if(o[i]instanceof e.sceditor.plugins[t])return!0;return!1},n.register=function(t){return n.exsists(t)?(t=new e.sceditor.plugins[t],o.push(t),"init"in t&&t.init.apply(i),!0):!1},n.deregister=function(t){var r,s=o.length,a=!1;if(!n.isRegistered(t))return!1;for(;s--;)o[s]instanceof e.sceditor.plugins[t]&&(r=o.splice(s,1)[0],a=!0,"destroy"in r&&r.destroy.apply(i));return a},n.destroy=function(){for(var e=o.length;e--;)"destroy"in o[e]&&o[e].destroy.apply(i);o=null,i=null}},e.sceditor.command={get:function(t){return e.sceditor.commands[t]||null},set:function(t,n){return t&&n?(n=e.extend(e.sceditor.commands[t]||{},n),n.remove=function(){e.sceditor.command.remove(t)},e.sceditor.commands[t]=n,this):!1},remove:function(t){return e.sceditor.commands[t]&&delete e.sceditor.commands[t],this}},e.sceditor.defaultOptions={toolbar:"bold,italic,underline,strike,subscript,superscript|left,center,right,justify|font,size,color,removeformat|cut,copy,paste,pastetext|bulletlist,orderedlist|table|code,quote|horizontalrule,image,email,link,unlink|emoticon,youtube,date,time|ltr,rtl|print,maximize,source",style:"jquery.sceditor.default.css",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Georgia,Impact,Sans-serif,Serif,Times New Roman,Trebuchet MS,Verdana",colors:null,locale:"en",charset:"utf-8",emoticonsCompat:!1,emoticonsEnabled:!0,emoticonsRoot:"",emoticons:{dropdown:{":)":"emoticons/smile.png",":angel:":"emoticons/angel.png",":angry:":"emoticons/angry.png","8-)":"emoticons/cool.png",":'(":"emoticons/cwy.png",":ermm:":"emoticons/ermm.png",":D":"emoticons/grin.png","<3":"emoticons/heart.png",":(":"emoticons/sad.png",":O":"emoticons/shocked.png",":P":"emoticons/tongue.png",";)":"emoticons/wink.png"},more:{":alien:":"emoticons/alien.png",":blink:":"emoticons/blink.png",":blush:":"emoticons/blush.png",":cheerful:":"emoticons/cheerful.png",":devil:":"emoticons/devil.png",":dizzy:":"emoticons/dizzy.png",":getlost:":"emoticons/getlost.png",":happy:":"emoticons/happy.png",":kissing:":"emoticons/kissing.png",":ninja:":"emoticons/ninja.png",":pinch:":"emoticons/pinch.png",":pouty:":"emoticons/pouty.png",":sick:":"emoticons/sick.png",":sideways:":"emoticons/sideways.png",":silly:":"emoticons/silly.png",":sleeping:":"emoticons/sleeping.png",":unsure:":"emoticons/unsure.png",":woot:":"emoticons/w00t.png",":wassat:":"emoticons/wassat.png"},hidden:{":whistling:":"emoticons/whistling.png",":love:":"emoticons/wub.png"}},width:null,height:null,resizeEnabled:!0,resizeMinWidth:null,resizeMinHeight:null,resizeMaxHeight:null,resizeMaxWidth:null,resizeHeight:!0,resizeWidth:!0,getHtmlHandler:null,getTextHandler:null,dateFormat:"year-month-day",toolbarContainer:null,enablePasteFiltering:!1,disablePasting:!1,readOnly:!1,rtl:!1,autofocus:!1,autofocusEnd:!0,autoExpand:!1,autoUpdate:!1,runWithoutWysiwygSupport:!1,id:null,plugins:"",zIndex:null,parserOptions:{},dropDownCss:{}},e.fn.sceditor=function(t){var n,o=[];return t=t||{},t.runWithoutWysiwygSupport||e.sceditor.isWysiwygSupported?(this.each(function(){n=this.jquery?this:e(this),n.parents(".sceditor-container").length>0||("state"===t?o.push(!!n.data("sceditor")):"instance"===t?o.push(n.data("sceditor")):n.data("sceditor")||new e.sceditor(this,t))}),o.length?1===o.length?o[0]:e(o):this):void 0}})(jQuery,window,document);
6 minified/jquery.sceditor.xhtml.min.js
View
@@ -1,2 +1,4 @@
-(function(a,b,c){"use strict";var d={html:'<!DOCTYPE html><html><head><style>.ie * {min-height: auto !important}</style><meta http-equiv="Content-Type" content="text/html;charset={charset}" /><link rel="stylesheet" type="text/css" href="{style}" /></head><body contenteditable="true"></body></html>',toolbarButton:'<a class="sceditor-button sceditor-button-{name}" data-sceditor-command="{name}" unselectable="on"><div unselectable="on">{dispName}</div></a>',emoticon:'<img src="{url}" data-sceditor-emoticon="{key}" alt="{key}" title="{tooltip}" />',fontOpt:'<a class="sceditor-font-option" href="#" data-font="{font}"><font face="{font}">{font}</font></a>',sizeOpt:'<a class="sceditor-fontsize-option" data-size="{size}" href="#"><font size="{size}">{size}</font></a>',pastetext:'<div><label for="txt">{label}</label> <textarea cols="20" rows="7" id="txt"></textarea></div><div><input type="button" class="button" value="{insert}" /></div>',table:'<div><label for="rows">{rows}</label><input type="text" id="rows" value="2" /></div><div><label for="cols">{cols}</label><input type="text" id="cols" value="2" /></div><div><input type="button" class="button" value="{insert}" /></div>',image:'<div><label for="link">{url}</label> <input type="text" id="image" value="http://" /></div><div><label for="width">{width}</label> <input type="text" id="width" size="2" /></div><div><label for="height">{height}</label> <input type="text" id="height" size="2" /></div><div><input type="button" class="button" value="{insert}" /></div>',email:'<div><label for="email">{label}</label> <input type="text" id="email" /></div><div><input type="button" class="button" value="{insert}" /></div>',link:'<div><label for="link">{url}</label> <input type="text" id="link" value="http://" /></div><div><label for="des">{desc}</label> <input type="text" id="des" /></div><div><input type="button" class="button" value="{ins}" /></div>',youtubeMenu:'<div><label for="link">{label}</label> <input type="text" id="link" value="http://" /></div><div><input type="button" class="button" value="{insert}" /></div>',youtube:'<iframe width="560" height="315" src="http://www.youtube.com/embed/{id}?wmode=opaque" data-youtube-id="{id}" frameborder="0" allowfullscreen></iframe>'},e=function(b,c,e){var f=d[b];return a.each(c,function(a,b){f=f.replace(new RegExp("\\{"+a+"\\}","g"),b)}),e&&(f=a(f)),f};a.sceditor=function(d,f){var g=this,h=d.get?d.get(0):d,i=a(h),j,k,l,m,n,o,p,q=[],r,s,t=[],u,v=[],w=[],x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,ab,bb,cb,db,eb,fb;g.commands=a.extend(!0,{},f.commands||a.sceditor.commands),D=function(){i.data("sceditor",g),g.opts=a.extend({},a.sceditor.defaultOptions,f),g.opts.locale&&g.opts.locale!=="en"&&J(),j=a('<div class="sceditor-container" />').insertAfter(i).css("z-index",g.opts.zIndex),a.sceditor.ie&&j.addClass("ie ie"+a.sceditor.ie),C=!!i.attr("required"),i.removeAttr("required"),I(),P(),K(),H(),N(),L(),M(),a.sceditor.isWysiwygSupported||g.toggleSourceMode();var d=function(){a(b).unbind("load",d),g.opts.autofocus&&eb(),g.opts.autoExpand&&g.expandToContent(),Y()};a(b).load(d),c.readyState&&c.readyState==="complete"&&d(),_(),y.call("ready")},I=function(){var b=g.opts.plugins;b=b?b.toString().split(","):[],y=new a.sceditor.PluginManager(g),a.each(b,function(b,c){y.register(a.trim(c))})},J=function(){var b;a.sceditor.locale[g.opts.locale]?s=a.sceditor.locale[g.opts.locale]:(b=g.opts.locale.split("-"),a.sceditor.locale[b[0]]&&(s=a.sceditor.locale[b[0]])),s&&s.dateFormat&&(g.opts.dateFormat=s.dateFormat)},H=function(){var c,d,f,h;n=a("<textarea></textarea>").hide(),l=a('<iframe frameborder="0"></iframe>'),b.location.protocol==="https:"&&l.attr("src","javascript:false"),j.append(l).append(n),m=l[0],o=n[0],g.width(g.opts.width||i.width()),g.height(g.opts.height||i.height()),d=Q(),f=a(d),d.open(),d.write(e("html",{charset:g.opts.charset,style:g.opts.style})),d.close(),g.readOnly(!!g.opts.readOnly),c=f.find("body"),a.sceditor.ie&&f.find("html").addClass("ie ie"+a.sceditor.ie);if(/iPhone|iPod|iPad| wosbrowser\//i.test(navigator.userAgent)||a.sceditor.ie)c.height("100%"),a.sceditor.ie||c.bind("touchend",g.focus);u=new a.sceditor.rangeHelper(m.contentWindow),g.val(i.hide().val()),h=i.attr("tabindex"),n.attr("tabindex",h),l.attr("tabindex",h)},L=function(){var b=a(Q()),c=b.find("body");g.opts.autoUpdate&&(c.bind("blur",g.updateOriginal),n.bind("blur",g.updateOriginal)),g.opts.rtl===null&&(g.opts.rtl=n.css("direction")==="rtl"),g.rtl(!!g.opts.rtl),g.opts.autoExpand&&b.bind("keyup",g.expandToContent),g.opts.resizeEnabled&&O(),j.attr("id",g.opts.id),g.emoticons(g.opts.emoticonsEnabled)},M=function(){var d=a(Q());a(c).click(X),a(h.form).bind("reset",U).submit(g.updateOriginal),a(b).bind("resize orientationChanged",Y),d.find("body").keypress(T).keyup(bb).bind("paste",R).bind(a.sceditor.ie?"selectionchange":"keyup focus blur contextmenu mouseup touchend click",cb).bind("keydown keyup keypress focus blur contextmenu",W),n.bind("keydown keyup keypress focus blur contextmenu",W),d.keypress(T).mousedown(V).bind(a.sceditor.ie?"selectionchange":"focus blur contextmenu mouseup click",cb).bind("beforedeactivate keyup",G).keyup(bb).focus(function(){r=null}),j.bind("selectionchanged",_).bind("selectionchanged",db).bind("selectionchanged",W).bind("nodechanged",W)},K=function(){var b,c,d=g.opts.toolbar.split("|");k=a('<div class="sceditor-toolbar" unselectable="on" />'),a.each(d,function(d,f){b=a('<div class="sceditor-group" />'),a.each(f.split(","),function(d,f){if(!g.commands[f])return;c=e("toolbarButton",{name:f,dispName:g.commands[f].tooltip||f},!0),c.data("sceditor-txtmode",!!g.commands[f].txtExec),c.data("sceditor-wysiwygmode",!!g.commands[f].exec),c.click(function(){var b=a(this);return b.hasClass("disabled")||F(b,g.commands[f]),_(),!1}),g.commands[f].tooltip&&c.attr("title",g._(g.commands[f].tooltip)),g.commands[f].exec||c.addClass("disabled"),b.append(c)}),k.append(b)}),g.opts.toolbarContainer?a(g.opts.toolbarContainer).append(k):j.append(k)},N=function(){a.each(g.commands,function(b,c){c.keyPress&&q.push(c.keyPress),c.forceNewLineAfter&&a.isArray(c.forceNewLineAfter)&&(v=a.merge(v,c.forceNewLineAfter)),c.state?w.push({name:b,state:c.state}):typeof c.exec=="string"&&w.push({name:b,state:c.exec})})},O=function(){var d,e,f,h,i,k,l=a('<div class="sceditor-grip" />'),m=a('<div class="sceditor-resize-cover" />'),n=0,o=0,p=0,q=0,r=j.width(),s=j.height(),t=!1,u=g.rtl();d=g.opts.resizeMinHeight||s/1.5,e=g.opts.resizeMaxHeight||s*2.5,f=g.opts.resizeMinWidth||r/1.25,h=g.opts.resizeMaxWidth||r*1.25,i=function(c){c.type==="touchmove"&&(c=b.event);var i=q+(c.pageY-o),k=u?p-(c.pageX-n):p+(c.pageX-n);h>0&&k>h&&(k=h),e>0&&i>e&&(i=e),g.opts.resizeWidth&&k>=f&&(h<0||k<=h)&&g.width(k),g.opts.resizeHeight&&i>=d&&(e<0||i<=e)&&(g.height(i),a.sceditor.ie<7&&j.height(i)),c.preventDefault()},k=function(b){if(!t)return;t=!1,m.hide(),j.removeClass("resizing").height("auto"),a(c).unbind("touchmove mousemove",i),a(c).unbind("touchend mouseup",k),b.preventDefault()},j.append(l),j.append(m.hide()),l.bind("touchstart mousedown",function(d){d.type==="touchstart"&&(d=b.event),n=d.pageX,o=d.pageY,p=j.width(),q=j.height(),t=!0,j.addClass("resizing"),m.show(),a(c).bind("touchmove mousemove",i),a(c).bind("touchend mouseup",k),a.sceditor.ie<7&&j.height(q),d.preventDefault()})},P=function(){var b;if(!a.isPlainObject(g.opts.emoticons))return;a.each(g.opts.emoticons,function(d,e){a.each(e,function(a,e){g.opts.emoticonsRoot&&(g.opts.emoticons[d][a]=g.opts.emoticonsRoot+(e.url||e)),b=c.createElement("img"),b.src=e.url||e,t.push(b)})})},eb=function(){var b,c,d,e,f=Q(),h=f.body,i=!!g.opts.autofocusEnd;g.sourceMode()?(e=o.value.length,o.setSelectionRange?o.setSelectionRange(e,e):o.createTextRange&&(b=o.createTextRange(),b.moveEnd("character",e),b.moveStart("character",e),u.selectRange(b))):(i?a(h).append(d=f.createElement("div")):d=h.firstChild,f.createRange?(b=f.createRange(),b.setStart(d,0),b.setEnd(d,0)):(b=h.createTextRange(),b.moveToElementText(d),b.collapse(!1)),u.selectRange(b),i&&(a(f).scrollTop(h.scrollHeight),a(h).scrollTop(h.scrollHeight))),g.focus()},g.readOnly=function(a){return typeof a!="boolean"?n.attr("readonly")==="readonly":(Q().body.contentEditable=!a,a?n.attr("readonly","readonly"):n.removeAttr("readonly"),Z(a),this)},g.rtl=function(b){var c=b?"rtl":"ltr";return typeof b!="boolean"?n.attr("dir")==="rtl":(a(Q().body).attr("dir",c),n.attr("dir",c),j.removeClass("rtl").removeClass("ltr").addClass(c),this)},Z=function(b){var c=g.inSourceMode();k.find(".sceditor-button").removeClass("disabled").each(function(){var d=a(this);b===!0||c&&!d.data("sceditor-txtmode")?d.addClass("disabled"):!c&&!d.data("sceditor-wysiwygmode")&&d.addClass("disabled")})},g.width=function(a,b){return!a&&a!==0?j.width():(g.dimensions(a,null,b),this)},g.dimensions=function(a,b,c){var d,e=!1;return a=!a&&a!==0?!1:a,b=!b&&b!==0?!1:b,a===!1&&b===!1?{width:g.width(),height:g.height()}:(typeof l.data("outerWidthOffset")=="undefined"&&g.updateStyleCache(),a!==!1&&a!==g.width()&&(c!==!1&&(g.opts.width=a),a=j.width(a).width(),m.style.width=a-l.data("outerWidthOffset")+"px",o.style.width=a-n.data("outerWidthOffset")+"px",d=g.opts.toolbarContainer?0:k.outerHeight(!0),e=d!==(g.opts.toolbarContainer?0:k.outerHeight(!0))),b!==!1&&b!==g.height()&&(c!==!1&&(g.opts.height=b),b&&b.toString().indexOf("%")&&(b=j.height(b).height(),j.height("auto")),b-=g.opts.toolbarContainer?0:k.outerHeight(!0),e=!0),e&&(m.style.height=b-l.data("outerHeightOffset")+"px",o.style.height=b-n.data("outerHeightOffset")+"px"),this)},g.updateStyleCache=function(){l.data("outerWidthOffset",l.outerWidth(!0)-l.width()),n.data("outerWidthOffset",n.outerWidth(!0)-n.width()),l.data("outerHeightOffset",l.outerHeight(!0)-l.height()),n.data("outerHeightOffset",n.outerHeight(!0)-n.height())},g.height=function(a,b){return!a&&a!==0?j.height():(g.dimensions(null,a,b),this)},g.maximize=function(b){return typeof b=="undefined"?j.is(".sceditor-maximize"):(b=!!b,a.sceditor.ie<7&&a("html, body").toggleClass("sceditor-maximize",b),j.toggleClass("sceditor-maximize",b),g.width(b?"100%":g.opts.width,!1),g.height(b?"100%":g.opts.height,!1),this)},g.expandToContent=function(a){var b=Q(),c=j.height(),d=b.body.scrollHeight||b.documentElement.scrollHeight,e=c-l.height(),f=g.opts.resizeMaxHeight||(g.opts.height||i.height())*2;d+=e,a!==!0&&d>f&&(d=f),d>c&&g.height(d)},g.destroy=function(){y.destroy(),u=null,r=null,y=null,a(c).unbind("click",X),a(b).unbind("resize orientationChanged",Y),a(h.form).unbind("reset",U).unbind("submit",g.updateOriginal),a(Q().body).unbind(),a(Q()).unbind().find("*").remove(),n.unbind().remove(),j.unbind().find("*").unbind().remove(),j.remove(),i.removeData("sceditor").removeData("sceditorbbcode").show(),C&&i.attr("required","required")},g.createDropDown=function(b,c,d,e){var f=p&&p.is(".sceditor-"+c);g.closeDropDown();if(f)return;e!==!1&&a(d).find(":not(input,textarea)").filter(function(){return this.nodeType===1}).attr("unselectable","on");var h={top:b.offset().top,left:b.offset().left,marginTop:b.outerHeight()};a.extend(h,g.opts.dropDownCss),p=a('<div class="sceditor-dropdown sceditor-'+c+'" />').css(h).append(d).appendTo(a("body")).click(function(a){a.stopPropagation()})},X=function(a){a.which!==3&&g.closeDropDown()},R=function(a){function i(a,b){if(a.childNodes.length>0){while(a.firstChild)b.appendChild(a.firstChild);while(h.firstChild)a.appendChild(h.firstChild);S(a,b)}else{if(e>25){while(h.firstChild)a.appendChild(h.firstChild);u.restoreRange();return}++e,setTimeout(function(){i(a,b)},20)}}var b,d=Q().body,e=0,f=d.ownerDocument.createElement("div"),h=d.ownerDocument.createDocumentFragment();if(g.opts.disablePasting)return!1;if(!g.opts.enablePasteFiltering)return;u.saveRange(),c.body.appendChild(f);if(a&&a.clipboardData&&a.clipboardData.getData)if((b=a.clipboardData.getData("text/html"))||(b=a.clipboardData.getData("text/plain")))return f.innerHTML=b,S(d,f),a.stopPropagation(),a.preventDefault(),!1;while(d.firstChild)h.appendChild(d.firstChild);return i(d,f),g.focus(),!0},S=function(b,c){a.sceditor.dom.fixNesting(c);var d=c.innerHTML;y.hasHandler("toSource")&&(d=y.callOnlyFirst("toSource",d,a(c))),c.parentNode.removeChild(c),y.hasHandler("toWysiwyg")&&(d=y.callOnlyFirst("toWysiwyg",d,!0)),u.restoreRange(),u.insertHTML(E(d))},g.closeDropDown=function(a){p&&(p.unbind().remove(),p=null),a===!0&&g.focus()},Q=function(){return m.contentDocument?m.contentDocument:m.contentWindow&&m.contentWindow.document?m.contentWindow.document:m.document?m.document:null},g.wysiwygEditorInsertHtml=function(b,c,d){g.focus();if(!d&&(a(u.parentNode()).is("code")||a(u.parentNode()).parents("code").length!==0))return;u.insertHTML(b,c),bb()},g.wysiwygEditorInsertText=function(b,c){g.wysiwygEditorInsertHtml(a.sceditor.escapeEntities(b),a.sceditor.escapeEntities(c))},g.insertText=function(a,b){return g.inSourceMode()?g.sourceEditorInsertText(a,b):g.wysiwygEditorInsertText(a,b),this},g.sourceEditorInsertText=function(a,b){var d,e,f,g,h;h=o.scrollTop,o.focus(),typeof o.selectionStart!="undefined"?(e=o.selectionStart,f=o.selectionEnd,g=a.length,b&&(a+=o.value.substring(e,f)+b),o.value=o.value.substring(0,e)+a+o.value.substring(f,o.value.length),o.selectionStart=e+a.length-(b?b.length:0),o.selectionEnd=o.selectionStart):typeof c.selection.createRange!="undefined"?(d=c.selection.createRange(),b&&(a+=d.text+b),d.text=a,b&&d.moveEnd("character",0-b.length),d.moveStart("character",d.End-d.Start),d.select()):o.value+=a+b,o.scrollTop=h,o.focus()},g.getRangeHelper=function(){return u},g.val=function(a,b){return typeof a=="string"?(g.inSourceMode()?g.setSourceEditorValue(a):(b!==!1&&y.hasHandler("toWysiwyg")&&(a=y.callOnlyFirst("toWysiwyg",a)),g.setWysiwygEditorValue(a)),this):g.inSourceMode()?g.getSourceEditorValue(!1):g.getWysiwygEditorValue()},g.insert=function(b,c,d,e){if(g.inSourceMode())g.sourceEditorInsertText(b,c);else{if(c){var f=g.getRangeHelper().selectedHtml(),h=a("<div>").appendTo(a("body")).hide().html(f);d!==!1&&(y.hasHandler("toSource")&&(f=y.callOnlyFirst("toSource",f,h)),h.remove()),b+=f+c}y.hasHandler("toWysiwyg")&&(b=y.callOnlyFirst("toWysiwyg",b,!0)),e!==!1&&(b=E(b)),g.wysiwygEditorInsertHtml(b)}return this},g.getWysiwygEditorValue=function(b){var c,d=l.contents().find("body");return a.sceditor.ie&&g.focus(),u.saveRange(),a.sceditor.dom.fixNesting(d.get(0)),c=d.html(),b!==!1&&y.hasHandler("toSource")&&(c=y.callOnlyFirst("toSource",c,d)),u.restoreRange(),r=null,c},g.getSourceEditorValue=function(a){var b=n.val();return a!==!1&&y.hasHandler("toWysiwyg")&&(b=y.callOnlyFirst("toWysiwyg",b)),b},g.setWysiwygEditorValue=function(b){b||(b="<p>"+(a.sceditor.ie?"":"<br />")+"</p>"),Q().body.innerHTML=E(b),bb()},g.setSourceEditorValue=function(a){n.val(a)},g.updateOriginal=function(){i.val(g.val())},E=function(b){if(!g.opts.emoticonsEnabled)return b;var c=a.extend({},g.opts.emoticons.more,g.opts.emoticons.dropdown,g.opts.emoticons.hidden);return a.each(c,function(c,d){var f=a.sceditor.regexEscape(c)+"(?=([^\\<\\>]*?<(?!/code)|[^\\<\\>]*?$))",h="";g.opts.emoticonsCompat&&(f="((>|^|\\s| | | | |&nbsp;))"+f+"(?=(\\s|$|<| | | | |&nbsp;))",h="$1"),b=b.replace(new RegExp(f,"gm"),h+e("emoticon",{key:c,url:d.url||d,tooltip:d.tooltip||c}))}),b},g.inSourceMode=function(){return j.hasClass("sourceMode")},g.sourceMode=function(a){return typeof a!="boolean"?g.inSourceMode():((g.inSourceMode()&&!a||!g.inSourceMode()&&a)&&g.toggleSourceMode(),this)},g.toggleSourceMode=function(){if(!a.sceditor.isWysiwygSupported&&g.inSourceMode())return;g.inSourceMode()?g.setWysiwygEditorValue(g.getSourceEditorValue()):g.setSourceEditorValue(g.getWysiwygEditorValue()),r=null,n.toggle(),l.toggle(),g.inSourceMode()?j.removeClass("sourceMode").addClass("wysiwygMode"):j.removeClass("wysiwygMode").addClass("sourceMode"),Z(),_()},ab=function(){o.focus();if(o.selectionStart!=null)return o.value.substring(o.selectionStart,o.selectionEnd);if(c.selection.createRange)return c.selection.createRange().text},F=function(b,c){if(g.inSourceMode()){c.txtExec&&(a.isArray(c.txtExec)?g.sourceEditorInsertText.apply(g,c.txtExec):c.txtExec.call(g,b,ab()));return}if(!c.exec)return;a.isFunction(c.exec)?c.exec.call(g,b):g.execCommand(c.exec,c.hasOwnProperty("execParam")?c.execParam:null)},G=function(){a.sceditor.ie&&(r=u.selectedRange())},g.execCommand=function(b,c){var d=!1,e=a(u.parentNode());g.focus();if(e.is("code")||e.parents("code").length!==0)return;if(Q())try{d=Q().execCommand(b,!1,c)}catch(f){}!d&&g.commands[b]&&g.commands[b].errorMessage&&alert(g._(g.commands[b].errorMessage))},cb=function(){if(B)return;B=!0,setTimeout(function(){u.compare(A)||(A=u.cloneSelected(),j.trigger(a.Event("selectionchanged"))),B=!1},100)},db=function(){var b=u.parentNode();z!==b&&(j.trigger(a.Event("nodechanged",{oldNode:z,newNode:b})),z=b)},g.currentNode=function(){return z},_=function(a){var b,c,d,e,f,h=Q(),i=w.length,j=g.sourceMode();if(!g.sourceMode()&&!g.readOnly()){f=a?a.newNode:u.parentNode(),d=u.getFirstBlockParent(f);while(i--){b=0,c=w[i],e=k.find(".sceditor-button-"+c.name);if(j&&!e.data("sceditor-txtmode"))e.addClass("disabled");else if(!j&&!e.data("sceditor-wysiwygmode"))e.addClass("disabled");else{if(typeof c.state=="string")try{b=h.queryCommandEnabled(c.state)?0:-1,b>-1&&(b=h.queryCommandState(c.state)?1:0)}catch(a){}else b=c.state.call(g,f,d);b<0?e.addClass("disabled"):e.removeClass("disabled"),b>0?e.addClass("active"):e.removeClass("active")}}}else k.find(".sceditor-button").removeClass("active")},T=function(b){var c,d=q.length;g.closeDropDown(),c=a(u.parentNode());if(b.which===13)if(c.is("code,blockquote,pre")||c.parents("code,blockquote,pre").length!==0)return r=null,g.wysiwygEditorInsertHtml("<br />",null,!0),!1;if(c.is("code")||c.parents("code").length!==0)return;while(d--)q[d].call(g,b,m,n)},bb=function(){var b,c,d=Q();a.sceditor.dom.rTraverse(d.body,function(e){b=e.nodeName.toLowerCase(),a.inArray(b,v)>-1&&(c=!0);if(e.nodeType===3&&!/^\s*$/.test(e.nodeValue)||e.nodeName.toLowerCase()==="br"||a.sceditor.ie&&!e.firstChild&&!a.sceditor.dom.isInline(e,!1))return c&&a(d.body).append(a("<div>"+(a.sceditor.ie?"":"<br />")+"</div>\n")),!1})},U=function(){g.val(i.val())},V=function(){g.closeDropDown(),r=null},Y=function(){var a=g.opts.height,b=g.opts.width,c=j.parent().height();g.maximize()?g.height("100%",!1).width("100%",!1):(a&&a.toString().indexOf("%")>-1&&g.height(a),b&&b.toString().indexOf("%")>-1&&g.width(b))},g._=function(){var a=arguments;return s&&s[a[0]]&&(a[0]=s[a[0]]),a[0].replace(/\{(\d+)\}/g,function(b,c){return typeof a[c-0+1]!="undefined"?a[c-0+1]:"{"+c+"}"})},W=function(b){var c,d=a.extend({},b);y.call(d.type+"Event",b,g),delete d.type,c=a.Event((b.target===o?"scesrc":"scewys")+b.type,d),j.trigger.apply(j,[c,g]),c.isDefaultPrevented()&&b.preventDefault(),c.isImmediatePropagationStopped()&&c.stopImmediatePropagation(),c.isPropagationStopped()&&c.stopPropagation()},g.bind=function(b,c,d,e){var f=b.length;b=b.split(" ");while(f--)a.isFunction(c)&&(d||j.bind("scewys"+b[f],c),e||j.bind("scesrc"+b[f],c));return this},g.unbind=function(b,c,d,e){var f=b.length;b=b.split(" ");while(f--)a.isFunction(c)&&(d||j.unbind("scewys"+b[f],c),e||j.unbind("scesrc"+b[f],c));return this},g.blur=function(b,c,d){return a.isFunction(b)?g.bind("blur",b,c,d):g.sourceMode()?n.blur():(x||(x=a('<input style="width:0;height:0;opacity:0;border:0;padding:0;filter:alpha(opacity=0)" type="text" />').appendTo(j)),x.removeAttr("disabled").show().focus().blur().hide().attr("disabled","disabled")),this},g.focus=function(b,c,d){return a.isFunction(b)?g.bind("focus",b,c,d):g.inSourceMode()?o.focus():(m.contentWindow.focus(),Q().body.focus(),r&&(u.selectRange(r),r=null)),this},g.keyDown=function(a,b,c){return g.bind("keydown",a,b,c)},g.keyPress=function(a,b,c){return g.bind("keypress",a,b,c)},g.keyUp=function(a,b,c){return g.bind("keyup",a,b,c)},g.nodeChanged=function(a){return g.bind("nodechanged",a,!1,!0)},g.selectionChanged=function(a){return g.bind("selectionchanged",a,!1,!0)},fb=function(b){var c=0,d=String.fromCharCode(b.which);g.emoticonsCache||(g.emoticonsCache=[],a.each(a.extend({},g.opts.emoticons.more,g.opts.emoticons.dropdown,g.opts.emoticons.hidden),function(a,b){g.emoticonsCache[c++]=[a,e("emoticon",{key:a,url:b.url||b,tooltip:b.tooltip||a})]}),g.emoticonsCache.sort(function(a,b){return a[0].length-b[0].length})),g.longestEmoticonCode||(g.longestEmoticonCode=g.emoticonsCache[g.emoticonsCache.length-1][0].length);if(g.getRangeHelper().raplaceKeyword(g.emoticonsCache,!0,!0,g.longestEmoticonCode,g.opts.emoticonsCompat,d))return/^\s$/.test(d)&&g.opts.emoticonsCompat?!0:(b.preventDefault(),b.stopPropagation(),!1)},g.emoticons=function(b){if(!b&&b!==!1)return g.opts.emoticonsEnabled;var c=a(Q().body);return g.opts.emoticonsEnabled=b,b?(c.keypress(fb),g.sourceMode()||(u.saveRange(),c.html(E(c.html())),u.restoreRange())):(c.find("img[data-sceditor-emoticon]").replaceWith(function(){return a(this).data("sceditor-emoticon")}),c.unbind("keypress",fb)),this},D()},a.sceditor.ie=function(){var a,d=3,e=c.createElement("div"),f=e.getElementsByTagName("i");do e.innerHTML="<!--[if gt IE "+ ++d+"]><i></i><![endif]-->";while(f[0]);return c.all&&b.atob&&(d=10),d>4?d:a}(),a.sceditor.isWysiwygSupported=function(){var b,c=a('<div contenteditable="true">')[0].contentEditable,d=typeof c!="undefined"&&c!=="inherit",e=navigator.userAgent;if(!d)return!1;var f=/Opera Mobi|Opera Mini/i.test(e);return/Android/i.test(e)&&(f=!0,/Safari/.test(e)&&(b=/Safari\/(\d+)/.exec(e),f=!b||!b[1]?!0:b[1]<534)),/ Silk\//i.test(e)&&(b=/AppleWebKit\/(\d+)/.exec(e),f=!b||!b[1]?!0:b[1]<534),/iPhone|iPod|iPad/i.test(e)&&(f=!/OS [5-9](_\d)+ like Mac OS X/i.test(e)),/fennec/i.test(e)&&(f=!1),!f}(),a.sceditor.regexEscape=function(a){return a.replace(/[\$\?\[\]\.\*\(\)\|\\]/g,"\\$&").replace("<","&lt;").replace(">","&gt;")},a.sceditor.escapeEntities=function(a){return a?a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/ {2}/g," &nbsp;").replace(/\r\n|\r/g,"\n").replace(/\n/g,"<br />"):a},a.sceditor.locale={},a.sceditor.commands={bold:{exec:"bold",tooltip:"Bold"},italic:{exec:"italic",tooltip:"Italic"},underline:{exec:"underline",tooltip:"Underline"},strike:{exec:"strikethrough",tooltip:"Strikethrough"},subscript:{exec:"subscript",tooltip:"Subscript"},superscript:{exec:"superscript",tooltip:"Superscript"},left:{exec:"justifyleft",tooltip:"Align left"},center:{exec:"justifycenter",tooltip:"Center"},right:{exec:"justifyright",tooltip:"Align right"},justify:{exec:"justifyfull",tooltip:"Justify"},font:{_dropDown:function(b,c,d){var f=b.opts.fonts.split(","),g=a("<div />"),h=function(){return d(a(this).data("font")),b.closeDropDown(!0),!1};for(var i=0;i<f.length;i++)g.append(e("fontOpt",{font:f[i]},!0).click(h));b.createDropDown(c,"font-picker",g)},exec:function(b){var c=this;a.sceditor.command.get("font")._dropDown(c,b,function(a){c.execCommand("fontname",a)})},tooltip:"Font Name"},size:{_dropDown:function(b,c,d){var f=a("<div />"),g=function(c){d(a(this).data("size")),b.closeDropDown(!0),c.preventDefault()};for(var h=1;h<=7;h++)f.append(e("sizeOpt",{size:h},!0).click(g));b.createDropDown(c,"fontsize-picker",f)},exec:function(b){var c=this;a.sceditor.command.get("size")._dropDown(c,b,function(a){c.execCommand("fontsize",a)})},tooltip:"Font Size"},color:{_dropDown:function(b,c,d){var e,f,g,h,i={r:255,g:255,b:255},j=a("<div />"),k=b.opts.colors?b.opts.colors.split("|"):new Array(21),l=[],m=a.sceditor.command.get("color");if(!m._htmlCache){for(e=0;e<k.length;++e){h=k[e]?k[e].split(","):new Array(21),l.push('<div class="sceditor-color-column">');for(f=0;f<h.length;++f)g=h[f]||"#"+i.r.toString(16)+i.g.toString(16)+i.b.toString(16),l.push('<a href="#" class="sceditor-color-option" style="background-color: '+g+'" data-color="'+g+'"></a>'),f%5===0?(i.g-=51,i.b=255):i.b-=51;l.push("</div>"),e%5===0?(i.r-=51,i.g=255,i.b=255):(i.g=255,i.b=255)}m._htmlCache=l.join("")}j.append(m._htmlCache).find("a").click(function(c){d(a(this).attr("data-color")),b.closeDropDown(!0),c.preventDefault()}),b.createDropDown(c,"color-picker",j)},exec:function(b){var c=this;a.sceditor.command.get("color")._dropDown(c,b,function(a){c.execCommand("forecolor",a)})},tooltip:"Font Color"},removeformat:{exec:"removeformat",tooltip:"Remove Formatting"},cut:{exec:"cut",tooltip:"Cut",errorMessage:"Your browser does not allow the cut command. Please use the keyboard shortcut Ctrl/Cmd-X"},copy:{exec:"copy",tooltip:"Copy",errorMessage:"Your browser does not allow the copy command. Please use the keyboard shortcut Ctrl/Cmd-C"},paste:{exec:"paste",tooltip:"Paste",errorMessage:"Your browser does not allow the paste command. Please use the keyboard shortcut Ctrl/Cmd-V"},pastetext:{exec:function(a){var b,c=this,d=e("pastetext",{label:c._("Paste your text inside the following box:"),insert:c._("Insert")},!0);d.find(".button").click(function(a){b=d.find("#txt").val(),b&&c.wysiwygEditorInsertText(b),c.closeDropDown(!0),a.preventDefault()}),c.createDropDown(a,"pastetext",d)},tooltip:"Paste Text"},bulletlist:{exec:"insertunorderedlist",tooltip:"Bullet list"},orderedlist:{exec:"insertorderedlist",tooltip:"Numbered list"},table:{exec:function(b){var c=this,d=e("table",{rows:c._("Rows:"),cols:c._("Cols:"),insert:c._("Insert")},!0);d.find(".button").click(function(b){var e=d.find("#rows").val()-0,f=d.find("#cols").val()-0,g="<table>";if(e<1||f<1)return;for(var h=0;h<e;h++){g+="<tr>";for(var i=0;i<f;i++)g+="<td>"+(a.sceditor.ie?"":"<br />")+"</td>";g+="</tr>"}g+="</table>",c.wysiwygEditorInsertHtml(g),c.closeDropDown(!0),b.preventDefault()}),c.createDropDown(b,"inserttable",d)},tooltip:"Insert a table"},horizontalrule:{exec:"inserthorizontalrule",tooltip:"Insert a horizontal rule"},code:{forceNewLineAfter:["code"],exec:function(){this.wysiwygEditorInsertHtml("<code>","<br /></code>")},tooltip:"Code"},image:{exec:function(a){var b=this,c=e("image",{url:b._("URL:"),width:b._("Width (optional):"),height:b._("Height (optional):"),insert:b._("Insert")},!0);c.find(".button").click(function(a){var d=c.find("#image").val(),e=c.find("#width").val(),f=c.find("#height").val(),g="";e&&(g+=' width="'+e+'"'),f&&(g+=' height="'+f+'"'),d&&d!=="http://"&&b.wysiwygEditorInsertHtml("<img"+g+' src="'+d+'" />'),b.closeDropDown(!0),a.preventDefault()}),b.createDropDown(a,"insertimage",c)},tooltip:"Insert an image"},email:{exec:function(a){var b=this,c=e("email",{label:b._("E-mail:"),insert:b._("Insert")},!0);c.find(".button").click(function(a){var d=c.find("#email").val();d&&(b.focus(),b.getRangeHelper().selectedHtml()?b.execCommand("createlink","mailto:"+d):b.wysiwygEditorInsertHtml('<a href="mailto:'+d+'">'+d+"</a>")),b.closeDropDown(!0),a.preventDefault()}),b.createDropDown(a,"insertemail",c)},tooltip:"Insert an email"},link:{exec:function(a){var b=this,c=e("link",{url:b._("URL:"),desc:b._("Description (optional):"),ins:b._("Insert")},!0);c.find(".button").click(function(a){var d=c.find("#link").val(),e=c.find("#des").val();d&&d!=="http://"&&(b.focus(),!b.getRangeHelper().selectedHtml()||e?(e||(e=d),b.wysiwygEditorInsertHtml('<a href="'+d+'">'+e+"</a>")):b.execCommand("createlink",d)),b.closeDropDown(!0),a.preventDefault()}),b.createDropDown(a,"insertlink",c)},tooltip:"Insert a link"},unlink:{exec:"unlink",tooltip:"Unlink"},quote:{forceNewLineAfter:["blockquote"],exec:function(a,b,c){var d="<blockquote>",e="</blockquote>";b?(c=c?"<cite>"+c+"</cite>":"",d=d+c+b+e+"<br />",e=null):this.getRangeHelper().selectedHtml()===""&&(e="<br />"+e),this.wysiwygEditorInsertHtml(d,e)},tooltip:"Insert a Quote"},emoticon:{exec:function(b){var c,d=this,e=d.opts.emoticonsCompat?" ":"",f=a("<div />"),g=a("<div />");c=function(b,c){g.append(a("<img />").attr({src:a.isPlainObject(c)?c.url:c,alt:b,title:a.isPlainObject(c)?c.tooltip||b:b}).click(function(b){d.insert(a(this).attr("alt")+e),d.closeDropDown(!0),b.preventDefault()})),g.children().length>3&&(f.append(g),g=a("<div />"))},a.each(d.opts.emoticons.dropdown,c),g.children().length>0&&f.append(g);if(d.opts.emoticons.more){var h=a(this._('<a class="sceditor-more">{0}</a>',this._("More"))).click(function(){var e=a.extend({},d.opts.emoticons.dropdown,d.opts.emoticons.more);return f=a("<div />"),a.each(e,c),g.children().length>0&&f.append(g),d.createDropDown(b,"insertemoticon",f),!1});f.append(h)}d.createDropDown(b,"insertemoticon",f)},txtExec:function(b){a.sceditor.command.get("emoticon").exec.call(this,b)},tooltip:"Insert an emoticon"},youtube:{_dropDown:function(a,b,c){var d,f=e("youtubeMenu",{label:a._("Video URL:"),insert:a._("Insert")},!0);f.find(".button").click(function(b){var e=f.find("#link").val().replace("http://","");e!==""&&(d=e.match(/(?:v=|v\/|embed\/|youtu.be\/)(.{11})/),d&&(e=d[1]),/^[a-zA-Z0-9_\-]{11}$/.test(e)?c(e):alert("Invalid YouTube video")),a.closeDropDown(!0),b.preventDefault()}),a.createDropDown(b,"insertlink",f)},exec:function(b){var c=this;a.sceditor.command.get("youtube")._dropDown(c,b,function(a){c.wysiwygEditorInsertHtml(e("youtube",{id:a}))})},tooltip:"Insert a YouTube video"},date:{_date:function(a){var b=new Date,c=b.getYear(),d=b.getMonth()+1,e=b.getDate();return c<2e3&&(c=1900+c),d<10&&(d="0"+d),e<10&&(e="0"+e),a.opts.dateFormat.replace(/year/i,c).replace(/month/i,d).replace(/day/i,e)},exec:function(){this.insertText(a.sceditor.command.get("date")._date(this))},txtExec:function(){this.insertText(a.sceditor.command.get("date")._date(this))},tooltip:"Insert current date"},time:{_time:function(){var a=new Date,b=a.getHours(),c=a.getMinutes(),d=a.getSeconds();return b<10&&(b="0"+b),c<10&&(c="0"+c),d<10&&(d="0"+d),b+":"+c+":"+d},exec:function(){this.insertText(a.sceditor.command.get("time")._time())},txtExec:function(){this.insertText(a.sceditor.command.get("time")._time())},tooltip:"Insert current time"},ltr:{state:function(a,b){return b&&b.style.direction==="ltr"},exec:function(){var b=this,c=b.getRangeHelper().getFirstBlockParent(),d=a(c);b.focus();if(!c||d.is("body")){b.execCommand("formatBlock","p"),c=b.getRangeHelper().getFirstBlockParent(),d=a(c);if(!c||d.is("body"))return}d.css("direction")==="ltr"?d.css("direction",""):d.css("direction","ltr")},tooltip:"Left-to-Right"},rtl:{state:function(a,b){return b&&b.style.direction==="rtl"},exec:function(){var b=this,c=b.getRangeHelper().getFirstBlockParent(),d=a(c);b.focus();if(!c||d.is("body")){b.execCommand("formatBlock","p"),c=b.getRangeHelper().getFirstBlockParent(),d=a(c);if(!c||d.is("body"))return}d.css("direction")==="rtl"?d.css("direction",""):d.css("direction","rtl")},tooltip:"Right-to-Left"},print:{exec:"print",tooltip:"Print"},maximize:{state:function(){return this.maximize()},exec:function(){this.maximize(!this.maximize())},txtExec:function(){this.maximize(!this.maximize())},tooltip:"Maximize"},source:{exec:function(){this.toggleSourceMode(),this.blur()},txtExec:function(){this.toggleSourceMode(),this.blur()},tooltip:"View source"},ignore:{}},a.sceditor.rangeHelper=function(b,c){var d,e,f,g,h,i,j=!0,k="sceditor-start-marker",l="sceditor-end-marker",m="character",n=this;f=function(a,b){e=b||a.contentDocument||a.document,d=a,j=!!a.getSelection}(b,c),n.insertHTML=function(a,b){var c,d,f=n.selectedRange();b&&(a+=n.selectedHtml()+b);if(j){d=e.createElement("div"),c=e.createDocumentFragment(),d.innerHTML=a;while(d.firstChild)c.appendChild(d.firstChild);n.insertNode(c)}else{if(!f)return!1;f.pasteHTML(a)}},n.insertNode=function(a,b){if(j){var c,d,f=e.createDocumentFragment(),g=n.selectedRange();if(!g)return!1;f.appendChild(a),b&&(f.appendChild(g.extractContents()),f.appendChild(b)),d=f.lastChild,g.deleteContents(),g.insertNode(f),c=e.createRange(),c.setStartAfter(d),n.selectRange(c)}else n.insertHTML(a.outerHTML,b?b.outerHTML:null)},n.cloneSelected=function(){var a=n.selectedRange();if(a)return j?a.cloneRange():a.duplicate()},n.selectedRange=function(){var a,b,c=j?d.getSelection():e.selection;if(!c)return;c.getRangeAt&&c.rangeCount<=0&&(a=e.createRange(),a.setStart(e.body,0),c.addRange(a)),a=j?c.getRangeAt(0):c.createRange();if(a.parentElement&&(b=a.parentElement())&&b.ownerDocument!==e)return;return a},n.selectedHtml=function(){var a,b=n.selectedRange();return b?!j&&b.text!==""&&b.htmlText?b.htmlText:j?(a=e.createElement("div"),a.appendChild(b.cloneContents()),a.innerHTML):"":""},n.parentNode=function(){var a=n.selectedRange();if(a){if(j)return a.commonAncestorContainer;if(a.parentElement)return a.parentElement()}},n.getFirstBlockParent=function(b){var c=function(b){if(!a.sceditor.dom.isInline(b))return b;var d=b?b.parentNode:null;return d?c(d):null};return c(b||n.parentNode())},n.insertNodeAt=function(a,b){var c=n.selectedRange(),d=n.cloneSelected();if(!d)return!1;d.collapse(a),d.insertNode?d.insertNode(b):d.pasteHTML(b.outerHTML),n.selectRange(c)},g=function(a){n.removeMarker
-(a);var b=e.createElement("span");return b.id=a,b.style.lineHeight="0",b.style.display="none",b.className="sceditor-selection",b},n.insertMarkers=function(){n.insertNodeAt(!0,g(k)),n.insertNodeAt(!1,g(l))},n.getMarker=function(a){return e.getElementById(a)},n.removeMarker=function(a){var b=n.getMarker(a);b&&b.parentNode.removeChild(b)},n.removeMarkers=function(){n.removeMarker(k),n.removeMarker(l)},n.saveRange=function(){n.insertMarkers()},n.selectRange=function(a){j?(d.getSelection().removeAllRanges(),d.getSelection().addRange(a)):a.select()},n.restoreRange=function(){var a,b=n.selectedRange(),c=n.getMarker(k),d=n.getMarker(l);if(!c||!d||!b)return!1;j?(b=e.createRange(),b.setStartBefore(c),b.setEndAfter(d),n.selectRange(b)):(b=e.body.createTextRange(),a=e.body.createTextRange(),a.moveToElementText(c),b.setEndPoint("StartToStart",a),b.moveStart(m,0),a.moveToElementText(d),b.setEndPoint("EndToStart",a),b.moveEnd(m,0),n.selectRange(b)),n.removeMarkers()},i=function(a,b){var c=n.cloneSelected();if(!c)return!1;c.collapse(!1),j?(c.setStart(c.startContainer,c.startOffset-a),c.setEnd(c.endContainer,c.endOffset+b)):(c.moveStart(m,0-a),c.moveEnd(m,b)),n.selectRange(c)},h=function(a,b){var c="",d=n.cloneSelected();return d?(d.collapse(!1),a?j?(c=d.startContainer.textContent.substr(0,d.startOffset),c=c.substr(Math.max(0,c.length-b))):(d.moveStart(m,0-b),c=d.text):j?c=d.startContainer.textContent.substr(d.startOffset,b):(d.moveEnd(m,b),c=d.text),c):""},n.raplaceKeyword=function(b,c,d,e,f,g){d||b.sort(function(a,b){return a.length-b.length});var k,l,m,o,p,q,r,s,t=e||b[b.length-1][0].length;k=l=m="";if(f){if(!j)return!1;++t}k=h(!0,t),c&&(l=h(!1,t)),m=k+(g!=null?g:"")+l,o=b.length;while(o--){r=new RegExp("(?:[\\s    ])"+a.sceditor.regexEscape(b[o][0])+"(?=[\\s    ])"),s=k.length-1-b[o][0].length,f&&--s,s=Math.max(0,s);if(!f&&(p=m.indexOf(b[o][0],s))>-1||f&&(p=m.substr(s).search(r))>-1){f&&(p+=s+1);if(p>k.length||p+b[o][0].length+(f?1:0)<k.length)continue;return q=k.length-p,i(q,b[o][0].length-q-(g!=null&&/^\S/.test(g)?1:0)),n.insertHTML(b[o][1]),!0}}return!1},n.compare=function(a,b){return b||(b=n.selectedRange()),!a||!b?!a&&!b:j?a.compareBoundaryPoints(Range.END_TO_END,b)===0&&a.compareBoundaryPoints(Range.START_TO_START,b)===0:a.compareEndPoints("EndToEnd",b)===0&&a.compareEndPoints("StartToStart",b)===0}},a.sceditor.dom={traverse:function(a,b,c,d,e){if(a){a=e?a.lastChild:a.firstChild;while(a!=null){var f=e?a.previousSibling:a.nextSibling;if(!c&&b(a)===!1)return!1;if(!d&&this.traverse(a,b,c,d,e)===!1)return!1;if(c&&b(a)===!1)return!1;a=f}}},rTraverse:function(a,b,c,d){this.traverse(a,b,c,d,!0)},blockLevelList:"|body|hr|p|div|h1|h2|h3|h4|h5|h6|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|blockquote|center|",isInline:function(b,c){return!b||b.nodeType!==1?!0:(b=b.tagName.toLowerCase(),b==="code"?!c:a.sceditor.dom.blockLevelList.indexOf("|"+b+"|")<0)},copyCSS:function(a,b){b.style.cssText=a.style.cssText+b.style.cssText},fixNesting:function(a){var b=this,c=function(a){while(b.isInline(a.parentNode,!0))a=a.parentNode;return a};b.traverse(a,function(a){if(a.nodeType===1&&!b.isInline(a,!0)&&b.isInline(a.parentNode,!0)){var d=c(a),e=d.parentNode,f=b.extractContents(d,a),g=a;b.copyCSS(d,g),e.insertBefore(f,d),e.insertBefore(g,d)}})},findCommonAncestor:function(b,c){return a(b).parents().has(a(c)).first()},removeWhiteSpace:function(b){var c,d=/[^\S|\u00A0]+/g;this.traverse(b,function(b){c=b.nodeValue;if(b.nodeType===3&&a(b).parents("code, pre").length===0&&c){if(!b.previousSibling||!a.sceditor.dom.isInline(b.previousSibling))c=c.replace(/^[\r\n]+/,"");if(!b.nextSibling||!a.sceditor.dom.isInline(b.nextSibling))c=c.replace(/[\r\n]+$/,"");c=c.replace(/[\r\n]+/," ");if(!c.length){b.parentNode.removeChild(b);return}/\S|\u00A0/.test(c)?d.test(c)&&(c=c.replace(d," ")):c=" ",b.nodeValue=c}})},extractContents:function(a,b){var c=this,d=c.findCommonAncestor(a,b),e=d?d.get(0):null,f=!1,g=!1;return function h(d){var e=a.ownerDocument.createDocumentFragment();return c.traverse(d,function(c){if(g||c===b&&f)return g=!0,!1;c===a&&(f=!0);var d,i;f?jQuery.contains(c,b)&&c.nodeType===1?(d=h(c),i=c.cloneNode(!1),i.appendChild(d),e.appendChild(i)):e.appendChild(c):jQuery.contains(c,a)&&c.nodeType===1&&(d=h(c),i=c.cloneNode(!1),i.appendChild(d),e.appendChild(i))},!1),e}(e)}},a.sceditor.plugins={},a.sceditor.PluginManager=function(b){var c=this,d=[],e=b,f=function(a){return"signal"+a.charAt(0).toUpperCase()+a.slice(1)},g=function(a,b){a=[].slice.call(a);var c=d.length,g=f(a.shift());while(c--)if(g in d[c]){if(b)return d[c][g].apply(e,a);d[c][g].apply(e,a)}};c.call=function(){g(arguments,!1)},c.callOnlyFirst=function(){return g(arguments,!0)},c.iter=function(a){return a=f(a),function(){var b=d.length;return{callNext:function(c){while(b--)if(d[b]&&a in d[b])return d[b].apply(e,c)},hasNext:function(){var c=b;while(c--)if(d[c]&&a in d[c])return!0;return!1}}}()},c.hasHandler=function(a){var b=d.length;a=f(a);while(b--)if(a in d[b])return!0;return!1},c.exsists=function(b){return b in a.sceditor.plugins?(b=a.sceditor.plugins[b],typeof b=="function"&&typeof b.prototype=="object"):!1},c.isRegistered=function(b){var e=d.length;if(!c.exsists(b))return!1;while(e--)if(d[e]instanceof a.sceditor.plugins[b])return!0;return!1},c.register=function(b){return c.exsists(b)?(b=new a.sceditor.plugins[b],d.push(b),"init"in b&&b.init.apply(e),!0):!1},c.deregister=function(b){var f,g=d.length,h=!1;if(!c.isRegistered(b))return!1;while(g--)d[g]instanceof a.sceditor.plugins[b]&&(f=d.splice(g,1)[0],h=!0,"destroy"in f&&f.destroy.apply(e));return h},c.destroy=function(){var a=d.length;while(a--)"destroy"in d[a]&&d[a].destroy.apply(e);d=null,e=null}},a.sceditor.command={get:function(b){return a.sceditor.commands[b]||null},set:function(b,c){return!b||!c?!1:(c=a.extend(a.sceditor.commands[b]||{},c),c.remove=function(){a.sceditor.command.remove(b)},a.sceditor.commands[b]=c,this)},remove:function(b){return a.sceditor.commands[b]&&delete a.sceditor.commands[b],this}},a.sceditor.defaultOptions={toolbar:"bold,italic,underline,strike,subscript,superscript|left,center,right,justify|font,size,color,removeformat|cut,copy,paste,pastetext|bulletlist,orderedlist|table|code,quote|horizontalrule,image,email,link,unlink|emoticon,youtube,date,time|ltr,rtl|print,maximize,source",style:"jquery.sceditor.default.css",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Georgia,Impact,Sans-serif,Serif,Times New Roman,Trebuchet MS,Verdana",colors:null,locale:"en",charset:"utf-8",emoticonsCompat:!1,emoticonsEnabled:!0,emoticonsRoot:"",emoticons:{dropdown:{":)":"emoticons/smile.png",":angel:":"emoticons/angel.png",":angry:":"emoticons/angry.png","8-)":"emoticons/cool.png",":'(":"emoticons/cwy.png",":ermm:":"emoticons/ermm.png",":D":"emoticons/grin.png","<3":"emoticons/heart.png",":(":"emoticons/sad.png",":O":"emoticons/shocked.png",":P":"emoticons/tongue.png",";)":"emoticons/wink.png"},more:{":alien:":"emoticons/alien.png",":blink:":"emoticons/blink.png",":blush:":"emoticons/blush.png",":cheerful:":"emoticons/cheerful.png",":devil:":"emoticons/devil.png",":dizzy:":"emoticons/dizzy.png",":getlost:":"emoticons/getlost.png",":happy:":"emoticons/happy.png",":kissing:":"emoticons/kissing.png",":ninja:":"emoticons/ninja.png",":pinch:":"emoticons/pinch.png",":pouty:":"emoticons/pouty.png",":sick:":"emoticons/sick.png",":sideways:":"emoticons/sideways.png",":silly:":"emoticons/silly.png",":sleeping:":"emoticons/sleeping.png",":unsure:":"emoticons/unsure.png",":woot:":"emoticons/w00t.png",":wassat:":"emoticons/wassat.png"},hidden:{":whistling:":"emoticons/whistling.png",":love:":"emoticons/wub.png"}},width:null,height:null,resizeEnabled:!0,resizeMinWidth:null,resizeMinHeight:null,resizeMaxHeight:null,resizeMaxWidth:null,resizeHeight:!0,resizeWidth:!0,getHtmlHandler:null,getTextHandler:null,dateFormat:"year-month-day",toolbarContainer:null,enablePasteFiltering:!1,disablePasting:!1,readOnly:!1,rtl:!1,autofocus:!1,autofocusEnd:!0,autoExpand:!1,autoUpdate:!1,runWithoutWysiwygSupport:!1,id:null,plugins:"",zIndex:null,parserOptions:{},dropDownCss:{}},a.fn.sceditor=function(b){var c,d=[];b=b||{};if(!b.runWithoutWysiwygSupport&&!a.sceditor.isWysiwygSupported)return;return this.each(function(){c=this.jquery?this:a(this);if(c.parents(".sceditor-container").length>0)return;b==="state"?d.push(!!c.data("sceditor")):b==="instance"?d.push(c.data("sceditor")):c.data("sceditor")||new a.sceditor(this,b)}),d.length?d.length===1?d[0]:a(d):this}})(jQuery,window,document),function(a){"use strict",a.sceditor.XHTMLSerializer=function(){var b=this,c={indentStr:" "},d=[],e=0,f,g,h,i,j,k,l,m,n,o,p;f=function(a){var b={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};return a?a.replace(/[&<>"]/g,function(a){return b[a]||a}):""},g=function(a){return a.replace(/[\r\n]/,"").replace(/[^\S|\u00A0]+/g," ")},b.serialize=function(a,b){d=[];if(b){a=a.firstChild;while(a)h(a),a=a.nextSibling}else h(a);return d.join("")},h=function(a){switch(a.nodeType){case 1:var b=a.nodeName.toLowerCase();b==="!"&&l(a),j(a);break;case 3:m(a);break;case 4:k(a);break;case 8:l(a);break;case 9:case 11:i(a);break;case 2:case 5:case 6:case 7:case 10:case 12:}},i=function(a){var b;b=a.firstChild;while(b)h(b),b=b.nextSibling},j=function(a){var b,c,g=a.nodeName.toLowerCase(),i=a.attributes.length,j=!a.firstChild&&/^(?:area|base|br|col|embed|hr|img|input|link|meta|param)$/.test(g);o(a)&&n(),d.push("<"+g);while(i--)c=a.attributes[i],d.push(" ",c.name.toLowerCase(),'="',f(c.value),'"');d.push(j?" />":">"),e++,b=a.firstChild;while(b)h(b),b=b.nextSibling;e--,j||(o(a)&&a.firstChild&&n(),d.push("</",g,">"))},k=function(a){n(),d.push("<![CDATA[",f(a.nodeValue),"]]>")},l=function(a){n(),d.push("<!-- ",f(a.nodeValue)," -->")},m=function(a){var b=g(a.nodeValue);b&&(o(a)&&n(),d.push(f(b)))},n=function(){var a=e;p();while(a--)d.push(c.indentStr)},o=function(b){if(b.nodeType!==1){if(b.previousSibling&&a.sceditor.dom.isInline(b.previousSibling))return!1;b=b.parentNode}return!b.previousSibling&&!a.sceditor.dom.isInline(b.parentNode)?!0:!a.sceditor.dom.isInline(b)},p=function(){d.length&&d.push("\n")}},a.sceditor.plugins.xhtml=function(){var b=this,c={},d={},e,f,g,h,i,j;b.init=function(){a.isEmptyObject(a.sceditor.plugins.xhtml.converters||{})||a.each(a.sceditor.plugins.xhtml.converters,function(b,d){a.each(d.tags,function(a){c[a]||(c[a]=[]),c[a].push(d)})}),e(this)},e=function(b){var c={bold:{txtExec:["<strong>","</strong>"]},italic:{txtExec:["<em>","</em>"]},underline:{txtExec:['<span style="text-decoration: underline;">',"<span>"]},strike:{txtExec:['<span style="text-decoration: line-through;">',"<span>"]},subscript:{txtExec:["<sub>","</sub>"]},superscript:{txtExec:["<sup>","</sup>"]},left:{txtExec:['<div style="text-align: left;">',"<div>"]},center:{txtExec:['<div style="text-align: center;">',"<div>"]},right:{txtExec:['<div style="text-align: right;">',"<div>"]},justify:{txtExec:['<div style="text-align: justify;">',"<div>"]},font:{txtExec:function(b){var c=this;a.sceditor.command.get("font")._dropDown(c,b,function(a){c.insertText('<span style="font-family: '+a+';">',"</span>")})}},size:{txtExec:function(b){var c=this;a.sceditor.command.get("size")._dropDown(c,b,function(a){c.insertText('<span style="font-size: '+a+';">',"</span>")})}},color:{txtExec:function(b){var c=this;a.sceditor.command.get("color")._dropDown(c,b,function(a){c.insertText('<span style="color: '+a+';">',"</span>")})}},bulletlist:{txtExec:["<ul><li>","</li></ul>"]},orderedlist:{txtExec:["<ol><li>","</li></ol>"]},table:{txtExec:["<table><tr><td>","</td></tr></table>"]},horizontalrule:{txtExec:["<hr />"]},code:{txtExec:["<code>","</code>"]},image:{txtExec:function(a,b){var c=prompt(this._("Enter the image URL:"),b);c&&this.insertText('<img src="'+c+'" />')}},email:{txtExec:function(a,b){var c=b&&b.indexOf("@")>-1?null:b,d=prompt(this._("Enter the e-mail address:"),c?"":b),e=prompt(this._("Enter the displayed text:"),c||d)||d;d&&this.insertText('<a href="mailto:'+d+'">'+e+"</a>")}},link:{txtExec:function(a,b){var c=b&&b.indexOf("http://")>-1?null:b,d=prompt(this._("Enter URL:"),c?"http://":b),e=prompt(this._("Enter the displayed text:"),c||d)||d;d&&this.insertText('<a href="'+d+'">'+e+"</a>")}},quote:{txtExec:["<blockquote>","</blockquote>"]},youtube:{txtExec:function(b){var c=this;a.sceditor.command.get("youtube")._dropDown(c,b,function(a){c.insertText('<iframe width="560" height="315" src="http://www.youtube.com/embed/{id}?wmode=opaque" data-youtube-id="'+a+'" frameborder="0" allowfullscreen></iframe>')})}},rtl:{txtExec:['<div stlye="direction: rtl;">',"</div>"]},ltr:{txtExec:['<div stlye="direction: ltr;">',"</div>"]}};b.commands=a.extend(!0,{},c,b.commands)},b.signalToSource=function(b,c){return c=c.jquery?c[0]:c,a(c).find(".sceditor-selection").remove(),f(c),h(c),j(c),(new a.sceditor.XHTMLSerializer).serialize(c,!0)},b.signalToWysiwyg=function(a){return a},b.convertTagTo=function(a,b){var c,d,e=a.attributes.length,f=a.ownerDocument.createElement(b);while(e--)d=a.attributes[e],f.setAttribute(d.name,d.value);while(c=a.firstChild)f.appendChild(c);return a.parentNode.replaceChild(f,a),f},g=function(d,e){c[d]&&a.each(c[d],function(c,f){f.tags[d]?a.each(f.tags[d],function(c,d){if(typeof e.attr(c)=="undefined")return;if(d&&a.inArray(e.attr(c),d)<0)return;f.conv.call(b,e[0])}):f.conv&&f.conv.call(b,e[0])})},f=function(b){if(!c)return;a.sceditor.dom.traverse(b,function(b){var d=a(b),e=b.nodeName.toLowerCase();if(!c)return;g("*",d),g(e,d)},!0)},h=function(b){a.sceditor.dom.traverse(b,function(b){var c=b.nodeName.toLowerCase(),d=a.sceditor.plugins.xhtml.allowedTags,e=a.sceditor.plugins.xhtml.disallowedTags;if(b.nodeType===4)c="!cdata";else if(c==="!"||b.nodeType===8)c="!comment";d&&d.length&&b.nodeType!==3?a.inArray(c,d)<0&&b.parentNode&&b.parentNode.removeChild(b):e&&e.length&&b.nodeType!==3&&a.inArray(c,e)>-1&&b.parentNode&&b.parentNode.removeChild(b)})},i=function(b,c){var d={};return b&&a.extend(d,b),c?(a.each(c,function(b,c){a.isArray(d[b])?a.isArray(c)&&(d[b]=a.merge(d[b],c)):d[b]=c}),d):d},j=function(b){d={},a.sceditor.dom.traverse(b,function(b){if(!b.attributes)return;var c,e,f=b.nodeName.toLowerCase(),g=a.sceditor.plugins.xhtml.allowedAttribs,h=a.sceditor.plugins.xhtml.disallowedAttribs,j=b.attributes.length;if(g&&!a.isEmptyObject(g)&&j){d[f]||(d[f]=i(g["*"],g[f]));while(j--)c=b.attributes[j],e=typeof d[f][c.name]=="undefined",a.isArray(d[f][c.name])&&a.inArray(c.value,d[f][c.name])<0&&(e=!0),e&&b.removeAttribute(c.name)}else if(h&&!a.isEmptyObject(h)&&j){d[f]||(d[f]=i(h["*"],h[f]));while(j--)c=b.attributes[j],e=typeof d[f][c.name]!="undefined",a.isArray(d[f][c.name])&&a.inArray(c.value,d[f][c.name])>-1&&(e=!0),e&&b.removeAttribute(c.name)}})}},a.sceditor.plugins.xhtml.converters=[{tags:{"*":{width:null}},conv:function(b){var c=a(b);c.css("width",c.attr("width")).removeAttr("width")}},{tags:{"*":{height:null}},conv:function(b){var c=a(b);c.css("height",c.attr("height")).removeAttr("height")}},{tags:{li:{value:null}},conv:function(b){a(b).removeAttr("value")}},{tags:{"*":{text:null}},conv:function(b){var c=a(b);c.css("color",c.attr("text")).removeAttr("text")}},{tags:{"*":{size:null}},conv:function(b){var c=a(b);c.css("font-size",c.css("font-size")).removeAttr("size")}},{tags:{"*":{color:null}},conv:function(b){var c=a(b);c.css("color",c.attr("color")).removeAttr("color")}},{tags:{"*":{face:null}},conv:function(b){var c=a(b);c.css("font-family",c.attr("face")).removeAttr("face")}},{tags:{"*":{language:null}},conv:function(b){var c=a(b),d=c.attr("language");/jscript|javascript|js/i.test(d)?c.attr("type","text/javascript"):/vb/i.test(d)&&c.attr("type","text/vbscript"),c.removeAttr("language")}},{tags:{"*":{align:null}},conv:function(b){var c=a(b);c.css("text-align",c.attr("align")).removeAttr("align")}},{tags:{"*":{border:null}},conv:function(b){var c=a(b);c.css("border-size",c.attr("border")).removeAttr("border")}},{tags:{applet:{name:null},img:{name:null},layer:{name:null},map:{name:null},object:{name:null},param:{name:null}},conv:function(b){a(b).removeAttr("name")}},{tags:{hr:{noshade:null}},conv:function(b){var c=a(b);c.css("border-style","solid").removeAttr("noshade")}},{tags:{"*":{nowrap:null}},conv:function(b){var c=a(b);c.css("white-space","nowrap").removeAttr("nowrap")}},{tags:{big:null},conv:function(b){a(this.convertTagTo(b,"span")).css("font-size","larger")}},{tags:{small:null},conv:function(b){a(this.convertTagTo(b,"span")).css("font-size","smaller")}},{tags:{b:null},conv:function(b){a(this.convertTagTo(b,"strong"))}},{tags:{u:null},conv:function(b){a(this.convertTagTo(b,"span")).css("text-decoration","underline")}},{tags:{i:null},conv:function(b){a(this.convertTagTo(b,"em"))}},{tags:{s:null,strike:null},conv:function(b){a(this.convertTagTo(b,"span")).css("text-decoration","line-through")}},{tags:{dir:null},conv:function(a){this.convertTagTo(a,"ul")}},{tags:{center:null},conv:function(b){a(this.convertTagTo(b,"div")).css("text-align","center")}},{tags:{font:null},conv:function(a){this.convertTagTo(a,"span")}}],a.sceditor.plugins.xhtml.allowedAttribs={},a.sceditor.plugins.xhtml.disallowedAttribs={},a.sceditor.plugins.xhtml.allowedTags=[],a.sceditor.plugins.xhtml.disallowedTags=[]}(jQuery);
+/*! SCEditor | (C) 2011-2013, Sam Clarke | sceditor.com/license */
+(function(e,t,n){"use strict";var o={html:'<!DOCTYPE html><html><head><style>.ie * {min-height: auto !important}</style><meta http-equiv="Content-Type" content="text/html;charset={charset}" /><link rel="stylesheet" type="text/css" href="{style}" /></head><body contenteditable="true"></body></html>',toolbarButton:'<a class="sceditor-button sceditor-button-{name}" data-sceditor-command="{name}" unselectable="on"><div unselectable="on">{dispName}</div></a>',emoticon:'<img src="{url}" data-sceditor-emoticon="{key}" alt="{key}" title="{tooltip}" />',fontOpt:'<a class="sceditor-font-option" href="#" data-font="{font}"><font face="{font}">{font}</font></a>',sizeOpt:'<a class="sceditor-fontsize-option" data-size="{size}" href="#"><font size="{size}">{size}</font></a>',pastetext:'<div><label for="txt">{label}</label> <textarea cols="20" rows="7" id="txt"></textarea></div><div><input type="button" class="button" value="{insert}" /></div>',table:'<div><label for="rows">{rows}</label><input type="text" id="rows" value="2" /></div><div><label for="cols">{cols}</label><input type="text" id="cols" value="2" /></div><div><input type="button" class="button" value="{insert}" /></div>',image:'<div><label for="link">{url}</label> <input type="text" id="image" value="http://" /></div><div><label for="width">{width}</label> <input type="text" id="width" size="2" /></div><div><label for="height">{height}</label> <input type="text" id="height" size="2" /></div><div><input type="button" class="button" value="{insert}" /></div>',email:'<div><label for="email">{label}</label> <input type="text" id="email" /></div><div><input type="button" class="button" value="{insert}" /></div>',link:'<div><label for="link">{url}</label> <input type="text" id="link" value="http://" /></div><div><label for="des">{desc}</label> <input type="text" id="des" /></div><div><input type="button" class="button" value="{ins}" /></div>',youtubeMenu:'<div><label for="link">{label}</label> <input type="text" id="link" value="http://" /></div><div><input type="button" class="button" value="{insert}" /></div>',youtube:'<iframe width="560" height="315" src="http://www.youtube.com/embed/{id}?wmode=opaque" data-youtube-id="{id}" frameborder="0" allowfullscreen></iframe>'},i=function(t,n,i){var r=o[t];return e.each(n,function(e,t){r=r.replace(RegExp("\\{"+e+"\\}","g"),t)}),i&&(r=e(r)),r};e.sceditor=function(o,r){var s,a,c,l,d,u,p,f,h,m,g,v,b,y,x,w,C,E,k,T,S,D,M,R,H,z,A,N,O,I,_,P,W,L,F,j,q,V,B,U,$,Y,X,Q,K,G,J=this,Z=o.get?o.get(0):o,et=e(Z),tt=[],nt=[],ot=[],it=[];J.commands=e.extend(!0,{},r.commands||e.sceditor.commands),C=function(){et.data("sceditor",J),J.opts=e.extend({},e.sceditor.defaultOptions,r),J.opts.locale&&"en"!==J.opts.locale&&M(),s=e('<div class="sceditor-container" />').insertAfter(et).css("z-index",J.opts.zIndex),e.sceditor.ie&&s.addClass("ie ie"+e.sceditor.ie),w=!!et.attr("required"),et.removeAttr("required"),D(),O(),R(),S(),A(),H(),z(),e.sceditor.isWysiwygSupported||J.toggleSourceMode();var o=function(){e(t).unbind("load",o),J.opts.autofocus&&K(),J.opts.autoExpand&&J.expandToContent(),V()};e(t).load(o),n.readyState&&"complete"===n.readyState&&o(),U(),v.call("ready")},D=function(){var t=J.opts.plugins;t=t?(""+t).split(","):[],v=new e.sceditor.PluginManager(J),e.each(t,function(t,n){v.register(e.trim(n))})},M=function(){var t;e.sceditor.locale[J.opts.locale]?h=e.sceditor.locale[J.opts.locale]:(t=J.opts.locale.split("-"),e.sceditor.locale[t[0]]&&(h=e.sceditor.locale[t[0]])),h&&h.dateFormat&&(J.opts.dateFormat=h.dateFormat)},S=function(){var n,o,r,a;d=e("<textarea></textarea>").hide(),c=e('<iframe frameborder="0"></iframe>'),"https:"===t.location.protocol&&c.attr("src","javascript:false"),s.append(c).append(d),l=c[0],u=d[0],J.width(J.opts.width||et.width()),J.height(J.opts.height||et.height()),o=I(),r=e(o),o.open(),o.write(i("html",{charset:J.opts.charset,style:J.opts.style})),o.close(),J.readOnly(!!J.opts.readOnly),n=r.find("body"),e.sceditor.ie&&r.find("html").addClass("ie ie"+e.sceditor.ie),(/iPhone|iPod|iPad| wosbrowser\//i.test(navigator.userAgent)||e.sceditor.ie)&&(n.height("100%"),e.sceditor.ie||n.bind("touchend",J.focus)),m=new e.sceditor.rangeHelper(l.contentWindow),J.val(et.hide().val()),a=et.attr("tabindex"),d.attr("tabindex",a),c.attr("tabindex",a)},H=function(){var t=e(I()),n=t.find("body");J.opts.autoUpdate&&(n.bind("blur",J.updateOriginal),d.bind("blur",J.updateOriginal)),null===J.opts.rtl&&(J.opts.rtl="rtl"===d.css("direction")),J.rtl(!!J.opts.rtl),J.opts.autoExpand&&t.bind("keyup",J.expandToContent),J.opts.resizeEnabled&&N(),s.attr("id",J.opts.id),J.emoticons(J.opts.emoticonsEnabled)},z=function(){var o=e(I());e(n).click(q),e(Z.form).bind("reset",L).submit(J.updateOriginal),e(t).bind("resize orientationChanged",V),o.find("body").keypress(W).keyup(Y).bind("paste",_).bind(e.sceditor.ie?"selectionchange":"keyup focus blur contextmenu mouseup touchend click",X).bind("keydown keyup keypress focus blur contextmenu",j),d.bind("keydown keyup keypress focus blur contextmenu",j),o.keypress(W).mousedown(F).bind(e.sceditor.ie?"selectionchange":"focus blur contextmenu mouseup click",X).bind("beforedeactivate keyup",T).keyup(Y).focus(function(){f=null}),s.bind("selectionchanged",U).bind("selectionchanged",Q).bind("selectionchanged",j).bind("nodechanged",j)},R=function(){var t,n,o=J.opts.toolbar.split("|");a=e('<div class="sceditor-toolbar" unselectable="on" />'),e.each(o,function(o,r){t=e('<div class="sceditor-group" />'),e.each(r.split(","),function(o,r){J.commands[r]&&(n=i("toolbarButton",{name:r,dispName:J.commands[r].tooltip||r},!0),n.data("sceditor-txtmode",!!J.commands[r].txtExec),n.data("sceditor-wysiwygmode",!!J.commands[r].exec),n.click(function(){var t=e(this);return t.hasClass("disabled")||k(t,J.commands[r]),U(),!1}),J.commands[r].tooltip&&n.attr("title",J._(J.commands[r].tooltip)),J.commands[r].exec||n.addClass("disabled"),t.append(n))}),a.append(t)}),J.opts.toolbarContainer?e(J.opts.toolbarContainer).append(a):s.append(a)},A=function(){e.each(J.commands,function(t,n){n.keyPress&&tt.push(n.keyPress),n.forceNewLineAfter&&e.isArray(n.forceNewLineAfter)&&(ot=e.merge(ot,n.forceNewLineAfter)),n.state?it.push({name:t,state:n.state}):"string"==typeof n.exec&&it.push({name:t,state:n.exec})})},N=function(){var o,i,r,a,c,l,d=e('<div class="sceditor-grip" />'),u=e('<div class="sceditor-resize-cover" />'),p=0,f=0,h=0,m=0,g=s.width(),v=s.height(),b=!1,y=J.rtl();o=J.opts.resizeMinHeight||v/1.5,i=J.opts.resizeMaxHeight||2.5*v,r=J.opts.resizeMinWidth||g/1.25,a=J.opts.resizeMaxWidth||1.25*g,c=function(n){"touchmove"===n.type&&(n=t.event);var c=m+(n.pageY-f),l=y?h-(n.pageX-p):h+(n.pageX-p);a>0&&l>a&&(l=a),i>0&&c>i&&(c=i),J.opts.resizeWidth&&l>=r&&(0>a||a>=l)&&J.width(l),J.opts.resizeHeight&&c>=o&&(0>i||i>=c)&&(J.height(c),7>e.sceditor.ie&&s.height(c)),n.preventDefault()},l=function(t){b&&(b=!1,u.hide(),s.removeClass("resizing").height("auto"),e(n).unbind("touchmove mousemove",c),e(n).unbind("touchend mouseup",l),t.preventDefault())},s.append(d),s.append(u.hide()),d.bind("touchstart mousedown",function(o){"touchstart"===o.type&&(o=t.event),p=o.pageX,f=o.pageY,h=s.width(),m=s.height(),b=!0,s.addClass("resizing"),u.show(),e(n).bind("touchmove mousemove",c),e(n).bind("touchend mouseup",l),7>e.sceditor.ie&&s.height(m),o.preventDefault()})},O=function(){var t;e.isPlainObject(J.opts.emoticons)&&e.each(J.opts.emoticons,function(o,i){e.each(i,function(e,i){J.opts.emoticonsRoot&&(J.opts.emoticons[o][e]=J.opts.emoticonsRoot+(i.url||i)),t=n.createElement("img"),t.src=i.url||i,nt.push(t)})})},K=function(){var t,n,o,i=I(),r=i.body,s=!!J.opts.autofocusEnd;J.sourceMode()?(o=u.value.length,u.setSelectionRange?u.setSelectionRange(o,o):u.createTextRange&&(t=u.createTextRange(),t.moveEnd("character",o),t.moveStart("character",o),m.selectRange(t))):(s?e(r).append(n=i.createElement("div")):n=r.firstChild,i.createRange?(t=i.createRange(),t.setStart(n,0),t.setEnd(n,0)):(t=r.createTextRange(),t.moveToElementText(n),t.collapse(!1)),m.selectRange(t),s&&(e(i).scrollTop(r.scrollHeight),e(r).scrollTop(r.scrollHeight))),J.focus()},J.readOnly=function(e){return"boolean"!=typeof e?"readonly"===d.attr("readonly"):(I().body.contentEditable=!e,e?d.attr("readonly","readonly"):d.removeAttr("readonly"),B(e),this)},J.rtl=function(t){var n=t?"rtl":"ltr";return"boolean"!=typeof t?"rtl"===d.attr("dir"):(e(I().body).attr("dir",n),d.attr("dir",n),s.removeClass("rtl").removeClass("ltr").addClass(n),this)},B=function(t){var n=J.inSourceMode();a.find(".sceditor-button").removeClass("disabled").each(function(){var o=e(this);t===!0||n&&!o.data("sceditor-txtmode")?o.addClass("disabled"):n||o.data("sceditor-wysiwygmode")||o.addClass("disabled")})},J.width=function(e,t){return e||0===e?(J.dimensions(e,null,t),this):s.width()},J.dimensions=function(e,t,n){var o,i=!1;return e=e||0===e?e:!1,t=t||0===t?t:!1,e===!1&&t===!1?{width:J.width(),height:J.height()}:(c.data("outerWidthOffset")===void 0&&J.updateStyleCache(),e!==!1&&e!==J.width()&&(n!==!1&&(J.opts.width=e),e=s.width(e).width(),l.style.width=e-c.data("outerWidthOffset")+"px",u.style.width=e-d.data("outerWidthOffset")+"px",o=J.opts.toolbarContainer?0:a.outerHeight(!0),i=o!==(J.opts.toolbarContainer?0:a.outerHeight(!0))),t!==!1&&t!==J.height()&&(n!==!1&&(J.opts.height=t),t&&(""+t).indexOf("%")&&(t=s.height(t).height(),s.height("auto")),t-=J.opts.toolbarContainer?0:a.outerHeight(!0),i=!0),i&&(l.style.height=t-c.data("outerHeightOffset")+"px",u.style.height=t-d.data("outerHeightOffset")+"px"),this)},J.updateStyleCache=function(){c.data("outerWidthOffset",c.outerWidth(!0)-c.width()),d.data("outerWidthOffset",d.outerWidth(!0)-d.width()),c.data("outerHeightOffset",c.outerHeight(!0)-c.height()),d.data("outerHeightOffset",d.outerHeight(!0)-d.height())},J.height=function(e,t){return e||0===e?(J.dimensions(null,e,t),this):s.height()},J.maximize=function(t){return t===void 0?s.is(".sceditor-maximize"):(t=!!t,7>e.sceditor.ie&&e("html, body").toggleClass("sceditor-maximize",t),s.toggleClass("sceditor-maximize",t),J.width(t?"100%":J.opts.width,!1),J.height(t?"100%":J.opts.height,!1),this)},J.expandToContent=function(e){var t=I(),n=s.height(),o=t.body.scrollHeight||t.documentElement.scrollHeight,i=n-c.height(),r=J.opts.resizeMaxHeight||2*(J.opts.height||et.height());o+=i,e!==!0&&o>r&&(o=r),o>n&&J.height(o)},J.destroy=function(){v.destroy(),m=null,f=null,v=null,e(n).unbind("click",q),e(t).unbind("resize orientationChanged",V),e(Z.form).unbind("reset",L).unbind("submit",J.updateOriginal),e(I().body).unbind(),e(I()).unbind().find("*").remove(),d.unbind().remove(),s.unbind().find("*").unbind().remove(),s.remove(),et.removeData("sceditor").removeData("sceditorbbcode").show(),w&&et.attr("required","required")},J.createDropDown=function(t,n,o,i){var r=p&&p.is(".sceditor-"+n);if(J.closeDropDown(),!r){i!==!1&&e(o).find(":not(input,textarea)").filter(function(){return 1===this.nodeType}).attr("unselectable","on");var s={top:t.offset().top,left:t.offset().left,marginTop:t.outerHeight()};e.extend(s,J.opts.dropDownCss),p=e('<div class="sceditor-dropdown sceditor-'+n+'" />').css(s).append(o).appendTo(e("body")).click(function(e){e.stopPropagation()})}},q=function(e){3!==e.which&&J.closeDropDown()},_=function(e){function t(e,n){if(e.childNodes.length>0){for(;e.firstChild;)n.appendChild(e.firstChild);for(;a.firstChild;)e.appendChild(a.firstChild);P(e,n)}else{if(r>25){for(;a.firstChild;)e.appendChild(a.firstChild);return m.restoreRange(),void 0}++r,setTimeout(function(){t(e,n)},20)}}var o,i=I().body,r=0,s=i.ownerDocument.createElement("div"),a=i.ownerDocument.createDocumentFragment();if(J.opts.disablePasting)return!1;if(J.opts.enablePasteFiltering){if(m.saveRange(),n.body.appendChild(s),e&&e.clipboardData&&e.clipboardData.getData&&((o=e.clipboardData.getData("text/html"))||(o=e.clipboardData.getData("text/plain"))))return s.innerHTML=o,P(i,s),e.stopPropagation(),e.preventDefault(),!1;for(;i.firstChild;)a.appendChild(i.firstChild);return t(i,s),J.focus(),!0}},P=function(t,n){e.sceditor.dom.fixNesting(n);var o=n.innerHTML;v.hasHandler("toSource")&&(o=v.callOnlyFirst("toSource",o,e(n))),n.parentNode.removeChild(n),v.hasHandler("toWysiwyg")&&(o=v.callOnlyFirst("toWysiwyg",o,!0)),m.restoreRange(),m.insertHTML(E(o))},J.closeDropDown=function(e){p&&(p.unbind().remove(),p=null),e===!0&&J.focus()},I=function(){return l.contentDocument?l.contentDocument:l.contentWindow&&l.contentWindow.document?l.contentWindow.document:l.document?l.document:null},J.wysiwygEditorInsertHtml=function(t,n,o){J.focus(),(o||!e(m.parentNode()).is("code")&&0===e(m.parentNode()).parents("code").length)&&(m.insertHTML(t,n),Y())},J.wysiwygEditorInsertText=function(t,n){J.wysiwygEditorInsertHtml(e.sceditor.escapeEntities(t),e.sceditor.escapeEntities(n))},J.insertText=function(e,t){return J.inSourceMode()?J.sourceEditorInsertText(e,t):J.wysiwygEditorInsertText(e,t),this},J.sourceEditorInsertText=function(e,t){var o,i,r,s,a;a=u.scrollTop,u.focus(),u.selectionStart!==void 0?(i=u.selectionStart,r=u.selectionEnd,s=e.length,t&&(e+=u.value.substring(i,r)+t),u.value=u.value.substring(0,i)+e+u.value.substring(r,u.value.length),u.selectionStart=i+e.length-(t?t.length:0),u.selectionEnd=u.selectionStart):n.selection.createRange!==void 0?(o=n.selection.createRange(),t&&(e+=o.text+t),o.text=e,t&&o.moveEnd("character",0-t.length),o.moveStart("character",o.End-o.Start),o.select()):u.value+=e+t,u.scrollTop=a,u.focus()},J.getRangeHelper=function(){return m},J.val=function(e,t){return"string"==typeof e?(J.inSourceMode()?J.setSourceEditorValue(e):(t!==!1&&v.hasHandler("toWysiwyg")&&(e=v.callOnlyFirst("toWysiwyg",e)),J.setWysiwygEditorValue(e)),this):J.inSourceMode()?J.getSourceEditorValue(!1):J.getWysiwygEditorValue()},J.insert=function(t,n,o,i){if(J.inSourceMode())J.sourceEditorInsertText(t,n);else{if(n){var r=J.getRangeHelper().selectedHtml(),s=e("<div>").appendTo(e("body")).hide().html(r);o!==!1&&(v.hasHandler("toSource")&&(r=v.callOnlyFirst("toSource",r,s)),s.remove()),t+=r+n}v.hasHandler("toWysiwyg")&&(t=v.callOnlyFirst("toWysiwyg",t,!0)),i!==!1&&(t=E(t)),J.wysiwygEditorInsertHtml(t)}return this},J.getWysiwygEditorValue=function(t){var n,o=c.contents().find("body");return e.sceditor.ie&&J.focus(),m.saveRange(),e.sceditor.dom.fixNesting(o.get(0)),n=o.html(),t!==!1&&v.hasHandler("toSource")&&(n=v.callOnlyFirst("toSource",n,o)),m.restoreRange(),f=null,n},J.getSourceEditorValue=function(e){var t=d.val();return e!==!1&&v.hasHandler("toWysiwyg")&&(t=v.callOnlyFirst("toWysiwyg",t)),t},J.setWysiwygEditorValue=function(t){t||(t="<p>"+(e.sceditor.ie?"":"<br />")+"</p>"),I().body.innerHTML=E(t),Y()},J.setSourceEditorValue=function(e){d.val(e)},J.updateOriginal=function(){et.val(J.val())},E=function(t){if(!J.opts.emoticonsEnabled)return t;var n=e.extend({},J.opts.emoticons.more,J.opts.emoticons.dropdown,J.opts.emoticons.hidden);return e.each(n,function(n,o){var r=e.sceditor.regexEscape(n)+"(?=([^\\<\\>]*?<(?!/code)|[^\\<\\>]*?$))",s="";J.opts.emoticonsCompat&&(r="((>|^|\\s| | | | |&nbsp;))"+r+"(?=(\\s|$|<| | | | |&nbsp;))",s="$1"),t=t.replace(RegExp(r,"gm"),s+i("emoticon",{key:n,url:o.url||o,tooltip:o.tooltip||n}))}),t},J.inSourceMode=function(){return s.hasClass("sourceMode")},J.sourceMode=function(e){return"boolean"!=typeof e?J.inSourceMode():((J.inSourceMode()&&!e||!J.inSourceMode()&&e)&&J.toggleSourceMode(),this)},J.toggleSourceMode=function(){(e.sceditor.isWysiwygSupported||!J.inSourceMode())&&(J.inSourceMode()?J.setWysiwygEditorValue(J.getSourceEditorValue()):J.setSourceEditorValue(J.getWysiwygEditorValue()),f=null,d.toggle(),c.toggle(),J.inSourceMode()?s.removeClass("sourceMode").addClass("wysiwygMode"):s.removeClass("wysiwygMode").addClass("sourceMode"),B(),U())},$=function(){return u.focus(),null!=u.selectionStart?u.value.substring(u.selectionStart,u.selectionEnd):n.selection.createRange?n.selection.createRange().text:void 0},k=function(t,n){return J.inSourceMode()?(n.txtExec&&(e.isArray(n.txtExec)?J.sourceEditorInsertText.apply(J,n.txtExec):n.txtExec.call(J,t,$())),void 0):(n.exec&&(e.isFunction(n.exec)?n.exec.call(J,t):J.execCommand(n.exec,n.hasOwnProperty("execParam")?n.execParam:null)),void 0)},T=function(){e.sceditor.ie&&(f=m.selectedRange())},J.execCommand=function(t,n){var o=!1,i=e(m.parentNode());if(J.focus(),!i.is("code")&&0===i.parents("code").length){if(I())try{o=I().execCommand(t,!1,n)}catch(r){}!o&&J.commands[t]&&J.commands[t].errorMessage&&alert(J._(J.commands[t].errorMessage))}},X=function(){x||(x=!0,setTimeout(function(){m.compare(y)||(y=m.cloneSelected(),s.trigger(e.Event("selectionchanged"))),x=!1},100))},Q=function(){var t=m.parentNode();b!==t&&(s.trigger(e.Event("nodechanged",{oldNode:b,newNode:t})),b=t)},J.currentNode=function(){return b},U=function(e){var t,n,o,i,r,s=I(),c=it.length,l=J.sourceMode();if(J.sourceMode()||J.readOnly())a.find(".sceditor-button").removeClass("active");else for(r=e?e.newNode:m.parentNode(),o=m.getFirstBlockParent(r);c--;)if(t=0,n=it[c],i=a.find(".sceditor-button-"+n.name),l&&!i.data("sceditor-txtmode"))i.addClass("disabled");else if(l||i.data("sceditor-wysiwygmode")){if("string"==typeof n.state)try{t=s.queryCommandEnabled(n.state)?0:-1,t>-1&&(t=s.queryCommandState(n.state)?1:0)}catch(e){}else t=n.state.call(J,r,o);0>t?i.addClass("disabled"):i.removeClass("disabled"),t>0?i.addClass("active"):i.removeClass("active")}else i.addClass("disabled")},W=function(t){var n,o=tt.length;if(J.closeDropDown(),n=e(m.parentNode()),13===t.which&&(n.is("code,blockquote,pre")||0!==n.parents("code,blockquote,pre").length))return f=null,J.wysiwygEditorInsertHtml("<br />",null,!0),!1;if(!n.is("code")&&0===n.parents("code").length)for(;o--;)tt[o].call(J,t,l,d)},Y=function(){var t,n,o=I();e.sceditor.dom.rTraverse(o.body,function(i){return t=i.nodeName.toLowerCase(),e.inArray(t,ot)>-1&&(n=!0),3===i.nodeType&&!/^\s*$/.test(i.nodeValue)||"br"===i.nodeName.toLowerCase()||e.sceditor.ie&&!i.firstChild&&!e.sceditor.dom.isInline(i,!1)?(n&&e(o.body).append(e("<div>"+(e.sceditor.ie?"":"<br />")+"</div>\n")),!1):void 0})},L=function(){J.val(et.val())},F=function(){J.closeDropDown(),f=null},V=function(){var e=J.opts.height,t=J.opts.width;J.maximize()?J.height("100%",!1).width("100%",!1):(e&&(""+e).indexOf("%")>-1&&J.height(e),t&&(""+t).indexOf("%")>-1&&J.width(t))},J._=function(){var e=arguments;return h&&h[e[0]]&&(e[0]=h[e[0]]),e[0].replace(/\{(\d+)\}/g,function(t,n){return e[n-0+1]!==void 0?e[n-0+1]:"{"+n+"}"})},j=function(t){var n,o=e.extend({},t);v.call(o.type+"Event",t,J),delete o.type,n=e.Event((t.target===u?"scesrc":"scewys")+t.type,o),s.trigger.apply(s,[n,J]),n.isDefaultPrevented()&&t.preventDefault(),n.isImmediatePropagationStopped()&&n.stopImmediatePropagation(),n.isPropagationStopped()&&n.stopPropagation()},J.bind=function(t,n,o,i){var r=t.length;for(t=t.split(" ");r--;)e.isFunction(n)&&(o||s.bind("scewys"+t[r],n),i||s.bind("scesrc"+t[r],n));return this},J.unbind=function(t,n,o,i){var r=t.length;for(t=t.split(" ");r--;)e.isFunction(n)&&(o||s.unbind("scewys"+t[r],n),i||s.unbind("scesrc"+t[r],n));return this},J.blur=function(t,n,o){return e.isFunction(t)?J.bind("blur",t,n,o):J.sourceMode()?d.blur():(g||(g=e('<input style="width:0;height:0;opacity:0;border:0;padding:0;filter:alpha(opacity=0)" type="text" />').appendTo(s)),g.removeAttr("disabled").show().focus().blur().hide().attr("disabled","disabled")),this},J.focus=function(t,n,o){return e.isFunction(t)?J.bind("focus",t,n,o):J.inSourceMode()?u.focus():(l.contentWindow.focus(),I().body.focus(),f&&(m.selectRange(f),f=null)),this},J.keyDown=function(e,t,n){return J.bind("keydown",e,t,n)},J.keyPress=function(e,t,n){return J.bind("keypress",e,t,n)},J.keyUp=function(e,t,n){return J.bind("keyup",e,t,n)},J.nodeChanged=function(e){return J.bind("nodechanged",e,!1,!0)},J.selectionChanged=function(e){return J.bind("selectionchanged",e,!1,!0)},G=function(t){var n=0,o=String.fromCharCode(t.which);return J.emoticonsCache||(J.emoticonsCache=[],e.each(e.extend({},J.opts.emoticons.more,J.opts.emoticons.dropdown,J.opts.emoticons.hidden),function(e,t){J.emoticonsCache[n++]=[e,i("emoticon",{key:e,url:t.url||t,tooltip:t.tooltip||e})]}),J.emoticonsCache.sort(function(e,t){return e[0].length-t[0].length})),J.longestEmoticonCode||(J.longestEmoticonCode=J.emoticonsCache[J.emoticonsCache.length-1][0].length),J.getRangeHelper().raplaceKeyword(J.emoticonsCache,!0,!0,J.longestEmoticonCode,J.opts.emoticonsCompat,o)?/^\s$/.test(o)&&J.opts.emoticonsCompat?!0:(t.preventDefault(),t.stopPropagation(),!1):void 0},J.emoticons=function(t){if(!t&&t!==!1)return J.opts.emoticonsEnabled;var n=e(I().body);return J.opts.emoticonsEnabled=t,t?(n.keypress(G),J.sourceMode()||(m.saveRange(),n.html(E(n.html())),m.restoreRange())):(n.find("img[data-sceditor-emoticon]").replaceWith(function(){return e(this).data("sceditor-emoticon")}),n.unbind("keypress",G)),this},C()},e.sceditor.ie=function(){var e,o=3,i=n.createElement("div"),r=i.getElementsByTagName("i");do i.innerHTML="<!--[if gt IE "+ ++o+"]><i></i><![endif]-->";while(r[0]);return n.all&&t.atob&&(o=10),o>4?o:e}(),e.sceditor.isWysiwygSupported=function(){var t,n=e('<div contenteditable="true">')[0].contentEditable,o=n!==void 0&&"inherit"!==n,i=navigator.userAgent;if(!o)return!1;var r=/Opera Mobi|Opera Mini/i.test(i);return/Android/i.test(i)&&(r=!0,/Safari/.test(i)&&(t=/Safari\/(\d+)/.exec(i),r=t&&t[1]?534>t[1]:!0)),/ Silk\//i.test(i)&&(t=/AppleWebKit\/(\d+)/.exec(i),r=t&&t[1]?534>t[1]:!0),/iPhone|iPod|iPad/i.test(i)&&(r=!/OS [5-9](_\d)+ like Mac OS X/i.test(i)),/fennec/i.test(i)&&(r=!1),!r}(),e.sceditor.regexEscape=function(e){return e.replace(/[\$\?\[\]\.\*\(\)\|\\]/g,"\\$&").replace("<","&lt;").replace(">","&gt;")},e.sceditor.escapeEntities=function(e){return e?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/ {2}/g," &nbsp;").replace(/\r\n|\r/g,"\n").replace(/\n/g,"<br />"):e},e.sceditor.locale={},e.sceditor.commands={bold:{exec:"bold",tooltip:"Bold"},italic:{exec:"italic",tooltip:"Italic"},underline:{exec:"underline",tooltip:"Underline"},strike:{exec:"strikethrough",tooltip:"Strikethrough"},subscript:{exec:"subscript",tooltip:"Subscript"},superscript:{exec:"superscript",tooltip:"Superscript"},left:{exec:"justifyleft",tooltip:"Align left"},center:{exec:"justifycenter",tooltip:"Center"},right:{exec:"justifyright",tooltip:"Align right"},justify:{exec:"justifyfull",tooltip:"Justify"},font:{_dropDown:function(t,n,o){for(var r=t.opts.fonts.split(","),s=e("<div />"),a=function(){return o(e(this).data("font")),t.closeDropDown(!0),!1},c=0;r.length>c;c++)s.append(i("fontOpt",{font:r[c]},!0).click(a));t.createDropDown(n,"font-picker",s)},exec:function(t){var n=this;e.sceditor.command.get("font")._dropDown(n,t,function(e){n.execCommand("fontname",e)})},tooltip:"Font Name"},size:{_dropDown:function(t,n,o){for(var r=e("<div />"),s=function(n){o(e(this).data("size")),t.closeDropDown(!0),n.preventDefault()},a=1;7>=a;a++)r.append(i("sizeOpt",{size:a},!0).click(s));t.createDropDown(n,"fontsize-picker",r)},exec:function(t){var n=this;e.sceditor.command.get("size")._dropDown(n,t,function(e){n.execCommand("fontsize",e)})},tooltip:"Font Size"},color:{_dropDown:function(t,n,o){var i,r,s,a,c={r:255,g:255,b:255},l=e("<div />"),d=t.opts.colors?t.opts.colors.split("|"):Array(21),u=[],p=e.sceditor.command.get("color");if(!p._htmlCache){for(i=0;d.length>i;++i){for(a=d[i]?d[i].split(","):Array(21),u.push('<div class="sceditor-color-column">'),r=0;a.length>r;++r)s=a[r]||"#"+c.r.toString(16)+c.g.toString(16)+c.b.toString(16),u.push('<a href="#" class="sceditor-color-option" style="background-color: '+s+'" data-color="'+s+'"></a>'),0===r%5?(c.g-=51,c.b=255):c.b-=51;u.push("</div>"),0===i%5?(c.r-=51,c.g=255,c.b=255):(c.g=255,c.b=255)}p._htmlCache=u.join("")}l.append(p._htmlCache).find("a").click(function(n){o(e(this).attr("data-color")),t.closeDropDown(!0),n.preventDefault()}),t.createDropDown(n,"color-picker",l)},exec:function(t){var n=this;e.sceditor.command.get("color")._dropDown(n,t,function(e){n.execCommand("forecolor",e)})},tooltip:"Font Color"},removeformat:{exec:"removeformat",tooltip:"Remove Formatting"},cut:{exec:"cut",tooltip:"Cut",errorMessage:"Your browser does not allow the cut command. Please use the keyboard shortcut Ctrl/Cmd-X"},copy:{exec:"copy",tooltip:"Copy",errorMessage:"Your browser does not allow the copy command. Please use the keyboard shortcut Ctrl/Cmd-C"},paste:{exec:"paste",tooltip:"Paste",errorMessage:"Your browser does not allow the paste command. Please use the keyboard shortcut Ctrl/Cmd-V"},pastetext:{exec:function(e){var t,n=this,o=i("pastetext",{label:n._("Paste your text inside the following box:"),insert:n._("Insert")},!0);o.find(".button").click(function(e){t=o.find("#txt").val(),t&&n.wysiwygEditorInsertText(t),n.closeDropDown(!0),e.preventDefault()}),n.createDropDown(e,"pastetext",o)},tooltip:"Paste Text"},bulletlist:{exec:"insertunorderedlist",tooltip:"Bullet list"},orderedlist:{exec:"insertorderedlist",tooltip:"Numbered list"},table:{exec:function(t){var n=this,o=i("table",{rows:n._("Rows:"),cols:n._("Cols:"),insert:n._("Insert")},!0);o.find(".button").click(function(t){var i=o.find("#rows").val()-0,r=o.find("#cols").val()-0,s="<table>";if(!(1>i||1>r)){for(var a=0;i>a;a++){s+="<tr>";for(var c=0;r>c;c++)s+="<td>"+(e.sceditor.ie?"":"<br />")+"</td>";s+="</tr>"}s+="</table>",n.wysiwygEditorInsertHtml(s),n.closeDropDown(!0),t.preventDefault()}}),n.createDropDown(t,"inserttable",o)},tooltip:"Insert a table"},horizontalrule:{exec:"inserthorizontalrule",tooltip:"Insert a horizontal rule"},code:{forceNewLineAfter:["code"],exec:function(){this.wysiwygEditorInsertHtml("<code>","<br /></code>")},tooltip:"Code"},image:{exec:function(e){var t=this,n=i("image",{url:t._("URL:"),width:t._("Width (optional):"),height:t._("Height (optional):"),insert:t._("Insert")},!0);n.find(".button").click(function(e){var o=n.find("#image").val(),i=n.find("#width").val(),r=n.find("#height").val(),s="";i&&(s+=' width="'+i+'"'),r&&(s+=' height="'+r+'"'),o&&"http://"!==o&&t.wysiwygEditorInsertHtml("<img"+s+' src="'+o+'" />'),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"insertimage",n)},tooltip:"Insert an image"},email:{exec:function(e){var t=this,n=i("email",{label:t._("E-mail:"),insert:t._("Insert")},!0);n.find(".button").click(function(e){var o=n.find("#email").val();o&&(t.focus(),t.getRangeHelper().selectedHtml()?t.execCommand("createlink","mailto:"+o):t.wysiwygEditorInsertHtml('<a href="mailto:'+o+'">'+o+"</a>")),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"insertemail",n)},tooltip:"Insert an email"},link:{exec:function(e){var t=this,n=i("link",{url:t._("URL:"),desc:t._("Description (optional):"),ins:t._("Insert")},!0);n.find(".button").click(function(e){var o=n.find("#link").val(),i=n.find("#des").val();o&&"http://"!==o&&(t.focus(),!t.getRangeHelper().selectedHtml()||i?(i||(i=o),t.wysiwygEditorInsertHtml('<a href="'+o+'">'+i+"</a>")):t.execCommand("createlink",o)),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"insertlink",n)},tooltip:"Insert a link"},unlink:{exec:"unlink",tooltip:"Unlink"},quote:{forceNewLineAfter:["blockquote"],exec:function(e,t,n){var o="<blockquote>",i="</blockquote>";t?(n=n?"<cite>"+n+"</cite>":"",o=o+n+t+i+"<br />",i=null):""===this.getRangeHelper().selectedHtml()&&(i="<br />"+i),this.wysiwygEditorInsertHtml(o,i)},tooltip:"Insert a Quote"},emoticon:{exec:function(t){var n,o=this,i=o.opts.emoticonsCompat?" ":"",r=e("<div />"),s=e("<div />");if(n=function(t,n){s.append(e("<img />").attr({src:e.isPlainObject(n)?n.url:n,alt:t,title:e.isPlainObject(n)?n.tooltip||t:t}).click(function(t){o.insert(e(this).attr("alt")+i),o.closeDropDown(!0),t.preventDefault()})),s.children().length>3&&(r.append(s),s=e("<div />"))},e.each(o.opts.emoticons.dropdown,n),s.children().length>0&&r.append(s),o.opts.emoticons.more){var a=e(this._('<a class="sceditor-more">{0}</a>',this._("More"))).click(function(){var i=e.extend({},o.opts.emoticons.dropdown,o.opts.emoticons.more);return r=e("<div />"),e.each(i,n),s.children().length>0&&r.append(s),o.createDropDown(t,"insertemoticon",r),!1});r.append(a)}o.createDropDown(t,"insertemoticon",r)},txtExec:function(t){e.sceditor.command.get("emoticon").exec.call(this,t)},tooltip:"Insert an emoticon"},youtube:{_dropDown:function(e,t,n){var o,r=i("youtubeMenu",{label:e._("Video URL:"),insert:e._("Insert")},!0);r.find(".button").click(function(t){var i=r.find("#link").val().replace("http://","");""!==i&&(o=i.match(/(?:v=|v\/|embed\/|youtu.be\/)(.{11})/),o&&(i=o[1]),/^[a-zA-Z0-9_\-]{11}$/.test(i)?n(i):alert("Invalid YouTube video")),e.closeDropDown(!0),t.preventDefault()}),e.createDropDown(t,"insertlink",r)},exec:function(t){var n=this;e.sceditor.command.get("youtube")._dropDown(n,t,function(e){n.wysiwygEditorInsertHtml(i("youtube",{id:e}))})},tooltip:"Insert a YouTube video"},date:{_date:function(e){var t=new Date,n=t.getYear(),o=t.getMonth()+1,i=t.getDate();return 2e3>n&&(n=1900+n),10>o&&(o="0"+o),10>i&&(i="0"+i),e.opts.dateFormat.replace(/year/i,n).replace(/month/i,o).replace(/day/i,i)},exec:function(){this.insertText(e.sceditor.command.get("date")._date(this))},txtExec:function(){this.insertText(e.sceditor.command.get("date")._date(this))},tooltip:"Insert current date"},time:{_time:function(){var e=new Date,t=e.getHours(),n=e.getMinutes(),o=e.getSeconds();return 10>t&&(t="0"+t),10>n&&(n="0"+n),10>o&&(o="0"+o),t+":"+n+":"+o},exec:function(){this.insertText(e.sceditor.command.get("time")._time())},txtExec:function(){this.insertText(e.sceditor.command.get("time")._time())},tooltip:"Insert current time"},ltr:{state:function(e,t){return t&&"ltr"===t.style.direction},exec:function(){var t=this,n=t.getRangeHelper().getFirstBlockParent(),o=e(n);t.focus(),(n&&!o.is("body")||(t.execCommand("formatBlock","p"),n=t.getRangeHelper().getFirstBlockParent(),o=e(n),n&&!o.is("body")))&&("ltr"===o.css("direction")?o.css("direction",""):o.css("direction","ltr"))},tooltip:"Left-to-Right"},rtl:{state:function(e,t){return t&&"rtl"===t.style.direction},exec:function(){var t=this,n=t.getRangeHelper().getFirstBlockParent(),o=e(n);t.focus(),(n&&!o.is("body")||(t.execCommand("formatBlock","p"),n=t.getRangeHelper().getFirstBlockParent(),o=e(n),n&&!o.is("body")))&&("rtl"===o.css("direction")?o.css("direction",""):o.css("direction","rtl"))},tooltip:"Right-to-Left"},print:{exec:"print",tooltip:"Print"},maximize:{state:function(){return this.maximize()},exec:function(){this.maximize(!this.maximize())},txtExec:function(){this.maximize(!this.maximize())},tooltip:"Maximize"},source:{exec:function(){this.toggleSourceMode(),this.blur()},txtExec:function(){this.toggleSourceMode(),this.blur()},tooltip:"View source"},ignore:{}},e.sceditor.rangeHelper=function(t,n){var o,i,r,s,a,c,l=!0,d="sceditor-start-marker",u="sceditor-end-marker",p="character",f=this;r=function(e,t){i=t||e.contentDocument||e.document,o=e,l=!!e.getSelection}(t,n),f.insertHTML=function(e,t){var n,o,r=f.selectedRange();if(t&&(e+=f.selectedHtml()+t),l){for(o=i.createElement("div"),n=i.createDocumentFragment(),o.innerHTML=e;o.firstChild;)n.appendChild(o.firstChild);f.insertNode(n)}else{if(!r)return!1;r.pasteHTML(e)}},f.insertNode=function(e,t){if(l){var n,o,r=i.createDocumentFragment(),s=f.selectedRange();if(!s)return!1;r.appendChild(e),t&&(r.appendChild(s.extractContents()),r.appendChild(t)),o=r.lastChild,s.deleteContents(),s.insertNode(r),n=i.createRange(),n.setStartAfter(o),f.selectRange(n)}else f.insertHTML(e.outerHTML,t?t.outerHTML:null)},f.cloneSelected=function(){var e=f.selectedRange();return e?l?e.cloneRange():e.duplicate():void 0},f.selectedRange=function(){var e,t,n=l?o.getSelection():i.selection;if(n&&(n.getRangeAt&&0>=n.rangeCount&&(e=i.createRange(),e.setStart(i.body,0),n.addRange(e)),e=l?n.getRangeAt(0):n.createRange(),!e.parentElement||!(t=e.parentElement())||t.ownerDocument===i))return e},f.selectedHtml=function(){var e,t=f.selectedRange();return t?!l&&""!==t.text&&t.htmlText?t.htmlText:l?(e=i.createElement("div"),e.appendChild(t.cloneContents()),e.innerHTML):"":""
+},f.parentNode=function(){var e=f.selectedRange();if(e){if(l)return e.commonAncestorContainer;if(e.parentElement)return e.parentElement()}},f.getFirstBlockParent=function(t){var n=function(t){if(!e.sceditor.dom.isInline(t))return t;var o=t?t.parentNode:null;return o?n(o):null};return n(t||f.parentNode())},f.insertNodeAt=function(e,t){var n=f.selectedRange(),o=f.cloneSelected();return o?(o.collapse(e),o.insertNode?o.insertNode(t):o.pasteHTML(t.outerHTML),f.selectRange(n),void 0):!1},s=function(e){f.removeMarker(e);var t=i.createElement("span");return t.id=e,t.style.lineHeight="0",t.style.display="none",t.className="sceditor-selection",t},f.insertMarkers=function(){f.insertNodeAt(!0,s(d)),f.insertNodeAt(!1,s(u))},f.getMarker=function(e){return i.getElementById(e)},f.removeMarker=function(e){var t=f.getMarker(e);t&&t.parentNode.removeChild(t)},f.removeMarkers=function(){f.removeMarker(d),f.removeMarker(u)},f.saveRange=function(){f.insertMarkers()},f.selectRange=function(e){l?(o.getSelection().removeAllRanges(),o.getSelection().addRange(e)):e.select()},f.restoreRange=function(){var e,t=f.selectedRange(),n=f.getMarker(d),o=f.getMarker(u);return n&&o&&t?(l?(t=i.createRange(),t.setStartBefore(n),t.setEndAfter(o),f.selectRange(t)):(t=i.body.createTextRange(),e=i.body.createTextRange(),e.moveToElementText(n),t.setEndPoint("StartToStart",e),t.moveStart(p,0),e.moveToElementText(o),t.setEndPoint("EndToStart",e),t.moveEnd(p,0),f.selectRange(t)),f.removeMarkers(),void 0):!1},c=function(e,t){var n=f.cloneSelected();return n?(n.collapse(!1),l?(n.setStart(n.startContainer,n.startOffset-e),n.setEnd(n.endContainer,n.endOffset+t)):(n.moveStart(p,0-e),n.moveEnd(p,t)),f.selectRange(n),void 0):!1},a=function(e,t){var n="",o=f.cloneSelected();return o?(o.collapse(!1),e?l?(n=o.startContainer.textContent.substr(0,o.startOffset),n=n.substr(Math.max(0,n.length-t))):(o.moveStart(p,0-t),n=o.text):l?n=o.startContainer.textContent.substr(o.startOffset,t):(o.moveEnd(p,t),n=o.text),n):""},f.raplaceKeyword=function(t,n,o,i,r,s){o||t.sort(function(e,t){return e.length-t.length});var d,u,p,h,m,g,v,b,y=i||t[t.length-1][0].length;if(d=u=p="",r){if(!l)return!1;++y}for(d=a(!0,y),n&&(u=a(!1,y)),p=d+(null!=s?s:"")+u,h=t.length;h--;)if(v=RegExp("(?:[\\s    ])"+e.sceditor.regexEscape(t[h][0])+"(?=[\\s    ])"),b=d.length-1-t[h][0].length,r&&--b,b=Math.max(0,b),!r&&(m=p.indexOf(t[h][0],b))>-1||r&&(m=p.substr(b).search(v))>-1){if(r&&(m+=b+1),m>d.length||m+t[h][0].length+(r?1:0)<d.length)continue;return g=d.length-m,c(g,t[h][0].length-g-(null!=s&&/^\S/.test(s)?1:0)),f.insertHTML(t[h][1]),!0}return!1},f.compare=function(e,t){return t||(t=f.selectedRange()),e&&t?l?0===e.compareBoundaryPoints(Range.END_TO_END,t)&&0===e.compareBoundaryPoints(Range.START_TO_START,t):0===e.compareEndPoints("EndToEnd",t)&&0===e.compareEndPoints("StartToStart",t):!e&&!t}},e.sceditor.dom={traverse:function(e,t,n,o,i){if(e)for(e=i?e.lastChild:e.firstChild;null!=e;){var r=i?e.previousSibling:e.nextSibling;if(!n&&t(e)===!1)return!1;if(!o&&this.traverse(e,t,n,o,i)===!1)return!1;if(n&&t(e)===!1)return!1;e=r}},rTraverse:function(e,t,n,o){this.traverse(e,t,n,o,!0)},blockLevelList:"|body|hr|p|div|h1|h2|h3|h4|h5|h6|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|blockquote|center|",isInline:function(t,n){return t&&1===t.nodeType?(t=t.tagName.toLowerCase(),"code"===t?!n:0>e.sceditor.dom.blockLevelList.indexOf("|"+t+"|")):!0},copyCSS:function(e,t){t.style.cssText=e.style.cssText+t.style.cssText},fixNesting:function(e){var t=this,n=function(e){for(;t.isInline(e.parentNode,!0);)e=e.parentNode;return e};t.traverse(e,function(e){if(1===e.nodeType&&!t.isInline(e,!0)&&t.isInline(e.parentNode,!0)){var o=n(e),i=o.parentNode,r=t.extractContents(o,e),s=e;t.copyCSS(o,s),i.insertBefore(r,o),i.insertBefore(s,o)}})},findCommonAncestor:function(t,n){return e(t).parents().has(e(n)).first()},removeWhiteSpace:function(t){var n,o=/[^\S|\u00A0]+/g;this.traverse(t,function(t){if(n=t.nodeValue,3===t.nodeType&&0===e(t).parents("code, pre").length&&n){if(t.previousSibling&&e.sceditor.dom.isInline(t.previousSibling)||(n=n.replace(/^[\r\n]+/,"")),t.nextSibling&&e.sceditor.dom.isInline(t.nextSibling)||(n=n.replace(/[\r\n]+$/,"")),n=n.replace(/[\r\n]+/," "),!n.length)return t.parentNode.removeChild(t),void 0;/\S|\u00A0/.test(n)?o.test(n)&&(n=n.replace(o," ")):n=" ",t.nodeValue=n}})},extractContents:function(e,t){var n=this,o=n.findCommonAncestor(e,t),i=o?o.get(0):null,r=!1,s=!1;return function a(o){var i=e.ownerDocument.createDocumentFragment();return n.traverse(o,function(n){if(s||n===t&&r)return s=!0,!1;n===e&&(r=!0);var o,c;r?jQuery.contains(n,t)&&1===n.nodeType?(o=a(n),c=n.cloneNode(!1),c.appendChild(o),i.appendChild(c)):i.appendChild(n):jQuery.contains(n,e)&&1===n.nodeType&&(o=a(n),c=n.cloneNode(!1),c.appendChild(o),i.appendChild(c))},!1),i}(i)}},e.sceditor.plugins={},e.sceditor.PluginManager=function(t){var n=this,o=[],i=t,r=function(e){return"signal"+e.charAt(0).toUpperCase()+e.slice(1)},s=function(e,t){e=[].slice.call(e);for(var n=o.length,s=r(e.shift());n--;)if(s in o[n]){if(t)return o[n][s].apply(i,e);o[n][s].apply(i,e)}};n.call=function(){s(arguments,!1)},n.callOnlyFirst=function(){return s(arguments,!0)},n.iter=function(e){return e=r(e),function(){var t=o.length;return{callNext:function(n){for(;t--;)if(o[t]&&e in o[t])return o[t].apply(i,n)},hasNext:function(){for(var n=t;n--;)if(o[n]&&e in o[n])return!0;return!1}}}()},n.hasHandler=function(e){var t=o.length;for(e=r(e);t--;)if(e in o[t])return!0;return!1},n.exsists=function(t){return t in e.sceditor.plugins?(t=e.sceditor.plugins[t],"function"==typeof t&&"object"==typeof t.prototype):!1},n.isRegistered=function(t){var i=o.length;if(!n.exsists(t))return!1;for(;i--;)if(o[i]instanceof e.sceditor.plugins[t])return!0;return!1},n.register=function(t){return n.exsists(t)?(t=new e.sceditor.plugins[t],o.push(t),"init"in t&&t.init.apply(i),!0):!1},n.deregister=function(t){var r,s=o.length,a=!1;if(!n.isRegistered(t))return!1;for(;s--;)o[s]instanceof e.sceditor.plugins[t]&&(r=o.splice(s,1)[0],a=!0,"destroy"in r&&r.destroy.apply(i));return a},n.destroy=function(){for(var e=o.length;e--;)"destroy"in o[e]&&o[e].destroy.apply(i);o=null,i=null}},e.sceditor.command={get:function(t){return e.sceditor.commands[t]||null},set:function(t,n){return t&&n?(n=e.extend(e.sceditor.commands[t]||{},n),n.remove=function(){e.sceditor.command.remove(t)},e.sceditor.commands[t]=n,this):!1},remove:function(t){return e.sceditor.commands[t]&&delete e.sceditor.commands[t],this}},e.sceditor.defaultOptions={toolbar:"bold,italic,underline,strike,subscript,superscript|left,center,right,justify|font,size,color,removeformat|cut,copy,paste,pastetext|bulletlist,orderedlist|table|code,quote|horizontalrule,image,email,link,unlink|emoticon,youtube,date,time|ltr,rtl|print,maximize,source",style:"jquery.sceditor.default.css",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Georgia,Impact,Sans-serif,Serif,Times New Roman,Trebuchet MS,Verdana",colors:null,locale:"en",charset:"utf-8",emoticonsCompat:!1,emoticonsEnabled:!0,emoticonsRoot:"",emoticons:{dropdown:{":)":"emoticons/smile.png",":angel:":"emoticons/angel.png",":angry:":"emoticons/angry.png","8-)":"emoticons/cool.png",":'(":"emoticons/cwy.png",":ermm:":"emoticons/ermm.png",":D":"emoticons/grin.png","<3":"emoticons/heart.png",":(":"emoticons/sad.png",":O":"emoticons/shocked.png",":P":"emoticons/tongue.png",";)":"emoticons/wink.png"},more:{":alien:":"emoticons/alien.png",":blink:":"emoticons/blink.png",":blush:":"emoticons/blush.png",":cheerful:":"emoticons/cheerful.png",":devil:":"emoticons/devil.png",":dizzy:":"emoticons/dizzy.png",":getlost:":"emoticons/getlost.png",":happy:":"emoticons/happy.png",":kissing:":"emoticons/kissing.png",":ninja:":"emoticons/ninja.png",":pinch:":"emoticons/pinch.png",":pouty:":"emoticons/pouty.png",":sick:":"emoticons/sick.png",":sideways:":"emoticons/sideways.png",":silly:":"emoticons/silly.png",":sleeping:":"emoticons/sleeping.png",":unsure:":"emoticons/unsure.png",":woot:":"emoticons/w00t.png",":wassat:":"emoticons/wassat.png"},hidden:{":whistling:":"emoticons/whistling.png",":love:":"emoticons/wub.png"}},width:null,height:null,resizeEnabled:!0,resizeMinWidth:null,resizeMinHeight:null,resizeMaxHeight:null,resizeMaxWidth:null,resizeHeight:!0,resizeWidth:!0,getHtmlHandler:null,getTextHandler:null,dateFormat:"year-month-day",toolbarContainer:null,enablePasteFiltering:!1,disablePasting:!1,readOnly:!1,rtl:!1,autofocus:!1,autofocusEnd:!0,autoExpand:!1,autoUpdate:!1,runWithoutWysiwygSupport:!1,id:null,plugins:"",zIndex:null,parserOptions:{},dropDownCss:{}},e.fn.sceditor=function(t){var n,o=[];return t=t||{},t.runWithoutWysiwygSupport||e.sceditor.isWysiwygSupported?(this.each(function(){n=this.jquery?this:e(this),n.parents(".sceditor-container").length>0||("state"===t?o.push(!!n.data("sceditor")):"instance"===t?o.push(n.data("sceditor")):n.data("sceditor")||new e.sceditor(this,t))}),o.length?1===o.length?o[0]:e(o):this):void 0}})(jQuery,window,document),/*!pl SCEditor | (C) 2011-2013, Sam Clarke | sceditor.com/license */
+function(e){"use strict";e.sceditor.XHTMLSerializer=function(){var t,n,o,i,r,s,a,c,l,d,u,p=this,f={indentStr:" "},h=[],m=0;t=function(e){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};return e?e.replace(/[&<>"]/g,function(e){return t[e]||e}):""},n=function(e){return e.replace(/[\r\n]/,"").replace(/[^\S|\u00A0]+/g," ")},p.serialize=function(e,t){if(h=[],t)for(e=e.firstChild;e;)o(e),e=e.nextSibling;else o(e);return h.join("")},o=function(e){switch(e.nodeType){case 1:var t=e.nodeName.toLowerCase();"!"===t&&a(e),r(e);break;case 3:c(e);break;case 4:s(e);break;case 8:a(e);break;case 9:case 11:i(e);break;case 2:case 5:case 6:case 7:case 10:case 12:}},i=function(e){var t;for(t=e.firstChild;t;)o(t),t=t.nextSibling},r=function(e){var n,i,r=e.nodeName.toLowerCase(),s=e.attributes.length,a=!e.firstChild&&/^(?:area|base|br|col|embed|hr|img|input|link|meta|param)$/.test(r);for(d(e)&&l(),h.push("<"+r);s--;)i=e.attributes[s],h.push(" ",i.name.toLowerCase(),'="',t(i.value),'"');for(h.push(a?" />":">"),m++,n=e.firstChild;n;)o(n),n=n.nextSibling;m--,a||(d(e)&&e.firstChild&&l(),h.push("</",r,">"))},s=function(e){l(),h.push("<![CDATA[",t(e.nodeValue),"]]>")},a=function(e){l(),h.push("<!-- ",t(e.nodeValue)," -->")},c=function(e){var o=n(e.nodeValue);o&&(d(e)&&l(),h.push(t(o)))},l=function(){var e=m;for(u();e--;)h.push(f.indentStr)},d=function(t){if(1!==t.nodeType){if(t.previousSibling&&e.sceditor.dom.isInline(t.previousSibling))return!1;t=t.parentNode}return t.previousSibling||e.sceditor.dom.isInline(t.parentNode)?!e.sceditor.dom.isInline(t):!0},u=function(){h.length&&h.push("\n")}},e.sceditor.plugins.xhtml=function(){var t,n,o,i,r,s,a=this,c={},l={};a.init=function(){e.isEmptyObject(e.sceditor.plugins.xhtml.converters||{})||e.each(e.sceditor.plugins.xhtml.converters,function(t,n){e.each(n.tags,function(e){c[e]||(c[e]=[]),c[e].push(n)})}),t(this)},t=function(t){var n={bold:{txtExec:["<strong>","</strong>"]},italic:{txtExec:["<em>","</em>"]},underline:{txtExec:['<span style="text-decoration: underline;">',"<span>"]},strike:{txtExec:['<span style="text-decoration: line-through;">',"<span>"]},subscript:{txtExec:["<sub>","</sub>"]},superscript:{txtExec:["<sup>","</sup>"]},left:{txtExec:['<div style="text-align: left;">',"<div>"]},center:{txtExec:['<div style="text-align: center;">',"<div>"]},right:{txtExec:['<div style="text-align: right;">',"<div>"]},justify:{txtExec:['<div style="text-align: justify;">',"<div>"]},font:{txtExec:function(t){var n=this;e.sceditor.command.get("font")._dropDown(n,t,function(e){n.insertText('<span style="font-family: '+e+';">',"</span>")})}},size:{txtExec:function(t){var n=this;e.sceditor.command.get("size")._dropDown(n,t,function(e){n.insertText('<span style="font-size: '+e+';">',"</span>")})}},color:{txtExec:function(t){var n=this;e.sceditor.command.get("color")._dropDown(n,t,function(e){n.insertText('<span style="color: '+e+';">',"</span>")})}},bulletlist:{txtExec:["<ul><li>","</li></ul>"]},orderedlist:{txtExec:["<ol><li>","</li></ol>"]},table:{txtExec:["<table><tr><td>","</td></tr></table>"]},horizontalrule:{txtExec:["<hr />"]},code:{txtExec:["<code>","</code>"]},image:{txtExec:function(e,t){var n=prompt(this._("Enter the image URL:"),t);n&&this.insertText('<img src="'+n+'" />')}},email:{txtExec:function(e,t){var n=t&&t.indexOf("@")>-1?null:t,o=prompt(this._("Enter the e-mail address:"),n?"":t),i=prompt(this._("Enter the displayed text:"),n||o)||o;o&&this.insertText('<a href="mailto:'+o+'">'+i+"</a>")}},link:{txtExec:function(e,t){var n=t&&t.indexOf("http://")>-1?null:t,o=prompt(this._("Enter URL:"),n?"http://":t),i=prompt(this._("Enter the displayed text:"),n||o)||o;o&&this.insertText('<a href="'+o+'">'+i+"</a>")}},quote:{txtExec:["<blockquote>","</blockquote>"]},youtube:{txtExec:function(t){var n=this;e.sceditor.command.get("youtube")._dropDown(n,t,function(e){n.insertText('<iframe width="560" height="315" src="http://www.youtube.com/embed/{id}?wmode=opaque" data-youtube-id="'+e+'" frameborder="0" allowfullscreen></iframe>')})}},rtl:{txtExec:['<div stlye="direction: rtl;">',"</div>"]},ltr:{txtExec:['<div stlye="direction: ltr;">',"</div>"]}};t.commands=e.extend(!0,{},n,t.commands)},a.signalToSource=function(t,o){return o=o.jquery?o[0]:o,e(o).find(".sceditor-selection").remove(),n(o),i(o),s(o),(new e.sceditor.XHTMLSerializer).serialize(o,!0)},a.signalToWysiwyg=function(e){return e},a.convertTagTo=function(e,t){for(var n,o,i=e.attributes.length,r=e.ownerDocument.createElement(t);i--;)o=e.attributes[i],r.setAttribute(o.name,o.value);for(;n=e.firstChild;)r.appendChild(n);return e.parentNode.replaceChild(r,e),r},o=function(t,n){c[t]&&e.each(c[t],function(o,i){i.tags[t]?e.each(i.tags[t],function(t,o){void 0!==n.attr(t)&&(o&&0>e.inArray(n.attr(t),o)||i.conv.call(a,n[0]))}):i.conv&&i.conv.call(a,n[0])})},n=function(t){c&&e.sceditor.dom.traverse(t,function(t){var n=e(t),i=t.nodeName.toLowerCase();c&&(o("*",n),o(i,n))},!0)},i=function(t){e.sceditor.dom.traverse(t,function(t){var n=t.nodeName.toLowerCase(),o=e.sceditor.plugins.xhtml.allowedTags,i=e.sceditor.plugins.xhtml.disallowedTags;4===t.nodeType?n="!cdata":("!"===n||8===t.nodeType)&&(n="!comment"),o&&o.length&&3!==t.nodeType?0>e.inArray(n,o)&&t.parentNode&&t.parentNode.removeChild(t):i&&i.length&&3!==t.nodeType&&e.inArray(n,i)>-1&&t.parentNode&&t.parentNode.removeChild(t)})},r=function(t,n){var o={};return t&&e.extend(o,t),n?(e.each(n,function(t,n){e.isArray(o[t])?e.isArray(n)&&(o[t]=e.merge(o[t],n)):o[t]=n}),o):o},s=function(t){l={},e.sceditor.dom.traverse(t,function(t){if(t.attributes){var n,o,i=t.nodeName.toLowerCase(),s=e.sceditor.plugins.xhtml.allowedAttribs,a=e.sceditor.plugins.xhtml.disallowedAttribs,c=t.attributes.length;if(s&&!e.isEmptyObject(s)&&c)for(l[i]||(l[i]=r(s["*"],s[i]));c--;)n=t.attributes[c],o=l[i][n.name]===void 0,e.isArray(l[i][n.name])&&0>e.inArray(n.value,l[i][n.name])&&(o=!0),o&&t.removeAttribute(n.name);else if(a&&!e.isEmptyObject(a)&&c)for(l[i]||(l[i]=r(a["*"],a[i]));c--;)n=t.attributes[c],o=l[i][n.name]!==void 0,e.isArray(l[i][n.name])&&e.inArray(n.value,l[i][n.name])>-1&&(o=!0),o&&t.removeAttribute(n.name)}})}},e.sceditor.plugins.xhtml.converters=[{tags:{"*":{width:null}},conv:function(t){var n=e(t);n.css("width",n.attr("width")).removeAttr("width")}},{tags:{"*":{height:null}},conv:function(t){var n=e(t);n.css("height",n.attr("height")).removeAttr("height")}},{tags:{li:{value:null}},conv:function(t){e(t).removeAttr("value")}},{tags:{"*":{text:null}},conv:function(t){var n=e(t);n.css("color",n.attr("text")).removeAttr("text")}},{tags:{"*":{size:null}},conv:function(t){var n=e(t);n.css("font-size",n.css("font-size")).removeAttr("size")}},{tags:{"*":{color:null}},conv:function(t){var n=e(t);n.css("color",n.attr("color")).removeAttr("color")}},{tags:{"*":{face:null}},conv:function(t){var n=e(t);n.css("font-family",n.attr("face")).removeAttr("face")}},{tags:{"*":{language:null}},conv:function(t){var n=e(t),o=n.attr("language");/jscript|javascript|js/i.test(o)?n.attr("type","text/javascript"):/vb/i.test(o)&&n.attr("type","text/vbscript"),n.removeAttr("language")}},{tags:{"*":{align:null}},conv:function(t){var n=e(t);n.css("text-align",n.attr("align")).removeAttr("align")}},{tags:{"*":{border:null}},conv:function(t){var n=e(t);n.css("border-size",n.attr("border")).removeAttr("border")}},{tags:{applet:{name:null},img:{name:null},layer:{name:null},map:{name:null},object:{name:null},param:{name:null}},conv:function(t){e(t).removeAttr("name")}},{tags:{hr:{noshade:null}},conv:function(t){var n=e(t);n.css("border-style","solid").removeAttr("noshade")}},{tags:{"*":{nowrap:null}},conv:function(t){var n=e(t);n.css("white-space","nowrap").removeAttr("nowrap")}},{tags:{big:null},conv:function(t){e(this.convertTagTo(t,"span")).css("font-size","larger")}},{tags:{small:null},conv:function(t){e(this.convertTagTo(t,"span")).css("font-size","smaller")}},{tags:{b:null},conv:function(t){e(this.convertTagTo(t,"strong"))}},{tags:{u:null},conv:function(t){e(this.convertTagTo(t,"span")).css("text-decoration","underline")}},{tags:{i:null},conv:function(t){e(this.convertTagTo(t,"em"))}},{tags:{s:null,strike:null},conv:function(t){e(this.convertTagTo(t,"span")).css("text-decoration","line-through")}},{tags:{dir:null},conv:function(e){this.convertTagTo(e,"ul")}},{tags:{center:null},conv:function(t){e(this.convertTagTo(t,"div")).css("text-align","center")}},{tags:{font:null},conv:function(e){this.convertTagTo(e,"span")}}],e.sceditor.plugins.xhtml.allowedAttribs={},e.sceditor.plugins.xhtml.disallowedAttribs={},e.sceditor.plugins.xhtml.allowedTags=[],e.sceditor.plugins.xhtml.disallowedTags=[]}(jQuery);
3  minified/plugins/bbcode.js
View
@@ -1 +1,2 @@
-(function(a,b,c){"use strict",a.sceditor.BBCodeParser=function(b){if(!(this instanceof a.sceditor.BBCodeParser))return new a.sceditor.BBCodeParser(b);var d=this,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t={open:"open",content:"content",newline:"newline",close:"close"};Object.freeze&&Object.freeze(t);var u=function(a,b,c,d,e,f){var g=this;g.type=a,g.name=b,g.val=c,g.attrs=d||{},g.children=e||[],g.closing=f||null};u.prototype={clone:function(a){var b=this;return new u(b.type,b.name,b.val,b.attrs,a?b.children:[],b.closing?b.closing.clone():null)},splitAt:function(b){var c,d=this,e=0,f=d.children.length;typeof object!="number"&&(b=a.inArray(b,d.children));if(b<0||b>f)return null;while(f--)f>=b?e++:f=0;return c=d.clone(),c.children=d.children.splice(b,e),c}},e=function(){d.opts=a.extend({},a.sceditor.BBCodeParser.defaults,b),d.bbcodes=a.sceditor.plugins.bbcode.bbcodes},d.tokenize=function(a){var b,c,d,e=[],g=[{type:"close",regex:/^\[\/[^\[\]]+\]/},{type:"open",regex:/^\[[^\[\]]+\]/},{type:"newline",regex:/^(\r\n|\r|\n)/},{type:"content",regex:/^([^\[\r\n]+|\[)/}];g.reverse();a:while(a.length){d=g.length;while(d--){c=g[d].type;if(!(b=a.match(g[d].regex))||!b[0])continue;e.push(f(c,b[0])),a=a.substr(b[0].length);continue a}a.length&&e.push(f(t.content,a)),a=""}return e},f=function(b,c){var d,e,f;b==="open"&&(d=c.match(/\[([^\]\s=]+)(?:([^\]]+))?\]/))?(f=r(d[1]),d[2]&&(d[2]=a.trim(d[2]))&&(e=g(d[2]))):b==="close"&&(d=c.match(/\[\/([^\[\]]+)\]/))?f=r(d[1]):b==="newline"&&(f="#newline");if(!f||(b==="open"||b==="close")&&!a.sceditor.plugins.bbcode.bbcodes[f])b="content",f="#";return new u(b,f,c,e)},g=function(b){var c,d=/([^\s=]+)=(?:(?:(["'])((?:\\\2|[^\2])*?)\2)|((?:.(?!\s\S+=))*.))/g,e=a.sceditor.plugins.bbcode.stripQuotes,f={};if(b.charAt(0)==="="&&b.indexOf("=",1)<0)f.defaultattr=e(b.substr(1));else{b.charAt(0)==="="&&(b="defaultattr"+b);while(c=d.exec(b))f[r(c[1])]=e(c[3])||c[4]}return f},d.parse=function(a,b){var c=h(d.tokenize(a));return d.opts.fixInvalidChildren&&m(c),d.opts.removeEmptyTags&&l(c),d.opts.fixInvalidNesting&&j(c),i(c,null,b),d.opts.removeEmptyTags&&l(c),c},p=function(a,b,c){var d=c.length;while(d--)if(c[d].type===b&&c[d].name===a)return!0;return!1},k=function(b,c){var e=b?d.bbcodes[b.name]:null,f=e?e.allowedChildren:null;return!d.opts.fixInvalidChildren||!f?!0:f&&a.inArray(c.name||"#",f)<0?!1:!0},h=function(b){var c,e,f,g,h,i,j,k=[],l=[],m=[],n=function(){return s(m)},o=function(a){n()?n().children.push(a):l.push(a)},q=function(b){return n()&&(e=d.bbcodes[n().name])&&e.closedBy&&a.inArray(b,e.closedBy)>-1};while(c=b.shift()){j=b[0];switch(c.type){case t.open:q(c.name)&&m.pop(),o(c),e=d.bbcodes[c.name],(!e||!e.isSelfClosing)&&(e||p(c.name,t.close,b))&&m.push(c);break;case t.close:n()&&c.name!==n().name&&q("/"+c.name)&&m.pop();if(n()&&c.name===n().name)n().closing=c,m.pop();else if(p(c.name,t.open,m)){while(f=m.pop()){if(f.name===c.name){f.closing=c;break}g=f.clone(),k.length>1&&g.children.push(s(k)),k.push(g)}o(s(k)),h=k.length;while(h--)m.push(k[h]);k.length=0}else c.type=t.content,o(c);break;case t.newline:n()&&j&&q((j.type===t.close?"/":"")+j.name)&&(j.type!==t.close||j.name!==n().name)&&(e=d.bbcodes[n().name],e&&e.breakAfter?m.pop():e&&e.isInline===!1&&d.opts.breakAfterBlock&&e.breakAfter!==!1&&m.pop()),o(c);break;default:o(c)}i=c}return l},i=function(a,b,c){var e,f,g,h,j,k,l,m,n=a.length,o=n;b&&(h=d.bbcodes[b.name]);while(o--){if(!(e=a[o]))continue;if(e.type===t.newline){f=o>0?a[o-1]:null,g=o<n-1?a[o+1]:null,m=!1,!c&&h&&h.isSelfClosing!==!0&&(f?!k&&!g&&(h.isInline===!1&&d.opts.breakEndBlock&&h.breakEnd!==!1&&(m=!0),h.breakEnd&&(m=!0),k=m):(h.isInline===!1&&d.opts.breakStartBlock&&h.breakStart!==!1&&(m=!0),h.breakStart&&(m=!0))),f&&f.type===t.open&&(j=d.bbcodes[f.name])&&(c?j.isInline===!1&&(m=!0):(j.isInline===!1&&d.opts.breakAfterBlock&&j.breakAfter!==!1&&(m=!0),j.breakAfter&&(m=!0)));if(!c&&!l&&g&&g.type===t.open)if(j=d.bbcodes[g.name]){j.isInline===!1&&d.opts.breakBeforeBlock&&j.breakBefore!==!1&&(m=!0),j.breakBefore&&(m=!0),l=m;if(m){a.splice(o,1);continue}}m&&a.splice(o,1),l=!1}else e.type===t.open&&i(e.children,e,c)}},j=function(b,c,e,f){var g,h,i,k,l,m,n=function(a){var b=d.bbcodes[a.name];return!b||b.isInline!==!1};c=c||[],f=f||b;for(h=0;h<b.length;h++){if(!(g=b[h])||g.type!==t.open)continue;if(!n(g)&&e){i=s(c),m=i.splitAt(g),l=c.length>1?c[c.length-2].children:f;if((k=a.inArray(i,l))>-1){m.children.splice(a.inArray(g,m.children),1),l.splice(k+1,0,g,m);return}}c.push(g),j(g.children,c,e||n(g),f),c.pop(g)}},m=function(a,b){var c,d,e=a.length;while(e--){if(!(c=a[e]))continue;k(b,c)||(c.name=null,c.type=t.content,k(b,c)?(d=[e+1,0].concat(c.children),c.closing&&(c.closing.name=null,c.closing.type=t.content,d.push(c.closing)),e+=d.length-1,Array.prototype.splice.apply(a,d)):b.children.splice(e,1)),c.type===t.open&&m(c.children,c)}},l=function(a){var b,c,e,f=a.length;e=function(a){var b=a.length;while(b--){if(a[b].type===t.open)return!1;if(a[b].type===t.close)return!1;if(a[b].type===t.content&&a[b].val&&/\S|\u00A0/.test(a[b].val))return!1}return!0};while(f--){if(!(b=a[f])||b.type!==t.open)continue;c=d.bbcodes[b.name],l(b.children),e(b.children)&&c&&!c.isSelfClosing&&!c.allowsEmpty&&a.splice(f,1)}},d.toHTML=function(a,b){return n(d.parse(a,b),!0)},n=function(b,e){var f,g,h,i,j,k,l,m,o=[];l=function(a){return(!a||(typeof a.isHtmlInline!="undefined"?a.isHtmlInline:a.isInline))!==!1};while(b.length>0){if(!(f=b.shift()))continue;if(f.type===t.open)m=f.children[f.children.length-1]||{},g=d.bbcodes[f.name],j=e&&l(g),h=n(f.children,!1),g&&g.html?(!l(g)&&l(d.bbcodes[m.name])&&!g.isPreFormatted&&!g.skipLastLineBreak&&(a.sceditor.ie||(h+="<br />")),a.isFunction(g.html)?i=g.html.call(d,f,f.attrs,h):i=a.sceditor.plugins.bbcode.formatString(g.html,h)):i=f.val+h+(f.closing?f.closing.val:"");else{if(f.type===t.newline){if(!e){o.push("<br />");continue}if(k){o.push("</div>\n"),k=!1;continue}o.push("<div>"),a.sceditor.ie||o.push("<br />"),(c.documentMode&&c.documentMode<8||a.sceditor.ie<8)&&o.push(" "),o.push("</div>\n");continue}j=e,i=a.sceditor.escapeEntities(f.val)}j&&!k?(o.push("<div>"),k=!0):!j&&k&&(o.push("</div>\n"),k=!1),o.push(i)}return k&&o.push("</div>\n"),o.join("")},d.toBBCode=function(a,b){return o(d.parse(a,b))},o=function(b){var c,e,f,g,h,i,j,k,l,m,n=[];while(b.length>0){if(!(c=b.shift()))continue;f=d.bbcodes[c.name],g=!!f&&f.isInline===!1,h=f&&f.isSelfClosing,j=g&&d.opts.breakBeforeBlock&&f.breakBefore!==!1||f&&f.breakBefore,k=g&&!h&&d.opts.breakStartBlock&&f.breakStart!==!1||f&&f.breakStart,l=g&&d.opts.breakEndBlock&&f.breakEnd!==!1||f&&f.breakEnd,m=g&&d.opts.breakAfterBlock&&f.breakAfter!==!1||f&&f.breakAfter,i=(f?f.quoteType:null)||d.opts.quoteType||a.sceditor.BBCodeParser.QuoteType.auto;if(!f&&c.type===t.open)n.push(c.val),c.children&&n.push(o(c.children)),c.closing&&n.push(c.closing.val);else if(c.type===t.open){j&&n.push("\n"),n.push("["+c.name);if(c.attrs){c.attrs.defaultattr&&(n.push("="+q(c.attrs.defaultattr,i,"defaultattr")),delete c.attrs.defaultattr);for(e in c.attrs)c.attrs.hasOwnProperty(e)&&n.push(" "+e+"="+q(c.attrs[e],i,e))}n.push("]"),k&&n.push("\n"),c.children&&n.push(o(c.children)),!h&&!f.excludeClosing&&(l&&n.push("\n"),n.push("[/"+c.name+"]")),m&&n.push("\n"),c.closing&&h&&n.push(c.closing.val)}else n.push(c.val)}return n.join("")},q=function(b,c,d){var e=a.sceditor.BBCodeParser.QuoteType,f=/\s|=/.test(b);return a.isFunction(c)?c(b,d):c===e.never||c===e.auto&&!f?b:'"'+b.replace("\\","\\\\").replace('"','\\"')+'"'},s=function(a){return a.length?a[a.length-1]:null},r=function(a){return a.toLowerCase()},e()},a.sceditor.BBCodeParser.QuoteType={always:1,never:2,auto:3},Object.freeze&&Object.freeze(a.sceditor.BBCodeParser.QuoteType),a.sceditor.BBCodeParser.defaults={breakBeforeBlock:!1,breakStartBlock:!1,breakEndBlock:!1,breakAfterBlock:!0,removeEmptyTags:!0,fixInvalidNesting:!0,fixInvalidChildren:!0,quoteType:a.sceditor.BBCodeParser.QuoteType.auto},a.sceditorBBCodePlugin=a.sceditor.plugins.bbcode=function(){var b=this,d,e,f,g,h,i,j;g=a.sceditor.plugins.bbcode.formatString,b.bbcodes=a.sceditor.plugins.bbcode.bbcodes,b.stripQuotes=a.sceditor.plugins.bbcode.stripQuotes;var k={},l={},m={ul:["li","ol","ul"],ol:["li","ol","ul"],table:["tr"],tr:["td","th"],code:["br","p","div"]},n={};b.init=function(){b.opts=this.opts,d(),i(this)},i=function(b){var c={bold:{txtExec:["[b]","[/b]"]},italic:{txtExec:["[i]","[/i]"]},underline:{txtExec:["[u]","[/u]"]},strike:{txtExec:["[s]","[/s]"]},subscript:{txtExec:["[sub]","[/sub]"]},superscript:{txtExec:["[sup]","[/sup]"]},left:{txtExec:["[left]","[/left]"]},center:{txtExec:["[center]","[/center]"]},right:{txtExec:["[right]","[/right]"]},justify:{txtExec:["[justify]","[/justify]"]},font:{txtExec:function(b){var c=this;a.sceditor.command.get("font")._dropDown(c,b,function(a){c.insertText("[font="+a+"]","[/font]")})}},size:{txtExec:function(b){var c=this;a.sceditor.command.get("size")._dropDown(c,b,function(a){c.insertText("[size="+a+"]","[/size]")})}},color:{txtExec:function(b){var c=this;a.sceditor.command.get("color")._dropDown(c,b,function(a){c.insertText("[color="+a+"]","[/color]")})}},bulletlist:{txtExec:["[ul][li]","[/li][/ul]"]},orderedlist:{txtExec:["[ol][li]","[/li][/ol]"]},table:{txtExec:["[table][tr][td]","[/td][/tr][/table]"]},horizontalrule:{txtExec:["[hr]"]},code:{txtExec:["[code]","[/code]"]},image:{txtExec:function(a,b){var c=prompt(this._("Enter the image URL:"),b);c&&this.insertText("[img]"+c+"[/img]")}},email:{txtExec:function(a,b){var c=b&&b.indexOf("@")>-1?null:b,d=prompt(this._("Enter the e-mail address:"),c?"":b),e=prompt(this._("Enter the displayed text:"),c||d)||d;d&&this.insertText("[email="+d+"]"+e+"[/email]")}},link:{txtExec:function(a,b){var c=b&&b.indexOf("http://")>-1?null:b,d=prompt(this._("Enter URL:"),c?"http://":b),e=prompt(this._("Enter the displayed text:"),c||d)||d;d&&this.insertText("[url="+d+"]"+e+"[/url]")}},quote:{txtExec:["[quote]","[/quote]"]},youtube:{txtExec:function(b){var c=this;a.sceditor.command.get("youtube")._dropDown(c,b,function(a){c.insertText("[youtube]"+a+"[/youtube]")})}},rtl:{txtExec:["[rtl]","[/rtl]"]},ltr:{txtExec:["[ltr]","[/ltr]"]}};b.commands=a.extend(!0,{},c,b.commands)},d=function(){a.each(b.bbcodes,function(c){b.bbcodes[c].tags&&a.each(b.bbcodes[c].tags,function(a,d){var e=b.bbcodes[c].isInline===!1;k[a]=k[a]||{},k[a][e]=k[a][e]||{},k[a][e][c]=d}),b.bbcodes[c].styles&&a.each(b.bbcodes[c].styles,function(a,d){var e=b.bbcodes[c].isInline===!1;l[e]=l[e]||{},l[e][a]=l[e][a]||{},l[e][a][c]=d})})},h=function(b,c){var d,e,f,g,h,i=b.style;return i?(n[c]||(n[c]=a.camelCase(c)),h=n[c],"text-align"===c?(d=a(b),f=i.direction,g=i[h]||d.css(c),d.parent().css(c)!==g&&d.css("display")==="block"&&!d.is("hr")&&!d.is("th")&&(e=g),f&&e&&(/right/i.test(e)&&f==="rtl"||/left/i.test(e)&&f==="ltr")?null:e):i[h]):null},e=function(c,d,e){var f;return e=!!e,l[e]?(a.each(l[e],function(e,i){f=h(c[0],e);if(!f||h(c.parent()[0],e)===f)return;a.each(i,function(e,h){if(!h||a.inArray(f.toString(),h)>-1)a.isFunction(b.bbcodes[e].format)?d=b.bbcodes[e].format.call(b,c,d):d=g(b.bbcodes[e].format,d)})}),d):d},f=function(c,d,e){var f=c[0].nodeName.toLowerCase();e=!!e,k[f]&&k[f][e]&&a.each(k[f][e],function(e,f){if(f){var h=!1;a.each(f,function(b,d){if(!c.attr(b)||d&&a.inArray(c.attr(b),d)<0)return;return h=!0,!1});if(!h)return}a.isFunction(b.bbcodes[e].format)?d=b.bbcodes[e].format.call(b,c,d):d=g(b.bbcodes[e].format,d)});if(e&&(!a.sceditor.dom.isInline(c[0],!0)||f==="br")){var h=c[0].parentNode,i=c[0].previousSibling,j=a.sceditor.dom.isInline(h,!0)||h.nodeName.toLowerCase()==="body";if(j||f==="li"||h.lastChild!==c[0]||f==="br"&&a.sceditor.ie)d+="\n";"br"!==f&&!j&&i&&i.nodeType===3&&(d="\n"+d)}return d},b.signalToSource=function(c,d){var e=new a.sceditor.BBCodeParser(b.opts.parserOptions);return a.sceditor.dom.removeWhiteSpace(d[0]),a.trim(e.toBBCode(b.elementToBbcode(d),!0))},b.elementToBbcode=function(b){return function c(b,d){var g="";return a.sceditor.dom.traverse(b,function(b){var h=a(b),i="",j=b.nodeType,k=b.nodeName.toLowerCase(),l=m[k],n=!0;typeof d=="object"&&(n=a.inArray(k,d)>-1,n||(l=d));if(j!==3&&j!==1)return;if(j===1){if(h.hasClass("sceditor-ignore"))return;k!=="iframe"&&(i=c(b,l)),n?(k!=="code"&&(i=e(h,i),i=f(h,i),i=e(h,i,!0)),g+=f(h,i,!0)):g+=i}else b.wholeText&&(!b.previousSibling||b.previousSibling.nodeType!==3)?h.parents("code").length===0?g+=b.wholeText.replace(/ +/g," "):g+=b.wholeText:b.wholeText||(g+=b.nodeValue)},!1,!0),g}(b.get(0))},b.signalToWysiwyg=function(c,d){var e=new a.sceditor.BBCodeParser(b.opts.parserOptions),f=e.toHTML(c);return d?j(f):f},j=function(b){var d,e,f,g=a("<div />").hide().appendTo(c.body),h=g[0];return f=function(b){while(e=b.firstChild)h.insertBefore(e,b);a.sceditor.ie>=9&&h.insertBefore(c.createElement("br"),b),h.removeChild(b)},h.innerHTML=b.replace(/<\/div>\n/g,"</div>"),d=h.firstChild,d&&d.nodeName.toLowerCase()==="div"&&f(d),d=h.lastChild,d&&d.nodeName.toLowerCase()==="div"&&f(d),h=h.innerHTML,g.remove(),h}},a.sceditor.plugins.bbcode.stripQuotes=function(a){return a?a.replace(/\\(.)/g,"$1").replace(/^(["'])(.*?)\1$/,"$2"):a},a.sceditor.plugins.bbcode.formatString=function(){var a=arguments;return a[0].replace(/\{(\d+)\}/g,function(b,c){return typeof a[c-0+1]!="undefined"?a[c-0+1]:"{"+c+"}"})},a.sceditor.plugins.bbcode.normaliseColour=function(a){function c(a){return a=parseInt(a,10),isNaN(a)?"00":(a=Math.max(0,Math.min(a,255)).toString(16),a.length<2?"0"+a:a)}var b;return(b=a.match(/rgb\((\d{1,3}),\s*?(\d{1,3}),\s*?(\d{1,3})\)/i))?"#"+c(b[1])+c(b[2]-0)+c(b[3]-0):(b=a.match(/#([0-f])([0-f])([0-f])\s*?$/i))?"#"+b[1]+b[1]+b[2]+b[2]+b[3]+b[3]:a},a.sceditor.plugins.bbcode.bbcodes={b:{tags:{b:null,strong:null},styles:{"font-weight":["bold","bolder","401","700","800","900"]},format:"[b]{0}[/b]",html:"<strong>{0}</strong>"},i:{tags:{i:null,em:null},styles:{"font-style":["italic","oblique"]},format:"[i]{0}[/i]",html:"<em>{0}</em>"},u:{tags:{u:null},styles:{"text-decoration":["underline"]},format:"[u]{0}[/u]",html:"<u>{0}</u>"},s:{tags:{s:null,strike:null},styles:{"text-decoration":["line-through"]},format:"[s]{0}[/s]",html:"<s>{0}</s>"},sub:{tags:{sub:null},format:"[sub]{0}[/sub]",html:"<sub>{0}</sub>"},sup:{tags:{sup:null},format:"[sup]{0}[/sup]",html:"<sup>{0}</sup>"},font:{tags:{font:{face:null}},styles:{"font-family":null},quoteType:a.sceditor.BBCodeParser.QuoteType.never,format:function(a,b){var c;if(a[0].nodeName.toLowerCase()!=="font"||!(c=a.attr("face")))c=a.css("font-family");return"[font="+this.stripQuotes(c)+"]"+b+"[/font]"},html:function(a,b,c){return'<font face="'+b.defaultattr+'">'+c+"</font>"}},size:{tags:{font:{size:null}},styles:{"font-size":null},format:function(a,b){var c=a.attr("size"),d=1;return c||(c=a.css("fontSize")),c.indexOf("px")>-1?(c=c.replace("px","")-0,c>12&&(d=2),c>15&&(d=3),c>17&&(d=4),c>23&&(d=5),c>31&&(d=6),c>47&&(d=7)):d=c,"[size="+d+"]"+b+"[/size]"},html:function(a,b,c){return'<font size="'+b.defaultattr+'">'+c+"</font>"}},color:{tags:{font:{color:null}},styles:{color:null},quoteType:a.sceditor.BBCodeParser.QuoteType.never,format:function(b,c){var d,e=b[0];if(e.nodeName.toLowerCase()!=="font"||!(d=b.attr("color")))d=e.style.color||b.css("color");return"[color="+a.sceditor.plugins.bbcode.normaliseColour(d)+"]"+c+"[/color]"},html:function(a,b,c){return'<font color="'+b.defaultattr+'">'+c+"</font>"}},ul:{tags:{ul:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ul]{0}[/ul]",html:"<ul>{0}</ul>"},list:{breakStart:!0,isInline:!1,skipLastLineBreak:!0,html:"<ul>{0}</ul>"},ol:{tags:{ol:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ol]{0}[/ol]",html:"<ol>{0}</ol>"},li:{tags:{li:null},isInline:!1,closedBy:["/ul","/ol","/list","*","li"],format:"[li]{0}[/li]",html:"<li>{0}</li>"},"*":{isInline:!1,closedBy:["/ul","/ol","/list","*","li"],html:"<li>{0}</li>"},table:{tags:{table:null},isInline:!1,isHtmlInline:!0,skipLastLineBreak:!0,format:"[table]{0}[/table]",html:"<table>{0}</table>"},tr:{tags:{tr:null},isInline:!1,skipLastLineBreak:!0,format:"[tr]{0}[/tr]",html:"<tr>{0}</tr>"},th:{tags:{th:null},allowsEmpty:!0,isInline:!1,format:"[th]{0}[/th]",html:"<th>{0}</th>"},td:{tags:{td:null},allowsEmpty:!0,isInline:!1,format:"[td]{0}[/td]",html:"<td>{0}</td>"},emoticon:{allowsEmpty:!0,tags:{img:{src:null,"data-sceditor-emoticon":null}},format:function(a,b){return a.attr("data-sceditor-emoticon")+b},html:"{0}"},hr:{tags:{hr:null},allowsEmpty:!0,isSelfClosing:!0,isInline:!1,format:"[hr]{0}",html:"<hr />"},img:{allowsEmpty:!0,tags:{img:{src:null}},quoteType:a.sceditor.BBCodeParser.QuoteType.never,format:function(b,c){var d="",e=function(a){return b.style?b.style[a]:null};if(typeof b.attr("data-sceditor-emoticon")!="undefined")return c;if(b.attr("width")||b.attr("height")||e("width")||e("height"))d="="+a(b).width()+"x"+a(b).height();return"[img"+d+"]"+b.attr("src")+"[/img]"},html:function(a,b,c){var d,e="";return typeof b.width!="undefined"&&(e+=' width="'+b.width+'"'),typeof b.height!="undefined"&&(e+=' height="'+b.height+'"'),typeof b.defaultattr!="undefined"&&(d=b.defaultattr.split(/x/i),e=' width="'+d[0]+'"'+' height="'+(d.length===2?d[1]:d[0])+'"'),"<img"+e+' src="'+c+'" />'}},url:{allowsEmpty:!0,tags:{a:{href:null}},quoteType:a.sceditor.BBCodeParser.QuoteType.never,format:function(a,b){var c=a.attr("href");return c.substr(0,7)==="mailto:"?'[email="'+c.substr(7)+'"]'+b+"[/email]":"[url="+decodeURI(c)+"]"+b+"[/url]"},html:function(a,b,c){if(typeof b.defaultattr=="undefined"||b.defaultattr.length===0)b.defaultattr=c;return'<a href="'+encodeURI(b.defaultattr)+'">'+c+"</a>"}},email:{quoteType:a.sceditor.BBCodeParser.QuoteType.never,html:function(a,b,c){return typeof b.defaultattr=="undefined"&&(b.defaultattr=c),'<a href="mailto:'+b.defaultattr+'">'+c+"</a>"}},quote:{tags:{blockquote:null},isInline:!1,quoteType:a.sceditor.BBCodeParser.QuoteType.never,format:function(b,c){var d="",e=a(b),f=e.children("cite").first();if(f.length===1||e.data("author"))d=f.text()||e.data("author"),e.data("author",d),f.remove(),e.children("cite").replaceWith(function(){return a(this).text()}),c=this.elementToBbcode(a(b)),d="="+d;return"[quote"+d+"]"+c+"[/quote]"},html:function(a,b,c){return typeof b.defaultattr!="undefined"&&(c="<cite>"+b.defaultattr+"</cite>"+c),"<blockquote>"+c+"</blockquote>"}},code:{tags:{code:null},isInline:!1,allowedChildren:["#","#newline"],format:"[code]{0}[/code]",html:"<code>{0}</code>"},left:{styles:{"text-align":["left","-webkit-left","-moz-left","-khtml-left"]},isInline:!1,format:"[left]{0}[/left]",html:'<div align="left">{0}</div>'},center:{styles:{"text-align":["center","-webkit-center","-moz-center","-khtml-center"]},isInline:!1,format:"[center]{0}[/center]",html:'<div align="center">{0}</div>'},right:{styles:{"text-align":["right","-webkit-right","-moz-right","-khtml-right"]},isInline:!1,format:"[right]{0}[/right]",html:'<div align="right">{0}</div>'},justify:{styles:{"text-align":["justify","-webkit-justify","-moz-justify","-khtml-justify"]},isInline:!1,format:"[justify]{0}[/justify]",html:'<div align="justify">{0}</div>'},youtube:{allowsEmpty:!0,tags:{iframe:{"data-youtube-id":null}},format:function(a,b){return(a=a.attr("data-youtube-id"))?"[youtube]"+a+"[/youtube]":b},html:'<iframe width="560" height="315" src="http://www.youtube.com/embed/{0}?wmode=opaque" data-youtube-id="{0}" frameborder="0" allowfullscreen></iframe>'},rtl:{styles:{direction:["rtl"]},format:"[rtl]{0}[/rtl]",html:'<div style="direction: rtl">{0}</div>'},ltr:{styles:{direction:["ltr"]},format:"[ltr]{0}[/ltr]",html:'<div style="direction: ltr">{0}</div>'},ignore:{}},a.sceditor.plugins.bbcode.bbcode={get:function(b){return a.sceditor.plugins.bbcode.bbcodes[b]||null},set:function(b,c){return!b||!c?!1:(c=a.extend(a.sceditor.plugins.bbcode.bbcodes[b]||{},c),c.remove=function(){a.sceditor.plugins.bbcode.bbcode.remove(b)},a.sceditor.plugins.bbcode.bbcodes[b]=c,this)},rename:function(a,b){return this.hasOwnProperty(a)?(this[b]=this[a],this.remove(a),this):!1},remove:function(b){return a.sceditor.plugins.bbcode.bbcodes[b]&&delete a.sceditor.plugins.bbcode.bbcodes[b],this}},a.fn.sceditorBBCodePlugin=function(b){return b=b||{},a.isPlainObject(b)&&(b.plugins=(b.plugins?b.plugins:"")+"bbcode"),this.sceditor(b)}})(jQuery,window,document);
+/*!pl SCEditor | (C) 2011-2013, Sam Clarke | sceditor.com/license */
+(function(e,t,n){"use strict";e.sceditor.BBCodeParser=function(t){if(!(this instanceof e.sceditor.BBCodeParser))return new e.sceditor.BBCodeParser(t);var r,o,i,l,s,a,c,u,d,f,h,p,b,m,g,y=this,v={open:"open",content:"content",newline:"newline",close:"close"};Object.freeze&&Object.freeze(v);var x=function(e,t,n,r,o,i){var l=this;l.type=e,l.name=t,l.val=n,l.attrs=r||{},l.children=o||[],l.closing=i||null};x.prototype={clone:function(e){var t=this;return new x(t.type,t.name,t.val,t.attrs,e?t.children:[],t.closing?t.closing.clone():null)},splitAt:function(t){var n,r=this,o=0,i=r.children.length;if("number"!=typeof object&&(t=e.inArray(t,r.children)),0>t||t>i)return null;for(;i--;)i>=t?o++:i=0;return n=r.clone(),n.children=r.children.splice(t,o),n}},r=function(){y.opts=e.extend({},e.sceditor.BBCodeParser.defaults,t),y.bbcodes=e.sceditor.plugins.bbcode.bbcodes},y.tokenize=function(e){var t,n,r,i=[],l=[{type:"close",regex:/^\[\/[^\[\]]+\]/},{type:"open",regex:/^\[[^\[\]]+\]/},{type:"newline",regex:/^(\r\n|\r|\n)/},{type:"content",regex:/^([^\[\r\n]+|\[)/}];l.reverse();e:for(;e.length;){for(r=l.length;r--;)if(n=l[r].type,(t=e.match(l[r].regex))&&t[0]){i.push(o(n,t[0])),e=e.substr(t[0].length);continue e}e.length&&i.push(o(v.content,e)),e=""}return i},o=function(t,n){var r,o,l;return"open"===t&&(r=n.match(/\[([^\]\s=]+)(?:([^\]]+))?\]/))?(l=m(r[1]),r[2]&&(r[2]=e.trim(r[2]))&&(o=i(r[2]))):"close"===t&&(r=n.match(/\[\/([^\[\]]+)\]/))?l=m(r[1]):"newline"===t&&(l="#newline"),l&&("open"!==t&&"close"!==t||e.sceditor.plugins.bbcode.bbcodes[l])||(t="content",l="#"),new x(t,l,n,o)},i=function(t){var n,r=/([^\s=]+)=(?:(?:(["'])((?:\\\2|[^\2])*?)\2)|((?:.(?!\s\S+=))*.))/g,o=e.sceditor.plugins.bbcode.stripQuotes,i={};if("="===t.charAt(0)&&0>t.indexOf("=",1))i.defaultattr=o(t.substr(1));else for("="===t.charAt(0)&&(t="defaultattr"+t);n=r.exec(t);)i[m(n[1])]=o(n[3])||n[4];return i},y.parse=function(e,t){var n=l(y.tokenize(e));return y.opts.fixInvalidChildren&&d(n),y.opts.removeEmptyTags&&u(n),y.opts.fixInvalidNesting&&a(n),s(n,null,t),y.opts.removeEmptyTags&&u(n),n},p=function(e,t,n){for(var r=n.length;r--;)if(n[r].type===t&&n[r].name===e)return!0;return!1},c=function(t,n){var r=t?y.bbcodes[t.name]:null,o=r?r.allowedChildren:null;return y.opts.fixInvalidChildren&&o?o&&0>e.inArray(n.name||"#",o)?!1:!0:!0},l=function(t){for(var n,r,o,i,l,s,a,c=[],u=[],d=[],f=function(){return g(d)},h=function(e){f()?f().children.push(e):u.push(e)},b=function(t){return f()&&(r=y.bbcodes[f().name])&&r.closedBy&&e.inArray(t,r.closedBy)>-1};n=t.shift();){switch(a=t[0],n.type){case v.open:b(n.name)&&d.pop(),h(n),r=y.bbcodes[n.name],r&&r.isSelfClosing||!r&&!p(n.name,v.close,t)||d.push(n);break;case v.close:if(f()&&n.name!==f().name&&b("/"+n.name)&&d.pop(),f()&&n.name===f().name)f().closing=n,d.pop();else if(p(n.name,v.open,d)){for(;o=d.pop();){if(o.name===n.name){o.closing=n;break}i=o.clone(),c.length>1&&i.children.push(g(c)),c.push(i)}for(h(g(c)),l=c.length;l--;)d.push(c[l]);c.length=0}else n.type=v.content,h(n);break;case v.newline:f()&&a&&b((a.type===v.close?"/":"")+a.name)&&(a.type!==v.close||a.name!==f().name)&&(r=y.bbcodes[f().name],r&&r.breakAfter?d.pop():r&&r.isInline===!1&&y.opts.breakAfterBlock&&r.breakAfter!==!1&&d.pop()),h(n);break;default:h(n)}s=n}return u},s=function(e,t,n){var r,o,i,l,a,c,u,d,f=e.length,h=f;for(t&&(l=y.bbcodes[t.name]);h--;)if(r=e[h])if(r.type===v.newline){if(o=h>0?e[h-1]:null,i=f-1>h?e[h+1]:null,d=!1,!n&&l&&l.isSelfClosing!==!0&&(o?c||i||(l.isInline===!1&&y.opts.breakEndBlock&&l.breakEnd!==!1&&(d=!0),l.breakEnd&&(d=!0),c=d):(l.isInline===!1&&y.opts.breakStartBlock&&l.breakStart!==!1&&(d=!0),l.breakStart&&(d=!0))),o&&o.type===v.open&&(a=y.bbcodes[o.name])&&(n?a.isInline===!1&&(d=!0):(a.isInline===!1&&y.opts.breakAfterBlock&&a.breakAfter!==!1&&(d=!0),a.breakAfter&&(d=!0))),!n&&!u&&i&&i.type===v.open&&(a=y.bbcodes[i.name])&&(a.isInline===!1&&y.opts.breakBeforeBlock&&a.breakBefore!==!1&&(d=!0),a.breakBefore&&(d=!0),u=d,d)){e.splice(h,1);continue}d&&e.splice(h,1),u=!1}else r.type===v.open&&s(r.children,r,n)},a=function(t,n,r,o){var i,l,s,c,u,d,f=function(e){var t=y.bbcodes[e.name];return!t||t.isInline!==!1};for(n=n||[],o=o||t,l=0;t.length>l;l++)if((i=t[l])&&i.type===v.open){if(!f(i)&&r&&(s=g(n),d=s.splitAt(i),u=n.length>1?n[n.length-2].children:o,(c=e.inArray(s,u))>-1))return d.children.splice(e.inArray(i,d.children),1),u.splice(c+1,0,i,d),void 0;n.push(i),a(i.children,n,r||f(i),o),n.pop(i)}},d=function(e,t){for(var n,r,o=e.length;o--;)(n=e[o])&&(c(t,n)||(n.name=null,n.type=v.content,c(t,n)?(r=[o+1,0].concat(n.children),n.closing&&(n.closing.name=null,n.closing.type=v.content,r.push(n.closing)),o+=r.length-1,Array.prototype.splice.apply(e,r)):t.children.splice(o,1)),n.type===v.open&&d(n.children,n))},u=function(e){var t,n,r,o=e.length;for(r=function(e){for(var t=e.length;t--;){if(e[t].type===v.open)return!1;if(e[t].type===v.close)return!1;if(e[t].type===v.content&&e[t].val&&/\S|\u00A0/.test(e[t].val))return!1}return!0};o--;)(t=e[o])&&t.type===v.open&&(n=y.bbcodes[t.name],u(t.children),r(t.children)&&n&&!n.isSelfClosing&&!n.allowsEmpty&&e.splice(o,1))},y.toHTML=function(e,t){return f(y.parse(e,t),!0)},f=function(t,r){var o,i,l,s,a,c,u,d,h=[];for(u=function(e){return(!e||(e.isHtmlInline!==void 0?e.isHtmlInline:e.isInline))!==!1};t.length>0;)if(o=t.shift()){if(o.type===v.open)d=o.children[o.children.length-1]||{},i=y.bbcodes[o.name],a=r&&u(i),l=f(o.children,!1),i&&i.html?(u(i)||!u(y.bbcodes[d.name])||i.isPreFormatted||i.skipLastLineBreak||e.sceditor.ie||(l+="<br />"),s=e.isFunction(i.html)?i.html.call(y,o,o.attrs,l):e.sceditor.plugins.bbcode.formatString(i.html,l)):s=o.val+l+(o.closing?o.closing.val:"");else{if(o.type===v.newline){if(!r){h.push("<br />");continue}if(c){h.push("</div>\n"),c=!1;continue}h.push("<div>"),e.sceditor.ie||h.push("<br />"),(n.documentMode&&8>n.documentMode||8>e.sceditor.ie)&&h.push(" "),h.push("</div>\n");continue}a=r,s=e.sceditor.escapeEntities(o.val)}a&&!c?(h.push("<div>"),c=!0):!a&&c&&(h.push("</div>\n"),c=!1),h.push(s)}return c&&h.push("</div>\n"),h.join("")},y.toBBCode=function(e,t){return h(y.parse(e,t))},h=function(t){for(var n,r,o,i,l,s,a,c,u,d,f=[];t.length>0;)if(n=t.shift())if(o=y.bbcodes[n.name],i=!(!o||o.isInline!==!1),l=o&&o.isSelfClosing,a=i&&y.opts.breakBeforeBlock&&o.breakBefore!==!1||o&&o.breakBefore,c=i&&!l&&y.opts.breakStartBlock&&o.breakStart!==!1||o&&o.breakStart,u=i&&y.opts.breakEndBlock&&o.breakEnd!==!1||o&&o.breakEnd,d=i&&y.opts.breakAfterBlock&&o.breakAfter!==!1||o&&o.breakAfter,s=(o?o.quoteType:null)||y.opts.quoteType||e.sceditor.BBCodeParser.QuoteType.auto,o||n.type!==v.open)if(n.type===v.open){if(a&&f.push("\n"),f.push("["+n.name),n.attrs){n.attrs.defaultattr&&(f.push("="+b(n.attrs.defaultattr,s,"defaultattr")),delete n.attrs.defaultattr);for(r in n.attrs)n.attrs.hasOwnProperty(r)&&f.push(" "+r+"="+b(n.attrs[r],s,r))}f.push("]"),c&&f.push("\n"),n.children&&f.push(h(n.children)),l||o.excludeClosing||(u&&f.push("\n"),f.push("[/"+n.name+"]")),d&&f.push("\n"),n.closing&&l&&f.push(n.closing.val)}else f.push(n.val);else f.push(n.val),n.children&&f.push(h(n.children)),n.closing&&f.push(n.closing.val);return f.join("")},b=function(t,n,r){var o=e.sceditor.BBCodeParser.QuoteType,i=/\s|=/.test(t);return e.isFunction(n)?n(t,r):n===o.never||n===o.auto&&!i?t:'"'+t.replace("\\","\\\\").replace('"','\\"')+'"'},g=function(e){return e.length?e[e.length-1]:null},m=function(e){return e.toLowerCase()},r()},e.sceditor.BBCodeParser.QuoteType={always:1,never:2,auto:3},Object.freeze&&Object.freeze(e.sceditor.BBCodeParser.QuoteType),e.sceditor.BBCodeParser.defaults={breakBeforeBlock:!1,breakStartBlock:!1,breakEndBlock:!1,breakAfterBlock:!0,removeEmptyTags:!0,fixInvalidNesting:!0,fixInvalidChildren:!0,quoteType:e.sceditor.BBCodeParser.QuoteType.auto},e.sceditorBBCodePlugin=e.sceditor.plugins.bbcode=function(){var t,r,o,i,l,s,a,c=this;i=e.sceditor.plugins.bbcode.formatString,c.bbcodes=e.sceditor.plugins.bbcode.bbcodes,c.stripQuotes=e.sceditor.plugins.bbcode.stripQuotes;var u={},d={},f={ul:["li","ol","ul"],ol:["li","ol","ul"],table:["tr"],tr:["td","th"],code:["br","p","div"]},h={};c.init=function(){c.opts=this.opts,t(),s(this)},s=function(t){var n={bold:{txtExec:["[b]","[/b]"]},italic:{txtExec:["[i]","[/i]"]},underline:{txtExec:["[u]","[/u]"]},strike:{txtExec:["[s]","[/s]"]},subscript:{txtExec:["[sub]","[/sub]"]},superscript:{txtExec:["[sup]","[/sup]"]},left:{txtExec:["[left]","[/left]"]},center:{txtExec:["[center]","[/center]"]},right:{txtExec:["[right]","[/right]"]},justify:{txtExec:["[justify]","[/justify]"]},font:{txtExec:function(t){var n=this;e.sceditor.command.get("font")._dropDown(n,t,function(e){n.insertText("[font="+e+"]","[/font]")})}},size:{txtExec:function(t){var n=this;e.sceditor.command.get("size")._dropDown(n,t,function(e){n.insertText("[size="+e+"]","[/size]")})}},color:{txtExec:function(t){var n=this;e.sceditor.command.get("color")._dropDown(n,t,function(e){n.insertText("[color="+e+"]","[/color]")})}},bulletlist:{txtExec:["[ul][li]","[/li][/ul]"]},orderedlist:{txtExec:["[ol][li]","[/li][/ol]"]},table:{txtExec:["[table][tr][td]","[/td][/tr][/table]"]},horizontalrule:{txtExec:["[hr]"]},code:{txtExec:["[code]","[/code]"]},image:{txtExec:function(e,t){var n=prompt(this._("Enter the image URL:"),t);n&&this.insertText("[img]"+n+"[/img]")}},email:{txtExec:function(e,t){var n=t&&t.indexOf("@")>-1?null:t,r=prompt(this._("Enter the e-mail address:"),n?"":t),o=prompt(this._("Enter the displayed text:"),n||r)||r;r&&this.insertText("[email="+r+"]"+o+"[/email]")}},link:{txtExec:function(e,t){var n=t&&t.indexOf("http://")>-1?null:t,r=prompt(this._("Enter URL:"),n?"http://":t),o=prompt(this._("Enter the displayed text:"),n||r)||r;r&&this.insertText("[url="+r+"]"+o+"[/url]")}},quote:{txtExec:["[quote]","[/quote]"]},youtube:{txtExec:function(t){var n=this;e.sceditor.command.get("youtube")._dropDown(n,t,function(e){n.insertText("[youtube]"+e+"[/youtube]")})}},rtl:{txtExec:["[rtl]","[/rtl]"]},ltr:{txtExec:["[ltr]","[/ltr]"]}};t.commands=e.extend(!0,{},n,t.commands)},t=function(){e.each(c.bbcodes,function(t){c.bbcodes[t].tags&&e.each(c.bbcodes[t].tags,function(e,n){var r=c.bbcodes[t].isInline===!1;u[e]=u[e]||{},u[e][r]=u[e][r]||{},u[e][r][t]=n}),c.bbcodes[t].styles&&e.each(c.bbcodes[t].styles,function(e,n){var r=c.bbcodes[t].isInline===!1;d[r]=d[r]||{},d[r][e]=d[r][e]||{},d[r][e][t]=n})})},l=function(t,n){var r,o,i,l,s,a=t.style;return a?(h[n]||(h[n]=e.camelCase(n)),s=h[n],"text-align"===n?(r=e(t),i=a.direction,l=a[s]||r.css(n),r.parent().css(n)===l||"block"!==r.css("display")||r.is("hr")||r.is("th")||(o=l),i&&o&&(/right/i.test(o)&&"rtl"===i||/left/i.test(o)&&"ltr"===i)?null:o):a[s]):null},r=function(t,n,r){var o;return r=!!r,d[r]?(e.each(d[r],function(r,s){o=l(t[0],r),o&&l(t.parent()[0],r)!==o&&e.each(s,function(r,l){(!l||e.inArray(""+o,l)>-1)&&(n=e.isFunction(c.bbcodes[r].format)?c.bbcodes[r].format.call(c,t,n):i(c.bbcodes[r].format,n))})}),n):n},o=function(t,n,r){var o=t[0].nodeName.toLowerCase();if(r=!!r,u[o]&&u[o][r]&&e.each(u[o][r],function(r,o){if(o){var l=!1;if(e.each(o,function(n,r){return!t.attr(n)||r&&0>e.inArray(t.attr(n),r)?void 0:(l=!0,!1)}),!l)return}n=e.isFunction(c.bbcodes[r].format)?c.bbcodes[r].format.call(c,t,n):i(c.bbcodes[r].format,n)}),r&&(!e.sceditor.dom.isInline(t[0],!0)||"br"===o)){var l=t[0].parentNode,s=t[0].previousSibling,a=e.sceditor.dom.isInline(l,!0)||"body"===l.nodeName.toLowerCase();(a||"li"===o||l.lastChild!==t[0]||"br"===o&&e.sceditor.ie)&&(n+="\n"),"br"!==o&&!a&&s&&3===s.nodeType&&(n="\n"+n)}return n},c.signalToSource=function(t,n){var r=new e.sceditor.BBCodeParser(c.opts.parserOptions);return e.sceditor.dom.removeWhiteSpace(n[0]),e.trim(r.toBBCode(c.elementToBbcode(n),!0))},c.elementToBbcode=function(t){return function n(t,i){var l="";return e.sceditor.dom.traverse(t,function(t){var s=e(t),a="",c=t.nodeType,u=t.nodeName.toLowerCase(),d=f[u],h=!0;if("object"==typeof i&&(h=e.inArray(u,i)>-1,h||(d=i)),3===c||1===c)if(1===c){if(s.hasClass("sceditor-ignore"))return;"iframe"!==u&&(a=n(t,d)),h?("code"!==u&&(a=r(s,a),a=o(s,a),a=r(s,a,!0)),l+=o(s,a,!0)):l+=a}else!t.wholeText||t.previousSibling&&3===t.previousSibling.nodeType?t.wholeText||(l+=t.nodeValue):l+=0===s.parents("code").length?t.wholeText.replace(/ +/g," "):t.wholeText},!1,!0),l}(t.get(0))},c.signalToWysiwyg=function(t,n){var r=new e.sceditor.BBCodeParser(c.opts.parserOptions),o=r.toHTML(t);return n?a(o):o},a=function(t){var r,o,i,l=e("<div />").hide().appendTo(n.body),s=l[0];return i=function(t){for(;o=t.firstChild;)s.insertBefore(o,t);e.sceditor.ie>=9&&s.insertBefore(n.createElement("br"),t),s.removeChild(t)},s.innerHTML=t.replace(/<\/div>\n/g,"</div>"),r=s.firstChild,r&&"div"===r.nodeName.toLowerCase()&&i(r),r=s.lastChild,r&&"div"===r.nodeName.toLowerCase()&&i(r),s=s.innerHTML,l.remove(),s}},e.sceditor.plugins.bbcode.stripQuotes=function(e){return e?e.replace(/\\(.)/g,"$1").replace(/^(["'])(.*?)\1$/,"$2"):e},e.sceditor.plugins.bbcode.formatString=function(){var e=arguments;return e[0].replace(/\{(\d+)\}/g,function(t,n){return e[n-0+1]!==void 0?e[n-0+1]:"{"+n+"}"})},e.sceditor.plugins.bbcode.normaliseColour=function(e){function t(e){return e=parseInt(e,10),isNaN(e)?"00":(e=Math.max(0,Math.min(e,255)).toString(16),2>e.length?"0"+e:e)}var n;return(n=e.match(/rgb\((\d{1,3}),\s*?(\d{1,3}),\s*?(\d{1,3})\)/i))?"#"+t(n[1])+t(n[2]-0)+t(n[3]-0):(n=e.match(/#([0-f])([0-f])([0-f])\s*?$/i))?"#"+n[1]+n[1]+n[2]+n[2]+n[3]+n[3]:e},e.sceditor.plugins.bbcode.bbcodes={b:{tags:{b:null,strong:null},styles:{"font-weight":["bold","bolder","401","700","800","900"]},format:"[b]{0}[/b]",html:"<strong>{0}</strong>"},i:{tags:{i:null,em:null},styles:{"font-style":["italic","oblique"]},format:"[i]{0}[/i]",html:"<em>{0}</em>"},u:{tags:{u:null},styles:{"text-decoration":["underline"]},format:"[u]{0}[/u]",html:"<u>{0}</u>"},s:{tags:{s:null,strike:null},styles:{"text-decoration":["line-through"]},format:"[s]{0}[/s]",html:"<s>{0}</s>"},sub:{tags:{sub:null},format:"[sub]{0}[/sub]",html:"<sub>{0}</sub>"},sup:{tags:{sup:null},format:"[sup]{0}[/sup]",html:"<sup>{0}</sup>"},font:{tags:{font:{face:null}},styles:{"font-family":null},quoteType:e.sceditor.BBCodeParser.QuoteType.never,format:function(e,t){var n;return"font"===e[0].nodeName.toLowerCase()&&(n=e.attr("face"))||(n=e.css("font-family")),"[font="+this.stripQuotes(n)+"]"+t+"[/font]"},html:function(e,t,n){return'<font face="'+t.defaultattr+'">'+n+"</font>"}},size:{tags:{font:{size:null}},styles:{"font-size":null},format:function(e,t){var n=e.attr("size"),r=1;return n||(n=e.css("fontSize")),n.indexOf("px")>-1?(n=n.replace("px","")-0,n>12&&(r=2),n>15&&(r=3),n>17&&(r=4),n>23&&(r=5),n>31&&(r=6),n>47&&(r=7)):r=n,"[size="+r+"]"+t+"[/size]"},html:function(e,t,n){return'<font size="'+t.defaultattr+'">'+n+"</font>"}},color:{tags:{font:{color:null}},styles:{color:null},quoteType:e.sceditor.BBCodeParser.QuoteType.never,format:function(t,n){var r,o=t[0];return"font"===o.nodeName.toLowerCase()&&(r=t.attr("color"))||(r=o.style.color||t.css("color")),"[color="+e.sceditor.plugins.bbcode.normaliseColour(r)+"]"+n+"[/color]"},html:function(e,t,n){return'<font color="'+t.defaultattr+'">'+n+"</font>"}},ul:{tags:{ul:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ul]{0}[/ul]",html:"<ul>{0}</ul>"},list:{breakStart:!0,isInline:!1,skipLastLineBreak:!0,html:"<ul>{0}</ul>"},ol:{tags:{ol:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ol]{0}[/ol]",html:"<ol>{0}</ol>"},li:{tags:{li:null},isInline:!1,closedBy:["/ul","/ol","/list","*","li"],format:"[li]{0}[/li]",html:"<li>{0}</li>"},"*":{isInline:!1,closedBy:["/ul","/ol","/list","*","li"],html:"<li>{0}</li>"},table:{tags:{table:null},isInline:!1,isHtmlInline:!0,skipLastLineBreak:!0,format:"[table]{0}[/table]",html:"<table>{0}</table>"},tr:{tags:{tr:null},isInline:!1,skipLastLineBreak:!0,format:"[tr]{0}[/tr]",html:"<tr>{0}</tr>"},th:{tags:{th:null},allowsEmpty:!0,isInline:!1,format:"[th]{0}[/th]",html:"<th>{0}</th>"},td:{tags:{td:null},allowsEmpty:!0,isInline:!1,format:"[td]{0}[/td]",html:"<td>{0}</td>"},emoticon:{allowsEmpty:!0,tags:{img:{src:null,"data-sceditor-emoticon":null}},format:function(e,t){return e.attr("data-sceditor-emoticon")+t},html:"{0}"},hr:{tags:{hr:null},allowsEmpty:!0,isSelfClosing:!0,isInline:!1,format:"[hr]{0}",html:"<hr />"},img:{allowsEmpty:!0,tags:{img:{src:null}},quoteType:e.sceditor.BBCodeParser.QuoteType.never,format:function(t,n){var r="",o=function(e){return t.style?t.style[e]:null};return t.attr("data-sceditor-emoticon")!==void 0?n:((t.attr("width")||t.attr("height")||o("width")||o("height"))&&(r="="+e(t).width()+"x"+e(t).height()),"[img"+r+"]"+t.attr("src")+"[/img]")},html:function(e,t,n){var r,o="";return t.width!==void 0&&(o+=' width="'+t.width+'"'),t.height!==void 0&&(o+=' height="'+t.height+'"'),t.defaultattr!==void 0&&(r=t.defaultattr.split(/x/i),o=' width="'+r[0]+'"'+' height="'+(2===r.length?r[1]:r[0])+'"'),"<img"+o+' src="'+n+'" />'}},url:{allowsEmpty:!0,tags:{a:{href:null}},quoteType:e.sceditor.BBCodeParser.QuoteType.never,format:function(e,t){var n=e.attr("href");return"mailto:"===n.substr(0,7)?'[email="'+n.substr(7)+'"]'+t+"[/email]":"[url="+decodeURI(n)+"]"+t+"[/url]"},html:function(e,t,n){return(t.defaultattr===void 0||0===t.defaultattr.length)&&(t.defaultattr=n),'<a href="'+encodeURI(t.defaultattr)+'">'+n+"</a>"}},email:{quoteType:e.sceditor.BBCodeParser.QuoteType.never,html:function(e,t,n){return t.defaultattr===void 0&&(t.defaultattr=n),'<a href="mailto:'+t.defaultattr+'">'+n+"</a>"}},quote:{tags:{blockquote:null},isInline:!1,quoteType:e.sceditor.BBCodeParser.QuoteType.never,format:function(t,n){var r="",o=e(t),i=o.children("cite").first();return(1===i.length||o.data("author"))&&(r=i.text()||o.data("author"),o.data("author",r),i.remove(),o.children("cite").replaceWith(function(){return e(this).text()}),n=this.elementToBbcode(e(t)),r="="+r),"[quote"+r+"]"+n+"[/quote]"},html:function(e,t,n){return t.defaultattr!==void 0&&(n="<cite>"+t.defaultattr+"</cite>"+n),"<blockquote>"+n+"</blockquote>"}},code:{tags:{code:null},isInline:!1,allowedChildren:["#","#newline"],format:"[code]{0}[/code]",html:"<code>{0}</code>"},left:{styles:{"text-align":["left","-webkit-left","-moz-left","-khtml-left"]},isInline:!1,format:"[left]{0}[/left]",html:'<div align="left">{0}</div>'},center:{styles:{"text-align":["center","-webkit-center","-moz-center","-khtml-center"]},isInline:!1,format:"[center]{0}[/center]",html:'<div align="center">{0}</div>'},right:{styles:{"text-align":["right","-webkit-right","-moz-right","-khtml-right"]},isInline:!1,format:"[right]{0}[/right]",html:'<div align="right">{0}</div>'},justify:{styles:{"text-align":["justify","-webkit-justify","-moz-justify","-khtml-justify"]},isInline:!1,format:"[justify]{0}[/justify]",html:'<div align="justify">{0}</div>'},youtube:{allowsEmpty:!0,tags:{iframe:{"data-youtube-id":null}},format:function(e,t){return(e=e.attr("data-youtube-id"))?"[youtube]"+e+"[/youtube]":t},html:'<iframe width="560" height="315" src="http://www.youtube.com/embed/{0}?wmode=opaque" data-youtube-id="{0}" frameborder="0" allowfullscreen></iframe>'},rtl:{styles:{direction:["rtl"]},format:"[rtl]{0}[/rtl]",html:'<div style="direction: rtl">{0}</div>'},ltr:{styles:{direction:["ltr"]},format:"[ltr]{0}[/ltr]",html:'<div style="direction: ltr">{0}</div>'},ignore:{}},e.sceditor.plugins.bbcode.bbcode={get:function(t){return e.sceditor.plugins.bbcode.bbcodes[t]||null},set:function(t,n){return t&&n?(n=e.extend(e.sceditor.plugins.bbcode.bbcodes[t]||{},n),n.remove=function(){e.sceditor.plugins.bbcode.bbcode.remove(t)},e.sceditor.plugins.bbcode.bbcodes[t]=n,this):!1},rename:function(e,t){return this.hasOwnProperty(e)?(this[t]=this[e],this.remove(e),this):!1},remove:function(t){return e.sceditor.plugins.bbcode.bbcodes[t]&&delete e.sceditor.plugins.bbcode.bbcodes[t],this}},e.fn.sceditorBBCodePlugin=function(t){return t=t||{},e.isPlainObject(t)&&(t.plugins=(t.plugins?t.plugins:"")+"bbcode"),this.sceditor(t)}})(jQuery,window,document);
3  minified/plugins/xhtml.js
View
@@ -1 +1,2 @@
-(function(a){"use strict",a.sceditor.XHTMLSerializer=function(){var b=this,c={indentStr:" "},d=[],e=0,f,g,h,i,j,k,l,m,n,o,p;f=function(a){var b={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};return a?a.replace(/[&<>"]/g,function(a){return b[a]||a}):""},g=function(a){return a.replace(/[\r\n]/,"").replace(/[^\S|\u00A0]+/g," ")},b.serialize=function(a,b){d=[];if(b){a=a.firstChild;while(a)h(a),a=a.nextSibling}else h(a);return d.join("")},h=function(a){switch(a.nodeType){case 1:var b=a.nodeName.toLowerCase();b==="!"&&l(a),j(a);break;case 3:m(a);break;case 4:k(a);break;case 8:l(a);break;case 9:case 11:i(a);break;case 2:case 5:case 6:case 7:case 10:case 12:}},i=function(a){var b;b=a.firstChild;while(b)h(b),b=b.nextSibling},j=function(a){var b,c,g=a.nodeName.toLowerCase(),i=a.attributes.length,j=!a.firstChild&&/^(?:area|base|br|col|embed|hr|img|input|link|meta|param)$/.test(g);o(a)&&n(),d.push("<"+g);while(i--)c=a.attributes[i],d.push(" ",c.name.toLowerCase(),'="',f(c.value),'"');d.push(j?" />":">"),e++,b=a.firstChild;while(b)h(b),b=b.nextSibling;e--,j||(o(a)&&a.firstChild&&n(),d.push("</",g,">"))},k=function(a){n(),d.push("<![CDATA[",f(a.nodeValue),"]]>")},l=function(a){n(),d.push("<!-- ",f(a.nodeValue)," -->")},m=function(a){var b=g(a.nodeValue);b&&(o(a)&&n(),d.push(f(b)))},n=function(){var a=e;p();while(a--)d.push(c.indentStr)},o=function(b){if(b.nodeType!==1){if(b.previousSibling&&a.sceditor.dom.isInline(b.previousSibling))return!1;b=b.parentNode}return!b.previousSibling&&!a.sceditor.dom.isInline(b.parentNode)?!0:!a.sceditor.dom.isInline(b)},p=function(){d.length&&d.push("\n")}},a.sceditor.plugins.xhtml=function(){var b=this,c={},d={},e,f,g,h,i,j;b.init=function(){a.isEmptyObject(a.sceditor.plugins.xhtml.converters||{})||a.each(a.sceditor.plugins.xhtml.converters,function(b,d){a.each(d.tags,function(a){c[a]||(c[a]=[]),c[a].push(d)})}),e(this)},e=function(b){var c={bold:{txtExec:["<strong>","</strong>"]},italic:{txtExec:["<em>","</em>"]},underline:{txtExec:['<span style="text-decoration: underline;">',"<span>"]},strike:{txtExec:['<span style="text-decoration: line-through;">',"<span>"]},subscript:{txtExec:["<sub>","</sub>"]},superscript:{txtExec:["<sup>","</sup>"]},left:{txtExec:['<div style="text-align: left;">',"<div>"]},center:{txtExec:['<div style="text-align: center;">',"<div>"]},right:{txtExec:['<div style="text-align: right;">',"<div>"]},justify:{txtExec:['<div style="text-align: justify;">',"<div>"]},font:{txtExec:function(b){var c=this;a.sceditor.command.get("font")._dropDown(c,b,function(a){c.insertText('<span style="font-family: '+a+';">',"</span>")})}},size:{txtExec:function(b){var c=this;a.sceditor.command.get("size")._dropDown(c,b,function(a){c.insertText('<span style="font-size: '+a+';">',"</span>")})}},color:{txtExec:function(b){var c=this;a.sceditor.command.get("color")._dropDown(c,b,function(a){c.insertText('<span style="color: '+a+';">',"</span>")})}},bulletlist:{txtExec:["<ul><li>","</li></ul>"]},orderedlist:{txtExec:["<ol><li>","</li></ol>"]},table:{txtExec:["<table><tr><td>","</td></tr></table>"]},horizontalrule:{txtExec:["<hr />"]},code:{txtExec:["<code>","</code>"]},image:{txtExec:function(a,b){var c=prompt(this._("Enter the image URL:"),b);c&&this.insertText('<img src="'+c+'" />')}},email:{txtExec:function(a,b){var c=b&&b.indexOf("@")>-1?null:b,d=prompt(this._("Enter the e-mail address:"),c?"":b),e=prompt(this._("Enter the displayed text:"),c||d)||d;d&&this.insertText('<a href="mailto:'+d+'">'+e+"</a>")}},link:{txtExec:function(a,b){var c=b&&b.indexOf("http://")>-1?null:b,d=prompt(this._("Enter URL:"),c?"http://":b),e=prompt(this._("Enter the displayed text:"),c||d)||d;d&&this.insertText('<a href="'+d+'">'+e+"</a>")}},quote:{txtExec:["<blockquote>","</blockquote>"]},youtube:{txtExec:function(b){var c=this;a.sceditor.command.get("youtube")._dropDown(c,b,function(a){c.insertText('<iframe width="560" height="315" src="http://www.youtube.com/embed/{id}?wmode=opaque" data-youtube-id="'+a+'" frameborder="0" allowfullscreen></iframe>')})}},rtl:{txtExec:['<div stlye="direction: rtl;">',"</div>"]},ltr:{txtExec:['<div stlye="direction: ltr;">',"</div>"]}};b.commands=a.extend(!0,{},c,b.commands)},b.signalToSource=function(b,c){return c=c.jquery?c[0]:c,a(c).find(".sceditor-selection").remove(),f(c),h(c),j(c),(new a.sceditor.XHTMLSerializer).serialize(c,!0)},b.signalToWysiwyg=function(a){return a},b.convertTagTo=function(a,b){var c,d,e=a.attributes.length,f=a.ownerDocument.createElement(b);while(e--)d=a.attributes[e],f.setAttribute(d.name,d.value);while(c=a.firstChild)f.appendChild(c);return a.parentNode.replaceChild(f,a),f},g=function(d,e){c[d]&&a.each(c[d],function(c,f){f.tags[d]?a.each(f.tags[d],function(c,d){if(typeof e.attr(c)=="undefined")return;if(d&&a.inArray(e.attr(c),d)<0)return;f.conv.call(b,e[0])}):f.conv&&f.conv.call(b,e[0])})},f=function(b){if(!c)return;a.sceditor.dom.traverse(b,function(b){var d=a(b),e=b.nodeName.toLowerCase();if(!c)return;g("*",d),g(e,d)},!0)},h=function(b){a.sceditor.dom.traverse(b,function(b){var c=b.nodeName.toLowerCase(),d=a.sceditor.plugins.xhtml.allowedTags,e=a.sceditor.plugins.xhtml.disallowedTags;if(b.nodeType===4)c="!cdata";else if(c==="!"||b.nodeType===8)c="!comment";d&&d.length&&b.nodeType!==3?a.inArray(c,d)<0&&b.parentNode&&b.parentNode.removeChild(b):e&&e.length&&b.nodeType!==3&&a.inArray(c,e)>-1&&b.parentNode&&b.parentNode.removeChild(b)})},i=function(b,c){var d={};return b&&a.extend(d,b),c?(a.each(c,function(b,c){a.isArray(d[b])?a.isArray(c)&&(d[b]=a.merge(d[b],c)):d[b]=c}),d):d},j=function(b){d={},a.sceditor.dom.traverse(b,function(b){if(!b.attributes)return;var c,e,f=b.nodeName.toLowerCase(),g=a.sceditor.plugins.xhtml.allowedAttribs,h=a.sceditor.plugins.xhtml.disallowedAttribs,j=b.attributes.length;if(g&&!a.isEmptyObject(g)&&j){d[f]||(d[f]=i(g["*"],g[f]));while(j--)c=b.attributes[j],e=typeof d[f][c.name]=="undefined",a.isArray(d[f][c.name])&&a.inArray(c.value,d[f][c.name])<0&&(e=!0),e&&b.removeAttribute(c.name)}else if(h&&!a.isEmptyObject(h)&&j){d[f]||(d[f]=i(h["*"],h[f]));while(j--)c=b.attributes[j],e=typeof d[f][c.name]!="undefined",a.isArray(d[f][c.name])&&a.inArray(c.value,d[f][c.name])>-1&&(e=!0),e&&b.removeAttribute(c.name)}})}},a.sceditor.plugins.xhtml.converters=[{tags:{"*":{width:null}},conv:function(b){var c=a(b);c.css("width",c.attr("width")).removeAttr("width")}},{tags:{"*":{height:null}},conv:function(b){var c=a(b);c.css("height",c.attr("height")).removeAttr("height")}},{tags:{li:{value:null}},conv:function(b){a(b).removeAttr("value")}},{tags:{"*":{text:null}},conv:function(b){var c=a(b);c.css("color",c.attr("text")).removeAttr("text")}},{tags:{"*":{size:null}},conv:function(b){var c=a(b);c.css("font-size",c.css("font-size")).removeAttr("size")}},{tags:{"*":{color:null}},conv:function(b){var c=a(b);c.css("color",c.attr("color")).removeAttr("color")}},{tags:{"*":{face:null}},conv:function(b){var c=a(b);c.css("font-family",c.attr("face")).removeAttr("face")}},{tags:{"*":{language:null}},conv:function(b){var c=a(b),d=c.attr("language");/jscript|javascript|js/i.test(d)?c.attr("type","text/javascript"):/vb/i.test(d)&&c.attr("type","text/vbscript"),c.removeAttr("language")}},{tags:{"*":{align:null}},conv:function(b){var c=a(b);c.css("text-align",c.attr("align")).removeAttr("align")}},{tags:{"*":{border:null}},conv:function(b){var c=a(b);c.css("border-size",c.attr("border")).removeAttr("border")}},{tags:{applet:{name:null},img:{name:null},layer:{name:null},map:{name:null},object:{name:null},param:{name:null}},conv:function(b){a(b).removeAttr("name")}},{tags:{hr:{noshade:null}},conv:function(b){var c=a(b);c.css("border-style","solid").removeAttr("noshade")}},{tags:{"*":{nowrap:null}},conv:function(b){var c=a(b);c.css("white-space","nowrap").removeAttr("nowrap")}},{tags:{big:null},conv:function(b){a(this.convertTagTo(b,"span")).css("font-size","larger")}},{tags:{small:null},conv:function(b){a(this.convertTagTo(b,"span")).css("font-size","smaller")}},{tags:{b:null},conv:function(b){a(this.convertTagTo(b,"strong"))}},{tags:{u:null},conv:function(b){a(this.convertTagTo(b,"span")).css("text-decoration","underline")}},{tags:{i:null},conv:function(b){a(this.convertTagTo(b,"em"))}},{tags:{s:null,strike:null},conv:function(b){a(this.convertTagTo(b,"span")).css("text-decoration","line-through")}},{tags:{dir:null},conv:function(a){this.convertTagTo(a,"ul")}},{tags:{center:null},conv:function(b){a(this.convertTagTo(b,"div")).css("text-align","center")}},{tags:{font:null},conv:function(a){this.convertTagTo(a,"span")}}],a.sceditor.plugins.xhtml.allowedAttribs={},a.sceditor.plugins.xhtml.disallowedAttribs={},a.sceditor.plugins.xhtml.allowedTags=[],a.sceditor.plugins.xhtml.disallowedTags=[]})(jQuery);
+/*!pl SCEditor | (C) 2011-2013, Sam Clarke | sceditor.com/license */
+(function(t){"use strict";t.sceditor.XHTMLSerializer=function(){var e,n,i,r,o,s,a,c,l,u,d,v=this,f={indentStr:" "},m=[],g=0;e=function(t){var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};return t?t.replace(/[&<>"]/g,function(t){return e[t]||t}):""},n=function(t){return t.replace(/[\r\n]/,"").replace(/[^\S|\u00A0]+/g," ")},v.serialize=function(t,e){if(m=[],e)for(t=t.firstChild;t;)i(t),t=t.nextSibling;else i(t);return m.join("")},i=function(t){switch(t.nodeType){case 1:var e=t.nodeName.toLowerCase();"!"===e&&a(t),o(t);break;case 3:c(t);break;case 4:s(t);break;case 8:a(t);break;case 9:case 11:r(t);break;case 2:case 5:case 6:case 7:case 10:case 12:}},r=function(t){var e;for(e=t.firstChild;e;)i(e),e=e.nextSibling},o=function(t){var n,r,o=t.nodeName.toLowerCase(),s=t.attributes.length,a=!t.firstChild&&/^(?:area|base|br|col|embed|hr|img|input|link|meta|param)$/.test(o);for(u(t)&&l(),m.push("<"+o);s--;)r=t.attributes[s],m.push(" ",r.name.toLowerCase(),'="',e(r.value),'"');for(m.push(a?" />":">"),g++,n=t.firstChild;n;)i(n),n=n.nextSibling;g--,a||(u(t)&&t.firstChild&&l(),m.push("</",o,">"))},s=function(t){l(),m.push("<![CDATA[",e(t.nodeValue),"]]>")},a=function(t){l(),m.push("<!-- ",e(t.nodeValue)," -->")},c=function(t){var i=n(t.nodeValue);i&&(u(t)&&l(),m.push(e(i)))},l=function(){var t=g;for(d();t--;)m.push(f.indentStr)},u=function(e){if(1!==e.nodeType){if(e.previousSibling&&t.sceditor.dom.isInline(e.previousSibling))return!1;e=e.parentNode}return e.previousSibling||t.sceditor.dom.isInline(e.parentNode)?!t.sceditor.dom.isInline(e):!0},d=function(){m.length&&m.push("\n")}},t.sceditor.plugins.xhtml=function(){var e,n,i,r,o,s,a=this,c={},l={};a.init=function(){t.isEmptyObject(t.sceditor.plugins.xhtml.converters||{})||t.each(t.sceditor.plugins.xhtml.converters,function(e,n){t.each(n.tags,function(t){c[t]||(c[t]=[]),c[t].push(n)})}),e(this)},e=function(e){var n={bold:{txtExec:["<strong>","</strong>"]},italic:{txtExec:["<em>","</em>"]},underline:{txtExec:['<span style="text-decoration: underline;">',"<span>"]},strike:{txtExec:['<span style="text-decoration: line-through;">',"<span>"]},subscript:{txtExec:["<sub>","</sub>"]},superscript:{txtExec:["<sup>","</sup>"]},left:{txtExec:['<div style="text-align: left;">',"<div>"]},center:{txtExec:['<div style="text-align: center;">',"<div>"]},right:{txtExec:['<div style="text-align: right;">',"<div>"]},justify:{txtExec:['<div style="text-align: justify;">',"<div>"]},font:{txtExec:function(e){var n=this;t.sceditor.command.get("font")._dropDown(n,e,function(t){n.insertText('<span style="font-family: '+t+';">',"</span>")})}},size:{txtExec:function(e){var n=this;t.sceditor.command.get("size")._dropDown(n,e,function(t){n.insertText('<span style="font-size: '+t+';">',"</span>")})}},color:{txtExec:function(e){var n=this;t.sceditor.command.get("color")._dropDown(n,e,function(t){n.insertText('<span style="color: '+t+';">',"</span>")})}},bulletlist:{txtExec:["<ul><li>","</li></ul>"]},orderedlist:{txtExec:["<ol><li>","</li></ol>"]},table:{txtExec:["<table><tr><td>","</td></tr></table>"]},horizontalrule:{txtExec:["<hr />"]},code:{txtExec:["<code>","</code>"]},image:{txtExec:function(t,e){var n=prompt(this._("Enter the image URL:"),e);n&&this.insertText('<img src="'+n+'" />')}},email:{txtExec:function(t,e){var n=e&&e.indexOf("@")>-1?null:e,i=prompt(this._("Enter the e-mail address:"),n?"":e),r=prompt(this._("Enter the displayed text:"),n||i)||i;i&&this.insertText('<a href="mailto:'+i+'">'+r+"</a>")}},link:{txtExec:function(t,e){var n=e&&e.indexOf("http://")>-1?null:e,i=prompt(this._("Enter URL:"),n?"http://":e),r=prompt(this._("Enter the displayed text:"),n||i)||i;i&&this.insertText('<a href="'+i+'">'+r+"</a>")}},quote:{txtExec:["<blockquote>","</blockquote>"]},youtube:{txtExec:function(e){var n=this;t.sceditor.command.get("youtube")._dropDown(n,e,function(t){n.insertText('<iframe width="560" height="315" src="http://www.youtube.com/embed/{id}?wmode=opaque" data-youtube-id="'+t+'" frameborder="0" allowfullscreen></iframe>')})}},rtl:{txtExec:['<div stlye="direction: rtl;">',"</div>"]},ltr:{txtExec:['<div stlye="direction: ltr;">',"</div>"]}};e.commands=t.extend(!0,{},n,e.commands)},a.signalToSource=function(e,i){return i=i.jquery?i[0]:i,t(i).find(".sceditor-selection").remove(),n(i),r(i),s(i),(new t.sceditor.XHTMLSerializer).serialize(i,!0)},a.signalToWysiwyg=function(t){return t},a.convertTagTo=function(t,e){for(var n,i,r=t.attributes.length,o=t.ownerDocument.createElement(e);r--;)i=t.attributes[r],o.setAttribute(i.name,i.value);for(;n=t.firstChild;)o.appendChild(n);return t.parentNode.replaceChild(o,t),o},i=function(e,n){c[e]&&t.each(c[e],function(i,r){r.tags[e]?t.each(r.tags[e],function(e,i){void 0!==n.attr(e)&&(i&&0>t.inArray(n.attr(e),i)||r.conv.call(a,n[0]))}):r.conv&&r.conv.call(a,n[0])})},n=function(e){c&&t.sceditor.dom.traverse(e,function(e){var n=t(e),r=e.nodeName.toLowerCase();c&&(i("*",n),i(r,n))},!0)},r=function(e){t.sceditor.dom.traverse(e,function(e){var n=e.nodeName.toLowerCase(),i=t.sceditor.plugins.xhtml.allowedTags,r=t.sceditor.plugins.xhtml.disallowedTags;4===e.nodeType?n="!cdata":("!"===n||8===e.nodeType)&&(n="!comment"),i&&i.length&&3!==e.nodeType?0>t.inArray(n,i)&&e.parentNode&&e.parentNode.removeChild(e):r&&r.length&&3!==e.nodeType&&t.inArray(n,r)>-1&&e.parentNode&&e.parentNode.removeChild(e)})},o=function(e,n){var i={};return e&&t.extend(i,e),n?(t.each(n,function(e,n){t.isArray(i[e])?t.isArray(n)&&(i[e]=t.merge(i[e],n)):i[e]=n}),i):i},s=function(e){l={},t.sceditor.dom.traverse(e,function(e){if(e.attributes){var n,i,r=e.nodeName.toLowerCase(),s=t.sceditor.plugins.xhtml.allowedAttribs,a=t.sceditor.plugins.xhtml.disallowedAttribs,c=e.attributes.length;if(s&&!t.isEmptyObject(s)&&c)for(l[r]||(l[r]=o(s["*"],s[r]));c--;)n=e.attributes[c],i=l[r][n.name]===void 0,t.isArray(l[r][n.name])&&0>t.inArray(n.value,l[r][n.name])&&(i=!0),i&&e.removeAttribute(n.name);else if(a&&!t.isEmptyObject(a)&&c)for(l[r]||(l[r]=o(a["*"],a[r]));c--;)n=e.attributes[c],i=l[r][n.name]!==void 0,t.isArray(l[r][n.name])&&t.inArray(n.value,l[r][n.name])>-1&&(i=!0),i&&e.removeAttribute(n.name)}})}},t.sceditor.plugins.xhtml.converters=[{tags:{"*":{width:null}},conv:function(e){var n=t(e);n.css("width",n.attr("width")).removeAttr("width")}},{tags:{"*":{height:null}},conv:function(e){var n=t(e);n.css("height",n.attr("height")).removeAttr("height")}},{tags:{li:{value:null}},conv:function(e){t(e).removeAttr("value")}},{tags:{"*":{text:null}},conv:function(e){var n=t(e);n.css("color",n.attr("text")).removeAttr("text")}},{tags:{"*":{size:null}},conv:function(e){var n=t(e);n.css("font-size",n.css("font-size")).removeAttr("size")}},{tags:{"*":{color:null}},conv:function(e){var n=t(e);n.css("color",n.attr("color")).removeAttr("color")}},{tags:{"*":{face:null}},conv:function(e){var n=t(e);n.css("font-family",n.attr("face")).removeAttr("face")}},{tags:{"*":{language:null}},conv:function(e){var n=t(e),i=n.attr("language");/jscript|javascript|js/i.test(i)?n.attr("type","text/javascript"):/vb/i.test(i)&&n.attr("type","text/vbscript"),n.removeAttr("language")}},{tags:{"*":{align:null}},conv:function(e){var n=t(e);n.css("text-align",n.attr("align")).removeAttr("align")}},{tags:{"*":{border:null}},conv:function(e){var n=t(e);n.css("border-size",n.attr("border")).removeAttr("border")}},{tags:{applet:{name:null},img:{name:null},layer:{name:null},map:{name:null},object:{name:null},param:{name:null}},conv:function(e){t(e).removeAttr("name")}},{tags:{hr:{noshade:null}},conv:function(e){var n=t(e);n.css("border-style","solid").removeAttr("noshade")}},{tags:{"*":{nowrap:null}},conv:function(e){var n=t(e);n.css("white-space","nowrap").removeAttr("nowrap")}},{tags:{big:null},conv:function(e){t(this.convertTagTo(e,"span")).css("font-size","larger")}},{tags:{small:null},conv:function(e){t(this.convertTagTo(e,"span")).css("font-size","smaller")}},{tags:{b:null},conv:function(e){t(this.convertTagTo(e,"strong"))}},{tags:{u:null},conv:function(e){t(this.convertTagTo(e,"span")).css("text-decoration","underline")}},{tags:{i:null},conv:function(e){t(this.convertTagTo(e,"em"))}},{tags:{s:null,strike:null},conv:function(e){t(this.convertTagTo(e,"span")).css("text-decoration","line-through")}},{tags:{dir:null},conv:function(t){this.convertTagTo(t,"ul")}},{tags:{center:null},conv:function(e){t(this.convertTagTo(e,"div")).css("text-align","center")}},{tags:{font:null},conv:function(t){this.convertTagTo(t,"span")}}],t.sceditor.plugins.xhtml.allowedAttribs={},t.sceditor.plugins.xhtml.disallowedAttribs={},t.sceditor.plugins.xhtml.allowedTags=[],t.sceditor.plugins.xhtml.disallowedTags=[]})(jQuery);
10 src/jquery.sceditor.js
View
@@ -1,8 +1,9 @@
+/*! SCEditor | (C) 2011-2013, Sam Clarke | sceditor.com/license */
/**
* SCEditor
- * http://www.samclarke.com/2011/07/sceditor/
+ * http://www.sceditor.com/
*
- * Copyright (C) 2011-2012, Sam Clarke (samclarke.com)
+ * Copyright (C) 2011-2013, Sam Clarke (samclarke.com)
*
* SCEditor is licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
@@ -702,7 +703,7 @@
* @private
*/
autofocus = function() {
- var rng, marker, elm, txtPos,
+ var rng, elm, txtPos,
doc = getWysiwygDoc(),
body = doc.body,
focusEnd = !!base.opts.autofocusEnd;
@@ -2080,8 +2081,7 @@
*/
handleWindowResize = function() {
var height = base.opts.height,
- width = base.opts.width,
- parent = $editorContainer.parent().height();
+ width = base.opts.width;
if(!base.maximize())
{
7 src/plugins/bbcode.js
View
@@ -1,15 +1,16 @@
+/*!pl SCEditor | (C) 2011-2013, Sam Clarke | sceditor.com/license */
/**
* SCEditor BBCode Plugin
- * http://www.samclarke.com/2011/07/sceditor/
+ * http://www.sceditor.com/
*
- * Copyright (C) 2011-2012, Sam Clarke (samclarke.com)
+ * Copyright (C) 2011-2013, Sam Clarke (samclarke.com)
*
* SCEditor is licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* @fileoverview SCEditor BBCode Plugin
* @author Sam Clarke
- * @version 1.4.1
+ * @version 1.4.2
* @requires jQuery
*/
7 src/plugins/xhtml.js
View
@@ -1,14 +1,15 @@
+/*!pl SCEditor | (C) 2011-2013, Sam Clarke | sceditor.com/license */
/**
* SCEditor XHTML Plugin
* http://www.sceditor.com/
*
- * Copyright (C) 2011-2012, Sam Clarke (samclarke.com)
+ * Copyright (C) 2011-2013, Sam Clarke (samclarke.com)
*
* SCEditor is licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* @author Sam Clarke
- * @version 1.4.1
+ * @version 1.4.2
* @requires jQuery
*/
@@ -701,7 +702,7 @@
{
attr = node.attributes[attrsLength];
removeAttr = typeof attrsCache[tagName][attr.name] !== 'undefined';
-
+// this should check if only certian values so should be === null?
if($.isArray(attrsCache[tagName][attr.name]) && $.inArray(attr.value, attrsCache[tagName][attr.name]) > -1)
removeAttr = true;
Please sign in to comment.
Something went wrong with that request. Please try again.