www-thermferm/jqwidgets/jqxeditor.js

Sun, 07 Jul 2019 14:31:10 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 07 Jul 2019 14:31:10 +0200
branch
stable
changeset 603
fcff55324b84
parent 511
2d1d43c3a2c2
child 617
b216f9d4b917
permissions
-rw-r--r--

Merged fix from default

/*
jQWidgets v4.5.2 (2017-May)
Copyright (c) 2011-2017 jQWidgets.
License: http://jqwidgets.com/license/
*/
!function(a){a.jqx.jqxWidget("jqxEditor","",{}),a.extend(a.jqx._jqxEditor.prototype,{defineInstance:function(){var b={width:null,height:null,disabled:!1,pasteMode:"html",editable:!0,lineBreak:"default",changeType:null,toolbarPosition:"top",fontFamily:"sans-serif",commands:{bold:{tooltip:"Bold",command:"bold",type:"toggleButton"},italic:{tooltip:"Italic",command:"italic",type:"toggleButton"},underline:{tooltip:"Underline",command:"underline",type:"toggleButton"},format:{placeHolder:"Format Block",tooltip:"Format Block",command:"formatblock",value:[{value:"p",label:"Paragraph"},{value:"h1",label:"Header 1"},{value:"h2",label:"Header 2"},{value:"h3",label:"Header 3"},{value:"h4",label:"Header 4"}],type:"list",width:120,dropDownWidth:190,height:25},font:{placeHolder:"Font",tooltip:"Font Name",command:"fontname",value:[{label:"Arial",value:"Arial, Helvetica, sans-serif"},{label:"Comic Sans MS",value:'"Comic Sans MS", cursive, sans-serif'},{label:"Courier New",value:'"Courier New", Courier, monospace'},{label:"Georgia",value:"Georgia,serif"},{label:"Impact",value:"Impact,Charcoal,sans-serif"},{label:"Lucida Console",value:"'Lucida Console',Monaco,monospace"},{label:"Tahoma",value:"Tahoma,Geneva,sans-serif"},{label:"Times New Roman",value:"'Times New Roman',Times,serif"},{label:"Trebuchet MS",value:'"Trebuchet MS",Helvetica,sans-serif'},{label:"Verdana",value:"Verdana,Geneva,sans-serif"}],type:"list",width:160,height:25,dropDownWidth:160},size:{placeHolder:"Size",tooltip:"Font Size",command:"fontsize",value:[{label:"1 (8pt)",value:"xx-small"},{label:"2 (10pt)",value:"x-small"},{label:"3 (12pt)",value:"small"},{label:"4 (14pt)",value:"medium"},{label:"5 (18pt)",value:"large"},{label:"6 (24pt)",value:"x-large"},{label:"7 (36pt)",value:"xx-large"}],type:"list",width:45,height:25,dropDownWidth:160},color:{tooltip:"Text Color",command:"forecolor",value:"#000",type:"colorPicker"},background:{tooltip:"Fill Color",command:"backcolor",value:"#fff",type:"colorPicker"},left:{tooltip:"Align Left",command:"justifyleft",type:"toggleButton"},center:{tooltip:"Align Center",command:"justifycenter",type:"toggleButton"},right:{tooltip:"Align Right",command:"justifyright",type:"toggleButton"},outdent:{tooltip:"Indent Less",command:"outdent",type:"button"},indent:{tooltip:"Indent More",command:"indent",type:"button"},ul:{tooltip:"Insert unordered list",command:"insertunorderedlist",type:"toggleButton"},ol:{tooltip:"Insert ordered list",command:"insertorderedlist",type:"toggleButton"},image:{tooltip:"Insert image",command:"insertimage",type:"button"},link:{tooltip:"Insert link",command:"createlink",type:"toggleButton"},html:{tooltip:"View source",command:"viewsource",type:"toggleButton"},clean:{tooltip:"Remove Formatting",command:"removeformat",type:"button"}},createCommand:null,defaultLocalization:{bold:"Bold",italic:"Italic",underline:"Underline",format:"Format Block",font:"Font Name",size:"Font Size",color:"Text Color",background:"Fill Color",left:"Align Left",center:"Align Center",right:"Align Right",outdent:"Indent Less",indent:"Indent More",ul:"Insert unordered list",ol:"Insert ordered list",image:"Insert image",link:"Insert link",html:"View source",clean:"Remove Formatting",Remove:"Remove",Ok:"Ok",Cancel:"Cancel",Change:"Change","Go to link":"Go to link","Open in a new window/tab":"Open in a new window/tab",Align:"Align",VSpace:"VSpace",HSpace:"HSpace",Width:"Width",Height:"Height",Title:"Title",URL:"URL","Insert Image":"Insert Image","Insert Link":"Insert Link","Alt Text":"Alt Text","not set":"&ltnot set&gt",Left:"Left",Right:"Right",Paragraph:"Paragraph",Header:"Header",Arial:"Arial","Comic Sans MS":"Comic Sans MS","Courier New":"Courier New",Georgia:"Georgia",Impact:"Impact","Lucida Console":"Lucida Console",Tahoma:"Tahoma","Times New Roman":"Times New Roman","Trebuchet MS":"Trebuchet MS",Verdana:"Verdana"},localization:null,tools:"bold italic underline | format font size | color background | left center right | outdent indent | ul ol | image | link | clean | html",readOnly:!1,stylesheets:new Array,rtl:!1,colorPickerTemplate:'<div class="jqx-editor-color-picker"><div role="grid"><table class="jqx-editor-color-picker-table" cellspacing="0" cellpadding="0"><tbody><tr><td aria-label="RGB (0, 0, 0)"><div title="RGB (0, 0, 0)" style="background-color: rgb(0, 0, 0);"></div></td><td aria-label="RGB (68, 68, 68)"><div title="RGB (68, 68, 68)" style="background-color: rgb(68, 68, 68);"></div></td><td aria-label="RGB (102, 102, 102)"><div title="RGB (102, 102, 102)" style="background-color: rgb(102, 102, 102);"></div></td><td aria-label="RGB (153, 153, 153)"><div title="RGB (153, 153, 153)" style="background-color: rgb(153, 153, 153);"></div></td><td aria-label="RGB (204, 204, 204)"><div title="RGB (204, 204, 204)" style="background-color: rgb(204, 204, 204);"></div></td><td aria-label="RGB (238, 238, 238)"><div title="RGB (238, 238, 238)" style="background-color: rgb(238, 238, 238);"></div></td><td aria-label="RGB (243, 243, 243)"><div title="RGB (243, 243, 243)" style="background-color: rgb(243, 243, 243);"></div></td><td aria-label="RGB (255, 255, 255)"><div title="RGB (255, 255, 255)" style="background-color: rgb(255, 255, 255);"></div></td></tr></tbody></table></div><div role="grid"><table class="jqx-editor-color-picker-table" cellspacing="0" cellpadding="0"><tbody><tr><td aria-label="RGB (255, 0, 0)"><div title="RGB (255, 0, 0)" style="background-color: rgb(255, 0, 0);"></div></td><td aria-label="RGB (255, 153, 0)"><div title="RGB (255, 153, 0)" style="background-color: rgb(255, 153, 0);"></div></td><td aria-label="RGB (255, 255, 0)"><div title="RGB (255, 255, 0)" style="background-color: rgb(255, 255, 0);"></div></td><td aria-label="RGB (0, 255, 0)"><div title="RGB (0, 255, 0)" style="background-color: rgb(0, 255, 0);"></div></td><td aria-label="RGB (0, 255, 255)"><div title="RGB (0, 255, 255)" style="background-color: rgb(0, 255, 255);"></div></td><td aria-label="RGB (0, 0, 255)"><div title="RGB (0, 0, 255)" style="background-color: rgb(0, 0, 255);"></div></td><td aria-label="RGB (153, 0, 255)"><div title="RGB (153, 0, 255)" style="background-color: rgb(153, 0, 255);"></div></td><td aria-label="RGB (255, 0, 255)"><div title="RGB (255, 0, 255)" style="background-color: rgb(255, 0, 255);"></div></td></tr></tbody></table></div><div role="grid"><table class="jqx-editor-color-picker-table" cellspacing="0" cellpadding="0"><tbody><tr><td aria-label="RGB (244, 204, 204)"><div title="RGB (244, 204, 204)" style="background-color: rgb(244, 204, 204);"></div></td><td aria-label="RGB (252, 229, 205)"><div title="RGB (252, 229, 205)" style="background-color: rgb(252, 229, 205);"></div></td><td aria-label="RGB (255, 242, 204)"><div title="RGB (255, 242, 204)" style="background-color: rgb(255, 242, 204);"></div></td><td aria-label="RGB (217, 234, 211)"><div title="RGB (217, 234, 211)" style="background-color: rgb(217, 234, 211);"></div></td><td aria-label="RGB (208, 224, 227)"><div title="RGB (208, 224, 227)" style="background-color: rgb(208, 224, 227);"></div></td><td aria-label="RGB (207, 226, 243)"><div title="RGB (207, 226, 243)" style="background-color: rgb(207, 226, 243);"></div></td><td aria-label="RGB (217, 210, 233)"><div title="RGB (217, 210, 233)" style="background-color: rgb(217, 210, 233);"></div></td><td aria-label="RGB (234, 209, 220)"><div title="RGB (234, 209, 220)" style="background-color: rgb(234, 209, 220);"></div></td></tr><tr><td id="T-Kw-Jn88" aria-label="RGB (234, 153, 153)"><div title="RGB (234, 153, 153)" style="background-color: rgb(234, 153, 153);"></div></td><td aria-label="RGB (249, 203, 156)"><div title="RGB (249, 203, 156)" style="background-color: rgb(249, 203, 156);"></div></td><td aria-label="RGB (255, 229, 153)"><div title="RGB (255, 229, 153)" style="background-color: rgb(255, 229, 153);"></div></td><td aria-label="RGB (182, 215, 168)"><div title="RGB (182, 215, 168)" style="background-color: rgb(182, 215, 168);"></div></td><td aria-label="RGB (162, 196, 201)"><div title="RGB (162, 196, 201)" style="background-color: rgb(162, 196, 201);"></div></td><td aria-label="RGB (159, 197, 232)"><div title="RGB (159, 197, 232)" style="background-color: rgb(159, 197, 232);"></div></td><td aria-label="RGB (180, 167, 214)"><div title="RGB (180, 167, 214)" style="background-color: rgb(180, 167, 214);"></div></td><td aria-label="RGB (213, 166, 189)"><div title="RGB (213, 166, 189)" style="background-color: rgb(213, 166, 189);"></div></td></tr><tr><td aria-label="RGB (224, 102, 102)"><div title="RGB (224, 102, 102)" style="background-color: rgb(224, 102, 102);"></div></td><td aria-label="RGB (246, 178, 107)"><div title="RGB (246, 178, 107)" style="background-color: rgb(246, 178, 107);"></div></td><td aria-label="RGB (255, 217, 102)"><div title="RGB (255, 217, 102)" style="background-color: rgb(255, 217, 102);"></div></td><td aria-label="RGB (147, 196, 125)"><div title="RGB (147, 196, 125)" style="background-color: rgb(147, 196, 125);"></div></td><td aria-label="RGB (118, 165, 175)"><div title="RGB (118, 165, 175)" style="background-color: rgb(118, 165, 175);"></div></td><td aria-label="RGB (111, 168, 220)"><div title="RGB (111, 168, 220)" style="background-color: rgb(111, 168, 220);"></div></td><td aria-label="RGB (142, 124, 195)"><div title="RGB (142, 124, 195)" style="background-color: rgb(142, 124, 195);"></div></td><td aria-label="RGB (194, 123, 160)"><div title="RGB (194, 123, 160)" style="background-color: rgb(194, 123, 160);"></div></td></tr><tr><td id="T-Kw-Jn104" aria-label="RGB (204, 0, 0)"><div title="RGB (204, 0, 0)" style="background-color: rgb(204, 0, 0);"></div></td><td aria-label="RGB (230, 145, 56)"><div title="RGB (230, 145, 56)" style="background-color: rgb(230, 145, 56);"></div></td><td aria-label="RGB (241, 194, 50)"><div title="RGB (241, 194, 50)" style="background-color: rgb(241, 194, 50);"></div></td><td aria-label="RGB (106, 168, 79)"><div title="RGB (106, 168, 79)" style="background-color: rgb(106, 168, 79);"></div></td><td aria-label="RGB (69, 129, 142)"><div title="RGB (69, 129, 142)" style="background-color: rgb(69, 129, 142);"></div></td><td aria-label="RGB (61, 133, 198)"><div title="RGB (61, 133, 198)" style="background-color: rgb(61, 133, 198);"></div></td><td aria-label="RGB (103, 78, 167)"><div title="RGB (103, 78, 167)" style="background-color: rgb(103, 78, 167);"></div></td><td aria-label="RGB (166, 77, 121)"><div title="RGB (166, 77, 121)" style="background-color: rgb(166, 77, 121);"></div></td></tr><tr><td aria-label="RGB (153, 0, 0)"><div title="RGB (153, 0, 0)" style="background-color: rgb(153, 0, 0);"></div></td><td aria-label="RGB (180, 95, 6)"><div title="RGB (180, 95, 6)" style="background-color: rgb(180, 95, 6);"></div></td><td aria-label="RGB (191, 144, 0)"><div title="RGB (191, 144, 0)" style="background-color: rgb(191, 144, 0);"></div></td><td aria-label="RGB (56, 118, 29)"><div title="RGB (56, 118, 29)" style="background-color: rgb(56, 118, 29);"></div></td><td aria-label="RGB (19, 79, 92)"><div title="RGB (19, 79, 92)" style="background-color: rgb(19, 79, 92);"></div></td><td aria-label="RGB (11, 83, 148)"><div title="RGB (11, 83, 148)" style="background-color: rgb(11, 83, 148);"></div></td><td aria-label="RGB (53, 28, 117)"><div title="RGB (53, 28, 117)" style="background-color: rgb(53, 28, 117);"></div></td><td aria-label="RGB (116, 27, 71)"><div title="RGB (116, 27, 71)" style="background-color: rgb(116, 27, 71);"></div></td></tr><tr><td aria-label="RGB (102, 0, 0)"><div title="RGB (102, 0, 0)" style="background-color: rgb(102, 0, 0);"></div></td><td aria-label="RGB (120, 63, 4)"><div title="RGB (120, 63, 4)" style="background-color: rgb(120, 63, 4);"></div></td><td aria-label="RGB (127, 96, 0)"><div title="RGB (127, 96, 0)" style="background-color: rgb(127, 96, 0);"></div></td><td aria-label="RGB (39, 78, 19)"><div title="RGB (39, 78, 19)" style="background-color: rgb(39, 78, 19);"></div></td><td aria-label="RGB (12, 52, 61)"><div title="RGB (12, 52, 61)" style="background-color: rgb(12, 52, 61);"></div></td><td aria-label="RGB (7, 55, 99)"><div title="RGB (7, 55, 99)" style="background-color: rgb(7, 55, 99);"></div></td><td aria-label="RGB (32, 18, 77)"><div title="RGB (32, 18, 77)" style="background-color: rgb(32, 18, 77);"></div></td><td aria-label="RGB (76, 17, 48)"><div title="RGB (76, 17, 48)" style="background-color: rgb(76, 17, 48);"></div></td></tr></tbody></table></div></div>',touchMode:!1,keyPressed:null,events:["change"]};return this===a.jqx._jqxEditor.prototype?b:(a.extend(!0,this,b),this.localization=this.defaultLocalization,b)},createInstance:function(c){var d=this;d.textArea=d.host;var e=d.host.attr("contenteditable");if(d.host.addClass(d.toThemeProperty("jqx-widget")),1==e||"true"==e){d.inline=!0,d.widget=d.host,d.editorDocument=document,d.selection=new b(d.editorDocument);var f=a("<div class='jqx-editor-toolbar-container' unselectable='on' aria-label='Formatting options' role='toolbar'><div class='jqx-editor-toolbar'></div>");f.insertBefore(d.host),d.toolbarContainer=f,d.toolbar=f.find(".jqx-editor-toolbar"),d.editor=d.host,d.contentEditableElement=d.element}else{var g=a("<div class='jqx-editor'><div class='jqx-editor-container'><div class='jqx-editor-toolbar-container' aria-label='Formatting options' role='toolbar'><div class='jqx-editor-toolbar'></div></div><div class='jqx-editor-content'><iframe  src='javascript:\"<html></html>\"' allowtransparency='true' frameborder='0'></iframe></div></div></div>");d.widget=g,d.widget[0].className=d.widget[0].className+" "+d.element.className;try{d.widget[0].style=d.element.style}catch(a){}var h=a.trim(d.host.html())+"&#8203;";"default"==d.lineBreak||"div"==d.lineBreak?h="<div>"+h+"</div>":"p"==d.lineBreak&&(h="<p>"+h+"</p>"),h=h.replace(/&lt;/gi,"<"),h=h.replace(/&gt;/gi,">"),d.host.css("display","none"),d.host.after(g),g.find("iframe").after(d.host),d.container=g.find(".jqx-editor-container"),d.toolbarContainer=g.find(".jqx-editor-toolbar-container"),d.toolbar=g.find(".jqx-editor-toolbar"),d.iframe=g.find("iframe"),d.content=g.find(".jqx-editor-content");var i=function(){d.editorDocument=d.iframe[0].contentWindow.document,d.selection=new b(d.editorDocument);var c=0;d.addHandler(d.iframe,"load",function(){if(c++,c>1){d.iframe.off("load"),d.content.find("iframe").remove();a("<iframe  src='javascript:\"<html></html>\"' allowtransparency='true' frameborder='0'></iframe>").appendTo(d.content);d.iframe=g.find("iframe"),i()}}),a.jqx.browser.mozilla||(d.editorDocument.designMode="On"),d.editorDocument.open();var e=d.rtl?"direction:rtl;":"",f=a.jqx.browser.msie?"::selection{color: #fff; background: #328EFD;};::-moz-selection{color: #fff; background: #328eD;};::selection:window-inactive {background: #c7c7c7; color: #000;}::-moz-selection:window-inactive {background: #c7c7c7; color: #000;}html{font-size:13px; height:100%;}body{padding-top:1px;margin-top:-1px; padding-right: 1px; overflow-x: hidden;word-wrap: break-word;-webkit-nbsp-mode: space;-webkit-line-break: after-white-space;":"";if(d.editorDocument.write("<!DOCTYPE html><html><head><meta charset='utf-8' /><style>html,body{padding:0; margin:0; font-size: 13px; font-family: "+d.fontFamily+"; background:#fff; min-height:100%; "+e+"}"+f+"}h1{font-size:2em;margin:.67em 0}h2{font-size: 1.5em; margin: .75em 0}h3{font-size: 1.17em; margin: .83em 0}h4{font-size:1em; margin: 1.12em 0 }h5{font-size: .83em; margin: 1.5em 0}h6{font-size: .75em; margin: 1.67em 0}p{margin: 0px;padding:0 .2em}ul,ol{padding-left:2.5em}a{color:#00a}code{font-size:1.23em}.jqx-editor-paste-element {position: absolute; left: -1000px; height: 1px; overflow: hidden; top: -1000px;}.jqx-editor-focus {border: 1px solid #aaa !important;}</style>"+a.map(d.stylesheets,function(a){return"<link rel='stylesheet' href='"+a+"'>"}).join("")+"</head><body autocorrect='off' contenteditable='true'></body></html>"),d.contentEditableElement=d.editorDocument.body,d.host.is("textarea")){d._textArea=d.element;var j=d.host.data();j.jqxEditor.host=g,j.jqxEditor.element=g[0],d.element=g[0],g[0].id=d._textArea.id,d._textArea.id=d._textArea.id+"TextArea",a(d.element).addClass(d.toThemeProperty("jqx-widget")),d.host=a(d.element),d.host.data(j)}else{var j=d.host.data();j.jqxEditor.host=g,j.jqxEditor.element=g[0],d.element=g[0],d.host=a(d.element),d.host.data(j)}try{d.editorDocument.execCommand("useCSS",!1,!1),d.editorDocument.execCommand("enableInlineTableEditing",null,!1)}catch(a){}try{d.editorDocument.execCommand("styleWithCSS",0,!0)}catch(a){}d.editorDocument.close(),d.editor=a(d.editorDocument.body),d.editor.html(h).attr("spellcheck",!1).attr("autocorrect","off")};i(),a.jqx.utilities.resize(d.host,function(){d.widget.css("width",d.width),d.widget.css("height",d.height),d._arrange()})}},focus:function(){var b=this;a.jqx.browser.mozilla&&(b.focused||(b.iframe&&b.iframe.focus(),b.selection.selectNode(b.editor[0].firstChild,!0),b.selection.getRange().collapse(!0))),b.editor.focus();var c=null!=b.range?b.range:b.getRange();b.selectRange(c)},print:function(){var a=window.open("","_blank","width=450,height=470,left=400,top=100,menubar=yes,toolbar=no,location=no,scrollbars=yes");a.document.open(),a.document.write('<!doctype html><html><head><title>Print</title></head><body onload="print();">'+this.val()+"</body></html>"),a.document.close()},refresh:function(b){var c=this;a.each(this.defaultLocalization,function(a,b){c.localization[a]||(c.localization[a]=b)}),c._removeHandlers(),c.toolbar.addClass(c.toThemeProperty("jqx-widget-header")),c.content?(c.widget.css("width",c.width),c.widget.css("height",c.height),c.widget.addClass(c.toThemeProperty("jqx-editor")),c.widget.addClass(c.toThemeProperty("jqx-widget")),c.widget.addClass(c.toThemeProperty("jqx-rc-all")),c.widget.addClass(c.toThemeProperty("jqx-widget-header")),c.content.addClass(c.toThemeProperty("jqx-widget-content")),c.container.addClass(c.toThemeProperty("jqx-editor-container"))):(c.toolbarContainer.addClass(c.toThemeProperty("jqx-widget-header")),c.toolbarContainer.addClass(c.toThemeProperty("jqx-editor-toolbar-inline")),c.toolbarContainer.addClass(c.toThemeProperty("jqx-widget")),c.toolbarContainer.addClass(c.toThemeProperty("jqx-rc-all")),c.toolbarContainer.hide(),c.toolbarContainer.css("position","absolute"),c.editor.addClass(c.toThemeProperty("jqx-editor-inline")),c.toolbarContainer.css("width",c.host.outerWidth()+"px"));var d=c.toolbarContainer.index();if("top"==c.toolbarPosition&&0!=d||"bottom"==c.toolbarPosition&&1!=d)switch(c.toolbarPosition){case"bottom":c.toolbarContainer.insertAfter(c.content);break;case"top":default:c.toolbarContainer.insertBefore(c.content)}var e=c.tools;if(e!==!1){var f=e.split(" "),g=e.split(" | "),h=function(b,d){a.each(d,function(e,f){var g=c.commands[this];if(g){if(c.createCommand){var h=c.createCommand(this.toString());g=a.extend(g,h)}}else{if(!c.createCommand)return!0;if(g=c.createCommand(this.toString()),!g)return!0;c.commands[this]||(c.commands[this]=g)}switch(c.localization[this]&&(g.tooltip=c.localization[this]),g.type){case"list":g.widget&&g.widget.jqxDropDownList("destroy");var i=function(a,b,c){return"formatblock"==g.command?"<"+c+' unselectable="on" style="padding: 0px; margin: 0px;">'+b+"</"+c+">":"fontname"==g.command?'<span unselectable="on" style="font-family: '+c+';">'+b+"<span>":"fontsize"==g.command?'<span unselectable="on" style="font-size: '+c+';">'+b+"<span>":void 0},j=function(){var a=c.toThemeProperty("jqx-editor-toolbar-icon")+" "+c.toThemeProperty("jqx-editor-toolbar-icon-"+g.command),b="<div unselectable='on' style='margin-top: 0px; padding:0px;' class='"+a+"'></div>";return b},k="formatblock"==g.command||"fontname"==g.command||"fontsize"==g.command,l=g.value||[],m=new Array,n=g.placeHolder||"Please Choose:";"fontname"==g.command?a.each(l,function(){var a=c.localization[this.label];m.push({label:a,value:this.value})}):"formatblock"==g.command?(n=c.localization.format,a.each(l,function(){if(this.label.indexOf("Header")>=0)var a=this.label.replace("Header",c.localization.Header);else var a=c.localization[this.label];m.push({label:a,value:this.value})})):m=l;var o={enableBrowserBoundsDetection:!0,touchMode:c.touchMode,width:g.width||100,height:g.height||25,dropDownWidth:g.dropDownWidth||"auto",autoDropDownHeight:(g.value&&g.value.length)<12,placeHolder:n,source:m,theme:c.theme,keyboardSelection:!1,focusable:!1,disabled:c.disabled,rtl:c.rtl,selectionRenderer:"fontsize"==g.command?j:null,renderer:k?i:null},p="jqx-disableselect "+c.toThemeProperty("jqx-editor-dropdownlist")+" "+c.toThemeProperty("jqx-editor-toolbar-item"),q=a("<div unselectable='on' class='"+p+"'></div>");q.appendTo(b),q.jqxDropDownList(o),g.init&&g.init(q);var f=null,r=null,s="";c.addHandler(q,"mousedown",function(b){if(a(".jqx-editor-dropdownpicker").length>0&&a(".jqx-editor-dropdownpicker").jqxDropDownButton("close"),a(".jqx-editor-dropdownlist").length>0){var c=a(".jqx-editor-dropdownlist");a.each(c,function(b,c){c!=q[0]&&a(c).jqxDropDownList("close")})}}),c.addHandler(q,"open",function(a){c.focused||c.focus(),c.updating=!0,c.activeElement=q,f=q.val(),s=""}),c.addHandler(q,"change",function(b){c.updating=!1,c.activeElement=null,r=q.val(),s=b.args.type,a.jqx.browser.msie&&a.jqx.browser.version<9&&c.focus()}),c.addHandler(q,"close",function(a){c.updating=!1,c.activeElement=null,f!=r&&("mouse"!=s&&"keyboard"!=s||c._refreshTools())}),c._addCommandHandler(q,"change",g.command,null,g);break;case"colorPicker":g.widget&&(a(g.colorPicker).remove(),g.widget.jqxDropDownButton("destroy"));var t=a('<div unselectable="on" style="padding-top: 4px;"></div>').attr("id","picker-"+g.command),p="jqx-disableselect "+c.toThemeProperty("jqx-editor-dropdownpicker")+" "+c.toThemeProperty("jqx-editor-toolbar-item"),q=a("<div unselectable='on' class='"+p+"'></div>");q.appendTo(b),q.append(t),q.jqxDropDownButton({touchMode:c.touchMode,disabled:c.disabled,enableBrowserBoundsDetection:!0,width:g.width||45,height:g.height||25,rtl:c.rtl,focusable:!1,theme:c.theme});var u=a('<div unselectable="on" style="z-index: 55;">'),v=c.toThemeProperty("jqx-editor-toolbar-icon")+" "+c.toThemeProperty("jqx-editor-toolbar-icon-"+g.command),w=a("<div unselectable='on' class='"+v+"'></div>");u.append(w);var x=a('<div unselectable="on" class="jqx-editor-color-bar">').attr("id","bar-"+g.command).css("background-color",g.value);u.append(x),q.jqxDropDownButton("setContent",u),t.append(a(c.colorPickerTemplate)),g.colorPicker=t,g.init&&g.init(q),t.find("tr").attr("role","row").attr("unselectable","on"),t.find("td").attr("role","gridcell").attr("unselectable","on").css("-webkit-user-select","none"),t.find("div").attr("unselectable","on"),c.addHandler(q,"mousedown",function(b){if(a(".jqx-editor-dropdownlist").length>0&&a(".jqx-editor-dropdownlist").jqxDropDownList("close"),a(".jqx-editor-dropdownpicker").length>0){var c=a(".jqx-editor-dropdownpicker");a.each(c,function(b,c){c!=q[0]&&a(c).jqxDropDownButton("close")})}}),c.addHandler(q,"open",function(){c.focused||c.focus(),c.updating=!0,c.activeElement=t}),c.addHandler(q,"close",function(a){c.updating=!1,c.activeElement=null,f!=r&&("mouse"!=s&&"keyboard"!=s||c._refreshTools())}),c.addHandler(t,"keydown",function(b){var c=b.keyCode,d=a(t).find(".jqx-editor-color-picker-selected-cell"),e=t.find("tr"),f=e.length,h=d.parent().children().length,i=d.index(),j=-999,k=d.parent();switch(a.each(e,function(a,b){if(this==k[0])return j=a,!1}),c){case 27:q.jqxDropDownButton("close");break;case 13:a(d).trigger("mousedown");break;case 38:j--;break;case 40:j++;break;case 39:i++;break;case 37:i--}if(j>=0&&j<=f&&i>=0&&i<=h){var k=t.find("tr")[j],l=a(k).children()[i],m=a(l).children().css("background-color");g.val(m)}});var y=a(t).find("td");g.val=function(b){var d=c._rgbToHex(b);a.each(y,function(){var b=a(this).children().css("background-color"),e=c._rgbToHex(b);if(e==d)return y.removeClass("jqx-editor-color-picker-selected-cell"),a(this).addClass("jqx-editor-color-picker-selected-cell"),a("#bar-"+g.command).css("background",b),!1})},g.val(g.value),c._addCommandHandler(y,"mousedown",g.command,null,g);break;case"button":case"toggleButton":default:g.widget&&("button"==g.type?g.widget.jqxButton("destroy"):g.widget.jqxToggleButton("destroy"));var z=g.command,A=g.action,v=c.toThemeProperty("jqx-editor-toolbar-icon")+" "+c.toThemeProperty("jqx-editor-toolbar-icon-"+z),w=a("<div unselectable='on' class='"+v+"'></div>"),q=a("<div unselectable='on'></div>").addClass("jqx-disableselect").addClass(c.toThemeProperty("jqx-editor-toolbar-button"));g.init?z&&q.append(w):q.append(w),q.appendTo(b),"button"==g.type?q.jqxButton({disabled:c.disabled,rtl:c.rtl,theme:c.theme}):"toggleButton"==g.type&&q.jqxToggleButton({disabled:c.disabled,rtl:c.rtl,uiToggle:!1,theme:c.theme}),g.init&&g.init(q),g.toggled=!1,g.toggle=function(){g.toggled=!g.toggled},c.addHandler(q,"mousedown",function(a){return a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation(),!1}),a.jqx.mobile.isTouchDevice()?c._addCommandHandler(q,"mousedown",z,A,g):c._addCommandHandler(q,"click",z,A,g)}if(g.widget=q,q){try{""!=g.tooltip&&(g.widget.attr("title",g.tooltip),g.widget.attr("data-tooltip",g.tooltip)),g.command&&g.widget.attr("data-command",g.command),g.widget.attr("aria-label",g.tooltip)}catch(a){}"button"!=g.type&&"toggleButton"!=g.type||(d.length>2&&(0==e?(q.css("border-right-radius","0px"),q.addClass(c.toThemeProperty("jqx-rc-l"))):e==d.length-1&&(q.css("border-left-radius","0px"),q.addClass(c.toThemeProperty("jqx-rc-r"))),q.removeClass(c.toThemeProperty("jqx-rc-all"))),0!=e&&e!=d.length-1&&d.length>2?(q.css("border-left-radius","0px"),q.css("border-right-radius","0px"),q.removeClass(c.toThemeProperty("jqx-rc-all"))):2==d.length?(0==e?(q.css("border-right-radius","0px"),q.addClass(c.toThemeProperty("jqx-rc-l"))):(q.css("border-left-radius","0px"),q.addClass(c.toThemeProperty("jqx-rc-r"))),q.removeClass(c.toThemeProperty("jqx-rc-all"))):1==d.length&&q.css("margin-right","0px"))}})};if(c.toolbar.css("direction",this.rtl?"rtl":"ltr"),0==g.length)h(c.toolbar,f);else{for(var i=0;i<g.length;i++){var j=g[i],f=j.split(" "),k=c.toThemeProperty("jqx-editor-toolbar-group")+" "+c.toThemeProperty("jqx-fill-state-normal"),l=a("<div class='"+k+"'></div>");l.addClass(c.toThemeProperty("jqx-rc-all")),c.toolbar.append(l),h(l,f)}for(var m=c.toolbar.find(".jqx-editor-toolbar-group"),n=m.length,i=0;i<n;i++)0==a(m[i]).children().length&&a(m[i]).remove()}a.jqx.browser.msie&&a.jqx.browser.version<8&&(a(".jqx-editor-toolbar-group").css("float","left"),a(".jqx-editor-toolbar-group").children().css("float","left"),a(".jqx-editor-toolbar-group").css("zoom","1"),a(".jqx-editor-toolbar-group").children().css("zoom","1"))}c._arrange(),c._addHandlers()},_arrange:function(){var b=this;b.content&&(""==b.tools||0==b.tools?(b.content.height(b.container.outerHeight()-parseInt(b.container.css("padding-top"))-parseInt(b.container.css("padding-bottom"))-6),b.content.css("margin-top","4px"),b.toolbar.hide()):(b.toolbar.show(),b.content.css("margin-top","0px"),b.content.height(b.container.outerHeight()-b.toolbar.outerHeight()-parseInt(b.container.css("padding-top"))-parseInt(b.container.css("padding-bottom"))-2),"top"!=b.toolbarPosition&&(b.content.css("margin-top","4px"),b.content.css("margin-bottom","0px"))),a.jqx.browser.msie&&a.jqx.browser.version<8&&(b.content.css("margin-top","4px"),b.content.height(b.container.height()-b.toolbar.outerHeight()-2*parseInt(b.container.css("padding-bottom"))-10),b.content.width(b.container.width()-2*parseInt(b.container.css("padding-left"))-2)),b.editor.height()<b.content.height()&&b.editor.height(b.content.height()))},propertyChangedHandler:function(b,c,d,e){var f=b;if(void 0!=f.isInitialized&&0!=f.isInitialized&&"pasteMode"!=c&&"lineBreak"!=c&&"editable"!=c){if("disabled"==c&&b._refreshTools(),"width"==c||"height"==c||"toolbarPosition"==c)return void b._arrange();"theme"==c&&a.jqx.utilities.setTheme(d,e,b.host),b.refresh()}},selectRange:function(a){var b=this;a||(a=b.getRange()),b.selection.selectRange(a)},getRange:function(){var a=this;return a.selection.getRange()},getSelectedElement:function(){var a,b,c,d,e=this;try{if(e.editorDocument.getSelection){var f=e.editorDocument.getSelection();return a=f.getRangeAt(f.rangeCount-1),c=a.startContainer,d=a.endContainer,b=a.commonAncestorContainer,"#text"==c.nodeName&&(b=b.parentNode),"#text"==c.nodeName&&(c=c.parentNode),"body"==c.nodeName.toLowerCase()&&(c=c.firstChild),"#text"==d.nodeName&&(d=d.parentNode),"body"==d.nodeName.toLowerCase()&&(d=d.lastChild),c==d&&(b=c),d}if(e.editorDocument.selection){if(a=e.editorDocument.selection.createRange(),!a.duplicate)return null;b=a.parentElement();var g=a.duplicate(),h=a.duplicate();return g.collapse(!0),h.moveToElementText(g.parentElement()),h.setEndPoint("EndToStart",g),c=g.parentElement(),g=a.duplicate(),h=a.duplicate(),h.collapse(!1),g.moveToElementText(h.parentElement()),g.setEndPoint("StartToEnd",h),d=h.parentElement(),"body"==c.nodeName.toLowerCase()&&(c=c.firstChild),"body"==d.nodeName.toLowerCase()&&(d=d.lastChild),c==d&&(b=c),d}}catch(a){return null}return null},_addHandlers:function(){var b=this;b.addHandler(b.toolbar,"mousedown.editor"+b.element.id,function(a){return a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation(),!1});var c=function(){if(b._textArea&&(b.updating||(b._textArea.value=b.val())),b.changed&&(b._raiseEvent("change"),b.changed=!1),b.focused=!1,b.inline){if(b.host.removeClass(b.toThemeProperty("jqx-fill-state-focus")),b.host.removeClass(b.toThemeProperty("jqx-editor-inline-focus")),""==b.tools||null==b.tools)return;b.toolbarContainer.fadeOut("fast")}},d=function(){if(b.focused=!0,b.inline){if(b.host.addClass(b.toThemeProperty("jqx-fill-state-focus")),b.host.addClass(b.toThemeProperty("jqx-editor-inline-focus")),b.host.addClass(b.toThemeProperty("jqx-rc-all")),""==b.tools||null==b.tools)return;b.toolbarContainer.fadeIn("fast");var a=b.host.coord();"bottom"!=b.toolbarPosition?b.toolbarContainer.offset({left:a.left,top:a.top-b.toolbarContainer.outerHeight()-5}):b.toolbarContainer.offset({left:a.left,top:a.top+5+b.host.height()})}};a.jqx.browser.mozilla&&this.addHandler(a(document),"mousedown.editor"+b.element.id,function(a){c()}),b.addHandler(b.editor,"blur.editor"+b.element.id,function(a){c()}),b.addHandler(b.editor,"focus.editor"+b.element.id,function(a){d()}),b.addHandler(b.editor,"beforedeactivate.editor"+b.element.id,function(a){b.range=b.getRange()}),b.addHandler(b.editor,"mousedown.editor"+b.element.id,function(c){c.target.href||b.linkPopup&&b.linkPopup.remove(),b.range=b.getRange(),a.jqx.browser.mozilla&&(d(),c.stopPropagation()),a(".jqx-editor-dropdownpicker").length>0&&a(".jqx-editor-dropdownpicker").jqxDropDownButton("close"),a(".jqx-editor-dropdownlist").length>0&&a(".jqx-editor-dropdownlist").jqxDropDownList("close"),b.inline&&b.editor.focus()}),a.jqx.mobile.isTouchDevice()&&(b.addHandler(a(b.editorDocument),"selectionchange.editor"+b.element.id,function(){b.editorDocument.activeElement!=b.editor[0]&&setTimeout(function(){b.iframe&&b.iframe[0].contentWindow.focus()},500)}),b.addHandler(a(b.editorDocument),"touchstart.editor"+b.element.id,function(){setTimeout(function(){b.iframe&&b.iframe[0].contentWindow.focus()},500)})),b.addHandler(b.editor,"mouseup.editor"+b.element.id,function(a){return"source"==b._documentMode||(b.range=b.getRange(),void b._refreshTools(null,!0))}),b.addHandler(b.editor,"keydown.editor"+b.element.id,function(c){if(b.keyPressed&&b.keyPressed(c),"source"==b._documentMode)return!0;if(a.jqx.browser.mozilla&&(b.focused||d()),b.changeType="keyboard",b.disabled)return c.preventDefault&&c.preventDefault(),!1;if(b.updating){if(b.activeElement){var e=a.Event("keydown");a.extend(e,c),b.activeElement.trigger(e)}return c.preventDefault&&c.preventDefault(),!1}var f=c||window.event,g=f.keyCode,h=String.fromCharCode(g).toLowerCase();if(!b.editable){var i=[9,33,34,35,36,37,38,39,40,40,45];a.inArray(f.keyCode,i)!=-1||f.ctrlKey&&"c"==h||f.ctrlKey&&"a"==h||c.preventDefault();
}if(b.selection.getText().length>0||b.linkPopup){var i=[8,9,13,33,34,35,36,37,38,39,40,40,45,46];(!a.inArray(f.keyCode,i)!=-1||65==f.keyCode&&f.ctrlKey&&!f.altKey&&!f.shiftKey)&&(b._refreshToolsTimer&&clearTimeout(b._refreshToolsTimer),b._refreshToolsTimer=setTimeout(function(){b._refreshTools(null,!0,f.keyCode)},10))}if(13==g&&"default"!=b.lineBreak){var j=b.getSelectedElement();if(j){var k=j.nodeName.toLowerCase();switch(k){case"pre":case"li":case"ul":case"ol":case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return!0}for(var l=j;null!=l;){if("#document"==l.nodeName){l=b.editorDocument.body;break}if(l.parentNode==b.editorDocument.body||l==b.editorDocument.body)break;l=l.parentNode}}if(l){var m=b.getRange();"<div></div>"==b.editorDocument.body.innerHTML&&"br"!=b.lineBreak&&b.selection.insertContent("&#8203;"),"div"==b.lineBreak?l==b.editorDocument.body?a(l).append("<div>&#8203;</div><span id='INSERTION_MARKER'>&nbsp;</span>"):a("<div>&#8203;</div><span id='INSERTION_MARKER'>&nbsp;</span>").insertAfter(l):"p"==b.lineBreak?l==b.editorDocument.body?a(l).append("<p>&#8203;</p><span id='INSERTION_MARKER'>&nbsp;</span>"):a("<p>&#8203;</p><span id='INSERTION_MARKER'>&nbsp;</span>").insertAfter(l):b.execute("insertHTML","<br/>&#8203;<span id='INSERTION_MARKER'>&nbsp;</span>"),b.selectRange(m);var n=a(b.editorDocument).find("#INSERTION_MARKER");return"br"!=b.lineBreak?b.selection.selectNode(a(n).prev()[0],!0):(b.selection.selectNode(n[0],!0),b.getRange().setStartAfter&&b.getRange().setStartAfter(n[0])),n.remove(),b.selection.collapse(!1),l&&l.nodeName&&"br"==b.lineBreak&&"#text"!=l.nodeName.toLowerCase()&&(b.selection.selectNode(l,!0),b.getRange().setStartAfter&&b.getRange().setStartAfter(l),b.selection.collapse(!1)),"br"!=b.lineBreak&&(m=b.getRange(),m.select&&m.select()),c.preventDefault&&c.preventDefault(),!1}}if(f.ctrlKey&&("k"==h||"u"==h||"b"==h||"i"==h)){c.preventDefault&&c.preventDefault();var o=null;switch(h){case"k":o="link";break;case"u":o="underline";break;case"b":o="bold";break;case"i":o="italic"}return b.commands[o].widget&&b.commands[o].widget.trigger("click"),!1}}),b.addHandler(b.editor,"paste.editor"+b.element.id,function(c){if("source"==b._documentMode)return!0;if(b.readOnly)return!0;b.updating=!0,b.readOnly=!0;try{var d=function(a,c){if(c)b.paragraphise?(a="<p>"+a+"</p>",a=a.replace(/\n/g,"</p><p>"),a=a.replace(/<p>\s<\/p>/gi,"")):a=a.replace(/\n/g,"<br />");else{if(a=a.replace(/<html[^>]*?>(.*)/gim,"$1"),a=a.replace(/<\/html>/gi,""),a=a.replace(/<body[^>]*?>(.*)/gi,"$1"),a=a.replace(/<\/body>/gi,""),a=a.replace(/<style[^>]*?>[\s\S]*?<\/style[^>]*>/gi,""),a=a.replace(/<(?:meta|link)[^>]*>\s*/gi,""),a=a.replace(/<\\?\?xml[^>]*>/gi,""),a=a.replace(/<w:[^>]*>[\s\S]*?<\/w:[^>]*>/gi,""),a=a.replace(/<o:p>\s*<\/o:p>/g,""),a=a.replace(/<o:p>[\s\S]*?<\/o:p>/g,"&nbsp;"),a=a.replace(/<\/?\w+:[^>]*>/gi,""),a=a.replace(/<\!--[\s\S]*?-->/g,""),a=a.replace(/<\!\[[\s\S]*?\]>/g,""),a=a.replace(/\s*mso-[^:]+:[^;"']+;?/gi,""),a=a.replace(/<(\w[^>]*) style='([^\']*)'([^>]*)/gim,"<$1$3"),a=a.replace(/<(\w[^>]*) style="([^\"]*)"([^>]*)/gim,"<$1$3"),a=a.replace(/\s*margin: 0cm 0cm 0pt\s*;/gi,""),a=a.replace(/\s*margin: 0cm 0cm 0pt\s*"/gi,'"'),a=a.replace(/\s*text-indent: 0cm\s*;/gi,""),a=a.replace(/\s*text-indent: 0cm\s*"/gi,'"'),a=a.replace(/\s*text-align: [^\s;]+;?"/gi,'"'),a=a.replace(/\s*page-break-before: [^\s;]+;?"/gi,'"'),a=a.replace(/\s*font-variant: [^\s;]+;?"/gi,'"'),a=a.replace(/\s*tab-stops:[^;"']*;?/gi,""),a=a.replace(/\s*tab-stops:[^"']*/gi,""),a=a.replace(/\s*face="[^"']*"/gi,""),a=a.replace(/\s*face=[^ >]*/gi,""),a=a.replace(/\s*font-family:[^;"']*;?/gi,""),a=a.replace(/\s*font-size:[^;"']*;?/gi,""),a=a.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3"),a=a.replace(/<(\w+)[^>]*\sstyle="[^"']*display\s?:\s?none[\s \S]*?<\/\1>/gi,""),a=a.replace(/\s*style='\s*'/gi,""),a=a.replace(/\s*style="\s*"/gi,""),a=a.replace(/<span\s*[^>]*>\s*&nbsp;\s*<\/span>/gi,"&nbsp;"),a=a.replace(/<span\s*[^>]*><\/span>/gi,""),a=a.replace(/<(\w[^>]*) align=([^ |>]*)([^>]*)/gi,"<$1$3"),a=a.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3"),a=a.replace(/<span([^>]*)>([\s\S]*?)<\/span>/gi,"$2"),a=a.replace(/<font\s*>([\s\S]*?)<\/font>/gi,"$1"),a=a.replace(/<(u|i|strike)>&nbsp;<\/\1>/gi,"&nbsp;"),a=a.replace(/<h\d>\s*<\/h\d>/gi,""),a=a.replace(/<(\w[^>]*) language=([^ |>]*)([^>]*)/gi,"<$1$3"),a=a.replace(/<(\w[^>]*) onmouseover="([^\"']*)"([^>]*)/gi,"<$1$3"),a=a.replace(/<(\w[^>]*) onmouseout="([^\"']*)"([^>]*)/gi,"<$1$3"),a=a.replace(/<h(\d)([^>]*)>/gi,"<h$1>"),a=a.replace(/<(h\d)><font[^>]*>([\s\S]*?)<\/font><\/\1>/gi,"<$1>$2</$1>"),a=a.replace(/<(h\d)><em>([\s\S]*?)<\/em><\/\1>/gi,"<$1>$2</$1>"),a=a.replace(/<b\b[^>]*>(.*?)<\/b[^>]*>/gi,"<strong>$1</strong>"),a=a.replace(/<i\b[^>]*>(.*?)<\/i[^>]*>/gi,"<em>$1</em>"),a=a.replace(/<\s+[^>]*>/gi,""),a=a.replace(/<span>([\s\S]*?)<\/span>/gi,"$1"),a=a.replace(/<span>([\s\S]*?)<\/span>/gi,"$1"),a=a.replace(/<div>([\s\S]*?)<\/div>/gi,"$1"),a=a.replace(/<div>([\s\S]*?)<\/div>/gi,"$1"),a=a.replace(/<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g,""),a=a.replace(/<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g,""),a=a.replace(/<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g,""),a.trim&&(a=a.trim()),b.paragraphise){var d=a.substr(0,2);"<p"!==d&&(a="<p>"+a+"</p>",a=a.replace(/\n/g,"</p><p>"),a=a.replace(/<br[^>]*>/gi,"</p><p>"))}else a.replace(/<p>/gi,"<br />"),a.replace(/<\/p>/gi,"");a=a.replace(/<br>/gi,"<br />"),a=a.replace(/<br[^>]*><\/p>/gim,"</p>"),a=a.replace(/<p>&nbsp;<\/p>/gi,""),a=a.replace(/<p>\s<\/p>/gi,""),a=a.replace(/<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g,""),a=a.replace(/MsoNormal/gi,""),a=a.replace(/<\/?meta[^>]*>/gi,""),a=a.replace(/<\/?xml[^>]*>/gi,""),a=a.replace(/<\?xml[^>]*\/>/gi,""),a=a.replace(/<!--(.*)-->/gi,""),a=a.replace(/<!--(.*)>/gi,""),a=a.replace(/<!(.*)-->/gi,""),a=a.replace(/<w:[^>]*>(.*)<\/w:[^>]*>/gi,""),a=a.replace(/<w:[^>]*\/>/gi,""),a=a.replace(/<\/?w:[^>]*>/gi,""),a=a.replace(/<m:[^>]*\/>/gi,""),a=a.replace(/<m:[^>]>(.*)<\/m:[^>]*>/gi,""),a=a.replace(/<o:[^>]*>(.*)<\/o:[^>]*>/gi,""),a=a.replace(/<o:[^>]*\/>/gi,""),a=a.replace(/<\/?m:[^>]*>/gi,""),a=a.replace(/style=\"([^>]*)\"/gi,""),a=a.replace(/style=\'([^>]*)\'/gi,""),a=a.replace(/class=\"(.*)\"/gi,""),a=a.replace(/class=\'(.*)\'/gi,""),a=a.replace(/<b>/gi,"<strong>"),a=a.replace(/<\/b>/gi,"</strong>"),a=a.replace(/<p[^>]*>/gi,"<p>"),a=a.replace(/<\/p[^>]*>/gi,"</p>"),a=a.replace(/<span[^>]*>/gi,""),a=a.replace(/<\/span[^>]*>/gi,""),a=a.replace(/<st1:[^>]*>/gi,""),a=a.replace(/<\/st1:[^>]*>/gi,""),a=a.replace(/<font[^>]*>/gi,""),a=a.replace(/<\/font[^>]*>/gi,""),a=a.replace("  ",""),a=a.replace(/<strong><\/strong>/gi,""),a=a.replace(/<p><\/p>/gi,""),a=a.replace(/\/\*(.*)\*\//gi,""),a=a.replace(/<!--/gi,""),a=a.replace(/-->/gi,""),a=a.replace(/<style[^>]*>[^<]*<\/style[^>]*>/gi,""),a=a.trim()}return a},e=b.getRange();"text"!=b.pasteMode||a.jqx.browser.mozilla?b.selection.insertContent('<div class="jqx-editor-paste-element">&nbsp;</div>'):b.selection.insertContent('<textarea cols="50" contenteditable="false" class="jqx-editor-paste-element"></textarea>');var f=a(window).scrollTop(),g=a(b.editorDocument).find(".jqx-editor-paste-element");if(g.css("top",f+"px"),b.editor[0].createTextRange){c.preventDefault();var h=b.editor[0].createTextRange();h.moveToElementText(g[0]),h.execCommand("Paste")}else{var i=b.editorDocument.createRange();i.selectNodeContents(g[0]),b.selectRange(i)}"text"!=b.pasteMode||a.jqx.browser.mozilla||g.select(),b.marker=g,setTimeout(function(){b.selectRange(e);var c=function(a){var c=b.editorDocument.createElement("div"),d=b.editorDocument.createDocumentFragment();for(c.innerHTML=a;c.firstChild;)d.appendChild(c.firstChild);return d};if("text"!=b.pasteMode){var f=c(b.marker.html());if(f.firstChild&&"jqx-editor-paste-element"===f.firstChild.className){for(var g=[],h=0,i=f.childNodes.length;h<i;h++)g.push(f.childNodes[h].innerHTML);f=c(g.join("<br />"))}var j=document.createElement("div");j.appendChild(f.cloneNode(!0));var k=j.innerHTML}else{var k=b.marker.val();if(""!=b.marker.html()&&b.marker.val().indexOf("\n")==-1){var k=b.marker.html();k=k.replace(/&nbsp;/gm,""),k=k.replace(/\n\n/gm,"\n"),k=k.replace(/<br[^>]*>/gi,"\n"),k=k.replace(/<li[^>]*>/gi,"\n"),k=k.replace(/<p[^>]*>/gi,"\n"),b.marker.html(k);var k=b.marker.text()}}var l=d(k,"text"==b.pasteMode);b.getRange();b.selection.insertContent(l+"<span id='INSERTION_MARKER'>&nbsp;</span>"),b.marker.remove();var m=a(b.editorDocument).find("#INSERTION_MARKER");b.selection.selectNode(m[0],!0),b.getRange().setStartAfter&&b.getRange().setStartAfter(m[0]),m.remove(),b.selection.collapse(!1),m.removeAttr("id"),b._refreshTools(),b.changed=!0},100),b.updating=!1,b.readOnly=!1}catch(a){console&&console.log(a)}}),b.addHandler(b.editor,"keyup.editor"+b.element.id,function(c){if("source"==b._documentMode)return!0;if(b.updating||b.disabled||!b.editable)return c.preventDefault&&c.preventDefault(),c.stopPropagation&&c.stopPropagation(),!1;b.range=b.getRange(),b.changed=!0;var d=c||window.event,e=(d.keyCode,[8,9,13,33,34,35,36,37,38,39,40,40,45,46]);(a.inArray(d.keyCode,e)!=-1||65==d.keyCode&&d.ctrlKey&&!d.altKey&&!d.shiftKey)&&b._refreshTools(null,!0,d.keyCode)}),b.addHandler(b.editor,"click.editor"+b.element.id,function(c){if("source"==b._documentMode)return!0;if(b.editImage&&(a(b.editImage).removeClass("jqx-editor-focus"),b.editImage=null),"img"==c.target.tagName.toLowerCase()){var d=c.target;b.editImage=d,a(b.editImage).addClass("jqx-editor-focus")}}),b.addHandler(b.editor,"dblclick.editor"+b.element.id,function(c){if("source"==b._documentMode)return!0;if("img"==c.target.tagName.toLowerCase()){var d=c.target;a("#imageWindow"+this.element.id).length>0&&(b.editImage=d,b._updateImageWindow())}})},_updateLinkWindow:function(){var b=this,c=a("#linkWindow"+this.element.id);c.jqxWindow({position:{center:b.widget}}),c.jqxWindow("open");var d=c.find("input"),e=c.find(".jqx-editor-link-checkbox"),f=c.find("button:first"),g=a(c.find("button")[1]);if(b.editLink&&b.editLink.href)d[0].value=b.editLink.href||"",d[1].value=a(b.editLink).text()||b.editLink.href,e.val("_blank"==a(b.editLink).attr("target")),g.show();else{if(d[0].value="",d[1].value="",!b.selection.isCollapsed()){var h=b.selection.getText();h.match(/^(?!:\/\/)([a-zA-Z0-9]+\.)?[a-zA-Z0-9][a-zA-Z0-9-]+\.[a-zA-Z]{2,6}?$/i)?d[0].value=h:d[1].value=h}e.val(!1),g.hide()}d[0].value.length>0?f.jqxButton({disabled:!1}):f.jqxButton({disabled:!0})},_updateImageWindow:function(){var b=this,c=b.editImage;c||(c=a("<img>")[0]);var d=a("#imageWindow"+this.element.id);d.jqxWindow({position:{center:b.widget}}),d.jqxWindow("open");var e=d.find("input"),f=a(d.find("button")[1]);b.editImage?f.show():f.hide(),e[0].value=c.src,""==e[0].value&&(e[0].value=""),e[1].value=c.alt,"auto"!=c.style.width?e[2].value=c.style.width:e[2].value="","auto"!=c.style.height?e[3].value=c.style.height:e[3].value="",c.style.marginLeft&&"0px"!=c.style.marginLeft?e[4].value=c.style.marginLeft:e[4].value="",c.style.marginTop&&"0px"!=c.style.marginTop?e[5].value=c.style.marginTop:e[5].value="";var g=d.find(".jqx-editor-align"),h=a(c).css("float");"left"==h?g.jqxDropDownList({selectedIndex:1}):"right"==h?g.jqxDropDownList({selectedIndex:2}):g.jqxDropDownList({selectedIndex:0})},_removeHandlers:function(){var a=this;a.editor&&(a.removeHandler(a.editor,"blur.editor"+a.element.id),a.removeHandler(a.editor,"focus.editor"+a.element.id),a.removeHandler(a.editor,"click.editor"+a.element.id),a.removeHandler(a.editor,"mousedown.editor"+a.element.id),a.removeHandler(a.editor,"mouseup.editor"+a.element.id),a.removeHandler(a.editor,"keyup.editor"+a.element.id),a.removeHandler(a.editor,"keydown.editor"+a.element.id),a.removeHandler(a.editor,"beforedeactivate.editor"+a.element.id),a.removeHandler(a.editor,"dblclick.editor"+a.element.id)),a.toolbar&&a.removeHandler(a.toolbar,"mousedown.editor"+a.element.id)},getParentByTag:function(a,b){var b=b.toLowerCase(),c=a;do if(""==b||c.nodeName.toLowerCase()==b)return c;while(c=c.parentNode);return a},isStyleProperty:function(a,b,c,d){var b=b.toLowerCase(),e=a;do if(e.nodeName.toLowerCase()==b&&e.style[c]==d)return!0;while(e=e.parentNode);return!1},setStyleProperty:function(a,b){this.style[b]=!1;var c=this.getParentByTag(a,b);c&&c.tagName.toLowerCase()==b&&(this.style[b]=!0),"del"==b&&this.getParentByTag(a,"strike")&&"strike"==this.getParentByTag(a,"strike").tagName.toLowerCase()&&(this.style.del=!0)},updateStyle:function(a){var b=this,a=b.getSelectedElement()?b.getSelectedElement():a;if(a&&b.setStyleProperty)try{if(window.getComputedStyle){"#text"==a.nodeName.toLowerCase()&&(a=b.editor[0]);var c=window.getComputedStyle(a,null),d=401==c.getPropertyValue("font-weight")?700:c.getPropertyValue("font-weight");b.style={fontStyle:c.getPropertyValue("font-style"),fontSize:c.getPropertyValue("font-size"),textDecoration:c.getPropertyValue("text-decoration"),fontWeight:d,fontFamily:c.getPropertyValue("font-family"),textAlign:c.getPropertyValue("text-align"),color:b._rgbToHex(c.color),backColor:b._rgbToHex(c.backgroundColor)},b.style.fontStyle=c.getPropertyValue("font-style"),b.style.vAlign=c.getPropertyValue("vertical-align"),b.style.del=b.isStyleProperty(a,"span","textDecoration","line-through"),b.style.u=b.isStyleProperty(a,"span","textDecoration","underline");var e=function(a){for(var b="transparent",c="rgba(0, 0, 0, 0)";a&&(window.getComputedStyle(a).backgroundColor==b||window.getComputedStyle(a).backgroundColor==c);)a=a.parentNode;return a?window.getComputedStyle(a).backgroundColor:b};b.style.backColor||(b.style.backColor=b._rgbToHex(e(a)))}else{var c=a.currentStyle;b.style={fontStyle:c.fontStyle,fontSize:c.fontSize,textDecoration:c.textDecoration,fontWeight:c.fontWeight,fontFamily:c.fontFamily,textAlign:c.textAlign,color:b._rgbToHex(c.color),backColor:b._rgbToHex(c.backgroundColor)}}b.setStyleProperty(a,"h1"),b.setStyleProperty(a,"h2"),b.setStyleProperty(a,"h3"),b.setStyleProperty(a,"h4"),b.setStyleProperty(a,"h5"),b.setStyleProperty(a,"h6"),b.setStyleProperty(a,"del"),b.setStyleProperty(a,"sub"),b.setStyleProperty(a,"sup"),b.setStyleProperty(a,"u"),"a"==a.nodeName.toLowerCase()&&"underline"==b.style.textDecoration&&(b.style.u=!0),(b.style.h1||b.style.h2||b.style.h3||b.style.h4||b.style.h5||b.style.h6)&&(b.style.heading=!0)}catch(a){return null}},_refreshTools:function(b,c,d){var e=this;if(!e.updating){var b=e.getSelectedElement()?e.getSelectedElement():b;if(b&&e.setStyleProperty){e.updateStyle(b);var f=e.readOnly;if(e.readOnly=!0,e.tools!==!1){var g=e.tools.split(" "),h=e.tools.split(" | "),i=function(b){a.each(b,function(a,b){var c=e.commands[this];if(!c)return!0;switch(c.type){case"list":c.widget.jqxDropDownList("clearSelection"),c.widget.jqxDropDownList({disabled:e.disabled});break;case"colorPicker":c.val(c.value),c.widget.jqxDropDownButton({disabled:e.disabled});break;case"toggleButton":c.widget.jqxToggleButton("unCheck"),c.widget.jqxToggleButton({disabled:e.disabled});break;case"button":default:c.widget.jqxButton({disabled:e.disabled})}})};if(0==h.length)i(g);else for(var j=0;j<h.length;j++){var k=h[j],g=k.split(" ");i(g)}if(e.style){var l=function(d){a.each(d,function(d,f){var g=e.commands[this];if(!g)return!0;if(g.refresh)return g.refresh(g.widget,e.style),!0;switch(g.type){case"list":if("fontname"==g.command){for(var h=-1,i=999,j=0;j<g.value.length;j++){var f=g.value[j].label.toLowerCase(),k=e.style.fontFamily.toLowerCase().indexOf(f);k>=0&&(k<i&&(h=j),i=Math.min(i,k))}g.widget.jqxDropDownList("selectIndex",h)}else if("formatblock"==g.command){var f=null;e.style.h1?f="h1":e.style.h2?f="h2":e.style.h3?f="h3":e.style.h4?f="h4":e.style.h5?f="h5":e.style.h6&&(f="h6"),g.widget.jqxDropDownList("selectItem",f)}else if("fontsize"==g.command){var l="xx-small,x-small,small,medium,large,x-large,xx-large".split(","),m=-1;try{var m=b.getAttribute("size")-1;m==-1&&(m=e.editorDocument.queryCommandValue(g.command)-1)}catch(a){}var n=l[m];g.widget.val(n)}break;case"colorPicker":var o=function(a){return"number"!=typeof a?a:"rgb("+(255&a)+", "+((65280&a)>>8)+", "+((16711680&a)>>16)+")"},p=o(e.editorDocument.queryCommandValue(g.command));"backcolor"==g.command&&null==e.style.backColor&&(p="#FFFFFF");var q=e._rgbToHex(p);q?g.val(q):"forecolor"==g.command?g.val(e.style.color):"backcolor"==g.command&&g.val(e.style.backColor);break;case"toggleButton":if("viewsource"==g.command)return;if(!g.command)return;var r=!1,s=e.editorDocument.queryCommandState(g.command)&&e.editorDocument.queryCommandEnabled(g.command);if("createlink"==g.command&&"a"==b.nodeName.toLowerCase()){var t=!0;if(a(b).text().indexOf(e.selection.getText())==-1&&""!=e.selection.getText()&&(t=!1),t){e.linkPopup&&e.linkPopup.remove(),s=!0,e.linkPopup=a("<div class='jqx-editor-link-popup' contentEditable='false' style='overflow: hidden; white-space: nowrap; padding: 5px; height: 17px; font-size: 12px; color: #222222; background: #F5F5F5; position: absolute; z-index: 9999;'>"+e.localization["Go to link"]+": <a target='_blank' style='color:#222222;' href='"+b.href+"'>"+b.href+"</a> - <a style='color:#222222;' href='#change'>"+e.localization.Change+"</a> - <a style='color:#222222;' href='#remove'>"+e.localization.Remove+"</a></div>").appendTo(e.editor);var u=a(b).coord(),v=u.left;u.left+e.linkPopup.width()>e.editor.width()&&(v=e.editor.width()-e.linkPopup.width()-15),e.linkPopup.offset({top:a(b).height()+u.top+5,left:v}),e.addHandler(e.linkPopup,"mousedown",function(c){if(c.target&&c.target.href){var d=a(c.target).index();switch(d){case 1:e.editor.focus(),e.selection.selectNode(b,!0),e.commands.link.widget.trigger("click");break;case 2:try{e.editor.focus(),e.selection.selectNode(b),e.execute("unlink"),e.commands.underline.toggled=!1,e.selection.collapse(!1),e._refreshTools()}catch(a){}break;default:window.open(c.target.href,"_blank")}}return c.preventDefault&&c.preventDefault(),c.stopPropagation&&c.stopPropagation(),!1})}}"bold"==g.command?(e.style.fontWeight&&(e.style.fontWeight>=600||"bold"==e.style.fontWeight)&&(r=!0),e.selection.isCollapsed()?g.toggled=s:g.toggled=s||r,s=g.toggled):"italic"==g.command?(e.style.fontStyle&&"italic"==e.style.fontStyle&&(r=!0),c?g.toggled=s:s=g.toggled):"underline"==g.command?(e.style.u&&(r=!0),c?g.toggled=s:s=g.toggled):"justifyleft"==g.command?"left"==e.style.textAlign&&(r=!0):"justifyright"==g.command?"right"==e.style.textAlign&&(r=!0):"justifycenter"==g.command?"center"==e.style.textAlign&&(r=!0):"justifyfull"==g.command?"justify"==e.style.textAlign&&(r=!0):a.each(e.style,function(a,b){g.command==a.toLowerCase()&&(r=!0)});var w=s;r&&g.command.indexOf("justify")!=-1?g.widget.jqxToggleButton("check"):w?g.widget.jqxToggleButton("check"):r&&e.range.collapsed===!1?g.widget.jqxToggleButton("check"):a.jqx.browser.msie&&a.jqx.browser.version<9&&r&&!e.selection.isCollapsed()&&g.widget.jqxToggleButton("check");break;case"button":default:g.refresh&&g.refresh(g.widget,e.style)}})};if(0==h.length)l(g);else for(var j=0;j<h.length;j++){var k=h[j],g=k.split(" ");l(g)}}}e.readOnly=f}}},_rgbToHex:function(a){if(a){if("#"===a.substr(0,1)){if(4==a.length){var b=a.substr(1,1),c=a.substr(2,1),d=a.substr(3,1);return"#"+b+b+c+c+d+d}return a}var e=/(.*?)rgb\((\d+),\s*(\d+),\s*(\d+)\)/i.exec(a);if(!e)return null;var b=parseInt(e[2],10).toString(16),c=parseInt(e[3],10).toString(16),d=parseInt(e[4],10).toString(16);return"#"+((1==b.length?"0"+b:b)+(1==c.length?"0"+c:c)+(1==d.length?"0"+d:d))}return null},_preventDefault:function(b,c){c!==!1&&(a(".jqx-editor-dropdownpicker").length>0&&a(".jqx-editor-dropdownpicker").jqxDropDownButton("close"),a(".jqx-editor-dropdownlist").length>0&&a(".jqx-editor-dropdownlist").jqxDropDownList("close")),b.preventDefault&&b.preventDefault(),b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,b.returnValue=!1},_addCommandHandler:function(b,c,d,e,f){var g=this;switch(!d&&f.init&&(d="custom"),d){case"custom":switch(f.type){case"list":action=function(b){"source"!=g._documentMode&&"none"!=b.args.type&&(f.value=a(this).val(),g.execute("custom",f),g.readOnly||g._refreshTools()),g._preventDefault(b,!1)};break;case"colorPicker":action=function(b){if("source"!=g._documentMode){a(f.colorPicker).find("td").removeClass("jqx-editor-color-picker-selected-cell");if("div"==b.target.nodeName.toLowerCase()){var c=a(b.target).css("background-color");a(b.target).parent().addClass("jqx-editor-color-picker-selected-cell")}else{var c=a(b.target).find("div").css("background-color");a(b.target).addClass("jqx-editor-color-picker-selected-cell")}a("#bar-"+d).css("background",c),f.widget.val=function(){var a=function(a){return"number"!=typeof a?a:"rgb("+(255&a)+", "+((65280&a)>>8)+", "+((16711680&a)>>16)+")"},b=a(c),d=g._rgbToHex(b);return d},f.widget.jqxDropDownButton("close"),g.execute("custom",f)}return g._preventDefault(b),!1};break;case"button":case"toggleButton":default:action=function(b){a(".jqx-editor-dropdownpicker").length>0&&a(".jqx-editor-dropdownpicker").jqxDropDownButton("close"),a(".jqx-editor-dropdownlist").length>0&&a(".jqx-editor-dropdownlist").jqxDropDownList("close"),g._preventDefault(b);a(this).attr("data-command");return"source"!=g._documentMode&&(f.toggle&&f.toggle(),g.execute("custom",f),g._refreshTools()),!1}}break;case"formatblock":action=function(b){"source"!=g._documentMode&&"none"!=b.args.type&&(g.execute(a(this).attr("data-command"),"<"+a(this).val()+">",f),g.readOnly||(g.commands.bold.toggled=!1,g._refreshTools())),g._preventDefault(b,!1)};break;case"fontsize":action=function(b){if("source"!=g._documentMode&&"none"!=b.args.type){var c=a(this).val(),d="xx-small,x-small,small,medium,large,x-large,xx-large".split(","),e=a(this).jqxDropDownList("getSelectedIndex")+1,e=1+d.indexOf(c);g.execute(a(this).attr("data-command"),e,f)}g._preventDefault(b,!1)};break;case"fontname":action=function(b){if("source"!=g._documentMode&&"none"!=b.args.type){var c=a(this).val();g.execute(a(this).attr("data-command"),c,f)}g._preventDefault(b,!1)};break;case"forecolor":case"backcolor":action=function(b){if("source"!=g._documentMode){a(f.colorPicker).find("td").removeClass("jqx-editor-color-picker-selected-cell");if("div"==b.target.nodeName.toLowerCase()){var c=a(b.target).css("background-color");a(b.target).parent().addClass("jqx-editor-color-picker-selected-cell")}else{var c=a(b.target).find("div").css("background-color");a(b.target).addClass("jqx-editor-color-picker-selected-cell")}a("#bar-"+d).css("background",c),f.widget.jqxDropDownButton("close"),g.execute(d,c,f)}return g._preventDefault(b),!1};break;case"viewsource":action=function(b){return g.linkPopup&&g.linkPopup.remove(),f.toggle(),g.setMode(f.toggled),a(".jqx-editor-dropdownpicker").length>0&&a(".jqx-editor-dropdownpicker").jqxDropDownButton("close"),a(".jqx-editor-dropdownlist").length>0&&a(".jqx-editor-dropdownlist").jqxDropDownList("close"),g._preventDefault(b),!1};break;case"insertimage":action=function(a){g._insertImageAction(a,g,f)};break;case"createlink":action=function(a){g._createLinkAction(a,g,f)};break;default:action=function(b){a(".jqx-editor-dropdownpicker").length>0&&a(".jqx-editor-dropdownpicker").jqxDropDownButton("close"),a(".jqx-editor-dropdownlist").length>0&&a(".jqx-editor-dropdownlist").jqxDropDownList("close"),g._preventDefault(b);var c=a(this).attr("data-command");if("source"!=g._documentMode){if("underline"==c&&g.getSelectedElement()){var d=g.getSelectedElement();if(d&&"a"==d.nodeName.toLowerCase())return f.toggled?a(d).css("text-decoration","none"):a(d).css("text-decoration","underline"),f.toggle(),g._refreshTools(),!1}f.toggle&&f.toggle(),g.execute(c,a(this).val(),f),g._refreshTools()}return!1}}return g.addHandler(b,c,action),!1},_createLinkAction:function(b,c,d){var c=this;if("source"==c._documentMode)return void c._preventDefault(b);c.focused||c.editor.focus(),c.range=c.getRange();var e=c.getSelectedElement();if("a"==e.nodeName.toLowerCase()?c.editLink=e:c.editLink=null,a("#linkWindow"+this.element.id).length>0)return c.editLink&&c.selection.selectNode(e,!0),c._updateLinkWindow(),c._preventDefault(b),!1;var f=a("<div class='jqx-editor-window jqx-editor-link-window'><div>"+c.localization["Insert Link"]+"</div><div><table style='border-collapse: separate; border-spacing: 2px;'><tr><td align='right'>"+c.localization.URL+":</td><td><input style='width: 200px; height: 23px;' value=''/></td><tr/><tr><td align='right'>"+c.localization.Title+":</td><td><input style='width: 200px; height: 23px;' value=''/></td><tr/><tr><td align='right'></td><td><div class='jqx-editor-link-checkbox'>"+c.localization["Open in a new window/tab"]+"</div></td><tr/><tr><td align='right'></td><td align='right'><button>Ok</button><button style='margin-left: 5px;'>Remove</button><button style='margin-left: 5px;'>Cancel</button></td><tr/></table></div></div>");f[0].id="linkWindow"+this.element.id;var g=f.find("input");g.addClass(c.toThemeProperty("jqx-widget")),g.addClass(c.toThemeProperty("jqx-widget-content")),g.addClass(c.toThemeProperty("jqx-input"));var h=f.find(".jqx-editor-link-checkbox").jqxCheckBox({theme:c.theme,height:23,width:180}),i=f.find("button:first").jqxButton({theme:c.theme,disabled:!0}),j=a(f.find("button")[1]).jqxButton({theme:c.theme}),k=f.find("button:last").jqxButton({theme:c.theme});i.val(c.localization.Ok),k.val(c.localization.Cancel),j.val(c.localization.Remove),c.addHandler(k,a.jqx.mobile.isTouchDevice()?a.jqx.mobile.getTouchEventName("touchstart"):"click",function(a){c.editor.focus(),c.selectRange(c.range),c._refreshTools(),c._preventDefault(a)}),(!c.editLink||c.editLink&&!c.editLink.href)&&j.hide();var l=!1;if(c.addHandler(a(g[0]),"focus",function(){l=""==g[1].value||g[1].value==g[0].value}),c.addHandler(a(g[1]),"keyup",function(a){a.keyCode&&(13==a.keyCode&&i.trigger("click"),27==a.keyCode&&k.trigger("click"))}),c.addHandler(a(g[0]),"keyup change",function(a){g[0].value.length>0?i.jqxButton({disabled:!1}):i.jqxButton({disabled:!0}),l&&(g[1].value=g[0].value),a.keyCode&&(13==a.keyCode&&i.trigger("click"),27==a.keyCode&&k.trigger("click"))}),c.addHandler(j,a.jqx.mobile.isTouchDevice()?a.jqx.mobile.getTouchEventName("touchstart"):"click",function(a){f.jqxWindow("close");try{c.editor.focus(),c.selection.selectNode(c.editLink),c.execute("unlink"),c.selection.collapse(!1),c.commands.underline.toggled=!1,c._refreshTools()}catch(a){}c._preventDefault(a)}),c.addHandler(i,a.jqx.mobile.isTouchDevice()?a.jqx.mobile.getTouchEventName("touchstart"):"click",function(b){var e=f.find("input"),g=a("<a>"+(e[1].value||e[0].value)+"</a>");h.val()&&g.attr("target","_blank"),g[0].href=a.trim(e[0].value),e[0].value.indexOf("http")==-1&&e[0].value.indexOf("mailto")==-1&&(g[0].href="http://"+a.trim(e[0].value)),c.focused||c.editor.focus(),c.range&&c.selectRange(c.range),c.editLink&&a(c.editLink).remove(),c.execute("insertHTML",""+g[0].outerHTML+"<span id='INSERTION_MARKER'>&nbsp;</span>",d),c.editor.focus();var i=a(c.editorDocument).find("#INSERTION_MARKER");c.selection.selectNode(i[0],!0),c.getRange().setStartAfter&&c.getRange().setStartAfter(i[0]),i.remove(),c.selection.collapse(!1),c._refreshTools(),c._preventDefault(b)}),c.updating=!0,f.appendTo(document.body),c.addHandler(f,"open",function(){c.updating=!0,setTimeout(function(){c.range=c.getRange(),a(g[0]).focus()},25)}),f.jqxWindow({resizable:!1,width:280,okButton:i,cancelButton:k,theme:c.theme,isModal:!0,position:{center:c.widget}}),c.addHandler(f,"close",function(){c.updating=!1}),c.focused||(c.editor.focus(),c.selectRange(c.range)),c.editLink)g[0].value=c.editLink.href||"",g[1].value=a(c.editLink).text(),h.val("_blank"==a(c.editLink).attr("target"));else if(!c.selection.isCollapsed()){var m=c.selection.getText();m.match(/^(?!:\/\/)([a-zA-Z0-9]+\.)?[a-zA-Z0-9][a-zA-Z0-9-]+\.[a-zA-Z]{2,6}?$/i)?g[0].value=m:g[1].value=m}return g[0].value.length>0?i.jqxButton({disabled:!1}):i.jqxButton({disabled:!0}),c._preventDefault(b),!1},_insertImageAction:function(b,c,d){if("source"==c._documentMode)return void c._preventDefault(b);if(c.focused||c.editor.focus(),c.range=c.getRange(),a("#imageWindow"+this.element.id).length>0)return c._updateImageWindow(),c._preventDefault(b),!1;var e=a("<div class='jqx-editor-window jqx-editor-image-window'><div>"+c.localization["Insert Image"]+"</div><div><table style='border-collapse: separate; border-spacing: 2px;'><tr><td align='right'>"+c.localization.URL+":</td><td><input style='width: 180px; height: 23px;' value=''/></td><tr/><tr><td align='right'>"+c.localization["Alt Text"]+":</td><td><input style='width: 180px; height: 23px;' value=''/></td><tr/><tr><td align='right'>"+c.localization.Width+":</td><td><input style='width: 180px; height: 23px;' value=''/></td><tr/><tr><td align='right'>"+c.localization.Height+":</td><td><input style='width: 180px; height: 23px;' value=''/></td><tr/><tr><td align='right'>"+c.localization.HSpace+":</td><td><input style='width: 180px; height: 23px;' class='jqx-editor-hspace'/></td><tr/><tr><td align='right'>"+c.localization.VSpace+":</td><td><input style='width: 180px; height: 23px;' class='jqx-editor-vspace'/></td><tr/><tr><td align='right'>"+c.localization.Align+":</td><td><div class='jqx-editor-align'></div></td><tr/><tr><td align='right'></td><td align='right'><button>Ok</button><button style='margin-left: 5px;'>Remove</button><button style='margin-left: 5px;'>Cancel</button></td><tr/></table></div></div>");e[0].id="imageWindow"+this.element.id;var f=e.find("input");f.addClass(c.toThemeProperty("jqx-widget")),f.addClass(c.toThemeProperty("jqx-widget-content")),f.addClass(c.toThemeProperty("jqx-input")),e.find(".jqx-editor-align").jqxDropDownList({autoDropDownHeight:!0,selectedIndex:0,theme:c.theme,height:23,width:180,source:[c.localization["not set"],c.localization.Left,c.localization.Right]});var g=e.find("button:first").jqxButton({theme:c.theme}),h=e.find("button:last").jqxButton({theme:c.theme}),i=a(e.find("button")[1]).jqxButton({theme:c.theme});return g.val(c.localization.Ok),h.val(c.localization.Cancel),i.val(c.localization.Remove),i.hide(),c.addHandler(i,a.jqx.mobile.isTouchDevice()?a.jqx.mobile.getTouchEventName("touchstart"):"click",function(b){a(c.editImage).removeClass("jqx-editor-focus"),a(c.editImage).remove(),c.editImage=null,c._preventDefault(b),e.jqxWindow("close"),c._raiseEvent("change")}),c.addHandler(h,a.jqx.mobile.isTouchDevice()?a.jqx.mobile.getTouchEventName("touchstart"):"click",function(b){a(c.editImage).removeClass("jqx-editor-focus"),c.editImage=null,c._preventDefault(b)}),c.addHandler(g,a.jqx.mobile.isTouchDevice()?a.jqx.mobile.getTouchEventName("touchstart"):"click",function(b){a(c.editImage).removeClass("jqx-editor-focus");var f=e.find("input"),g=a(c.editImage?c.editImage:'<img style="border: 1px solid transparent;">'),h=g.attr("src",f[0].value).attr("unselectable","on");f[1].value&&h.attr("alt",f[1].value).attr("title",f[1].value),f[2].value&&!isNaN(parseInt(f[2].value))?h.width(f[2].value):h.css("width","auto"),f[3].value&&!isNaN(parseInt(f[3].value))?h.height(f[3].value):h.css("height","auto"),f[4].value?"auto"==f[4].value.toString()?(h.css("margin-left","auto"),h.css("margin-right","auto")):f[4].value.toString().indexOf("%")!=-1?(h.css("margin-left",parseInt(f[4].value)+"%"),h.css("margin-right",parseInt(f[4].value)+"%")):(h.css("margin-left",parseInt(f[4].value)+"px"),h.css("margin-right",parseInt(f[4].value)+"px")):(h.css("margin-left","0px"),h.css("margin-right","0px")),f[5].value?"auto"==f[5].value.toString()?(h.css("margin-top","auto"),h.css("margin-bottom","auto")):f[5].value.toString().indexOf("%")!=-1?(h.css("margin-top",parseInt(f[5].value)+"%"),h.css("margin-bottom",parseInt(f[5].value)+"%")):(h.css("margin-top",parseInt(f[5].value)+"px"),h.css("margin-bottom",parseInt(f[5].value)+"px")):(h.css("margin-top","0px"),h.css("margin-bottom","0px"));var i=e.find(".jqx-editor-align").jqxDropDownList("selectedIndex");if(1==i?h.css("float","left"):2==i?h.css("float","right"):0==i&&h.css("float","none"),h.css("resize",!1),h[0].oncontrolselect=function(){return!1},h[0].selectstart=function(){return!1},!c.editImage){c.focused||c.editor.focus(),c.range&&c.selectRange(c.range),
c.execute("insertHTML",h[0].outerHTML+"<span id='INSERTION_MARKER'>&nbsp;</span>",d),c.editor.focus();var j=a(c.editorDocument).find("#INSERTION_MARKER");c.selection.selectNode(j[0],!0),c.getRange().setStartAfter&&c.getRange().setStartAfter(j[0]),j.remove(),c.selection.collapse(!1),c._refreshTools(),c._preventDefault(b)}c.editImage=null,c._preventDefault(b)}),e.appendTo(document.body),c.updating=!0,c.addHandler(e,"open",function(){c.updating=!0,setTimeout(function(){c.range=c.getRange(),a(f[0]).focus()},25)}),e.jqxWindow({resizable:!1,width:280,okButton:g,cancelButton:h,theme:c.theme,isModal:!0,position:{center:c.widget}}),c.addHandler(e,"close",function(){c.updating=!1}),c.focused||(c.editor.focus(),c.selectRange(c.range)),c._preventDefault(b),!1},editmode:function(b){var c=this;if(b||c.readOnly){if(b&&c.readOnly){var d=c.editor.find("#sourceText").text();c.editor.html(d),c.buttons.hasOwnProperty("html")&&c.buttons.html.removeClass("active"),c.editor.attr("contentEditable",!0),c._addHandlers()}}else{c._removeHandlers(),c.editor.attr("contentEditable",!1);var d=document.createTextNode(c.editor.html()),e=a("<pre>");e.html(d).attr({id:"sourceText",contentEditable:!0}).css("height","100%"),c.editor.html(e),c.buttons.hasOwnProperty("html")&&c.buttons.html.addClass("active"),e.focus()}c.readOnly=!b},setMode:function(b){var d=this;d.range||(d.editor.focus(),d.range=d.getRange());var e,f=d.editor[0];if(b){d._documentMode="source";var g=new c,h=g.HTMLtoXML(f.innerHTML);h=g.FormatHTML(h),e=document.createTextNode(h),f.innerHTML="";var i=document.createElement("pre");f.contentEditable=!1,i.style.height="100%",i.style.margin="0px",i.style.outline="none",i.style.display="block",i.id="sourceText",i.contentEditable=!0,i.appendChild(e),f.appendChild(i),this.readOnly=!0}else this._documentMode="html",document.all?f.innerHTML=f.innerText:f.textContent?f.innerHTML=f.textContent:(e=document.createRange(),e.selectNodeContents(f.firstChild),f.innerHTML=e.toString()),f.contentEditable=!0,d.readOnly=!1,d._refreshTools(),d.editor.focus(),d.selection.selectNode(d.editor[0]),d.editor.scrollTop(0),d.selection.collapse(!0);if(a.each(this.commands,function(){if(this.widget&&"viewsource"!=this.command)switch(this.type){case"list":this.widget.jqxDropDownList({disabled:b});break;case"colorPicker":this.widget.jqxDropDownButton({disabled:b});break;case"button":this.widget.jqxButton({disabled:b});break;case"toggleButton":this.widget.jqxToggleButton({toggled:!1,disabled:b})}}),d.editor.focus(),a.jqx.browser.mozilla){var j=a("<a href='#'>anchor</a>");d.editor.prepend(j),j.focus(),j.remove(),d.selection.collapse(!0)}d.commands.html.widget&&(d.commands.html.widget.jqxToggleButton({toggled:"source"==b||1==b}),d.commands.html.toggled="source"==b||1==b)},execute:function(b,c,d){var e=this;if(!e.readOnly){var f=e.editorDocument;if("source"==e._documentMode)return;e.changeType="mouse",e.linkPopup&&e.linkPopup.remove(),e.editor.focus(),a.jqx.browser.mozilla,a.jqx.mobile.isTouchDevice()&&setTimeout(function(){},25);var g=function(b){try{if(b.command&&"inserthtml"==b.command.toLowerCase()){var c=e.getRange(),d=b.value;d.toString().indexOf("<")==-1&&(d="<span>"+b.value+"</span>"),e.selection.insertContent(""+d+"<span id='INSERTION_MARKER'>&nbsp;</span>"),e.selectRange(c),setTimeout(function(){var b=a(e.editorDocument).find("#INSERTION_MARKER");e.selection.selectNode(a(b).prev()[0],!0),b.remove(),e.selection.collapse(!1)},10)}else if(b.command){if(!f.queryCommandEnabled(b.command))return!1;f.execCommand(b.command,!1,b.value)}else{if(!f.queryCommandEnabled(b))return!1;f.execCommand(b,!1,b)}}catch(a){}};if("custom"==b){var h=c.action(c.widget,e.editor);h&&g(h)}else try{if(d&&d.action){var h=d.action(d.widget,e.editor);g(h)}else if(f.queryCommandEnabled(b))f.execCommand(b,!1,c);else{if("insertHTML"!=b)return!1;e.selection.insertContent(c)}}catch(a){if("insertHTML"!=b)return!1;e.selection.insertContent(c)}a.jqx.mobile.isTouchDevice()&&setTimeout(function(){e.iframe&&e.iframe[0].contentWindow.focus()},500),e._raiseEvent("change",{command:b,args:c}),e.changed=!0,e.range=e.getRange()}},destroy:function(){var b=this;b._removeHandlers();var c=b.tools.split(" "),d=b.tools.split(" | ");a.jqx.utilities.resize(this.host,null,!0);var e=function(c){a.each(c,function(c,d){var e=b.commands[this];if(!e)return!0;switch(e.type){case"list":e.widget.jqxDropDownList("destroy");break;case"colorPicker":e.colorPicker.remove(),e.widget.jqxDropDownButton("destroy");break;case"toggleButton":e.widget.jqxToggleButton("destroy");break;case"custom":b.destroyTool&&b.destroyTool(this);break;case"button":default:e.widget.jqxToggleButton("destroy"),"insertimage"===e.command?a("#imageWindow"+b.element.id).length>0&&(a("#imageWindow"+b.element.id).find(".jqx-editor-align").jqxDropDownList("destroy"),a("#imageWindow"+b.element.id).find("button").jqxButton("destroy")):"createlink"===e.command&&a("#linkWindow"+b.element.id).length>0&&(a("#linkWindow"+b.element.id).find(".jqx-editor-align").jqxDropDownList("destroy"),a("#linkWindow"+b.element.id).find("button").jqxButton("destroy"),a("#linkWindow"+b.element.id).find(".jqx-editor-link-checkbox").jqxCheckBox("destroy"))}})};if(0==d.length)e(c);else for(var f=0;f<d.length;f++){var g=d[f],c=g.split(" ");e(c)}var h=a("#linkWindow"+this.element.id),i=a("#imageWindow"+this.element.id);h&&h.length>0&&h.jqxWindow("destroy"),i&&i.length>0&&i.jqxWindow("destroy"),b.inline?b.toolbar.remove():(b.widget.remove(),b.host.remove()),b.iframe.remove(),b.iframe=null,b.selection=null,b.editorDocument=null,b.contentEditableElement=null},val:function(a){if(void 0!==a&&"source"===a){var b=this.editor[0];"source"===this._documentMode&&(b=this.editor.find("pre:first")[0]);var d=new c,e=d.HTMLtoXML(b.innerHTML);return e=d.FormatHTML(e)}return void 0!=a&&"object"!=typeof a&&this.editor.html(a),"source"===this._documentMode?this.editor.find("pre:first").html():this.editor.html()},_raiseEvent:function(b,c){if(void 0==c&&(c={owner:null}),"source"==this._documentMode)return!0;var d=b;c.type=this.changeType,this.changeType=null,args=c,args.owner=this;var e=new a.Event(d);if(e.owner=this,e.args=args,this._textArea)var f=a(this._textArea).trigger(e);else var f=this.host.trigger(e);return c=e.args,f}});var b=function(b){var c={initialize:function(a){this.document=a},getSelection:function(){return this.document.getSelection?this.document.getSelection():this.document.selection},getRange:function(){var a=this.getSelection();if(!a)return null;try{return a.rangeCount>0?a.getRangeAt(0):this.document.createRange?this.document.createRange():this.document.selection.createRange()}catch(a){return this.document.body.createTextRange()}},selectRange:function(a){if(a.select)a.select();else{var b=this.getSelection();b.addRange&&(b.removeAllRanges(),b.addRange(a))}},selectNode:function(a,b){var c=this.getRange(),d=this.getSelection();if(c.moveToElementText)c.moveToElementText(a),c.select();else if(d.addRange)try{b?c.selectNodeContents(a):c.selectNode(a),d.removeAllRanges(),d.addRange(c)}catch(a){}else d.setBaseAndExtent(a,0,a,1);return a},isCollapsed:function(){var a=this.getRange();return!a.item&&(0==a.boundingWidth||this.getSelection().isCollapsed)},collapse:function(a){var b=this.getRange(),c=this.getSelection();b.select?(b.collapse(a),b.select()):a?c.collapseToStart():c.collapseToEnd()},getContent:function(){var b=this.getRange(),c=a("<div>")[0];if(this.isCollapsed())return"";b.cloneContents?c.appendChild(b.cloneContents()):void 0!=b.item||void 0!=b.htmlText?a(c).html(b.item?b.item(0).outerHTML:b.htmlText):a(c).html(b.toString());var d=a(c).html();return d},getText:function(){var a=this.getRange(),b=this.getSelection();return this.isCollapsed()?"":a.text||(b.toString?b.toString():"")},getNode:function(){var c=this.getRange();if(!a.jqx.browser.msie||a.jqx.browser.version>=9){var d=null;if(c)for(d=c.commonAncestorContainer,c.collapsed||c.startContainer==c.endContainer&&c.startOffset-c.endOffset<2&&c.startContainer.hasChildNodes()&&(d=c.startContainer.childNodes[c.startOffset]);"element"!=typeof d;)d=d.parentNode;return b.id(d)}return b.id(c.item?c.item(0):c.parentElement())},insertContent:function(a){var b=this.getRange();if(b.pasteHTML)b.pasteHTML(a),b.collapse(!1),b.select();else if(b.insertNode)if(b.deleteContents(),b.createContextualFragment)b.insertNode(b.createContextualFragment(a));else{var c=this.document,d=c.createDocumentFragment(),e=c.createElement("div");d.appendChild(e),e.outerHTML=a,b.insertNode(d)}}};return c.initialize(b),c},c=function(){function a(a){for(var b={},c=a.split(","),d=0;d<c.length;d++)b[c[d]]=!0;return b}var b=/^<([-A-Za-z0-9_]+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,c=/^<\/([-A-Za-z0-9_]+)[^>]*>/,d=/([-A-Za-z0-9_]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,e=a("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),f=a("address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul"),g=a("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"),h=a("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),i=a("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),j=a("script,style"),k=this.HTMLParser=function(a,k){function l(a,b,c,j){if(b=b.toLowerCase(),f[b])for(;q.last()&&g[q.last()];)m("",q.last());if(h[b]&&q.last()==b&&m("",b),j=e[b]||!!j,j||q.push(b),k.start){var l=[];c.replace(d,function(a,b){var c=arguments[2]?arguments[2]:arguments[3]?arguments[3]:arguments[4]?arguments[4]:i[b]?b:"";l.push({name:b,value:c,escaped:c.replace(/(^|[^\\])"/g,'$1\\"')})}),k.start&&k.start(b,l,j)}}function m(a,b){if(b)for(var c=q.length-1;c>=0&&q[c].toLowerCase()!=b.toLowerCase();c--);else var c=0;if(c>=0){for(var d=q.length-1;d>=c;d--)k.end&&k.end(q[d]);q.length=c}}var n,o,p,q=[],r=a;for(q.last=function(){return this[this.length-1]};a;){if(o=!0,q.last()&&j[q.last()])a=a.replace(new RegExp("(.*)</"+q.last()+"[^>]*>"),function(a,b){return b=b.replace(/<!--(.*?)-->/g,"$1").replace(/<!\[CDATA\[(.*?)]]>/g,"$1"),k.chars&&k.chars(b),""}),m("",q.last());else if(0==a.indexOf("<!--")?(n=a.indexOf("-->"),n>=0&&(k.comment&&k.comment(a.substring(4,n)),a=a.substring(n+3),o=!1)):0==a.indexOf("</")?(p=a.match(c),p&&(a=a.substring(p[0].length),p[0].replace(c,m),o=!1)):0==a.indexOf("<")&&(p=a.match(b),p&&(a=a.substring(p[0].length),p[0].replace(b,l),o=!1)),o){n=a.indexOf("<");var s=n<0?a:a.substring(0,n);a=n<0?"":a.substring(n),k.chars&&k.chars(s)}r=a}m()};this.HTMLtoXML=function(a){var b="";return a=a.replace(/\r/gi,""),a=a.replace(/\n/gi,""),k(a,{start:function(a,c,d){b+="<"+a;for(var e=0;e<c.length;e++)b+=" "+c[e].name+'="'+c[e].escaped+'"';b+=(d?"/":"")+">"},end:function(a){b+="</"+a+">\r\n"},chars:function(a){b+=a},comment:function(a){b+="<!--"+a+"-->"}}),b},this.FormatHTML=function(a,b){function c(){return this.pos=0,this.token="",this.current_mode="CONTENT",this.tags={parent:"parent1",parentcount:1,parent1:""},this.tag_type="",this.token_text=this.last_token=this.last_text=this.token_type="",this.Utils={whitespace:"\n\r\t ".split(""),single_token:"br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?=".split(","),extra_liners:"head,body,/html".split(","),in_array:function(a,b){for(var c=0;c<b.length;c++)if(a===b[c])return!0;return!1}},this.get_content=function(){for(var a="",b=[],c=!1;"<"!==this.input.charAt(this.pos);){if(this.pos>=this.input.length)return b.length?b.join(""):["","TK_EOF"];if(a=this.input.charAt(this.pos),this.pos++,this.line_char_count++,this.Utils.in_array(a,this.Utils.whitespace))b.length&&(c=!0),this.line_char_count--;else{if(c){if(this.line_char_count>=this.max_char){b.push("\n");for(var d=0;d<this.indent_level;d++)b.push(this.indent_string);this.line_char_count=0}else b.push(" "),this.line_char_count++;c=!1}b.push(a)}}return b.length?b.join(""):""},this.get_contents_to=function(a){if(this.pos==this.input.length)return["","TK_EOF"];var b="",c=new RegExp("</"+a+"\\s*>","igm");c.lastIndex=this.pos;var d=c.exec(this.input),e=d?d.index:this.input.length;return this.pos<e&&(b=this.input.substring(this.pos,e),this.pos=e),b},this.record_tag=function(a){this.tags[a+"count"]?(this.tags[a+"count"]++,this.tags[a+this.tags[a+"count"]]=this.indent_level):(this.tags[a+"count"]=1,this.tags[a+this.tags[a+"count"]]=this.indent_level),this.tags[a+this.tags[a+"count"]+"parent"]=this.tags.parent,this.tags.parent=a+this.tags[a+"count"]},this.retrieve_tag=function(a){if(this.tags[a+"count"]){for(var b=this.tags.parent;b&&a+this.tags[a+"count"]!==b;)b=this.tags[b+"parent"];b&&(this.indent_level=this.tags[a+this.tags[a+"count"]],this.tags.parent=this.tags[b+"parent"]),delete this.tags[a+this.tags[a+"count"]+"parent"],delete this.tags[a+this.tags[a+"count"]],1==this.tags[a+"count"]?delete this.tags[a+"count"]:this.tags[a+"count"]--}},this.get_tag=function(){var a,b,c="",d=[],e=!1;do{if(this.pos>=this.input.length)return d.length?d.join(""):["","TK_EOF"];c=this.input.charAt(this.pos),this.pos++,this.line_char_count++,this.Utils.in_array(c,this.Utils.whitespace)?(e=!0,this.line_char_count--):("'"!==c&&'"'!==c||d[1]&&"!"===d[1]||(c+=this.get_unformatted(c),e=!0),"="===c&&(e=!1),d.length&&"="!==d[d.length-1]&&">"!==c&&e&&(this.line_char_count>=this.max_char?(this.print_newline(!1,d),this.line_char_count=0):(d.push(" "),this.line_char_count++),e=!1),"<"===c&&(a=this.pos-1),d.push(c))}while(">"!==c);var f,g=d.join("");f=g.indexOf(" ")!=-1?g.indexOf(" "):g.indexOf(">");var h=g.substring(1,f).toLowerCase();if("/"===g.charAt(g.length-2)||this.Utils.in_array(h,this.Utils.single_token))this.tag_type="SINGLE";else if("script"===h)this.record_tag(h),this.tag_type="SCRIPT";else if("style"===h)this.record_tag(h),this.tag_type="STYLE";else if(this.Utils.in_array(h,i)){var j=this.get_unformatted("</"+h+">",g);d.push(j),a>0&&this.Utils.in_array(this.input.charAt(a-1),this.Utils.whitespace)&&d.splice(0,0,this.input.charAt(a-1)),b=this.pos-1,this.Utils.in_array(this.input.charAt(b+1),this.Utils.whitespace)&&d.push(this.input.charAt(b+1)),this.tag_type="SINGLE"}else if("!"===h.charAt(0))if(h.indexOf("[if")!=-1){if(g.indexOf("!IE")!=-1){var j=this.get_unformatted("-->",g);d.push(j)}this.tag_type="START"}else if(h.indexOf("[endif")!=-1)this.tag_type="END",this.unindent();else if(h.indexOf("[cdata[")!=-1){var j=this.get_unformatted("]]>",g);d.push(j),this.tag_type="SINGLE"}else{var j=this.get_unformatted("-->",g);d.push(j),this.tag_type="SINGLE"}else"/"===h.charAt(0)?(this.retrieve_tag(h.substring(1)),this.tag_type="END"):(this.record_tag(h),this.tag_type="START"),this.Utils.in_array(h,this.Utils.extra_liners)&&this.print_newline(!0,this.output);return d.join("")},this.get_unformatted=function(a,b){if(b&&b.indexOf(a)!=-1)return"";var c="",d="",e=!0;do{if(this.pos>=this.input.length)return d;if(c=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(c,this.Utils.whitespace)){if(!e){this.line_char_count--;continue}if("\n"===c||"\r"===c){d+="\n",this.line_char_count=0;continue}}d+=c,this.line_char_count++,e=!0}while(d.indexOf(a)==-1);return d},this.get_token=function(){var a;if("TK_TAG_SCRIPT"===this.last_token||"TK_TAG_STYLE"===this.last_token){var b=this.last_token.substr(7);return a=this.get_contents_to(b),"string"!=typeof a?a:[a,"TK_"+b]}if("CONTENT"===this.current_mode)return a=this.get_content(),"string"!=typeof a?a:[a,"TK_CONTENT"];if("TAG"===this.current_mode){if(a=this.get_tag(),"string"!=typeof a)return a;var c="TK_TAG_"+this.tag_type;return[a,c]}},this.get_full_indent=function(a){return a=this.indent_level+a||0,a<1?"":Array(a+1).join(this.indent_string)},this.printer=function(a,b,c,d,e){this.input=a||"",this.output=[],this.indent_character=b,this.indent_string="",this.indent_size=c,this.brace_style=e,this.indent_level=0,this.max_char=d,this.line_char_count=0;for(var f=0;f<this.indent_size;f++)this.indent_string+=this.indent_character;this.print_newline=function(a,b){if(this.line_char_count=0,b&&b.length){if(!a)for(;this.Utils.in_array(b[b.length-1],this.Utils.whitespace);)b.pop();b.push("\n");for(var c=0;c<this.indent_level;c++)b.push(this.indent_string)}},this.print_token=function(a){this.output.push(a)},this.indent=function(){this.indent_level++},this.unindent=function(){this.indent_level>0&&this.indent_level--}},this}var d,e,f,g,h,i;for(b=b||{},e=b.indent_size||4,f=b.indent_char||" ",h=b.brace_style||"collapse",g=1/0,i=b.unformatted||["a","span","bdo","em","strong","dfn","code","samp","kbd","var","cite","abbr","acronym","q","sub","sup","tt","i","b","big","small","u","s","strike","font","ins","del","pre","address","dt","h1","h2","h3","h4","h5","h6"],d=new c,d.printer(a,f,e,g,h);;){var j=d.get_token();if(d.token_text=j[0],d.token_type=j[1],"TK_EOF"===d.token_type)break;switch(d.token_type){case"TK_TAG_START":d.print_newline(!1,d.output),d.print_token(d.token_text),d.indent(),d.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":d.print_newline(!1,d.output),d.print_token(d.token_text),d.current_mode="CONTENT";break;case"TK_TAG_END":if("TK_CONTENT"===d.last_token&&""===d.last_text){var k=d.token_text.match(/\w+/)[0],l=d.output[d.output.length-1].match(/<\s*(\w+)/);null!==l&&l[1]===k||d.print_newline(!0,d.output)}d.print_token(d.token_text),d.current_mode="CONTENT";break;case"TK_TAG_SINGLE":var m=d.token_text.match(/^\s*<([a-z]+)/i);m&&d.Utils.in_array(m[1],i)||d.print_newline(!1,d.output),d.print_token(d.token_text),d.current_mode="CONTENT";break;case"TK_CONTENT":""!==d.token_text&&d.print_token(d.token_text),d.current_mode="TAG";break;case"TK_STYLE":case"TK_SCRIPT":if(""!==d.token_text){d.output.push("\n");var n=d.token_text;if("keep"==b.indent_scripts)var o=0;else if("separate"==b.indent_scripts)var o=-d.indent_level;else var o=1;var p=d.get_full_indent(o),q=n.match(/^\s*/)[0],r=q.match(/[^\n\r]*$/)[0].split(d.indent_string).length-1,s=d.get_full_indent(o-r);n=n.replace(/^\s*/,p).replace(/\r\n|\r|\n/g,"\n"+s).replace(/\s*$/,""),n&&(d.print_token(n),d.print_newline(!0,d.output))}d.current_mode="TAG"}d.last_token=d.token_type,d.last_text=d.token_text}return d.output.join("")}}}(jqxBaseFramework);

mercurial