var Parchment=(function(){function f(l,i){var j=document.getElementById(l);if(!j){return}this.parchment=document.createElement("div");this.parchment.setAttribute("id","parchment");this.parchment.setAttribute("class","parchment-2");this.parchment.addEvents({keypress:function(m){m.stopPropagation()},keydown:function(m){m.stopPropagation()},keyup:function(m){m.stopPropagation()}});j.parentNode.insertBefore(this.parchment,j);if(j.tagName.test(/textarea/i)){this.textarea=j;this.editor=document.createElement("div");this.editor.innerHTML=j.value}else{this.editor=j;this.textarea=document.createElement("textarea");this.textarea.innerHTML=j.innerHTML}this.parchment.appendChild(this.editor);this.parchment.appendChild(this.textarea);this.setBrowser();this.editor.setAttribute("class","editor wiki-content");this.editor.setAttribute("contenteditable","true");this.attributes_whitelist={};this.empty_node_whitelist={br:function(){return true},img:function(){return true},hr:function(){return true}};this.node_tree=[];this.tag_tree=[];this.options=i||{};this.options.toolbar=this.options.toolbar||"full";this.plugins=[];this.observeEvents();this.loadPlugins();this.buildToolbar();this.clean({add_paragraphs:true,first_clean:true});document.fireEvent("parchmentready",this);if(this.browser.mozilla||this.browser.webit){document.execCommand("styleWithCSS",false,false);document.execCommand("enableObjectResizing",false,false)}function h(s){if(s.originalTarget!=document.documentElement){return}var u=s.keyCode||s.charCode;var n=s.shiftKey===true;var r=s.ctrlKey===true;var o=s.altKey===true;var p=s.metaKey===true;var t=Math.round(0.9*window.innerHeight);var q=50;var m=k(u,n,r,o,p);switch(m){case k(38,false,false,false,false):window.scrollBy(0,-q);break;case k(40,false,false,false,false):window.scrollBy(0,q);break;case k(33,false,false,false,false):case k(32,true,false,false,false):window.scrollBy(0,-t);break;case k(32,false,false,false,false):case k(34,false,false,false,false):window.scrollBy(0,t);break;default:return}s.preventDefault();s.stopPropagation()}function k(q,m,n,p,o){return[q,m,n,p,o].join(" ")}if(this.browser.mozilla){document.addEventListener("keypress",h)}}f.prototype.getSelectionObject=function(){var h;if(window.getSelection){h=window.getSelection()}else{if(document.selection){h=document.selection.createRange()}}return h};f.prototype.getRangeObject=function(i){i=i||this.getSelectionObject();var h;if(i.rangeCount>0){if(i.getRangeAt){return i.getRangeAt(0)}else{h=document.createRange();h.setStart(i.anchorNode,i.anchorOffset);h.setEnd(i.focusNode,i.focusOffset);return h}}else{h=document.createRange();h.setStart(this.editor,0);h.setEnd(this.editor,0);return h}};f.prototype.saveSelection=function(){var h=this.getSelectionObject();if(h.anchorNode){this.range=this.getRangeObject()}};f.prototype.restoreSelection=function(){if(!this.range){this.saveSelection()}var h=this.getSelectionObject();h.removeAllRanges();h.addRange(this.range)};f.prototype.setBrowser=function(){function h(k){k=k.toLowerCase();var m=/(webkit)[ \/]([\w.]+)/,o=/(opera)(?:.*version)?[ \/]([\w.]+)/,l=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/;var j=m.exec(k)||o.exec(k)||l.exec(k)||k.indexOf("compatible")<0&&n.exec(k)||[];return{browser:j[1]||"",version:j[2]||"0"}}var i=h(navigator.userAgent);if(i.browser){this.browser={};this.browser[i.browser]=true;this.browser.version=i.version;this.browser.ios=!!navigator.userAgent.match(/ip(?:ad|od|hone)/i)}};var d=function(i,j){var h=document.createElement("button");h.setProperty("type","button");h.setProperty("class",i.replace(" ","-").toLowerCase());h.setProperty("title",i);h.appendChild(document.createTextNode(i));h.addEvent("click",function(k){k.stop();j.callback(arguments)}.bind(j));return h};f.prototype.buildToolbar=function(){this.toolbar=document.createElement("div");this.toolbar.setAttribute("class","toolbar");this.editor.parentNode.appendChild(this.toolbar);this.options.plugins_display=this.options.plugins_display||Object.keys(Object.filter(this.options.plugins,function(n,i){return n.type&&n.type=="button"}));for(var m=0;m<this.options.plugins_display.length;m++){var j=this.options.plugins_display[m],h,l=document.createElement("span");(function(){if(j instanceof Array){for(var p=0;p<j.length;p++){l.appendChild(d(j[p],this.options.plugins[j[p]]))}this.toolbar.appendChild(l)}else{if(j instanceof Object){switch(j.type){case ("dropdown"):l.setAttribute("class","dropdown");var q=document.createElement("button");q.setAttribute("type","button");q.appendChild(document.createTextNode("Paragraph"));l.appendChild(q);var o=document.createElement("ul");for(p=0;p<j.buttons.length;p++){var n=document.createElement("li");n.appendChild(d(j.buttons[p],this.options.plugins[j.buttons[p]]));o.appendChild(n)}l.appendChild(o);this.toolbar.appendChild(l);break;case ("more"):if(!this.more_toggle){this.more_toggle=document.createElement("button");this.more_toggle.setAttribute("class","more");if(Cookie.read("parchmentmoreoptions")){this.more_toggle.addClass("open")}this.more_toggle.setAttribute("type","button");if(this.toolbar.firstChild){this.toolbar.insertBefore(this.more_toggle,this.toolbar.firstChild)}else{this.toolbar.appendChild(this.more_toggle)}this.more_toolbar=document.createElement("div");this.more_toolbar.setAttribute("class","toolbar more");if(Cookie.read("parchmentmoreoptions")){this.more_toolbar.addClass("open")}this.editor.parentNode.appendChild(this.more_toolbar);this.more_toggle.addEvent("click",function(i){i.stop();this.more_toolbar.toggleClass("open");this.more_toggle.toggleClass("open");if(this.more_toggle.hasClass("open")){Cookie.write("parchmentmoreoptions",true,{duration:365})}else{Cookie.dispose("parchmentmoreoptions")}var r=this.toolbar.getSize().y;if(this.more_toolbar){r+=this.more_toolbar.getSize().y}this.parchment.setStyle("padding-top",r)}.bind(this))}for(p=0;p<j.buttons.length;p++){l.appendChild(d(j.buttons[p],this.options.plugins[j.buttons[p]]))}this.more_toolbar.appendChild(l);break;default:break}}else{this.toolbar.appendChild(d(j,this.options.plugins[j]))}}}).apply(this);var k=this.toolbar.getSize().y;if(this.more_toolbar){this.more_toolbar.setStyle("top",k);k+=this.more_toolbar.getSize().y}this.parchment.setStyle("padding-top",k)}};f.prototype.loadPlugins=function(){for(var h in this.options.plugins){(function(){var k=this.options.plugins[h],i;k.parchment=this;if(k.init){k.init()}if(k.attributes_whitelist){for(i in k.attributes_whitelist){if(this.attributes_whitelist[i]){for(var j in k.attributes_whitelist[i]){if(this.attributes_whitelist[i][j]){if(this.attributes_whitelist[i][j] instanceof Array){this.attributes_whitelist[i][j].push(k.attributes_whitelist[i][j])}else{this.attributes_whitelist[i][j]=[this.attributes_whitelist[i][j],k.attributes_whitelist[i][j]]}}else{this.attributes_whitelist[i][j]=k.attributes_whitelist[i][j]}}}else{this.attributes_whitelist[i]=k.attributes_whitelist[i]}}}if(k.empty_node_whitelist){for(i in k.empty_node_whitelist){if(this.empty_node_whitelist[i]){if(this.empty_node_whitelist[i] instanceof Array){this.empty_node_whitelist[i].push(k.attributes_whitelist[i][j])}else{this.empty_node_whitelist[i][j]=[this.empty_node_whitelist[i],k.empty_node_whitelist[i]]}}else{this.empty_node_whitelist[i]=k.empty_node_whitelist[i]}}}}).apply(this)}};f.prototype.observeEvents=function(){this.editor.addEvents({keypress:g.bind(this),keyup:e.bind(this),keydown:b.bind(this),mouseup:a.bind(this)});document.addEvents({scroll:this.fixToolbar.bind(this)});if(this.textarea.form){this.textarea.form.addEvent("submit",function(h){this.editor.focus();this.clean();this.editor.blur()}.bind(this))}if(document.addEventListener){document.addEventListener("paste",c.bind(this),false)}else{if(this.IF.contentWindow.document.attachEvent){document.body.attachEvent("onpaste",c.bind(this))}}};f.prototype.fixToolbar=function(){var h=window.getScroll().y,i=this.parchment.getCoordinates(),j=this.toolbar.getSize().y;if(this.more_toolbar){j+=this.more_toolbar.getSize().y}if(h>i.top&&h+j<i.top+i.height){this.toolbar.addClass("fixed");this.toolbar.setStyle("width",i.width-2);if(this.more_toolbar){this.more_toolbar.addClass("fixed");this.more_toolbar.setStyle("width",i.width-2)}}else{this.toolbar.removeClass("fixed");this.toolbar.setStyle("width","100%");if(this.more_toolbar){this.more_toolbar.removeClass("fixed");this.more_toolbar.setStyle("width","100%")}}};var c=function(h){if(document.activeElement!==this.editor){return}var i=this;setTimeout(function(){for(var j in i.options.plugins){(function(){var k=this.options.plugins[j];if(typeof k.handlePaste!=="undefined"){k.handlePaste.apply(this)}}).apply(i)}i.clean({add_paragraphs:true})},1)};var g=function(m){var i=this.getSelectionObject(),j=this.getRangeObject(i),h=false,l=i.anchorNode;if(m.key=="enter"){while(l!=this.editor){if(l.parentNode.tagName.test(/h\d/i)){h=true;break}l=l.parentNode}if(!h){l=i.focusNode;while(l!=this.editor){if(l.parentNode.tagName.test(/h\d/i)){h=true;break}l=l.parentNode}}if(h){if(!i.isCollapsed){document.execCommand("delete",false,false);i=window.getSelection()}var n=l.parentNode,k=document.createElement("p");if(i.anchorOffset===0){this.editor.insertBefore(k,n)}else{if(n.nextSibling){this.editor.insertBefore(k,n.nextSibling)}else{this.editor.appendChild(k)}}k.innerHTML="&nbsp;";j.setStartBefore(k);j.setEndBefore(k);i.removeAllRanges();i.addRange(j);m.preventDefault();return}else{if(this.getParentBlockElement(i.anchorNode).tagName.test(/^(li|ol|ul|blockquote)$/i)){return}else{if(!this.getParentBlockElement(i.anchorNode).tagName.test(/^p$/i)){if(this.browser.webkit){m.preventDefault();document.execCommand("insertLineBreak",false,false)}else{if(this.browser.msie){m.preventDefault();document.selection.createRange().pasteHTML("<br>")}}return}}}}};var e=function(m){if(m.key.test(/backspace|delete|left|right|down|up/)){this.buildNodeTree()}var h=this.getSelectionObject(),i=this.getRangeObject(h),l=h.anchorNode,k=false,j=false;if(!h.anchorNode){return}if(m.key=="backspace"||m.key=="delete"){while(l&&l!=this.editor){if(l.className&&l.className.test(/js-item-cage/i)){k=l}if(l.nodeName&&l.nodeName.test(/h\d/i)){j=l}l=l.parentNode}if(!this.inCage&&k){document.execCommand("undo",false,false);if(k.previousSibling){i.selectNodeContents(k.previousSibling);i.collapse(true);h.removeAllRanges();h.addRange(i)}}if(!this.inHeader&&j){document.execCommand("undo",false,false);i.collapse(true);h.removeAllRanges();h.addRange(i)}}if(h.anchorNode.nodeType==Node.TEXT_NODE&&(h.anchorNode.parentNode==this.editor)){document.execCommand("formatblock",false,"<P>");i.setStartAfter(h.anchorNode);i.setEndAfter(h.anchorNode);h.removeAllRanges();h.addRange(i)}this.saveSelection()};var b=function(j){if(j.key=="tab"){j.preventDefault()}else{if(this.browser.mozilla&&["left","right","b","i"].inArray(j.key)>=0&&(j.meta||j.control)){j.preventDefault()}else{if((j.meta||j.control)&&j.key=="z"){j.stop();document.execCommand("undo",null,null)}else{if((j.meta||j.control)&&j.shift&&j.key=="z"){j.stop();document.execCommand("redo",null,null)}else{if(j.key=="backspace"||j.key=="delete"){this.inCage=false;this.inHeader=false;var h=this.getSelectionObject(),i=h.anchorNode;while(i&&i!=this.editor){if(i.className&&i.className.test(/js-item-cage/i)){this.inCage=true}if(i.nodeName&&i.nodeName.test(/h\d/i)){this.inHeader=true}i=i.parentNode}}}}}}};var a=function(h){this.buildNodeTree();this.saveSelection()};f.prototype.addParagraphs=function(h){var i=h.firstChild,j=false;while(i){if(this.isBlockElement(i)){j=false;if(i.nodeName.toLowerCase()=="br"){br=i;i=i.nextSibling;br.parentNode.removeChild(br);continue}if(i.nodeName.toLowerCase()=="p"&&i.getElementsByTagName("br").length>0){if(i.nextSibling){i.parentNode.insertBefore(document.createElement("br"),i.nextSibling)}else{i.parentNode.appendChild(document.createElement("br"))}while(i.lastChild){if(i.nextSibling){i.parentNode.insertBefore(i.lastChild,i.nextSibling)}else{i.parentNode.appendChild(i.lastChild)}}continue}}else{if(!j){j=document.createElement("p");i.parentNode.insertBefore(j,i)}j.appendChild(i)}i=j?j.nextSibling:i.nextSibling}};f.prototype.clean=function(o){o=o||{};this.editor.fireEvent("beforeclean",this);function n(H,k){if(!(k instanceof Array)){k=[k]}for(var j=0;j<k.length;j++){if(H.test(k[j])){return true}}return false}var v=this.editor.innerHTML,h=document.createElement("div"),q=true,l,p=!!o.add_paragraphs;h.innerHTML=v;while(q){l=v=h.innerHTML;v=v.replace(/<!--[\s\S]*?-->/g,"");v=v.replace(/<\/*(font|meta|link)([^>]*)>/gi,"");v=v.replace(/&nbsp;/gi," ");v=v.replace(/\s{2,}/g," ");while(v.test(/<([^\/][^>]*)>(\s+)/g)){v=v.replace(/<([^\/][^>]*)>(\s+)/g," <$1>")}while(v.test(/(\s+)<\/([^>]*)>/g)){v=v.replace(/(\s+)<\/([^>]*)>/g,"</$2> ")}v=v.replace(/\s*<(\/*(ADDRESS|BLOCKQUOTE|BR|DIV|DL|FIELDSET|FORM|H1|H2|H3|H4|H5|H6|HR|NOSCRIPT|OL|P|PRE|TABLE|UL|DD|DT|LI|TBODY|TD|TFOOT|TH|THEAD|TR)[^>]*)>\s*/gi,"<$1>");h.innerHTML=v;var w=h.getElementsByTagName("*"),B,x;for(B=w.length-1;B>=0;B--){x=w[B];var m=x.tagName.toLowerCase();if(m=="style"){x.parentNode.removeChild(x);continue}if(m=="br"&&(!x.nextSibling||!x.previousSibling)){x.parentNode.removeChild(x);continue}if(x.childNodes.length===0){var u=false;if(this.empty_node_whitelist[m]){if(this.empty_node_whitelist[m] instanceof Array){for(var C=0;C<this.empty_node_whitelist[m].length;C++){u=this.empty_node_whitelist[m][C](x);if(u){break}}}else{u=this.empty_node_whitelist[m](x)}}if(!u){x.parentNode.removeChild(x);continue}}if(x.getProperty("style")){if(m=="span"){if(x.getStyle("font-style")=="italic"){new Element("i").inject(x,"before").grab(x)}if(x.getStyle("font-weight")=="bold"){new Element("b").inject(x,"before").grab(x)}if(x.getStyle("text-decoration")=="line-through"){new Element("strike").inject(x,"before").grab(x)}if(x.getStyle("text-decoration")=="underline"){new Element("u").inject(x,"before").grab(x)}}if(m=="b"&&x.getStyle("font-weight")=="normal"){var E=new Element("span",{html:x.get("html")}).inject(x,"before");x.destroy();x=E}}for(var y=x.attributes.length-1;y>=0;y--){if(!this.attributes_whitelist[m]||!this.attributes_whitelist[m][x.attributes[y].nodeName]||x.attributes[y].nodeName=="class"||!n(x.attributes[y].nodeValue,this.attributes_whitelist[m][x.attributes[y].nodeName])){if(this.attributes_whitelist[m]&&x.attributes[y].nodeName=="class"){var t=x.attributes[y].nodeValue.split(" "),r=[];for(var F=0;F<t.length;F++){if(n(t[F],this.attributes_whitelist[m][x.attributes[y].nodeName])){r.push(t[F])}}if(r.length>0){x.setAttribute(x.attributes[y].nodeName,r.join(" "))}else{x.removeAttribute(x.attributes[y].nodeName)}}else{x.removeAttribute(x.attributes[y].nodeName)}}}}x=h.lastChild;while(x){if(x.nodeType==Node.ELEMENT_NODE&&x.nodeName.test(/div|span/i)&&x.attributes.length===0){while(x.firstChild){x.parentNode.insertBefore(x.firstChild,x)}}x=x.previousSibling}this.addParagraphs(h);for(B=0;B<h.getElementsByTagName("p").length;B++){var D=h.getElementsByTagName("p")[B],z;for(z=0;z<D.getElementsByTagName("span").length;z++){var A=D.getElementsByTagName("span")[z];if(A.attributes.length===0){while(A.firstChild){A.parentNode.insertBefore(A.firstChild,A)}A.parentNode.removeChild(A)}}for(z=0;z<D.getElementsByTagName("a").length;z++){var G=h.getElementsByTagName("a")[z];if(G.attributes.length===0){while(G.firstChild){G.parentNode.insertBefore(G.firstChild,G)}G.parentNode.removeChild(G)}}}if(l==h.innerHTML){q=false}}if(p){var s=document.createElement("p");s.innerHTML="<br>";if(!h.firstChild){h.appendChild(s.cloneNode(true))}else{if(!h.firstChild.nodeName.test(/(p|h\d)/i)){h.insertBefore(s.cloneNode(true),h.firstChild)}else{if(!h.firstChild.firstChild){h.firstChild.innerHTML="<br>"}}}if(!h.lastChild.nodeName.test(/(p|h\d)/i)){h.appendChild(s.cloneNode(true))}else{if(!h.lastChild.firstChild){h.lastChild.innerHTML="<br>"}}}this.textarea.value=h.innerHTML;if(o.first_clean){this.editor.innerHTML=h.innerHTML}else{if(this.browser.mozilla||this.browser.msie){this.editor.focus()}document.execCommand("selectAll",null,null);document.execCommand("delete",null,null);document.execCommand("selectAll",null,null);document.execCommand("delete",null,null);this.insertHTML(h.innerHTML)}this.buildNodeTree();this.editor.fireEvent("clean",this)};f.prototype.isBlockElement=function(h){return h.nodeName.test(/^(ADDRESS|BLOCKQUOTE|BR|DIV|DL|FIELDSET|FORM|H1|H2|H3|H4|H5|H6|HR|OL|P|PRE|TABLE|UL|DD|DT|LI|TBODY|TD|TFOOT|TH|THEAD|TR|OBJECT|EMBED)$/i)};f.prototype.getParentBlockElement=function(h){while(!this.isBlockElement(h)){h=h.parentNode}return h};f.prototype.selectBlock=function(){var i=this.getSelectionObject(),h=this.getRangeObject(i);h.setStart(h.startContainer,0);while(!this.isBlockElement(h.startContainer.parentNode)){h.setStart(h.startContainer.parentNode,0)}while(h.startContainer.previousSibling&&!this.isBlockElement(h.startContainer.previousSibling)){h.setStart(h.startContainer.previousSibling,0)}if(h.endContainer!=this.editor){h.setEnd(h.endContainer,h.endContainer.length);while(!this.isBlockElement(h.endContainer.parentNode)){h.setEnd(h.endContainer.parentNode,h.endContainer.parentNode.length)}while(h.endContainer.nextSibling&&!this.isBlockElement(h.endContainer.nextSibling)){h.setEnd(h.endContainer.nextSibling,h.endContainer.nextSibling.length)}}i.removeAllRanges();i.addRange(h)};f.prototype.insertHTML=function(h){if(!h){return}this.restoreSelection();if(this.browser.msie){document.selection.createRange().pasteHTML(h)}else{document.execCommand("insertHTML",false,h)}this.saveSelection()};f.prototype.insertCage=function(j){this.restoreSelection();var h=this.getSelectionObject(),i=this.getRangeObject(h),m="after";i.collapse(true);var l=i.startContainer,k=l;while(k.parentNode){if(k==this.editor){break}else{if(k==document.body){l=this.editor;break}}k=k.parentNode}while(l!=this.editor&&!l.nodeName.test(/^td|li$/i)&&l.parentNode!=this.editor&&!l.parentNode.nodeName.test(/^td|li$/i)){l=l.parentNode}while(!this.isBlockElement(l)&&l.previousSibling&&!this.isBlockElement(l.previousSibling)){l=l.previousSibling}if(l.nodeType==Node.TEXT_NODE||l.tagName.test(/p/i)){i.setStartBefore(l);i.setEndBefore(l);m="before"}else{if(l==this.editor){i.setStart(l,0);i.setEnd(l,0)}else{i.setStartAfter(l);i.setEndAfter(l)}}while(l.nodeType==Node.ELEMENT_NODE&&l.tagName.test(/^h\d$/i)){i.setStartAfter(l);i.setEndAfter(l);l=l.getNext();if(!l){break}}h.removeAllRanges();h.addRange(i);this.saveSelection();if(l.parentNode==this.editor){if(!l.previousSibling||!l.previousSibling.tagName.test(/p/i)){j="<p>&nbsp;</p>"+j}if(!l.nextSibling||!l.nextSibling.tagName.test(/p/i)){j=j+"<p>&nbsp;</p>"}else{if(l.nextSibling.tagName.test(/p/i)){j=j+"<p></p>"}}}this.insertHTML(j)};f.prototype.destroy=function(){};f.prototype.buildNodeTree=function(){var h=this.getSelectionObject(),i=h.anchorNode;if(!i){return}this.node_tree=[];this.tag_tree=[];while(i!=this.editor){this.node_tree.push(i);this.tag_tree.push(i.nodeName);i=i.parentNode;if(i==document){this.node_tree=[];this.tag_tree=[];break}}this.editor.fireEvent("nodetreechange",[this.tag_tree,this.node_tree])};return f})();Parchment.Plugins={Bold:{type:"button",init:function(){this.parchment.editor.addEvents({keydown:function(a){if((a.meta||a.control)&&a.key=="b"){a.stop();document.execCommand("bold",null,null)}},nodetreechange:function(a,b){if(a.contains("B")||a.contains("STRONG")){this.parchment.toolbar.getElement(".bold").addClass("on")}else{this.parchment.toolbar.getElement(".bold").removeClass("on")}}.bind(this)})},callback:function(){document.execCommand("bold",null,null);this.parchment.buildNodeTree()}},Italic:{type:"button",init:function(){this.parchment.editor.addEvents({keydown:function(a){if((a.meta||a.control)&&a.key=="i"){a.stop();document.execCommand("italic",null,null)}},nodetreechange:function(a,b){if(a.contains("I")||a.contains("EM")){this.parchment.toolbar.getElement(".italic").addClass("on")}else{this.parchment.toolbar.getElement(".italic").removeClass("on")}}.bind(this)})},callback:function(){document.execCommand("italic",null,null);this.parchment.buildNodeTree()}},Underline:{type:"button",init:function(){this.parchment.editor.addEvents({keydown:function(a){if((a.meta||a.control)&&a.key=="u"){a.stop();document.execCommand("underline",null,null)}},nodetreechange:function(a,b){if(a.contains("U")){this.parchment.toolbar.getElement(".underline").addClass("on")}else{this.parchment.toolbar.getElement(".underline").removeClass("on")}}.bind(this)})},callback:function(){document.execCommand("underline",null,null);this.parchment.buildNodeTree()}},Strikethrough:{type:"button",init:function(){this.parchment.editor.addEvents({nodetreechange:function(a,b){if(a.contains("STRIKE")){this.parchment.toolbar.getElement(".strikethrough").addClass("on")}else{this.parchment.toolbar.getElement(".strikethrough").removeClass("on")}}.bind(this)})},callback:function(){document.execCommand("strikethrough",null,null);this.parchment.buildNodeTree()}},"Ordered List":{type:"button",init:function(){this.parchment.editor.addEvents({nodetreechange:function(a,b){if(a.contains("OL")){this.parchment.toolbar.getElement(".ordered-list").addClass("on")}else{this.parchment.toolbar.getElement(".ordered-list").removeClass("on")}}.bind(this)})},callback:function(){document.execCommand("insertOrderedList",null,null);this.parchment.buildNodeTree()}},"Unordered List":{type:"button",init:function(){this.parchment.editor.addEvents({nodetreechange:function(a,b){if(a.contains("UL")){this.parchment.toolbar.getElement(".unordered-list").addClass("on")}else{this.parchment.toolbar.getElement(".unordered-list").removeClass("on")}}.bind(this)})},callback:function(){document.execCommand("insertUnorderedList",null,null);this.parchment.buildNodeTree()}},"Remove Format":{type:"button",callback:function(){document.execCommand("removeFormat",null,null);this.parchment.buildNodeTree()}},Clean:{type:"button",callback:function(a){this.parchment.clean({add_paragraphs:true})}}};function createParchment(c){var a=Parchment.Plugins,b=[{type:"dropdown",buttons:["Paragraph","Header 4","Header 3","Header 2"]},["Bold","Italic","Underline","Strikethrough"],["Unordered List","Ordered List"],["Blockquote"]],d={type:"more",buttons:["Remove Format","Code"]};if(c.toolbar!="wikid"){b.push(["Link","Image","Video","Table"]);d.buttons.push("Spoiler");d.buttons.push("Spoiler Block");d.buttons.push("HTML")}else{b.push(["Link","Image","Table"])}if(window.VINES_HAS_LISTS&&c.toolbar!="wikid"){d.buttons.push("List")}if(c.toolbar=="news"){d.buttons.push("Teaser")}if(window.VINES_USER_PERMISSION){d.buttons.push("Clean")}b.push(d);return new Parchment(c.id,{plugins:a,plugins_display:b,toolbar:c.toolbar,sizepicker:c.toolbar=="news"?"news":"wiki"})}if(!window.Node){window.Node={};Node.ELEMENT_NODE=1;Node.ATTRIBUTE_NODE=2;Node.TEXT_NODE=3;Node.CDATA_SECTION_NODE=4;Node.ENTITY_REFERENCE_NODE=5;Node.ENTITY_NODE=6;Node.PROCESSING_INSTRUCTION_NODE=7;Node.COMMENT_NODE=8;Node.DOCUMENT_NODE=9;Node.DOCUMENT_TYPE_NODE=10;Node.DOCUMENT_FRAGMENT_NODE=11;Node.NOTATION_NODE=12}if(!window.console){window.console={log:function(){}}}Array.prototype.inArray=function(c){if(this.indexOf){return this.indexOf(c)}for(var a=0,b=this.length;a<b;a++){if(this[a]===c){return a}}return -1};
