diff -r 065a242ed7ec -r 7119ea8a5225 www-thermferm/jqwidgets/jqxeditor.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/www-thermferm/jqwidgets/jqxeditor.js Sun Jul 20 23:09:50 2014 +0200
@@ -0,0 +1,7 @@
+/*
+jQWidgets v3.4.0 (2014-June-23)
+Copyright (c) 2011-2014 jQWidgets.
+License: http://jqwidgets.com/license/
+*/
+
+(function(c){$.jqx.jqxWidget("jqxEditor","",{});$.extend($.jqx._jqxEditor.prototype,{defineInstance:function(){this.width=null;this.height=null;this.disabled=false;this.pasteMode="html";this.editable=true;this.lineBreak="default";this.toolbarPosition="top";this.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"}};this.createCommand=null;this.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":"<not set>",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"};this.localization=this.defaultLocalization;this.tools="bold italic underline | format font size | color background | left center right | outdent indent | ul ol | image | link | clean | html";this.readOnly=false;this.stylesheets=new Array();this.rtl=false;this.colorPickerTemplate='
';this.touchMode=false;this.events=["change"]},createInstance:function(k){var g=this;this.textArea=this.host;var o=this.host.attr("contenteditable");this.host.addClass(this.toThemeProperty("jqx-widget"));if(o==true||o=="true"){this.inline=true;this.widget=this.host;this.editorDocument=document;this.selection=new b(this.editorDocument);var n=$("");n.insertBefore(this.host);this.toolbarContainer=n;this.toolbar=n.find(".jqx-editor-toolbar");this.editor=this.host;this.contentEditableElement=this.element}else{var h=$("
");this.widget=h;this.widget[0].className=this.widget[0].className+" "+this.element.className;try{this.widget[0].style=this.element.style}catch(l){}var j=$.trim(this.host.html())+"";if(this.lineBreak=="default"||this.lineBreak=="div"){j="
"+j+"
"}else{if(this.lineBreak=="p"){j="
"+j+"
"}}j=j.replace(/</ig,"<");j=j.replace(/>/ig,">");this.host.css("display","none");this.host.after(h);h.find("iframe").after(this.host);this.container=h.find(".jqx-editor-container");this.toolbarContainer=h.find(".jqx-editor-toolbar-container");this.toolbar=h.find(".jqx-editor-toolbar");this.iframe=h.find("iframe");this.content=h.find(".jqx-editor-content");this.editorDocument=this.iframe[0].contentWindow.document;this.selection=new b(this.editorDocument);if(!$.jqx.browser.mozilla){this.editorDocument.designMode="On"}this.editorDocument.open();var a=this.rtl?"direction:rtl;":"";var m=$.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;":"";this.editorDocument.write("
"+$.map(this.stylesheets,function(e){return"
"}).join("")+"");this.contentEditableElement=this.editorDocument.body;if(this.host.is("textarea")){this._textArea=this.element;var f=this.host.data();f.jqxEditor.host=h;f.jqxEditor.element=h[0];this.element=h[0];h[0].id=this._textArea.id;this._textArea.id=this._textArea.id+"TextArea";$(this.element).addClass(this.toThemeProperty("jqx-widget"));this.host=$(this.element);this.host.data(f)}try{this.editorDocument.execCommand("useCSS",false,false);this.editorDocument.execCommand("enableInlineTableEditing",null,false)}catch(i){}try{this.editorDocument.execCommand("styleWithCSS",0,true)}catch(i){}this.editorDocument.close();this.editor=$(this.editorDocument.body);this.editor.html(j).attr("spellcheck",false).attr("autocorrect","off");$.jqx.utilities.resize(h,function(){g.widget.css("width",g.width);g.widget.css("height",g.height);g._arrange()})}},focus:function(){if($.jqx.browser.mozilla){if(!this.focused){if(this.iframe){this.iframe.focus()}this.selection.selectNode(this.editor[0].firstChild,true);this.selection.getRange().collapse(true)}}this.editor.focus();var a=this.range!=null?this.range:this.getRange();this.selectRange(a)},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('
Print'+this.val()+"");a.document.close()},refresh:function(a){var m=this;$.each(this.defaultLocalization,function(i,r){if(!m.localization[i]){m.localization[i]=r}});this._removeHandlers();this.toolbar.addClass(this.toThemeProperty("jqx-widget-header"));if(this.content){this.widget.css("width",this.width);this.widget.css("height",this.height);this.widget.addClass(this.toThemeProperty("jqx-editor"));this.widget.addClass(this.toThemeProperty("jqx-widget"));this.widget.addClass(this.toThemeProperty("jqx-rc-all"));this.widget.addClass(this.toThemeProperty("jqx-widget-header"));this.content.addClass(this.toThemeProperty("jqx-widget-content"));this.container.addClass(this.toThemeProperty("jqx-editor-container"))}else{this.toolbarContainer.addClass(this.toThemeProperty("jqx-widget-header"));this.toolbarContainer.addClass(this.toThemeProperty("jqx-editor-toolbar-inline"));this.toolbarContainer.addClass(this.toThemeProperty("jqx-widget"));this.toolbarContainer.addClass(this.toThemeProperty("jqx-rc-all"));this.toolbarContainer.hide();this.toolbarContainer.css("position","absolute");this.editor.addClass(this.toThemeProperty("jqx-editor-inline"));this.toolbarContainer.css("width",this.host.outerWidth()+"px")}var n=this.toolbarContainer.index();if(this.toolbarPosition=="top"&&n!=0||this.toolbarPosition=="bottom"&&n!=1){switch(this.toolbarPosition){case"bottom":this.toolbarContainer.insertAfter(this.content);break;case"top":default:this.toolbarContainer.insertBefore(this.content);break}}var h=this.tools;if(h!==false){var l=h.split(" ");var p=h.split(" | ");var q=function(i,r){$.each(r,function(y,F){var u=m.commands[this];if(!u){if(m.createCommand){u=m.createCommand(this.toString());if(!u){return true}if(!m.commands[this]){m.commands[this]=u}}else{return true}}else{if(m.createCommand){var x=m.createCommand(this.toString());u=$.extend(u,x)}}if(m.localization[this]){u.tooltip=m.localization[this]}switch(u.type){case"list":if(u.widget){u.widget.jqxDropDownList("destroy")}var A=function(R,Q,S){if(u.command=="formatblock"){return"<"+S+' unselectable="on" style="padding: 0px; margin: 0px;">'+Q+""+S+">"}else{if(u.command=="fontname"){return'
'+Q+""}else{if(u.command=="fontsize"){return''+Q+""}}}};var t=function(){var Q=m.toThemeProperty("jqx-editor-toolbar-icon")+" "+m.toThemeProperty("jqx-editor-toolbar-icon-"+u.command);var R="";return R};var C=u.command=="formatblock"||u.command=="fontname"||u.command=="fontsize";var z=u.value||[];var N=new Array();var J=u.placeHolder||"Please Choose:";if(u.command=="fontname"){$.each(z,function(){var Q=m.localization[this.label];N.push({label:Q,value:this.value})})}else{if(u.command=="formatblock"){J=m.localization.format;$.each(z,function(){if(this.label.indexOf("Header")>=0){var Q=this.label.replace("Header",m.localization.Header)}else{var Q=m.localization[this.label]}N.push({label:Q,value:this.value})})}else{N=z}}var P={enableBrowserBoundsDetection:true,touchMode:m.touchMode,width:u.width||100,height:u.height||25,dropDownWidth:u.dropDownWidth||"auto",autoDropDownHeight:(u.value&&u.value.length)<12?true:false,placeHolder:J,source:N,theme:m.theme,keyboardSelection:false,focusable:false,disabled:m.disabled,rtl:m.rtl,selectionRenderer:u.command=="fontsize"?t:null,renderer:C?A:null};var D="jqx-disableselect "+m.toThemeProperty("jqx-editor-dropdownlist")+" "+m.toThemeProperty("jqx-editor-toolbar-item");var w=$("");w.appendTo(i);w.jqxDropDownList(P);if(u.init){u.init(w)}var F=null;var E=null;var K="";m.addHandler(w,"mousedown",function(R){if($(".jqx-editor-dropdownpicker").length>0){$(".jqx-editor-dropdownpicker").jqxDropDownButton("close")}if($(".jqx-editor-dropdownlist").length>0){var Q=$(".jqx-editor-dropdownlist");$.each(Q,function(S,T){if(T!=w[0]){$(T).jqxDropDownList("close")}})}});m.addHandler(w,"open",function(Q){if(!m.focused){m.focus()}m.updating=true;m.activeElement=w;F=w.val();K=""});m.addHandler(w,"change",function(Q){m.updating=false;m.activeElement=null;E=w.val();K=Q.args.type;if($.jqx.browser.msie&&$.jqx.browser.version<9){m.focus()}});m.addHandler(w,"close",function(Q){m.updating=false;m.activeElement=null;if(F!=E){if(K=="mouse"||K=="keyboard"){m._refreshTools()}}});m._addCommandHandler(w,"change",u.command,null,u);break;case"colorPicker":if(u.widget){$(u.colorPicker).remove();u.widget.jqxDropDownButton("destroy")}var B=$('').attr("id","picker-"+u.command);var D="jqx-disableselect "+m.toThemeProperty("jqx-editor-dropdownpicker")+" "+m.toThemeProperty("jqx-editor-toolbar-item");var w=$("");w.appendTo(i);w.append(B);w.jqxDropDownButton({touchMode:m.touchMode,disabled:m.disabled,enableBrowserBoundsDetection:true,width:u.width||45,height:u.height||25,rtl:m.rtl,focusable:false,theme:m.theme});var I=$('');var s=m.toThemeProperty("jqx-editor-toolbar-icon")+" "+m.toThemeProperty("jqx-editor-toolbar-icon-"+u.command);var O=$("
");I.append(O);var L=$('
').attr("id","bar-"+u.command).css("background-color",u.value);I.append(L);w.jqxDropDownButton("setContent",I);B.append($(m.colorPickerTemplate));u.colorPicker=B;if(u.init){u.init(w)}B.find("tr").attr("role","row").attr("unselectable","on");B.find("td").attr("role","gridcell").attr("unselectable","on").css("-webkit-user-select","none");B.find("div").attr("unselectable","on");m.addHandler(w,"mousedown",function(R){if($(".jqx-editor-dropdownlist").length>0){$(".jqx-editor-dropdownlist").jqxDropDownList("close")}if($(".jqx-editor-dropdownpicker").length>0){var Q=$(".jqx-editor-dropdownpicker");$.each(Q,function(S,T){if(T!=w[0]){$(T).jqxDropDownButton("close")}})}});m.addHandler(w,"open",function(){if(!m.focused){m.focus()}m.updating=true;m.activeElement=B});m.addHandler(w,"close",function(Q){m.updating=false;m.activeElement=null;if(F!=E){if(K=="mouse"||K=="keyboard"){m._refreshTools()}}});m.addHandler(B,"keydown",function(Q){var Y=Q.keyCode;var V=$(B).find(".jqx-editor-color-picker-selected-cell");var aa=B.find("tr");var T=aa.length;var S=V.parent().children().length;var U=V.index();var W=-999;var Z=V.parent();$.each(aa,function(ab,ac){if(this==Z[0]){W=ab;return false}});switch(Y){case 27:w.jqxDropDownButton("close");break;case 13:$(V).trigger("mousedown");break;case 38:W--;break;case 40:W++;break;case 39:U++;break;case 37:U--;break}if(W>=0&&W<=T){if(U>=0&&U<=S){var Z=B.find("tr")[W];var X=$(Z).children()[U];var R=$(X).children().css("background-color");u.val(R)}}});var M=$(B).find("td");u.val=function(Q){var R=m._rgbToHex(Q);$.each(M,function(){var S=$(this).children().css("background-color");var T=m._rgbToHex(S);if(T==R){M.removeClass("jqx-editor-color-picker-selected-cell");$(this).addClass("jqx-editor-color-picker-selected-cell");$("#bar-"+u.command).css("background",S);return false}})};u.val(u.value);m._addCommandHandler(M,"mousedown",u.command,null,u);break;case"button":case"toggleButton":default:if(u.widget){if(u.type=="button"){u.widget.jqxButton("destroy")}else{u.widget.jqxToggleButton("destroy")}}var v=u.command;var H=u.action;var s=m.toThemeProperty("jqx-editor-toolbar-icon")+" "+m.toThemeProperty("jqx-editor-toolbar-icon-"+v);var O=$("
");var w=$("
").addClass("jqx-disableselect").addClass(m.toThemeProperty("jqx-editor-toolbar-button"));if(!u.init){w.append(O)}else{if(v){w.append(O)}}w.appendTo(i);if(u.type=="button"){w.jqxButton({disabled:m.disabled,rtl:m.rtl,theme:m.theme})}else{if(u.type=="toggleButton"){w.jqxToggleButton({disabled:m.disabled,rtl:m.rtl,uiToggle:false,theme:m.theme})}}if(u.init){u.init(w)}u.toggled=false;u.toggle=function(){u.toggled=!u.toggled};m.addHandler(w,"mousedown",function(Q){if(Q.preventDefault){Q.preventDefault()}if(Q.stopPropagation){Q.stopPropagation()}return false});if(!$.jqx.mobile.isTouchDevice()){m._addCommandHandler(w,"click",v,H,u)}else{m._addCommandHandler(w,"mousedown",v,H,u)}break}u.widget=w;if(w){try{if(u.tooltip!=""){u.widget.attr("title",u.tooltip);u.widget.attr("data-tooltip",u.tooltip)}if(u.command){u.widget.attr("data-command",u.command)}u.widget.attr("aria-label",u.tooltip)}catch(G){}if(u.type=="button"||u.type=="toggleButton"){if(r.length>2){if(y==0){w.css("border-right-radius","0px");w.addClass(m.toThemeProperty("jqx-rc-l"))}else{if(y==r.length-1){w.css("border-left-radius","0px");w.addClass(m.toThemeProperty("jqx-rc-r"))}}w.removeClass(m.toThemeProperty("jqx-rc-all"))}if(y!=0&&y!=r.length-1&&r.length>2){w.css("border-left-radius","0px");w.css("border-right-radius","0px");w.removeClass(m.toThemeProperty("jqx-rc-all"))}else{if(r.length==2){if(y==0){w.css("border-right-radius","0px");w.addClass(m.toThemeProperty("jqx-rc-l"))}else{w.css("border-left-radius","0px");w.addClass(m.toThemeProperty("jqx-rc-r"))}w.removeClass(m.toThemeProperty("jqx-rc-all"))}else{if(r.length==1){w.css("margin-right","0px")}}}}}})};m.toolbar.css("direction",!this.rtl?"ltr":"rtl");if(p.length==0){q(m.toolbar,l)}else{for(var j=0;j
");k.addClass(m.toThemeProperty("jqx-rc-all"));m.toolbar.append(k);q(k,l)}var g=m.toolbar.find(".jqx-editor-toolbar-group");var e=g.length;for(var j=0;j
0){$(".jqx-editor-dropdownpicker").jqxDropDownButton("close")}if($(".jqx-editor-dropdownlist").length>0){$(".jqx-editor-dropdownlist").jqxDropDownList("close")}if(e.inline){e.editor.focus()}});if($.jqx.mobile.isTouchDevice()){this.addHandler($(this.editorDocument),"selectionchange.editor"+this.element.id,function(){if(e.editorDocument.activeElement!=e.editor[0]){window.focus();e.focus()}});this.addHandler($(this.editorDocument),"keydown.editor"+this.element.id,function(){if(e.editorDocument.activeElement!=e.editor[0]){window.focus();e.focus()}})}this.addHandler(this.editor,"mouseup.editor"+this.element.id,function(g){if(e._documentMode=="source"){return true}e.range=e.getRange();e._refreshTools(null,true)});this.addHandler(this.editor,"keydown.editor"+this.element.id,function(g){if(e._documentMode=="source"){return true}if($.jqx.browser.mozilla){if(!e.focused){a()}}if(e.disabled){if(g.preventDefault){g.preventDefault()}return false}if(e.updating){if(e.activeElement){var m=jQuery.Event("keydown");$.extend(m,g);e.activeElement.trigger(m)}if(g.preventDefault){g.preventDefault()}return false}var n=g||window.event;var q=n.keyCode;var r=String.fromCharCode(q).toLowerCase();if(!e.editable){var l=[8,9,33,34,35,36,37,38,39,40,40,45,46];if($.inArray(n.keyCode,l)==-1&&!(n.ctrlKey&&r=="c")&&!(n.ctrlKey&&r=="a")){g.preventDefault()}}if(e.selection.getText().length>0||e.linkPopup){var l=[8,9,13,33,34,35,36,37,38,39,40,40,45,46];if(!$.inArray(n.keyCode,l)!=-1||(n.keyCode==65&&n.ctrlKey&&!n.altKey&&!n.shiftKey)){if(e._refreshToolsTimer){clearTimeout(e._refreshToolsTimer)}e._refreshToolsTimer=setTimeout(function(){e._refreshTools(null,true,n.keyCode)},10)}}if(q==13&&e.lineBreak!="default"){var k=e.getSelectedElement();if(k){var o=k.nodeName.toLowerCase();switch(o){case"pre":case"li":case"ul":case"ol":case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return true}var p=k;while(p!=null){if(p.nodeName=="#document"){p=e.editorDocument.body;break}if(p.parentNode==e.editorDocument.body||p==e.editorDocument.body){break}p=p.parentNode}}if(p){var j=e.getRange();if(e.editorDocument.body.innerHTML==""&&e.lineBreak!="br"){e.selection.insertContent("")}if(e.lineBreak=="div"){if(p==e.editorDocument.body){$(p).append("
")}else{$("
").insertAfter(p)}}else{if(e.lineBreak=="p"){if(p==e.editorDocument.body){$(p).append("
")}else{$("
").insertAfter(p)}}else{e.execute("insertHTML","
")}}e.selectRange(j);var i=$(e.editorDocument).find("#INSERTION_MARKER");if(e.lineBreak!="br"){e.selection.selectNode($(i).prev()[0],true)}else{e.selection.selectNode(i[0],true);if(e.getRange().setStartAfter){e.getRange().setStartAfter(i[0])}}i.remove();e.selection.collapse(false);if(p&&p.nodeName&&e.lineBreak=="br"){if(p.nodeName.toLowerCase()!="#text"){e.selection.selectNode(p,true);if(e.getRange().setStartAfter){e.getRange().setStartAfter(p)}e.selection.collapse(false)}}if(e.lineBreak!="br"){j=e.getRange();if(j.select){j.select()}}if(g.preventDefault){g.preventDefault()}return false}}if(n.ctrlKey&&(r=="k"||r=="u"||r=="b"||r=="i")){if(g.preventDefault){g.preventDefault()}var h=null;switch(r){case"k":h="link";break;case"u":h="underline";break;case"b":h="bold";break;case"i":h="italic";break}if(e.commands[h].widget){e.commands[h].widget.trigger("click")}return false}});this.addHandler(this.editor,"paste.editor"+this.element.id,function(k){if(e._documentMode=="source"){return true}if(e.readOnly){return true}e.updating=true;e.readOnly=true;var l=k;var j=function(p,o){if(o){if(!e.paragraphise){p=p.replace(/\n/g,"
")}else{p=""+p+"
";p=p.replace(/\n/g,"");p=p.replace(/
\s<\/p>/gi,"")}}else{p=p.replace(/]*?>(.*)/gim,"$1");p=p.replace(/<\/html>/gi,"");p=p.replace(/
]*?>(.*)/gi,"$1");p=p.replace(/<\/body>/gi,"");p=p.replace(/