diff --git a/Leanote/Leanote-Info.plist b/Leanote/Leanote-Info.plist index 4e3b939..36db71c 100755 --- a/Leanote/Leanote-Info.plist +++ b/Leanote/Leanote-Info.plist @@ -38,7 +38,7 @@ CFBundleVersion - 95C + 961 LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/Leanote/Settings.bundle/Root.plist b/Leanote/Settings.bundle/Root.plist index 7374e82..7971ffc 100755 --- a/Leanote/Settings.bundle/Root.plist +++ b/Leanote/Settings.bundle/Root.plist @@ -18,7 +18,7 @@ AutocorrectionType No DefaultValue - 1.0 (95C) + 1.0 (961) IsSecure Key diff --git a/Leanote/editor/EditorAssets/ZSSRichTextEditor.js b/Leanote/editor/EditorAssets/ZSSRichTextEditor.js index 2909096..7de10f8 100755 --- a/Leanote/editor/EditorAssets/ZSSRichTextEditor.js +++ b/Leanote/editor/EditorAssets/ZSSRichTextEditor.js @@ -82,9 +82,9 @@ ZSSEditor.init = function(callbacker, logger) { // Change a few CSS values if the device is an iPad ZSSEditor.isiPad = (navigator.userAgent.match(/iPad/i) != null); if (ZSSEditor.isiPad) { - $(document.body).addClass('ipad_body'); - $('#zss_field_title').addClass('ipad_field_title'); - $('#zss_field_content').addClass('ipad_field_content'); + $(document.body).addClass('ipad-body'); + // $('#zss_field_title').addClass('ipad_field_title'); + // $('#zss_field_content').addClass('ipad_field_content'); } document.execCommand('insertBrOnReturn', false, false); diff --git a/Leanote/editor/EditorAssets/all.js b/Leanote/editor/EditorAssets/all.js index 37d7283..d48e673 100755 --- a/Leanote/editor/EditorAssets/all.js +++ b/Leanote/editor/EditorAssets/all.js @@ -7,8 +7,8 @@ window.wp=window.wp||{},function(){wp.shortcode={next:function(t,e,n){var s,r,o= !function(e){function t(){var e=s();e!==r&&(r=e,l.trigger("orientationchange"))}function n(t,n,a,o){var i=a.type;a.type=n,e.event.dispatch.call(t,a,o),a.type=i}e.attrFn=e.attrFn||{};var a=navigator.userAgent.toLowerCase(),o=a.indexOf("chrome")>-1&&(a.indexOf("windows")>-1||a.indexOf("macintosh")>-1||a.indexOf("linux")>-1)&&a.indexOf("mobile")<0&&a.indexOf("nexus")<0,i={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,touch_capable:"ontouchstart"in document.documentElement&&!o,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:"ontouchstart"in document.documentElement&&!o?"touchstart":"mousedown",endevent:"ontouchstart"in document.documentElement&&!o?"touchend":"mouseup",moveevent:"ontouchstart"in document.documentElement&&!o?"touchmove":"mousemove",tapevent:"ontouchstart"in document.documentElement&&!o?"tap":"click",scrollevent:"ontouchstart"in document.documentElement&&!o?"touchmove":"scroll",hold_timer:null,tap_timer:null};e.isTouchCapable=function(){return i.touch_capable},e.getStartEvent=function(){return i.startevent},e.getEndEvent=function(){return i.endevent},e.getMoveEvent=function(){return i.moveevent},e.getTapEvent=function(){return i.tapevent},e.getScrollEvent=function(){return i.scrollevent},e.each(["tapstart","tapend","tap","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange"],function(t,n){e.fn[n]=function(e){return e?this.on(n,e):this.trigger(n)},e.attrFn[n]=!0}),e.event.special.tapstart={setup:function(){var t=this,a=e(t);a.on(i.startevent,function(e){if(a.data("callee",arguments.callee),e.which&&1!==e.which)return!1;var o=e.originalEvent,c={position:{x:i.touch_capable?o.touches[0].screenX:e.screenX,y:i.touch_capable?o.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.touches[0].pageX-o.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.touches[0].pageY-o.touches[0].target.offsetTop:e.offsetY},time:(new Date).getTime(),target:e.target};return n(t,"tapstart",e,c),!0})},remove:function(){e(this).off(i.startevent,e(this).data.callee)}},e.event.special.tapmove={setup:function(){var t=this,a=e(t);a.on(i.moveevent,function(e){a.data("callee",arguments.callee);var o=e.originalEvent,c={position:{x:i.touch_capable?o.touches[0].screenX:e.screenX,y:i.touch_capable?o.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.touches[0].pageX-o.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.touches[0].pageY-o.touches[0].target.offsetTop:e.offsetY},time:(new Date).getTime(),target:e.target};return n(t,"tapmove",e,c),!0})},remove:function(){e(this).off(i.moveevent,e(this).data.callee)}},e.event.special.tapend={setup:function(){var t=this,a=e(t);a.on(i.endevent,function(e){a.data("callee",arguments.callee);var o=e.originalEvent,c={position:{x:i.touch_capable?o.changedTouches[0].screenX:e.screenX,y:i.touch_capable?o.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.changedTouches[0].pageX-o.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.changedTouches[0].pageY-o.changedTouches[0].target.offsetTop:e.offsetY},time:(new Date).getTime(),target:e.target};return n(t,"tapend",e,c),!0})},remove:function(){e(this).off(i.endevent,e(this).data.callee)}},e.event.special.taphold={setup:function(){var t,a=this,o=e(a),c={x:0,y:0};o.on(i.startevent,function(e){if(e.which&&1!==e.which)return!1;o.data("tapheld",!1),t=e.target;var s=e.originalEvent,r=(new Date).getTime(),u={x:i.touch_capable?s.touches[0].screenX:e.screenX,y:i.touch_capable?s.touches[0].screenY:e.screenY},h={x:i.touch_capable?s.touches[0].pageX-s.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?s.touches[0].pageY-s.touches[0].target.offsetTop:e.offsetY};return c.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,c.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,i.hold_timer=window.setTimeout(function(){var l=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,p=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY;if(e.target==t&&c.x==l&&c.y==p){o.data("tapheld",!0);var g=(new Date).getTime(),f={x:i.touch_capable?s.touches[0].screenX:e.screenX,y:i.touch_capable?s.touches[0].screenY:e.screenY},d={x:i.touch_capable?s.touches[0].pageX-s.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?s.touches[0].pageY-s.touches[0].target.offsetTop:e.offsetY};duration=g-r;var v={startTime:r,endTime:g,startPosition:u,startOffset:h,endPosition:f,endOffset:d,duration:duration,target:e.target};o.data("callee1",arguments.callee),n(a,"taphold",e,v)}},i.taphold_threshold),!0}).on(i.endevent,function(){o.data("callee2",arguments.callee),o.data("tapheld",!1),window.clearTimeout(i.hold_timer)})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2)}},e.event.special.doubletap={setup:function(){var t,a,o,c,s=this,r=e(s);r.on(i.startevent,function(e){return e.which&&1!==e.which?!1:r.data("lastTouch")?void 0:(r.data("doubletapped",!1),t=e.target,r.data("callee1",arguments.callee),c=e.originalEvent,o={position:{x:i.touch_capable?c.touches[0].screenX:e.screenX,y:i.touch_capable?c.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?c.touches[0].pageX-c.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?c.touches[0].pageY-c.touches[0].target.offsetTop:e.offsetY},time:(new Date).getTime(),target:e.target},!0)}).on(i.endevent,function(e){var c=(new Date).getTime(),u=r.data("lastTouch")||c+1,h=c-u;if(window.clearTimeout(a),r.data("callee2",arguments.callee),h0&&e.target==t&&h>100){r.data("doubletapped",!0),window.clearTimeout(i.tap_timer);var l={position:{x:i.touch_capable?e.originalEvent.changedTouches[0].screenX:e.screenX,y:i.touch_capable?e.originalEvent.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?e.originalEvent.changedTouches[0].pageX-e.originalEvent.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?e.originalEvent.changedTouches[0].pageY-e.originalEvent.changedTouches[0].target.offsetTop:e.offsetY},time:(new Date).getTime(),target:e.target},p={firstTap:o,secondTap:l,interval:l.time-o.time};n(s,"doubletap",e,p)}else r.data("lastTouch",c),a=window.setTimeout(function(){window.clearTimeout(a)},i.doubletap_int,[e]);r.data("lastTouch",c)})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2)}},e.event.special.singletap={setup:function(){var t=this,a=e(t),o=null,c=null,s={x:0,y:0};a.on(i.startevent,function(e){return e.which&&1!==e.which?!1:(c=(new Date).getTime(),o=e.target,a.data("callee1",arguments.callee),s.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,s.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,!0)}).on(i.endevent,function(e){a.data("callee2",arguments.callee),e.target==o&&(end_pos_x=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageX:e.pageX,end_pos_y=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageY:e.pageY,i.tap_timer=window.setTimeout(function(){if(!a.data("doubletapped")&&!a.data("tapheld")&&s.x==end_pos_x&&s.y==end_pos_y){var o=e.originalEvent,r={position:{x:i.touch_capable?o.changedTouches[0].screenX:e.screenX,y:i.touch_capable?o.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.changedTouches[0].pageX-o.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.changedTouches[0].pageY-o.changedTouches[0].target.offsetTop:e.offsetY},time:(new Date).getTime(),target:e.target};r.time-c=-i.tap_pixel_range&&diff_x<=i.tap_pixel_range&&diff_y>=-i.tap_pixel_range&&diff_y<=i.tap_pixel_range)){var l=e.originalEvent,p={position:{x:i.touch_capable?l.changedTouches[0].screenX:e.screenX,y:i.touch_capable?l.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?l.changedTouches[0].pageX-l.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?l.changedTouches[0].pageY-l.changedTouches[0].target.offsetTop:e.offsetY},time:(new Date).getTime(),target:e.target};n(a,"tap",e,p)}})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2)}},e.event.special.swipe={setup:function(){function t(t){s=e(t.target),s.data("callee1",arguments.callee),h.x=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageX:t.pageX,h.y=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageY:t.pageY,l.x=h.x,l.y=h.y,r=!0;var n=t.originalEvent;o={position:{x:i.touch_capable?n.touches[0].screenX:t.screenX,y:i.touch_capable?n.touches[0].screenY:t.screenY},offset:{x:i.touch_capable?n.touches[0].pageX-n.touches[0].target.offsetLeft:t.offsetX,y:i.touch_capable?n.touches[0].pageY-n.touches[0].target.offsetTop:t.offsetY},time:(new Date).getTime(),target:t.target};for(var a=new Date;new Date-a<100;);}function n(t){s=e(t.target),s.data("callee2",arguments.callee),l.x=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageX:t.pageX,l.y=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageY:t.pageY,window.clearTimeout(i.hold_timer);var n,a=s.data("xthreshold"),c=s.data("ythreshold"),p="undefined"!=typeof a&&a!==!1&&parseInt(a)?parseInt(a):i.swipe_h_threshold,g="undefined"!=typeof c&&c!==!1&&parseInt(c)?parseInt(c):i.swipe_v_threshold;if(h.y>l.y&&h.y-l.y>g&&(n="swipeup"),h.xp&&(n="swiperight"),h.yg&&(n="swipedown"),h.x>l.x&&h.x-l.x>p&&(n="swipeleft"),void 0!=n&&r){h.x=0,h.y=0,l.x=0,l.y=0,r=!1;var f=t.originalEvent;endEvnt={position:{x:i.touch_capable?f.touches[0].screenX:t.screenX,y:i.touch_capable?f.touches[0].screenY:t.screenY},offset:{x:i.touch_capable?f.touches[0].pageX-f.touches[0].target.offsetLeft:t.offsetX,y:i.touch_capable?f.touches[0].pageY-f.touches[0].target.offsetTop:t.offsetY},time:(new Date).getTime(),target:t.target};var d=Math.abs(o.position.x-endEvnt.position.x),v=Math.abs(o.position.y-endEvnt.position.y),m={startEvnt:o,endEvnt:endEvnt,direction:n.replace("swipe",""),xAmount:d,yAmount:v,duration:endEvnt.time-o.time};u=!0,s.trigger("swipe",m).trigger(n,m)}}function a(t){s=e(t.target);var n="";if(s.data("callee3",arguments.callee),u){var a=s.data("xthreshold"),c=s.data("ythreshold"),h="undefined"!=typeof a&&a!==!1&&parseInt(a)?parseInt(a):i.swipe_h_threshold,l="undefined"!=typeof c&&c!==!1&&parseInt(c)?parseInt(c):i.swipe_v_threshold,p=t.originalEvent;endEvnt={position:{x:i.touch_capable?p.changedTouches[0].screenX:t.screenX,y:i.touch_capable?p.changedTouches[0].screenY:t.screenY},offset:{x:i.touch_capable?p.changedTouches[0].pageX-p.changedTouches[0].target.offsetLeft:t.offsetX,y:i.touch_capable?p.changedTouches[0].pageY-p.changedTouches[0].target.offsetTop:t.offsetY},time:(new Date).getTime(),target:t.target},o.position.y>endEvnt.position.y&&o.position.y-endEvnt.position.y>l&&(n="swipeup"),o.position.xh&&(n="swiperight"),o.position.yl&&(n="swipedown"),o.position.x>endEvnt.position.x&&o.position.x-endEvnt.position.x>h&&(n="swipeleft");var g=Math.abs(o.position.x-endEvnt.position.x),f=Math.abs(o.position.y-endEvnt.position.y),d={startEvnt:o,endEvnt:endEvnt,direction:n.replace("swipe",""),xAmount:g,yAmount:f,duration:endEvnt.time-o.time};s.trigger("swipeend",d)}r=!1,u=!1}var o,c=this,s=e(c),r=!1,u=!1,h={x:0,y:0},l={x:0,y:0};s.on(i.startevent,t),s.on(i.moveevent,n),s.on(i.endevent,a)},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.moveevent,e(this).data.callee2).off(i.endevent,e(this).data.callee3)}},e.event.special.scrollstart={setup:function(){function t(e,t){a=t,n(c,a?"scrollstart":"scrollend",e)}var a,o,c=this,s=e(c);s.on(i.scrollevent,function(e){s.data("callee",arguments.callee),a||t(e,!0),clearTimeout(o),o=setTimeout(function(){t(e,!1)},50)})},remove:function(){e(this).off(i.scrollevent,e(this).data.callee)}};var c,s,r,u,h,l=e(window),p={0:!0,180:!0};if(i.orientation_support){var g=window.innerWidth||e(window).width(),f=window.innerHeight||e(window).height(),d=50;u=g>f&&g-f>d,h=p[window.orientation],(u&&h||!u&&!h)&&(p={"-90":!0,90:!0})}e.event.special.orientationchange=c={setup:function(){return i.orientation_support?!1:(r=s(),l.on("throttledresize",t),!0)},teardown:function(){return i.orientation_support?!1:(l.off("throttledresize",t),!0)},add:function(e){var t=e.handler;e.handler=function(e){return e.orientation=s(),t.apply(this,arguments)}}},e.event.special.orientationchange.orientation=s=function(){var e=!0,t=document.documentElement;return e=i.orientation_support?p[window.orientation]:t&&t.clientWidth/t.clientHeight<1.1,e?"portrait":"landscape"},e.event.special.throttledresize={setup:function(){e(this).on("resize",_)},teardown:function(){e(this).off("resize",_)}};var v,m,w,T=250,_=function(){m=(new Date).getTime(),w=m-x,w>=T?(x=m,e(this).trigger("throttledresize")):(v&&window.clearTimeout(v),v=window.setTimeout(t,T-w))},x=0;e.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe"},function(t,n){e.event.special[t]={setup:function(){e(this).on(n,e.noop)}}})}(jQuery); function WPHybridCallbacker(){}WPHybridCallbacker.prototype.callback=function(e,r){var t=e+":";r&&(t+=r),isUsingiOS?this.callbackThroughIFrame(t):console.log(t)},WPHybridCallbacker.prototype.callbackThroughIFrame=function(e){var r=document.createElement("IFRAME");r.setAttribute("src",e),r.style.cssText="border: 0px transparent;",document.documentElement.appendChild(r),r.parentNode.removeChild(r),r=null}; function WPHybridLogger(r,a){this.callbacker=r,this.parameterSeparator=a}WPHybridLogger.prototype.log=function(r){this.callbacker.callback("callback-log","msg="+r)},WPHybridLogger.prototype.logError=function(r,a,l){var o=["msg="+r,"url="+a,"line="+l],c=o.join(this.parameterSeparator);this.callbacker.callback("callback-log-error",c)}; -function callObjc(e){var t=document.createElement("IFRAME");t.setAttribute("src",e),t.style.cssText="border: 0px transparent;",document.documentElement.appendChild(t),t.parentNode.removeChild(t),t=null}function removeFomat(){try{for(var e=window.getSelection(),t=e.getRangeAt(0).cloneRange(),i=t.commonAncestorContainer;;){var n=i.nodeName.toLowerCase();if("p"==n||"div"==n||"hr"==n||"table"==n||"img"==n||"a"==n||"span"==n||"font"==n||"body"==n||0===n.indexOf("h")||"blockquote"==n)break;i=i.parentNode}if("img"===n)return;var o=$(i);if("body"!=n&&"html"!=n){if("div"==n&&"zss_field_content"==i.className)return;var r=n;-1!=n.indexOf("h")||"blockquote"==n?r="p":"a"===n&&(r="span");var a,d="LEACLR-"+(new Date).getTime(),l="~*Z+&",s='',c=$(s).get(0);o.find("img").length>0?(t.insertNode(c),a=o.html()):(c.innerHTML=l,t.insertNode(c),a=o.text(),a=a.replace(l,s)),o.replaceWith("<"+r+">"+a+""+r+">");var t=document.createRange(),S=window.getSelection();t.setStart($("#"+d).get(0),0),t.collapse(!0),S.removeAllRanges(),S.addRange(t),$("#"+d).remove()}console.log("format ok")}catch(u){console.error(u)}}function ZSSField(e,t){this.wrappedObject=e,this.callbacker=t,this.isComposing=!1,this.multiline=!1,this.bodyPlaceholderColor="#000000",this.wrappedDomNode().hasAttribute("nostyle")&&(this.hasNoStyle=!0),this.useVisualFormatting="true"===this.wrappedObject.data("wpUseVisualFormatting"),this.bindListeners()}var log=function(e){console.log(e),callObjc("callback-log:msg="+e)},LEAMD={},isUsingiOS=!0,defaultCallbackSeparator="~";const NodeName={BLOCKQUOTE:"BLOCKQUOTE",PARAGRAPH:"P"};var ZSSEditor={};ZSSEditor.caretArguments=["yOffset=0","height=0"],ZSSEditor.caretInfo={y:0,height:0},ZSSEditor.isiPad,ZSSEditor.currentSelection,ZSSEditor.currentEditingImage,ZSSEditor.currentEditingVideo,ZSSEditor.currentEditingLink,ZSSEditor.focusedField=null,ZSSEditor.enabledItems={},ZSSEditor.editableFields={},ZSSEditor.lastTappedNode=null,ZSSEditor.defaultParagraphSeparator="p",ZSSEditor.init=function(e,t){ZSSEditor.callbacker=e,ZSSEditor.logger=t,rangy.init(),ZSSEditor.isiPad=null!=navigator.userAgent.match(/iPad/i),ZSSEditor.isiPad&&($(document.body).addClass("ipad_body"),$("#zss_field_title").addClass("ipad_field_title"),$("#zss_field_content").addClass("ipad_field_content")),document.execCommand("insertBrOnReturn",!1,!1),document.execCommand("defaultParagraphSeparator",!1,this.defaultParagraphSeparator),document.execCommand("styleWithCSS",!1,!1);var i=$("div.field").each(function(){var e=new ZSSField($(this),ZSSEditor.callbacker),t=e.getNodeId();ZSSEditor.editableFields[t]=e,ZSSEditor.callback("callback-new-field","id="+t)});document.addEventListener("selectionchange",function(e){if(ZSSEditor.currentEditingLink=null,i.is(":focus")){ZSSEditor.selectionChangedCallback(),ZSSEditor.sendEnabledStyles(e);var t=$(e.target);t.hasClass("zs_active")||$("img").removeClass("zs_active")}},!1),$("[contenteditable]").on("paste",function(e){e.preventDefault();var t=(e.originalEvent||e).clipboardData.getData("text/plain");document.execCommand("insertText",!1,t)}),this.domLoadedCallback()},ZSSEditor.callback=function(e,t){this.callbacker.callback(e,t)},ZSSEditor.domLoadedCallback=function(){this.callback("callback-dom-loaded")},ZSSEditor.selectionChangedCallback=function(){var e=this.getJoinedFocusedFieldIdAndCaretArguments();this.callback("callback-selection-changed",e),this.callback("callback-input",e)},ZSSEditor.stylesCallback=function(e){var t="";e.length>0&&(t=e.join(defaultCallbackSeparator)),this.callback("callback-selection-style",t)},ZSSEditor.log=function(e){this.logger.log(e)},ZSSEditor.logMainElementSizes=function(){e="Window [w:"+$(window).width()+"|h:"+$(window).height()+"]",this.log(e);var e=encodeURIComponent("Viewport [w:"+window.innerWidth+"|h:"+window.innerHeight+"]");this.log(e),e=encodeURIComponent("Body [w:"+$(document.body).width()+"|h:"+$(document.body).height()+"]"),this.log(e),e=encodeURIComponent("HTML [w:"+$("html").width()+"|h:"+$("html").height()+"]"),this.log(e),e=encodeURIComponent("Document [w:"+$(document).width()+"|h:"+$(document).height()+"]"),this.log(e)},ZSSEditor.refreshVisibleViewportSize=function(){$(document.body).css("min-height",window.innerHeight+"px"),$("#zss_field_content").css("min-height",window.innerHeight-$("#zss_field_content").position().top+"px")},ZSSEditor.focusFirstEditableField=function(){$("div[contenteditable=true]:first").focus()},ZSSEditor.getField=function(e){var t=this.editableFields[e];return t},ZSSEditor.getFocusedField=function(){for(var e=$(this.closerParentNodeWithName("div")),t=e.attr("id");e&&(!t||null==this.editableFields[t]);)e=this.closerParentNodeStartingAtNode("div",e),e&&(t=e.attr("id"));var i=this.editableFields[t];return i?i:this.editableFields.zss_field_content},ZSSEditor.backupRange=function(){var e=window.getSelection(),t=e.getRangeAt(0);ZSSEditor.currentSelection={startContainer:t.startContainer,startOffset:t.startOffset,endContainer:t.endContainer,endOffset:t.endOffset}},ZSSEditor.restoreRange=function(){if(this.currentSelection){var e=window.getSelection();e.removeAllRanges();var t=document.createRange();t.setStart(this.currentSelection.startContainer,this.currentSelection.startOffset),t.setEnd(this.currentSelection.endContainer,this.currentSelection.endOffset),e.addRange(t)}},ZSSEditor.getSelectedText=function(){var e=window.getSelection();return e.toString()},ZSSEditor.getCaretArguments=function(){var e=this.getYCaretInfo();return null==e?null:(this.caretArguments[0]="yOffset="+e.y,this.caretArguments[1]="height="+e.height,this.caretArguments)},ZSSEditor.getJoinedFocusedFieldIdAndCaretArguments=function(){var e,t=ZSSEditor.getJoinedCaretArguments(),i=ZSSEditor.getFocusedField();e=i?i.getNodeId():"zss_field_content";var n="id="+e;return t=n+defaultCallbackSeparator+t},ZSSEditor.getJoinedCaretArguments=function(){var e=(this.getCaretArguments(),this.caretArguments.join(defaultCallbackSeparator));return e},ZSSEditor.getCaretYPosition=function(){var e=window.getSelection(),t=e.getRangeAt(0),i=document.createElement("span");i.appendChild(document.createTextNode("")),t.insertNode(i);var n=i.offsetTop,o=i.parentNode;return o.removeChild(i),o.normalize(),n},ZSSEditor.getYCaretInfo=function(){var e=window.getSelection(),t=0==e.rangeCount;if(t)return null;var i=0,n=0,o=e.getRangeAt(0),r=0==o.getClientRects().length;if(r){var a=ZSSEditor.closerParentNode(),d=(ZSSEditor.closerParentNodeWithName("div"),$(a).css("font-size")),l=Math.floor(1.5*parseInt(d.replace("px","")));i=this.getCaretYPosition(),n=l}else if(o.getClientRects){var s=o.getClientRects();if(s.length>0){var c=document.body.getClientRects()[0].top<0;c&&(i=document.body.scrollTop),i+=s[0].top,n=s[0].height}}return this.caretInfo.y=i,this.caretInfo.height=n,this.caretInfo},ZSSEditor.defaultParagraphSeparatorTag=function(){return"<"+this.defaultParagraphSeparator+">"},ZSSEditor.setBold=function(){document.execCommand("bold",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setItalic=function(){document.execCommand("italic",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setSubscript=function(){document.execCommand("subscript",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setSuperscript=function(){document.execCommand("superscript",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setStrikeThrough=function(){var e="strikeThrough",t=ZSSEditor.isCommandEnabled(e);document.execCommand(e,!1,null);var i=t&&ZSSEditor.isCommandEnabled(e);if(i){for(var n=["del"],o=window.getSelection(),r=o.getRangeAt(0).cloneRange(),a=r.commonAncestorContainer,d=!1;a&&!d;)d=a&&a.nodeType==document.ELEMENT_NODE&&n.indexOf(a.nodeName.toLowerCase())>-1,d||(a=a.parentElement);if(a){var l=($(a).replaceWith(a.innerHTML),window.getSelection(),o.getRangeAt(0).cloneRange());l.setEnd(l.startContainer,l.startOffset+1),o.removeAllRanges(),o.addRange(l)}}ZSSEditor.sendEnabledStyles()},ZSSEditor.setUnderline=function(){document.execCommand("underline",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setBlockquote=function(){var e=rangy.saveSelection(),t=document.getSelection(),i=t.getRangeAt(0).cloneRange(),n=!1,o=this.getAncestorElementForSettingBlockquote(i);if(o){n=!0;var r=this.getChildNodesIntersectingRange(o,i);r&&r.length&&this.toggleBlockquoteForSpecificChildNodes(o,r)}rangy.restoreSelection(e),n&&ZSSEditor.sendEnabledStyles()},ZSSEditor.removeFormating=function(){var e=window.getSelection().toString();e?document.execCommand("removeFormat",!1,null):removeFomat(),ZSSEditor.sendEnabledStyles()},ZSSEditor.setHorizontalRule=function(){document.execCommand("insertHorizontalRule",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setHeading=function(e){var t=e,i=document.queryCommandValue("formatBlock");i.length>0&&i.toLowerCase()==t?document.execCommand("formatBlock",!1,this.defaultParagraphSeparatorTag()):document.execCommand("formatBlock",!1,"<"+t+">"),ZSSEditor.sendEnabledStyles()},ZSSEditor.setParagraph=function(){var e="p",t=document.queryCommandValue("formatBlock");t.length>0&&t.toLowerCase()==e?document.execCommand("formatBlock",!1,this.defaultParagraphSeparatorTag()):document.execCommand("formatBlock",!1,"<"+e+">"),ZSSEditor.sendEnabledStyles()},ZSSEditor.undo=function(){document.execCommand("undo"),ZSSEditor.sendEnabledStyles()},ZSSEditor.redo=function(){document.execCommand("redo"),ZSSEditor.sendEnabledStyles()},ZSSEditor.setOrderedList=function(){document.execCommand("insertOrderedList",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setUnorderedList=function(){document.execCommand("insertUnorderedList",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setJustifyCenter=function(){document.execCommand("justifyCenter",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setJustifyFull=function(){document.execCommand("justifyFull",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setJustifyLeft=function(){document.execCommand("justifyLeft",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setJustifyRight=function(){document.execCommand("justifyRight",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setIndent=function(){document.execCommand("indent",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setOutdent=function(){document.execCommand("outdent",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setTextColor=function(e){ZSSEditor.restoreRange(),document.execCommand("styleWithCSS",null,!0),document.execCommand("foreColor",!1,e),document.execCommand("styleWithCSS",null,!1),ZSSEditor.sendEnabledStyles()},ZSSEditor.setBackgroundColor=function(e){ZSSEditor.restoreRange(),document.execCommand("styleWithCSS",null,!0),document.execCommand("hiliteColor",!1,e),document.execCommand("styleWithCSS",null,!1),ZSSEditor.sendEnabledStyles()},ZSSEditor.insertLink=function(e,t){ZSSEditor.restoreRange();var i=document.getSelection();if(i.rangeCount){var n=document.createElement("a");n.setAttribute("href",e);var o=i.getRangeAt(0).cloneRange();o.surroundContents(n),n.innerHTML=t,i.removeAllRanges(),i.addRange(o)}ZSSEditor.sendEnabledStyles()},ZSSEditor.updateLink=function(e,t){ZSSEditor.restoreRange();var i=ZSSEditor.lastTappedNode;i&&(i.setAttribute("href",e),i.innerHTML=t),ZSSEditor.sendEnabledStyles()},ZSSEditor.unlink=function(){var e=ZSSEditor.closerParentNodeWithName("a");e&&this.unwrapNode(e),ZSSEditor.sendEnabledStyles()},ZSSEditor.unwrapNode=function(e){var t=rangy.saveSelection();$(e).contents().unwrap(),rangy.restoreSelection(t)},ZSSEditor.wrapNode=function(e){var t=rangy.saveSelection();$(e).contents().wrap(""),rangy.restoreSelection(t)},ZSSEditor.quickLink=function(){var e=document.getSelection(),t="",i=new String(e),n=new RegExp("^(.+)(@)(.+)$","gi");-1==i.search(n)?(checkhttplink=new RegExp("^http://","gi"),-1==i.search(checkhttplink)?(checkanchorlink=new RegExp("^#","gi"),t=-1==i.search(checkanchorlink)?"http://"+e:e):t=e):(checkmaillink=new RegExp("^mailto:","gi"),t=-1==i.search(checkmaillink)?"mailto:"+e:e);var o=''+e+"";ZSSEditor.insertHTML(o)},ZSSEditor.toggleBlockquoteForSpecificChildNodes=function(e,t){if(t&&t.length>0)if(e.nodeName==NodeName.BLOCKQUOTE)for(var i=0;i';try{this.insertHTML(o)}catch(r){console.error(r)}}},ZSSEditor.insertLocalImage=function(e,t){var i=" ",n=this.getImageProgressIdentifier(e),o=this.getImageContainerIdentifier(e),r='',a="",d='',l='',s=r+d+l+a;s=i+s+i,this.insertHTML(s),this.sendEnabledStyles()},ZSSEditor.getImageNodeWithIdentifier=function(e){return $('img[data-wpid="'+e+'"]')},ZSSEditor.getImageProgressIdentifier=function(e){return"progress_"+e},ZSSEditor.getImageProgressNodeWithIdentifier=function(e){return $("#"+this.getImageProgressIdentifier(e))},ZSSEditor.getImageContainerIdentifier=function(e){return"img_container_"+e},ZSSEditor.getImageContainerNodeWithIdentifier=function(e){return $("#"+this.getImageContainerIdentifier(e))},ZSSEditor.isMediaContainerNode=function(e){return void 0===e.id?!1:0==e.id.search("img_container_")||0==e.id.search("video_container_")},ZSSEditor.extractMediaIdentifier=function(e){return 0==e.id.search("img_container_")?e.id.replace("img_container_",""):0==e.id.search("video_container_")?e.id.replace("video_container_",""):""},ZSSEditor.replaceLocalImageWithRemoteImage=function(e,t){var i=this.getImageNodeWithIdentifier(e);if(0==i.length)return void this.markImageUploadDone(e);var n=new Image;n.onload=function(){i.attr("src",n.src),ZSSEditor.markImageUploadDone(e)},n.onerror=function(){i.attr("src",n.src),ZSSEditor.markImageUploadDone(e)},n.src=t},ZSSEditor.setProgressOnImage=function(e,t){var i=this.getImageNodeWithIdentifier(e);if(0!=i.length){1>t&&i.addClass("uploading");var n=this.getImageProgressNodeWithIdentifier(e);0!=n.length&&n.attr("value",t)}},ZSSEditor.markImageUploadDone=function(e){var t=this.getImageNodeWithIdentifier(e);if(t.length>0){t.removeAttr("data-wpid"),t.removeClass("uploading"),t.removeAttr("class"),t.parent().attr("id")==this.getImageContainerIdentifier(e)&&(t.parent().attr("id",""),t.parent().replaceWith(t));var i='';t.wrap(i)}var n=ZSSEditor.getJoinedFocusedFieldIdAndCaretArguments();ZSSEditor.callback("callback-input",n);var o=this;setTimeout(function(){o.sendImageReplacedCallback(e)},500)},ZSSEditor.sendImageReplacedCallback=function(e){var t=["id="+encodeURIComponent(e)],i=t.join(defaultCallbackSeparator);this.callback("callback-image-replaced",i)},ZSSEditor.markImageUploadFailed=function(e,t){var i=this.getImageNodeWithIdentifier(e);if(0!=i.length){var n="";i[0].width>480&&i[0].height>240?n="largeFail":(i[0].width<100||i[0].height<100)&&(n="smallFail"),i.addClass("failed");var o=this.getImageContainerNodeWithIdentifier(e);0!=o.length&&(o.attr("data-failed",t),i.removeClass("uploading"),o.addClass("failed"),o.addClass(n));var r=this.getImageProgressNodeWithIdentifier(e);0!=r.length&&r.addClass("failed")}},ZSSEditor.unmarkImageUploadFailed=function(e){var t=this.getImageNodeWithIdentifier(e);0!=t.length&&t.removeClass("failed");var i=this.getImageContainerNodeWithIdentifier(e);0!=i.length&&(i.removeAttr("data-failed"),i.removeClass("failed"));var n=this.getImageProgressNodeWithIdentifier(e);0!=n.length&&n.removeClass("failed")},ZSSEditor.removeImage=function(e){var t=this.getImageNodeWithIdentifier(e);0!=t.length&&t.remove();var i=this.getImageContainerNodeWithIdentifier(e);0!=i.length&&(i.attr("id",""),i.remove())},ZSSEditor.sendMediaRemovedCallback=function(e){var t=["id="+encodeURIComponent(e)],i=t.join(defaultCallbackSeparator);this.callback("callback-media-removed",i)},ZSSEditor.insertVideo=function(e,t,i){var n=''+i+"";this.insertHTML(n),this.sendEnabledStyles()},ZSSEditor.insertInProgressVideoWithIDUsingPosterImage=function(e,t){var i=" ",n=this.getVideoProgressIdentifier(e),o=this.getVideoContainerIdentifier(e),r='',a="",d='',l='',s=i+r+d+l+a+i;this.insertHTML(s),this.sendEnabledStyles()},ZSSEditor.getVideoNodeWithIdentifier=function(e){return $('video[data-wpid="'+e+'"]')},ZSSEditor.getVideoProgressIdentifier=function(e){return"progress_"+e},ZSSEditor.getVideoProgressNodeWithIdentifier=function(e){return $("#"+this.getVideoProgressIdentifier(e))},ZSSEditor.getVideoContainerIdentifier=function(e){return"video_container_"+e},ZSSEditor.getVideoContainerNodeWithIdentifier=function(e){return $("#"+this.getVideoContainerIdentifier(e))},ZSSEditor.replaceLocalVideoWithRemoteVideo=function(e,t,i,n){var o=this.getVideoNodeWithIdentifier(e);if(0==o.length)return void this.markVideoUploadDone(e);o.attr("src",t),o.attr("controls",""),""!=n&&o.attr("data-wpvideopress",n),o.attr("poster",i);var r=this;o.on("webkitbeginfullscreen",function(){r.sendVideoFullScreenStarted()}),o.on("webkitendfullscreen",function(){r.sendVideoFullScreenEnded()}),o.on("error",function(){o.load()}),this.markVideoUploadDone(e)},ZSSEditor.setProgressOnVideo=function(e,t){var i=this.getVideoNodeWithIdentifier(e);if(0!=i.length){1>t&&i.addClass("uploading");var n=this.getVideoProgressNodeWithIdentifier(e);0!=n.length&&n.attr("value",t)}},ZSSEditor.markVideoUploadDone=function(e){var t=this.getVideoNodeWithIdentifier(e);t.length>0&&(t.removeAttr("data-wpid"),t.removeClass("uploading"),t.removeAttr("class"),t.parent().attr("id")==this.getVideoContainerIdentifier(e)&&(t.parent().attr("id",""),t.parent().replaceWith(t)));var i=ZSSEditor.getJoinedFocusedFieldIdAndCaretArguments();ZSSEditor.callback("callback-input",i);var n=this;setTimeout(function(){n.sendVideoReplacedCallback(e)},500)},ZSSEditor.sendVideoReplacedCallback=function(e){var t=["id="+encodeURIComponent(e)],i=t.join(defaultCallbackSeparator);this.callback("callback-video-replaced",i)},ZSSEditor.sendVideoFullScreenStarted=function(){this.callback("callback-video-fullscreen-started","empty")},ZSSEditor.sendVideoFullScreenEnded=function(){this.callback("callback-video-fullscreen-ended","empty")},ZSSEditor.sendVideoPressInfoRequest=function(e){var t=["id="+encodeURIComponent(e)],i=t.join(defaultCallbackSeparator);this.callback("callback-videopress-info-request",i)},ZSSEditor.markVideoUploadFailed=function(e,t){var i=this.getVideoNodeWithIdentifier(e);if(0!=i.length){var n="";i[0].width>480&&i[0].height>240?n="largeFail":(i[0].width<100||i[0].height<100)&&(n="smallFail"),i.addClass("failed");var o=this.getVideoContainerNodeWithIdentifier(e);0!=o.length&&(o.attr("data-failed",t),i.removeClass("uploading"),o.addClass("failed"),o.addClass(n));var r=this.getVideoProgressNodeWithIdentifier(e);0!=r.length&&r.addClass("failed")}},ZSSEditor.unmarkVideoUploadFailed=function(e){var t=this.getVideoNodeWithIdentifier(e);0!=t.length&&t.removeClass("failed");var i=this.getVideoContainerNodeWithIdentifier(e);0!=i.length&&(i.removeAttr("data-failed"),i.removeClass("failed"));var n=this.getVideoProgressNodeWithIdentifier(e);0!=n.length&&n.removeClass("failed")},ZSSEditor.removeVideo=function(e){var t=this.getVideoNodeWithIdentifier(e);0!=t.length&&t.remove();var i=this.getVideoContainerNodeWithIdentifier(e);0!=i.length&&(i.attr("id",""),i.remove())},ZSSEditor.replaceVideoPressVideosForShortcode=function(e){var t=/]*data-wpvideopress="([\s\S]+?)"[^>]*>*<\/video>/g,i=e.replace(t,ZSSEditor.removeVideoVisualFormattingCallback);return i},ZSSEditor.removeVideoVisualFormattingCallback=function(e,t){return"[wpvideo "+t+"]"},ZSSEditor.applyVideoFormattingCallback=function(e){if(0==e.attrs.numeric.length)return e.content;var t=e.attrs.numeric[0],i='"wpposter.svg"',n='";return n},ZSSEditor.setVideoPressLinks=function(e,t,i){var n=$('video[data-wpvideopress="'+e+'"]');if(0!=n.length){n.attr("src",t),n.attr("controls",""),0==i.length?n.attr("poster","wpposter.svg"):n.attr("poster",i);var o=this;n.on("webkitbeginfullscreen",function(){o.sendVideoFullScreenStarted()}),n.on("webkitendfullscreen",function(){o.sendVideoFullScreenEnded()}),n.load()}},ZSSEditor.pauseAllVideos=function(){$("video").each(function(){this.pause()})},ZSSEditor.updateCurrentImageMeta=function(e){if(ZSSEditor.currentEditingImage){var t=JSON.parse(e),i=ZSSEditor.createImageFromMeta(t),n=ZSSEditor.findImageCaptionNode(ZSSEditor.currentEditingImage);n.insertAdjacentHTML("afterend",i),n.remove(),ZSSEditor.currentEditingImage=null}},ZSSEditor.applyImageSelectionFormatting=function(e){var t=ZSSEditor.findImageCaptionNode(e),i="";(e.width<100||e.height<100)&&(i=" small");var n='Edit',o=''+n+"";t.insertAdjacentHTML("beforebegin",o);var r=t.previousSibling;r.appendChild(t)},ZSSEditor.removeImageSelectionFormatting=function(e){var t=ZSSEditor.findImageCaptionNode(e);if(t.parentNode&&-1!=t.parentNode.className.indexOf("edit-container")){var i=t.parentNode,n=i.parentNode;n.insertBefore(t,i),i.remove()}},ZSSEditor.removeImageSelectionFormattingFromHTML=function(e){var t=document.createElement("div"),i=$(t).html(e),n=i.find("span.edit-container img");if(0==n.length)return e;for(var o=0;o")+1),i):i},ZSSEditor.applyCaptionFormatting=function(e){var t=e.attrs.named,i='';return i+='",i+=e.content,i+="",i+=""},ZSSEditor.removeCaptionFormatting=function(e){var t=/]*>([\s\S]+?)<\/label>/g,i=e.replace(t,ZSSEditor.removeCaptionFormattingCallback);return i},ZSSEditor.removeCaptionFormattingCallback=function(e,t){var i="";return-1===t.indexOf("]*>([\s\S]+?)<\/span>/gi),i&&i[1]?""+i[1]+"":""):i=t.replace(/\s*]*)>([\s\S]+?)<\/span>/gi,function(e,t,i){if(!i)return"";var n,o,r,a,d={};a=t.match(/data-caption-width="([0-9]*)"/),a=a&&a[1]?a[1]:"",a&&(d.width=a),n=t.match(/data-caption-id="([^"]*)"/),n=n&&n[1]?n[1]:"",n&&(d.id=n),o=t.match(/data-caption-class="([^"]*)"/),o=o&&o[1]?o[1]:"",o&&(d.class=o),r=t.match(/data-caption-align="([^"]*)"/),r=r&&r[1]?r[1]:"",r&&(d.align=r);var l={tag:"caption",attrs:d,type:"closed",content:i};return wp.shortcode.string(l)})},ZSSEditor.applyVisualFormatting=function(e){var t=wp.shortcode.replace("caption",e,ZSSEditor.applyCaptionFormatting);return t=wp.shortcode.replace("wpvideo",t,ZSSEditor.applyVideoFormattingCallback)},ZSSEditor.removeVisualFormatting=function(e){var t=e;return t=ZSSEditor.removeImageSelectionFormattingFromHTML(t),t=ZSSEditor.removeCaptionFormatting(t),t=ZSSEditor.replaceVideoPressVideosForShortcode(t)},ZSSEditor.insertHTML=function(e){var t=this.getFocusedField();t.wrapCaretInParagraphIfNecessary(),document.execCommand("insertHTML",!1,e),this.sendEnabledStyles()},ZSSEditor.isCommandEnabled=function(e){return document.queryCommandState(e)},ZSSEditor.sendEnabledStyles=function(e){var t=[],i=this.getFocusedField();if(i||(i=ZSSEditor.editableFields.zss_field_content),!i.hasNoStyle){for(var n=ZSSEditor.parentTags(),o=0;o0&&t.push(l),"undefined"!=typeof e){var s=$(e.target),c=e.target.nodeName.toLowerCase();try{var S=s.css("backgroundColor");S&&0!=S.length&&"rgba(0, 0, 0, 0)"!=S&&"rgb(0, 0, 0)"!=S&&"transparent"!=S&&t.push("backgroundColor")}catch(e){}try{var u=s.css("color");u&&0!=u.length&&"rgba(0, 0, 0, 0)"!=u&&"rgb(0, 0, 0)"!=u&&"transparent"!=u&&t.push("textColor")}catch(e){}"img"==c&&(ZSSEditor.currentEditingImage=s,t.push("image:"+s.attr("src")),void 0!==s.attr("alt")&&t.push("image-alt:"+s.attr("alt")))}}ZSSEditor.stylesCallback(t)},ZSSEditor.extractNodeFromAncestorNode=function(e,t){for(;t.contains(e);){this.extractNodeFromParent(e);break}},ZSSEditor.extractNodeFromParent=function(e){var t=e.parentNode,i=t.parentNode,n=null,o=null;if(null!=e.previousSibling)for(var n=t.cloneNode();t.firstChild!=e;)n.appendChild(t.firstChild);if(null!=e.nextSibling)for(var o=t.cloneNode();null!=e.nextSibling;)o.appendChild(e.nextSibling);n&&i.insertBefore(n,t),i.insertBefore(e,t),o&&i.insertBefore(o,t),i.removeChild(t)},ZSSEditor.getChildNodesIntersectingRange=function(e,t){var i=new Array;if(e)for(var n=e.firstChild;n;)t.intersectsNode(n)&&i.push(n),n=n.nextSibling;return i},ZSSEditor.getAncestorElementForSettingBlockquote=function(e){for(var t=(new Array,e.commonAncestorContainer);t&&(t.nodeType!=document.ELEMENT_NODE||t.nodeName==NodeName.PARAGRAPH);)t=t.parentNode;for(var i=t;i&&i.nodeName!=NodeName.BLOCKQUOTE;)i=i.parentElement;var n=i?i:t;return n},ZSSEditor.joinAdjacentSiblingsBlockquotes=function(e){var t=this.hasPreviousSiblingWithName(e,NodeName.BLOCKQUOTE),i=this.hasNextSiblingWithName(e,NodeName.BLOCKQUOTE),n=t||i,o=e.previousSibling,r=e.nextSibling;if(t){if(o.appendChild(e),i){for(;r.firstChild;)o.appendChild(r.firstChild);r.parentNode.removeChild(r)}}else i&&r.insertBefore(e,r.firstChild);return n},ZSSEditor.joinAdjacentSiblingsOrAncestorBlockquotes=function(e){for(var t=e,i=this.getFocusedField().wrappedDomNode(),n=!1;t&&t!=i&&!n;)n=this.joinAdjacentSiblingsBlockquotes(t),t=t.parentNode;return n},ZSSEditor.surroundNodeContentsWithNode=function(e,t){var i=document.createRange(),n=document.createElement(t);return i.selectNodeContents(e),i.surroundContents(n),n},ZSSEditor.surroundNodeContentsWithAParagraphNode=function(e){return this.surroundNodeContentsWithNode(e,this.defaultParagraphSeparator)},ZSSEditor.hasNextSiblingWithName=function(e,t){return e.nextSibling&&e.nextSibling.nodeName==t},ZSSEditor.hasPreviousSiblingWithName=function(e,t){return e.previousSibling&&e.previousSibling.nodeName==t},ZSSEditor.closerParentNode=function(){for(var e=null,t=window.getSelection(),i=t.getRangeAt(0).cloneRange(),n=i.commonAncestorContainer;n;){if(n.nodeType==document.ELEMENT_NODE){e=n;break}n=n.parentElement}return e},ZSSEditor.closerParentNodeStartingAtNode=function(e,t){e=e.toLowerCase();for(var i=null,n=t;n&&n.nodeName!=document.body.nodeName;){if(n.nodeName&&n.nodeName.toLowerCase()==e&&n.nodeType==document.ELEMENT_NODE){i=n;break}n=n.parentElement}return i},ZSSEditor.closerParentNodeWithName=function(e){var t=window.getSelection(),i=t.getRangeAt(0).cloneRange(),n=i.commonAncestorContainer; -return this.closerParentNodeWithNameRelativeToNode(e,n)},ZSSEditor.closerParentNodeWithNameRelativeToNode=function(e,t){e=e.toUpperCase();for(var i=null,n=t;n&&n.nodeName!=document.body.nodeName;){if(n.nodeName==e&&n.nodeType==document.ELEMENT_NODE){i=n;break}n=n.parentElement}return i},ZSSEditor.isCloserParentNodeABlockquote=function(){return this.closerParentNode().nodeName==NodeName.BLOCKQUOTE},ZSSEditor.parentTags=function(){for(var e=[],t=window.getSelection(),i=t.getRangeAt(0),n=i.commonAncestorContainer;n&&n.nodeName!=document.body.nodeName;)n.nodeType==document.ELEMENT_NODE&&e.push(n),n=n.parentElement;return e},ZSSField.prototype.bindListeners=function(){var e=this;this.wrappedObject.bind("tap",function(t){e.handleTapEvent(t)}),this.wrappedObject.bind("focus",function(t){e.handleFocusEvent(t)}),this.wrappedObject.bind("blur",function(t){e.handleBlurEvent(t)}),this.wrappedObject.bind("keydown",function(t){e.handleKeyDownEvent(t)}),this.wrappedObject.bind("input",function(t){e.handleInputEvent(t)}),this.wrappedObject.bind("compositionstart",function(t){e.handleCompositionStartEvent(t)}),this.wrappedObject.bind("compositionend",function(t){e.handleCompositionEndEvent(t)}),this.bindMutationObserver()},ZSSField.prototype.bindMutationObserver=function(){var e=this.wrappedObject[0],t=new MutationObserver(function(e){e.forEach(function(e){for(var t=0;t0,n=this.wrappedObject.find("ul").length>0,o=this.wrappedObject.find("ol").length>0;i||n||o||this.wrappedObject.empty()}},ZSSField.prototype.emptyFieldIfNoContentsAndRefreshPlaceholderColor=function(){this.emptyFieldIfNoContents(),this.refreshPlaceholderColor()},ZSSField.prototype.handleBlurEvent=function(){ZSSEditor.focusedField=null,this.emptyFieldIfNoContentsAndRefreshPlaceholderColor(),this.callback("callback-focus-out")},ZSSField.prototype.handleFocusEvent=function(){ZSSEditor.focusedField=this,this.refreshPlaceholderColorAboutToGainFocus(!0),this.callback("callback-focus-in")},ZSSField.prototype.handleKeyDownEvent=function(e){var t="13"==e.keyCode;this.isComposing?e.stopPropagation():t&&!this.isMultiline()?e.preventDefault():this.isMultiline()&&this.wrapCaretInParagraphIfNecessary()},ZSSField.prototype.handleInputEvent=function(){if(!this.isComposing){this.emptyFieldIfNoContentsAndRefreshPlaceholderColor();var e=ZSSEditor.getJoinedFocusedFieldIdAndCaretArguments();this.callback("callback-selection-changed",e),this.callback("callback-input",e)}},ZSSField.prototype.handleCompositionStartEvent=function(){this.isComposing=!0},ZSSField.prototype.handleCompositionEndEvent=function(){this.isComposing=!1},ZSSField.prototype.handleTapEvent=function(e){var t=e.target;if(t){if(ZSSEditor.lastTappedNode=t,"a"==t.nodeName.toLowerCase()){var i=["url="+encodeURIComponent(t.href),"title="+encodeURIComponent(t.innerHTML)],n=i.join(defaultCallbackSeparator),o=this;o.callback("callback-link-tap",n)}if("img"==t.nodeName.toLowerCase())return void this.sendImageTappedCallback(t);if(-1!=t.className.indexOf("edit-overlay")||-1!=t.className.indexOf("edit-content"))return ZSSEditor.removeImageSelectionFormatting(ZSSEditor.currentEditingImage),void this.sendImageTappedCallback(ZSSEditor.currentEditingImage);if(ZSSEditor.currentEditingImage&&(ZSSEditor.removeImageSelectionFormatting(ZSSEditor.currentEditingImage),ZSSEditor.currentEditingImage=null),"video"==t.nodeName.toLowerCase()&&t.dataset.wpid)return void this.sendVideoTappedCallback(t)}},ZSSField.prototype.sendImageTappedCallback=function(e){var t=ZSSEditor.extractImageMeta(e),i=JSON.stringify(t),n="";e.hasAttribute("data-wpid")&&(n=e.getAttribute("data-wpid"));var o="true"==this.wrappedObject.attr("contenteditable"),r=[];$("#zss_field_content img").each(function(){var e=$(this).attr("src");e&&r.push(encodeURIComponent(e))}),r.push(encodeURIComponent(e.src));var a=["id="+(o?"1":"0"),"url="+r.join(","),"meta="+encodeURIComponent(i)],d=a.join(defaultCallbackSeparator);ZSSEditor.callback("callback-image-tap",d)},ZSSField.prototype.sendVideoTappedCallback=function(e){var t="";e.hasAttribute("data-wpid")&&(t=e.getAttribute("data-wpid"));var i=["id="+encodeURIComponent(t),"url="+encodeURIComponent(e.src)],n=i.join(defaultCallbackSeparator);ZSSEditor.callback("callback-video-tap",n)},ZSSField.prototype.sendVideoFullScreenStarted=function(){this.callback("callback-video-fullscreen-started","empty")},ZSSField.prototype.sendVideoFullScreenEnded=function(){this.callback("callback-video-fullscreen-ended","empty")},ZSSField.prototype.callback=function(e,t){var i="id="+this.getNodeId();t&&t.length>0&&(i=i+defaultCallbackSeparator+t),this.callbacker.callback(e,i)},ZSSField.prototype.isFocused=function(){return this.wrappedObject.is(":focus")},ZSSField.prototype.focus=function(){this.isFocused()||this.wrappedObject.focus()},ZSSField.prototype.blur=function(){this.isFocused()&&this.wrappedObject.blur()},ZSSField.prototype.isMultiline=function(){return this.multiline},ZSSField.prototype.setMultiline=function(e){this.multiline=e},ZSSField.prototype.getNodeId=function(){return this.wrappedObject.attr("id")},ZSSField.prototype.enableEditing=function(){this.wrappedObject.attr("contenteditable",!0),ZSSEditor.focusedField||ZSSEditor.focusFirstEditableField()},ZSSField.prototype.disableEditing=function(){this.blur(),this.wrappedObject.attr("contenteditable",!1)},ZSSField.prototype.wrapCaretInParagraphIfNecessary=function(){var e=ZSSEditor.closerParentNode(),t=e==this.wrappedDomNode()||e.nodeName==NodeName.BLOCKQUOTE;if(t){var i=window.getSelection();if(i){var n=i.getRangeAt(0);if(n.startContainer==n.endContainer){var o=document.createElement("p"),r=document.createTextNode("");o.appendChild(r),n.insertNode(o),n.selectNode(r),i.removeAllRanges(),i.addRange(n)}}}},ZSSField.prototype.isRightToLeftTextEnabled=function(){var e=this.wrappedObject.attr("dir"),t="undefined"!=e&&"rtl"==e;return t},ZSSField.prototype.enableRightToLeftText=function(e){var t=e?"rtl":"ltr";this.wrappedObject.attr("dir",t),this.wrappedObject.css("direction",t)},ZSSField.prototype.isEmpty=function(){var e=this.getHTML(),t=0==e.length||""==e;return t},ZSSField.prototype.getHTML=function(){var e=this.wrappedObject.html();return e.replace(/<\/*(body|head|script).*?>/g,"")},ZSSField.prototype.strippedHTML=function(){return this.wrappedObject.text()},ZSSField.prototype.setPlainText=function(e){ZSSEditor.currentEditingImage=null,this.wrappedObject.text(e),this.refreshPlaceholderColor()},ZSSField.prototype.setHTML=function(e){ZSSEditor.currentEditingImage=null,this.wrappedObject.html(e);var t=this;$("video").on("webkitbeginfullscreen",function(){t.sendVideoFullScreenStarted()}),$("video").on("webkitendfullscreen",function(){t.sendVideoFullScreenEnded()}),this.refreshPlaceholderColor()},ZSSField.prototype.hasPlaceholderText=function(){return null!=this.wrappedObject.attr("placeholderText")},ZSSField.prototype.setPlaceholderText=function(e){this.wrappedObject.attr("placeholderText",e)},ZSSField.prototype.setPlaceholderColor=function(e){this.bodyPlaceholderColor=e,this.refreshPlaceholderColor()},ZSSField.prototype.refreshPlaceholderColor=function(){this.refreshPlaceholderColorForAttributes(this.hasPlaceholderText(),this.isFocused(),this.isEmpty())},ZSSField.prototype.refreshPlaceholderColorAboutToGainFocus=function(e){this.refreshPlaceholderColorForAttributes(this.hasPlaceholderText(),e,this.isEmpty())},ZSSField.prototype.refreshPlaceholderColorForAttributes=function(e,t,i){var n=e&&i;n?t?this.wrappedObject.css("color",this.bodyPlaceholderColor):this.wrappedObject.css("color",this.bodyPlaceholderColor):this.wrappedObject.css("color","")},ZSSField.prototype.wrappedDomNode=function(){return this.wrappedObject[0]}; +function callObjc(e){var t=document.createElement("IFRAME");t.setAttribute("src",e),t.style.cssText="border: 0px transparent;",document.documentElement.appendChild(t),t.parentNode.removeChild(t),t=null}function removeFomat(){try{for(var e=window.getSelection(),t=e.getRangeAt(0).cloneRange(),i=t.commonAncestorContainer;;){var n=i.nodeName.toLowerCase();if("p"==n||"div"==n||"hr"==n||"table"==n||"img"==n||"a"==n||"span"==n||"font"==n||"body"==n||0===n.indexOf("h")||"blockquote"==n)break;i=i.parentNode}if("img"===n)return;var o=$(i);if("body"!=n&&"html"!=n){if("div"==n&&"zss_field_content"==i.className)return;var r=n;-1!=n.indexOf("h")||"blockquote"==n?r="p":"a"===n&&(r="span");var a,d="LEACLR-"+(new Date).getTime(),l="~*Z+&",s='',c=$(s).get(0);o.find("img").length>0?(t.insertNode(c),a=o.html()):(c.innerHTML=l,t.insertNode(c),a=o.text(),a=a.replace(l,s)),o.replaceWith("<"+r+">"+a+""+r+">");var t=document.createRange(),S=window.getSelection();t.setStart($("#"+d).get(0),0),t.collapse(!0),S.removeAllRanges(),S.addRange(t),$("#"+d).remove()}console.log("format ok")}catch(u){console.error(u)}}function ZSSField(e,t){this.wrappedObject=e,this.callbacker=t,this.isComposing=!1,this.multiline=!1,this.bodyPlaceholderColor="#000000",this.wrappedDomNode().hasAttribute("nostyle")&&(this.hasNoStyle=!0),this.useVisualFormatting="true"===this.wrappedObject.data("wpUseVisualFormatting"),this.bindListeners()}var log=function(e){console.log(e),callObjc("callback-log:msg="+e)},LEAMD={},isUsingiOS=!0,defaultCallbackSeparator="~";const NodeName={BLOCKQUOTE:"BLOCKQUOTE",PARAGRAPH:"P"};var ZSSEditor={};ZSSEditor.caretArguments=["yOffset=0","height=0"],ZSSEditor.caretInfo={y:0,height:0},ZSSEditor.isiPad,ZSSEditor.currentSelection,ZSSEditor.currentEditingImage,ZSSEditor.currentEditingVideo,ZSSEditor.currentEditingLink,ZSSEditor.focusedField=null,ZSSEditor.enabledItems={},ZSSEditor.editableFields={},ZSSEditor.lastTappedNode=null,ZSSEditor.defaultParagraphSeparator="p",ZSSEditor.init=function(e,t){ZSSEditor.callbacker=e,ZSSEditor.logger=t,rangy.init(),ZSSEditor.isiPad=null!=navigator.userAgent.match(/iPad/i),ZSSEditor.isiPad&&$(document.body).addClass("ipad-body"),document.execCommand("insertBrOnReturn",!1,!1),document.execCommand("defaultParagraphSeparator",!1,this.defaultParagraphSeparator),document.execCommand("styleWithCSS",!1,!1);var i=$("div.field").each(function(){var e=new ZSSField($(this),ZSSEditor.callbacker),t=e.getNodeId();ZSSEditor.editableFields[t]=e,ZSSEditor.callback("callback-new-field","id="+t)});document.addEventListener("selectionchange",function(e){if(ZSSEditor.currentEditingLink=null,i.is(":focus")){ZSSEditor.selectionChangedCallback(),ZSSEditor.sendEnabledStyles(e);var t=$(e.target);t.hasClass("zs_active")||$("img").removeClass("zs_active")}},!1),$("[contenteditable]").on("paste",function(e){e.preventDefault();var t=(e.originalEvent||e).clipboardData.getData("text/plain");document.execCommand("insertText",!1,t)}),this.domLoadedCallback()},ZSSEditor.callback=function(e,t){this.callbacker.callback(e,t)},ZSSEditor.domLoadedCallback=function(){this.callback("callback-dom-loaded")},ZSSEditor.selectionChangedCallback=function(){var e=this.getJoinedFocusedFieldIdAndCaretArguments();this.callback("callback-selection-changed",e),this.callback("callback-input",e)},ZSSEditor.stylesCallback=function(e){var t="";e.length>0&&(t=e.join(defaultCallbackSeparator)),this.callback("callback-selection-style",t)},ZSSEditor.log=function(e){this.logger.log(e)},ZSSEditor.logMainElementSizes=function(){e="Window [w:"+$(window).width()+"|h:"+$(window).height()+"]",this.log(e);var e=encodeURIComponent("Viewport [w:"+window.innerWidth+"|h:"+window.innerHeight+"]");this.log(e),e=encodeURIComponent("Body [w:"+$(document.body).width()+"|h:"+$(document.body).height()+"]"),this.log(e),e=encodeURIComponent("HTML [w:"+$("html").width()+"|h:"+$("html").height()+"]"),this.log(e),e=encodeURIComponent("Document [w:"+$(document).width()+"|h:"+$(document).height()+"]"),this.log(e)},ZSSEditor.refreshVisibleViewportSize=function(){$(document.body).css("min-height",window.innerHeight+"px"),$("#zss_field_content").css("min-height",window.innerHeight-$("#zss_field_content").position().top+"px")},ZSSEditor.focusFirstEditableField=function(){$("div[contenteditable=true]:first").focus()},ZSSEditor.getField=function(e){var t=this.editableFields[e];return t},ZSSEditor.getFocusedField=function(){for(var e=$(this.closerParentNodeWithName("div")),t=e.attr("id");e&&(!t||null==this.editableFields[t]);)e=this.closerParentNodeStartingAtNode("div",e),e&&(t=e.attr("id"));var i=this.editableFields[t];return i?i:this.editableFields.zss_field_content},ZSSEditor.backupRange=function(){var e=window.getSelection(),t=e.getRangeAt(0);ZSSEditor.currentSelection={startContainer:t.startContainer,startOffset:t.startOffset,endContainer:t.endContainer,endOffset:t.endOffset}},ZSSEditor.restoreRange=function(){if(this.currentSelection){var e=window.getSelection();e.removeAllRanges();var t=document.createRange();t.setStart(this.currentSelection.startContainer,this.currentSelection.startOffset),t.setEnd(this.currentSelection.endContainer,this.currentSelection.endOffset),e.addRange(t)}},ZSSEditor.getSelectedText=function(){var e=window.getSelection();return e.toString()},ZSSEditor.getCaretArguments=function(){var e=this.getYCaretInfo();return null==e?null:(this.caretArguments[0]="yOffset="+e.y,this.caretArguments[1]="height="+e.height,this.caretArguments)},ZSSEditor.getJoinedFocusedFieldIdAndCaretArguments=function(){var e,t=ZSSEditor.getJoinedCaretArguments(),i=ZSSEditor.getFocusedField();e=i?i.getNodeId():"zss_field_content";var n="id="+e;return t=n+defaultCallbackSeparator+t},ZSSEditor.getJoinedCaretArguments=function(){var e=(this.getCaretArguments(),this.caretArguments.join(defaultCallbackSeparator));return e},ZSSEditor.getCaretYPosition=function(){var e=window.getSelection(),t=e.getRangeAt(0),i=document.createElement("span");i.appendChild(document.createTextNode("")),t.insertNode(i);var n=i.offsetTop,o=i.parentNode;return o.removeChild(i),o.normalize(),n},ZSSEditor.getYCaretInfo=function(){var e=window.getSelection(),t=0==e.rangeCount;if(t)return null;var i=0,n=0,o=e.getRangeAt(0),r=0==o.getClientRects().length;if(r){var a=ZSSEditor.closerParentNode(),d=(ZSSEditor.closerParentNodeWithName("div"),$(a).css("font-size")),l=Math.floor(1.5*parseInt(d.replace("px","")));i=this.getCaretYPosition(),n=l}else if(o.getClientRects){var s=o.getClientRects();if(s.length>0){var c=document.body.getClientRects()[0].top<0;c&&(i=document.body.scrollTop),i+=s[0].top,n=s[0].height}}return this.caretInfo.y=i,this.caretInfo.height=n,this.caretInfo},ZSSEditor.defaultParagraphSeparatorTag=function(){return"<"+this.defaultParagraphSeparator+">"},ZSSEditor.setBold=function(){document.execCommand("bold",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setItalic=function(){document.execCommand("italic",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setSubscript=function(){document.execCommand("subscript",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setSuperscript=function(){document.execCommand("superscript",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setStrikeThrough=function(){var e="strikeThrough",t=ZSSEditor.isCommandEnabled(e);document.execCommand(e,!1,null);var i=t&&ZSSEditor.isCommandEnabled(e);if(i){for(var n=["del"],o=window.getSelection(),r=o.getRangeAt(0).cloneRange(),a=r.commonAncestorContainer,d=!1;a&&!d;)d=a&&a.nodeType==document.ELEMENT_NODE&&n.indexOf(a.nodeName.toLowerCase())>-1,d||(a=a.parentElement);if(a){var l=($(a).replaceWith(a.innerHTML),window.getSelection(),o.getRangeAt(0).cloneRange());l.setEnd(l.startContainer,l.startOffset+1),o.removeAllRanges(),o.addRange(l)}}ZSSEditor.sendEnabledStyles()},ZSSEditor.setUnderline=function(){document.execCommand("underline",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setBlockquote=function(){var e=rangy.saveSelection(),t=document.getSelection(),i=t.getRangeAt(0).cloneRange(),n=!1,o=this.getAncestorElementForSettingBlockquote(i);if(o){n=!0;var r=this.getChildNodesIntersectingRange(o,i);r&&r.length&&this.toggleBlockquoteForSpecificChildNodes(o,r)}rangy.restoreSelection(e),n&&ZSSEditor.sendEnabledStyles()},ZSSEditor.removeFormating=function(){var e=window.getSelection().toString();e?document.execCommand("removeFormat",!1,null):removeFomat(),ZSSEditor.sendEnabledStyles()},ZSSEditor.setHorizontalRule=function(){document.execCommand("insertHorizontalRule",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setHeading=function(e){var t=e,i=document.queryCommandValue("formatBlock");i.length>0&&i.toLowerCase()==t?document.execCommand("formatBlock",!1,this.defaultParagraphSeparatorTag()):document.execCommand("formatBlock",!1,"<"+t+">"),ZSSEditor.sendEnabledStyles()},ZSSEditor.setParagraph=function(){var e="p",t=document.queryCommandValue("formatBlock");t.length>0&&t.toLowerCase()==e?document.execCommand("formatBlock",!1,this.defaultParagraphSeparatorTag()):document.execCommand("formatBlock",!1,"<"+e+">"),ZSSEditor.sendEnabledStyles()},ZSSEditor.undo=function(){document.execCommand("undo"),ZSSEditor.sendEnabledStyles()},ZSSEditor.redo=function(){document.execCommand("redo"),ZSSEditor.sendEnabledStyles()},ZSSEditor.setOrderedList=function(){document.execCommand("insertOrderedList",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setUnorderedList=function(){document.execCommand("insertUnorderedList",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setJustifyCenter=function(){document.execCommand("justifyCenter",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setJustifyFull=function(){document.execCommand("justifyFull",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setJustifyLeft=function(){document.execCommand("justifyLeft",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setJustifyRight=function(){document.execCommand("justifyRight",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setIndent=function(){document.execCommand("indent",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setOutdent=function(){document.execCommand("outdent",!1,null),ZSSEditor.sendEnabledStyles()},ZSSEditor.setTextColor=function(e){ZSSEditor.restoreRange(),document.execCommand("styleWithCSS",null,!0),document.execCommand("foreColor",!1,e),document.execCommand("styleWithCSS",null,!1),ZSSEditor.sendEnabledStyles()},ZSSEditor.setBackgroundColor=function(e){ZSSEditor.restoreRange(),document.execCommand("styleWithCSS",null,!0),document.execCommand("hiliteColor",!1,e),document.execCommand("styleWithCSS",null,!1),ZSSEditor.sendEnabledStyles()},ZSSEditor.insertLink=function(e,t){ZSSEditor.restoreRange();var i=document.getSelection();if(i.rangeCount){var n=document.createElement("a");n.setAttribute("href",e);var o=i.getRangeAt(0).cloneRange();o.surroundContents(n),n.innerHTML=t,i.removeAllRanges(),i.addRange(o)}ZSSEditor.sendEnabledStyles()},ZSSEditor.updateLink=function(e,t){ZSSEditor.restoreRange();var i=ZSSEditor.lastTappedNode;i&&(i.setAttribute("href",e),i.innerHTML=t),ZSSEditor.sendEnabledStyles()},ZSSEditor.unlink=function(){var e=ZSSEditor.closerParentNodeWithName("a");e&&this.unwrapNode(e),ZSSEditor.sendEnabledStyles()},ZSSEditor.unwrapNode=function(e){var t=rangy.saveSelection();$(e).contents().unwrap(),rangy.restoreSelection(t)},ZSSEditor.wrapNode=function(e){var t=rangy.saveSelection();$(e).contents().wrap(""),rangy.restoreSelection(t)},ZSSEditor.quickLink=function(){var e=document.getSelection(),t="",i=new String(e),n=new RegExp("^(.+)(@)(.+)$","gi");-1==i.search(n)?(checkhttplink=new RegExp("^http://","gi"),-1==i.search(checkhttplink)?(checkanchorlink=new RegExp("^#","gi"),t=-1==i.search(checkanchorlink)?"http://"+e:e):t=e):(checkmaillink=new RegExp("^mailto:","gi"),t=-1==i.search(checkmaillink)?"mailto:"+e:e);var o=''+e+"";ZSSEditor.insertHTML(o)},ZSSEditor.toggleBlockquoteForSpecificChildNodes=function(e,t){if(t&&t.length>0)if(e.nodeName==NodeName.BLOCKQUOTE)for(var i=0;i';try{this.insertHTML(o)}catch(r){console.error(r)}}},ZSSEditor.insertLocalImage=function(e,t){var i=" ",n=this.getImageProgressIdentifier(e),o=this.getImageContainerIdentifier(e),r='',a="",d='',l='',s=r+d+l+a;s=i+s+i,this.insertHTML(s),this.sendEnabledStyles()},ZSSEditor.getImageNodeWithIdentifier=function(e){return $('img[data-wpid="'+e+'"]')},ZSSEditor.getImageProgressIdentifier=function(e){return"progress_"+e},ZSSEditor.getImageProgressNodeWithIdentifier=function(e){return $("#"+this.getImageProgressIdentifier(e))},ZSSEditor.getImageContainerIdentifier=function(e){return"img_container_"+e},ZSSEditor.getImageContainerNodeWithIdentifier=function(e){return $("#"+this.getImageContainerIdentifier(e))},ZSSEditor.isMediaContainerNode=function(e){return void 0===e.id?!1:0==e.id.search("img_container_")||0==e.id.search("video_container_")},ZSSEditor.extractMediaIdentifier=function(e){return 0==e.id.search("img_container_")?e.id.replace("img_container_",""):0==e.id.search("video_container_")?e.id.replace("video_container_",""):""},ZSSEditor.replaceLocalImageWithRemoteImage=function(e,t){var i=this.getImageNodeWithIdentifier(e);if(0==i.length)return void this.markImageUploadDone(e);var n=new Image;n.onload=function(){i.attr("src",n.src),ZSSEditor.markImageUploadDone(e)},n.onerror=function(){i.attr("src",n.src),ZSSEditor.markImageUploadDone(e)},n.src=t},ZSSEditor.setProgressOnImage=function(e,t){var i=this.getImageNodeWithIdentifier(e);if(0!=i.length){1>t&&i.addClass("uploading");var n=this.getImageProgressNodeWithIdentifier(e);0!=n.length&&n.attr("value",t)}},ZSSEditor.markImageUploadDone=function(e){var t=this.getImageNodeWithIdentifier(e);if(t.length>0){t.removeAttr("data-wpid"),t.removeClass("uploading"),t.removeAttr("class"),t.parent().attr("id")==this.getImageContainerIdentifier(e)&&(t.parent().attr("id",""),t.parent().replaceWith(t));var i='';t.wrap(i)}var n=ZSSEditor.getJoinedFocusedFieldIdAndCaretArguments();ZSSEditor.callback("callback-input",n);var o=this;setTimeout(function(){o.sendImageReplacedCallback(e)},500)},ZSSEditor.sendImageReplacedCallback=function(e){var t=["id="+encodeURIComponent(e)],i=t.join(defaultCallbackSeparator);this.callback("callback-image-replaced",i)},ZSSEditor.markImageUploadFailed=function(e,t){var i=this.getImageNodeWithIdentifier(e);if(0!=i.length){var n="";i[0].width>480&&i[0].height>240?n="largeFail":(i[0].width<100||i[0].height<100)&&(n="smallFail"),i.addClass("failed");var o=this.getImageContainerNodeWithIdentifier(e);0!=o.length&&(o.attr("data-failed",t),i.removeClass("uploading"),o.addClass("failed"),o.addClass(n));var r=this.getImageProgressNodeWithIdentifier(e);0!=r.length&&r.addClass("failed")}},ZSSEditor.unmarkImageUploadFailed=function(e){var t=this.getImageNodeWithIdentifier(e);0!=t.length&&t.removeClass("failed");var i=this.getImageContainerNodeWithIdentifier(e);0!=i.length&&(i.removeAttr("data-failed"),i.removeClass("failed"));var n=this.getImageProgressNodeWithIdentifier(e);0!=n.length&&n.removeClass("failed")},ZSSEditor.removeImage=function(e){var t=this.getImageNodeWithIdentifier(e);0!=t.length&&t.remove();var i=this.getImageContainerNodeWithIdentifier(e);0!=i.length&&(i.attr("id",""),i.remove())},ZSSEditor.sendMediaRemovedCallback=function(e){var t=["id="+encodeURIComponent(e)],i=t.join(defaultCallbackSeparator);this.callback("callback-media-removed",i)},ZSSEditor.insertVideo=function(e,t,i){var n=''+i+"";this.insertHTML(n),this.sendEnabledStyles()},ZSSEditor.insertInProgressVideoWithIDUsingPosterImage=function(e,t){var i=" ",n=this.getVideoProgressIdentifier(e),o=this.getVideoContainerIdentifier(e),r='',a="",d='',l='',s=i+r+d+l+a+i;this.insertHTML(s),this.sendEnabledStyles()},ZSSEditor.getVideoNodeWithIdentifier=function(e){return $('video[data-wpid="'+e+'"]')},ZSSEditor.getVideoProgressIdentifier=function(e){return"progress_"+e},ZSSEditor.getVideoProgressNodeWithIdentifier=function(e){return $("#"+this.getVideoProgressIdentifier(e))},ZSSEditor.getVideoContainerIdentifier=function(e){return"video_container_"+e},ZSSEditor.getVideoContainerNodeWithIdentifier=function(e){return $("#"+this.getVideoContainerIdentifier(e))},ZSSEditor.replaceLocalVideoWithRemoteVideo=function(e,t,i,n){var o=this.getVideoNodeWithIdentifier(e);if(0==o.length)return void this.markVideoUploadDone(e);o.attr("src",t),o.attr("controls",""),""!=n&&o.attr("data-wpvideopress",n),o.attr("poster",i);var r=this;o.on("webkitbeginfullscreen",function(){r.sendVideoFullScreenStarted()}),o.on("webkitendfullscreen",function(){r.sendVideoFullScreenEnded()}),o.on("error",function(){o.load()}),this.markVideoUploadDone(e)},ZSSEditor.setProgressOnVideo=function(e,t){var i=this.getVideoNodeWithIdentifier(e);if(0!=i.length){1>t&&i.addClass("uploading");var n=this.getVideoProgressNodeWithIdentifier(e);0!=n.length&&n.attr("value",t)}},ZSSEditor.markVideoUploadDone=function(e){var t=this.getVideoNodeWithIdentifier(e);t.length>0&&(t.removeAttr("data-wpid"),t.removeClass("uploading"),t.removeAttr("class"),t.parent().attr("id")==this.getVideoContainerIdentifier(e)&&(t.parent().attr("id",""),t.parent().replaceWith(t)));var i=ZSSEditor.getJoinedFocusedFieldIdAndCaretArguments();ZSSEditor.callback("callback-input",i);var n=this;setTimeout(function(){n.sendVideoReplacedCallback(e)},500)},ZSSEditor.sendVideoReplacedCallback=function(e){var t=["id="+encodeURIComponent(e)],i=t.join(defaultCallbackSeparator);this.callback("callback-video-replaced",i)},ZSSEditor.sendVideoFullScreenStarted=function(){this.callback("callback-video-fullscreen-started","empty")},ZSSEditor.sendVideoFullScreenEnded=function(){this.callback("callback-video-fullscreen-ended","empty")},ZSSEditor.sendVideoPressInfoRequest=function(e){var t=["id="+encodeURIComponent(e)],i=t.join(defaultCallbackSeparator);this.callback("callback-videopress-info-request",i)},ZSSEditor.markVideoUploadFailed=function(e,t){var i=this.getVideoNodeWithIdentifier(e);if(0!=i.length){var n="";i[0].width>480&&i[0].height>240?n="largeFail":(i[0].width<100||i[0].height<100)&&(n="smallFail"),i.addClass("failed");var o=this.getVideoContainerNodeWithIdentifier(e);0!=o.length&&(o.attr("data-failed",t),i.removeClass("uploading"),o.addClass("failed"),o.addClass(n));var r=this.getVideoProgressNodeWithIdentifier(e);0!=r.length&&r.addClass("failed")}},ZSSEditor.unmarkVideoUploadFailed=function(e){var t=this.getVideoNodeWithIdentifier(e);0!=t.length&&t.removeClass("failed");var i=this.getVideoContainerNodeWithIdentifier(e);0!=i.length&&(i.removeAttr("data-failed"),i.removeClass("failed"));var n=this.getVideoProgressNodeWithIdentifier(e);0!=n.length&&n.removeClass("failed")},ZSSEditor.removeVideo=function(e){var t=this.getVideoNodeWithIdentifier(e);0!=t.length&&t.remove();var i=this.getVideoContainerNodeWithIdentifier(e);0!=i.length&&(i.attr("id",""),i.remove())},ZSSEditor.replaceVideoPressVideosForShortcode=function(e){var t=/]*data-wpvideopress="([\s\S]+?)"[^>]*>*<\/video>/g,i=e.replace(t,ZSSEditor.removeVideoVisualFormattingCallback);return i},ZSSEditor.removeVideoVisualFormattingCallback=function(e,t){return"[wpvideo "+t+"]"},ZSSEditor.applyVideoFormattingCallback=function(e){if(0==e.attrs.numeric.length)return e.content;var t=e.attrs.numeric[0],i='"wpposter.svg"',n='";return n},ZSSEditor.setVideoPressLinks=function(e,t,i){var n=$('video[data-wpvideopress="'+e+'"]');if(0!=n.length){n.attr("src",t),n.attr("controls",""),0==i.length?n.attr("poster","wpposter.svg"):n.attr("poster",i);var o=this;n.on("webkitbeginfullscreen",function(){o.sendVideoFullScreenStarted()}),n.on("webkitendfullscreen",function(){o.sendVideoFullScreenEnded()}),n.load()}},ZSSEditor.pauseAllVideos=function(){$("video").each(function(){this.pause()})},ZSSEditor.updateCurrentImageMeta=function(e){if(ZSSEditor.currentEditingImage){var t=JSON.parse(e),i=ZSSEditor.createImageFromMeta(t),n=ZSSEditor.findImageCaptionNode(ZSSEditor.currentEditingImage);n.insertAdjacentHTML("afterend",i),n.remove(),ZSSEditor.currentEditingImage=null}},ZSSEditor.applyImageSelectionFormatting=function(e){var t=ZSSEditor.findImageCaptionNode(e),i="";(e.width<100||e.height<100)&&(i=" small");var n='Edit',o=''+n+"";t.insertAdjacentHTML("beforebegin",o);var r=t.previousSibling;r.appendChild(t)},ZSSEditor.removeImageSelectionFormatting=function(e){var t=ZSSEditor.findImageCaptionNode(e);if(t.parentNode&&-1!=t.parentNode.className.indexOf("edit-container")){var i=t.parentNode,n=i.parentNode;n.insertBefore(t,i),i.remove()}},ZSSEditor.removeImageSelectionFormattingFromHTML=function(e){var t=document.createElement("div"),i=$(t).html(e),n=i.find("span.edit-container img");if(0==n.length)return e;for(var o=0;o")+1),i):i},ZSSEditor.applyCaptionFormatting=function(e){var t=e.attrs.named,i='';return i+='",i+=e.content,i+="",i+=""},ZSSEditor.removeCaptionFormatting=function(e){var t=/]*>([\s\S]+?)<\/label>/g,i=e.replace(t,ZSSEditor.removeCaptionFormattingCallback);return i},ZSSEditor.removeCaptionFormattingCallback=function(e,t){var i="";return-1===t.indexOf("]*>([\s\S]+?)<\/span>/gi),i&&i[1]?""+i[1]+"":""):i=t.replace(/\s*]*)>([\s\S]+?)<\/span>/gi,function(e,t,i){if(!i)return"";var n,o,r,a,d={};a=t.match(/data-caption-width="([0-9]*)"/),a=a&&a[1]?a[1]:"",a&&(d.width=a),n=t.match(/data-caption-id="([^"]*)"/),n=n&&n[1]?n[1]:"",n&&(d.id=n),o=t.match(/data-caption-class="([^"]*)"/),o=o&&o[1]?o[1]:"",o&&(d.class=o),r=t.match(/data-caption-align="([^"]*)"/),r=r&&r[1]?r[1]:"",r&&(d.align=r);var l={tag:"caption",attrs:d,type:"closed",content:i};return wp.shortcode.string(l)})},ZSSEditor.applyVisualFormatting=function(e){var t=wp.shortcode.replace("caption",e,ZSSEditor.applyCaptionFormatting);return t=wp.shortcode.replace("wpvideo",t,ZSSEditor.applyVideoFormattingCallback)},ZSSEditor.removeVisualFormatting=function(e){var t=e;return t=ZSSEditor.removeImageSelectionFormattingFromHTML(t),t=ZSSEditor.removeCaptionFormatting(t),t=ZSSEditor.replaceVideoPressVideosForShortcode(t)},ZSSEditor.insertHTML=function(e){var t=this.getFocusedField();t.wrapCaretInParagraphIfNecessary(),document.execCommand("insertHTML",!1,e),this.sendEnabledStyles()},ZSSEditor.isCommandEnabled=function(e){return document.queryCommandState(e)},ZSSEditor.sendEnabledStyles=function(e){var t=[],i=this.getFocusedField();if(i||(i=ZSSEditor.editableFields.zss_field_content),!i.hasNoStyle){for(var n=ZSSEditor.parentTags(),o=0;o0&&t.push(l),"undefined"!=typeof e){var s=$(e.target),c=e.target.nodeName.toLowerCase();try{var S=s.css("backgroundColor");S&&0!=S.length&&"rgba(0, 0, 0, 0)"!=S&&"rgb(0, 0, 0)"!=S&&"transparent"!=S&&t.push("backgroundColor")}catch(e){}try{var u=s.css("color");u&&0!=u.length&&"rgba(0, 0, 0, 0)"!=u&&"rgb(0, 0, 0)"!=u&&"transparent"!=u&&t.push("textColor")}catch(e){}"img"==c&&(ZSSEditor.currentEditingImage=s,t.push("image:"+s.attr("src")),void 0!==s.attr("alt")&&t.push("image-alt:"+s.attr("alt")))}}ZSSEditor.stylesCallback(t)},ZSSEditor.extractNodeFromAncestorNode=function(e,t){for(;t.contains(e);){this.extractNodeFromParent(e);break}},ZSSEditor.extractNodeFromParent=function(e){var t=e.parentNode,i=t.parentNode,n=null,o=null;if(null!=e.previousSibling)for(var n=t.cloneNode();t.firstChild!=e;)n.appendChild(t.firstChild);if(null!=e.nextSibling)for(var o=t.cloneNode();null!=e.nextSibling;)o.appendChild(e.nextSibling);n&&i.insertBefore(n,t),i.insertBefore(e,t),o&&i.insertBefore(o,t),i.removeChild(t)},ZSSEditor.getChildNodesIntersectingRange=function(e,t){var i=new Array;if(e)for(var n=e.firstChild;n;)t.intersectsNode(n)&&i.push(n),n=n.nextSibling;return i},ZSSEditor.getAncestorElementForSettingBlockquote=function(e){for(var t=(new Array,e.commonAncestorContainer);t&&(t.nodeType!=document.ELEMENT_NODE||t.nodeName==NodeName.PARAGRAPH);)t=t.parentNode;for(var i=t;i&&i.nodeName!=NodeName.BLOCKQUOTE;)i=i.parentElement;var n=i?i:t;return n},ZSSEditor.joinAdjacentSiblingsBlockquotes=function(e){var t=this.hasPreviousSiblingWithName(e,NodeName.BLOCKQUOTE),i=this.hasNextSiblingWithName(e,NodeName.BLOCKQUOTE),n=t||i,o=e.previousSibling,r=e.nextSibling;if(t){if(o.appendChild(e),i){for(;r.firstChild;)o.appendChild(r.firstChild);r.parentNode.removeChild(r)}}else i&&r.insertBefore(e,r.firstChild);return n},ZSSEditor.joinAdjacentSiblingsOrAncestorBlockquotes=function(e){for(var t=e,i=this.getFocusedField().wrappedDomNode(),n=!1;t&&t!=i&&!n;)n=this.joinAdjacentSiblingsBlockquotes(t),t=t.parentNode;return n},ZSSEditor.surroundNodeContentsWithNode=function(e,t){var i=document.createRange(),n=document.createElement(t);return i.selectNodeContents(e),i.surroundContents(n),n},ZSSEditor.surroundNodeContentsWithAParagraphNode=function(e){return this.surroundNodeContentsWithNode(e,this.defaultParagraphSeparator)},ZSSEditor.hasNextSiblingWithName=function(e,t){return e.nextSibling&&e.nextSibling.nodeName==t},ZSSEditor.hasPreviousSiblingWithName=function(e,t){return e.previousSibling&&e.previousSibling.nodeName==t},ZSSEditor.closerParentNode=function(){for(var e=null,t=window.getSelection(),i=t.getRangeAt(0).cloneRange(),n=i.commonAncestorContainer;n;){if(n.nodeType==document.ELEMENT_NODE){e=n;break}n=n.parentElement}return e},ZSSEditor.closerParentNodeStartingAtNode=function(e,t){e=e.toLowerCase();for(var i=null,n=t;n&&n.nodeName!=document.body.nodeName;){if(n.nodeName&&n.nodeName.toLowerCase()==e&&n.nodeType==document.ELEMENT_NODE){i=n;break}n=n.parentElement}return i},ZSSEditor.closerParentNodeWithName=function(e){var t=window.getSelection(),i=t.getRangeAt(0).cloneRange(),n=i.commonAncestorContainer;return this.closerParentNodeWithNameRelativeToNode(e,n) +},ZSSEditor.closerParentNodeWithNameRelativeToNode=function(e,t){e=e.toUpperCase();for(var i=null,n=t;n&&n.nodeName!=document.body.nodeName;){if(n.nodeName==e&&n.nodeType==document.ELEMENT_NODE){i=n;break}n=n.parentElement}return i},ZSSEditor.isCloserParentNodeABlockquote=function(){return this.closerParentNode().nodeName==NodeName.BLOCKQUOTE},ZSSEditor.parentTags=function(){for(var e=[],t=window.getSelection(),i=t.getRangeAt(0),n=i.commonAncestorContainer;n&&n.nodeName!=document.body.nodeName;)n.nodeType==document.ELEMENT_NODE&&e.push(n),n=n.parentElement;return e},ZSSField.prototype.bindListeners=function(){var e=this;this.wrappedObject.bind("tap",function(t){e.handleTapEvent(t)}),this.wrappedObject.bind("focus",function(t){e.handleFocusEvent(t)}),this.wrappedObject.bind("blur",function(t){e.handleBlurEvent(t)}),this.wrappedObject.bind("keydown",function(t){e.handleKeyDownEvent(t)}),this.wrappedObject.bind("input",function(t){e.handleInputEvent(t)}),this.wrappedObject.bind("compositionstart",function(t){e.handleCompositionStartEvent(t)}),this.wrappedObject.bind("compositionend",function(t){e.handleCompositionEndEvent(t)}),this.bindMutationObserver()},ZSSField.prototype.bindMutationObserver=function(){var e=this.wrappedObject[0],t=new MutationObserver(function(e){e.forEach(function(e){for(var t=0;t0,n=this.wrappedObject.find("ul").length>0,o=this.wrappedObject.find("ol").length>0;i||n||o||this.wrappedObject.empty()}},ZSSField.prototype.emptyFieldIfNoContentsAndRefreshPlaceholderColor=function(){this.emptyFieldIfNoContents(),this.refreshPlaceholderColor()},ZSSField.prototype.handleBlurEvent=function(){ZSSEditor.focusedField=null,this.emptyFieldIfNoContentsAndRefreshPlaceholderColor(),this.callback("callback-focus-out")},ZSSField.prototype.handleFocusEvent=function(){ZSSEditor.focusedField=this,this.refreshPlaceholderColorAboutToGainFocus(!0),this.callback("callback-focus-in")},ZSSField.prototype.handleKeyDownEvent=function(e){var t="13"==e.keyCode;this.isComposing?e.stopPropagation():t&&!this.isMultiline()?e.preventDefault():this.isMultiline()&&this.wrapCaretInParagraphIfNecessary()},ZSSField.prototype.handleInputEvent=function(){if(!this.isComposing){this.emptyFieldIfNoContentsAndRefreshPlaceholderColor();var e=ZSSEditor.getJoinedFocusedFieldIdAndCaretArguments();this.callback("callback-selection-changed",e),this.callback("callback-input",e)}},ZSSField.prototype.handleCompositionStartEvent=function(){this.isComposing=!0},ZSSField.prototype.handleCompositionEndEvent=function(){this.isComposing=!1},ZSSField.prototype.handleTapEvent=function(e){var t=e.target;if(t){if(ZSSEditor.lastTappedNode=t,"a"==t.nodeName.toLowerCase()){var i=["url="+encodeURIComponent(t.href),"title="+encodeURIComponent(t.innerHTML)],n=i.join(defaultCallbackSeparator),o=this;o.callback("callback-link-tap",n)}if("img"==t.nodeName.toLowerCase())return void this.sendImageTappedCallback(t);if(-1!=t.className.indexOf("edit-overlay")||-1!=t.className.indexOf("edit-content"))return ZSSEditor.removeImageSelectionFormatting(ZSSEditor.currentEditingImage),void this.sendImageTappedCallback(ZSSEditor.currentEditingImage);if(ZSSEditor.currentEditingImage&&(ZSSEditor.removeImageSelectionFormatting(ZSSEditor.currentEditingImage),ZSSEditor.currentEditingImage=null),"video"==t.nodeName.toLowerCase()&&t.dataset.wpid)return void this.sendVideoTappedCallback(t)}},ZSSField.prototype.sendImageTappedCallback=function(e){var t=ZSSEditor.extractImageMeta(e),i=JSON.stringify(t),n="";e.hasAttribute("data-wpid")&&(n=e.getAttribute("data-wpid"));var o="true"==this.wrappedObject.attr("contenteditable"),r=[];$("#zss_field_content img").each(function(){var e=$(this).attr("src");e&&r.push(encodeURIComponent(e))}),r.push(encodeURIComponent(e.src));var a=["id="+(o?"1":"0"),"url="+r.join(","),"meta="+encodeURIComponent(i)],d=a.join(defaultCallbackSeparator);ZSSEditor.callback("callback-image-tap",d)},ZSSField.prototype.sendVideoTappedCallback=function(e){var t="";e.hasAttribute("data-wpid")&&(t=e.getAttribute("data-wpid"));var i=["id="+encodeURIComponent(t),"url="+encodeURIComponent(e.src)],n=i.join(defaultCallbackSeparator);ZSSEditor.callback("callback-video-tap",n)},ZSSField.prototype.sendVideoFullScreenStarted=function(){this.callback("callback-video-fullscreen-started","empty")},ZSSField.prototype.sendVideoFullScreenEnded=function(){this.callback("callback-video-fullscreen-ended","empty")},ZSSField.prototype.callback=function(e,t){var i="id="+this.getNodeId();t&&t.length>0&&(i=i+defaultCallbackSeparator+t),this.callbacker.callback(e,i)},ZSSField.prototype.isFocused=function(){return this.wrappedObject.is(":focus")},ZSSField.prototype.focus=function(){this.isFocused()||this.wrappedObject.focus()},ZSSField.prototype.blur=function(){this.isFocused()&&this.wrappedObject.blur()},ZSSField.prototype.isMultiline=function(){return this.multiline},ZSSField.prototype.setMultiline=function(e){this.multiline=e},ZSSField.prototype.getNodeId=function(){return this.wrappedObject.attr("id")},ZSSField.prototype.enableEditing=function(){this.wrappedObject.attr("contenteditable",!0),ZSSEditor.focusedField||ZSSEditor.focusFirstEditableField()},ZSSField.prototype.disableEditing=function(){this.blur(),this.wrappedObject.attr("contenteditable",!1)},ZSSField.prototype.wrapCaretInParagraphIfNecessary=function(){var e=ZSSEditor.closerParentNode(),t=e==this.wrappedDomNode()||e.nodeName==NodeName.BLOCKQUOTE;if(t){var i=window.getSelection();if(i){var n=i.getRangeAt(0);if(n.startContainer==n.endContainer){var o=document.createElement("p"),r=document.createTextNode("");o.appendChild(r),n.insertNode(o),n.selectNode(r),i.removeAllRanges(),i.addRange(n)}}}},ZSSField.prototype.isRightToLeftTextEnabled=function(){var e=this.wrappedObject.attr("dir"),t="undefined"!=e&&"rtl"==e;return t},ZSSField.prototype.enableRightToLeftText=function(e){var t=e?"rtl":"ltr";this.wrappedObject.attr("dir",t),this.wrappedObject.css("direction",t)},ZSSField.prototype.isEmpty=function(){var e=this.getHTML(),t=0==e.length||""==e;return t},ZSSField.prototype.getHTML=function(){var e=this.wrappedObject.html();return e.replace(/<\/*(body|head|script).*?>/g,"")},ZSSField.prototype.strippedHTML=function(){return this.wrappedObject.text()},ZSSField.prototype.setPlainText=function(e){ZSSEditor.currentEditingImage=null,this.wrappedObject.text(e),this.refreshPlaceholderColor()},ZSSField.prototype.setHTML=function(e){ZSSEditor.currentEditingImage=null,this.wrappedObject.html(e);var t=this;$("video").on("webkitbeginfullscreen",function(){t.sendVideoFullScreenStarted()}),$("video").on("webkitendfullscreen",function(){t.sendVideoFullScreenEnded()}),this.refreshPlaceholderColor()},ZSSField.prototype.hasPlaceholderText=function(){return null!=this.wrappedObject.attr("placeholderText")},ZSSField.prototype.setPlaceholderText=function(e){this.wrappedObject.attr("placeholderText",e)},ZSSField.prototype.setPlaceholderColor=function(e){this.bodyPlaceholderColor=e,this.refreshPlaceholderColor()},ZSSField.prototype.refreshPlaceholderColor=function(){this.refreshPlaceholderColorForAttributes(this.hasPlaceholderText(),this.isFocused(),this.isEmpty())},ZSSField.prototype.refreshPlaceholderColorAboutToGainFocus=function(e){this.refreshPlaceholderColorForAttributes(this.hasPlaceholderText(),e,this.isEmpty())},ZSSField.prototype.refreshPlaceholderColorForAttributes=function(e,t,i){var n=e&&i;n?t?this.wrappedObject.css("color",this.bodyPlaceholderColor):this.wrappedObject.css("color",this.bodyPlaceholderColor):this.wrappedObject.css("color","")},ZSSField.prototype.wrappedDomNode=function(){return this.wrappedObject[0]}; window.wp=window.wp||{},function(){wp.loadText=function(e){if(null==e||!e.trim())return"";var p=!1,r=!1,n="table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|details|menu|summary";return-1!==e.indexOf("/g,function(e){return e.replace(/[\r\n]+/g,"")})),e=e.replace(/<[^<>]+>/g,function(e){return e.replace(/[\r\n]+/g," ")}),(-1!==e.indexOf("]*>[\s\S]+?<\/\1>/g,function(e){return e.replace(/(\r\n|\n)/g,"")})),-1!==e.indexOf("[caption")&&(r=!0,e=e.replace(/\[caption[\s\S]+?\[\/caption\]/g,function(e){return e=e.replace(/]*)>/g,""),e=e.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g,function(e){return e.replace(/[\r\n\t]+/," ")}),e.replace(/\s*\n\s*/g,"")})),e+="\n\n",e=e.replace(/\s*/gi,"\n\n"),e=e.replace(new RegExp("(<(?:"+n+")(?: [^>]*)?>)","gi"),"\n$1"),e=e.replace(new RegExp("((?:"+n+")>)","gi"),"$1\n\n"),e=e.replace(/]*)?>/gi,"\n\n"),e=e.replace(/\s*\s*/gi,""),e=e.replace(/\r\n|\r/g,"\n"),e=e.replace(/\n\s*\n+/g,"\n\n"),e=e.replace(/([\s\S]+?)\n\n/g,"$1\n"),e=e.replace(/\s*?<\/p>/gi,""),e=e.replace(new RegExp("\\s*(?(?:"+n+")(?: [^>]*)?>)\\s*","gi"),"$1"),e=e.replace(/(/gi,"$1"),e=e.replace(/\s*]*)>/gi,""),e=e.replace(/<\/blockquote>\s*<\/p>/gi,""),e=e.replace(new RegExp("\\s*(?(?:"+n+")(?: [^>]*)?>)","gi"),"$1"),e=e.replace(new RegExp("(?(?:"+n+")(?: [^>]*)?>)\\s*","gi"),"$1"),e=e.replace(/\s*\n/gi,"\n"),e=e.replace(new RegExp("(?(?:"+n+")[^>]*>)\\s*","gi"),"$1"),e=e.replace(/(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi,"$1"),e=e.replace(/(?:|)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|)*/gi,"[caption$1[/caption]"),e=e.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g,function(e,p,r){return r.match(/]*)?>/)?e:p+""+r+""}),p&&(e=e.replace(//g,"\n")),r&&(e=e.replace(/]*)>/g,"")),e}}(); window.wp=window.wp||{},function(){wp.saveText=function(e){if(null==e||!e.trim())return"";var n,p,r=!1,c=!1;return(-1!==e.indexOf("]*>[\s\S]+?<\/\1>/g,function(e){return e=e.replace(/(\r\n|\n)?/g,""),e=e.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,""),e.replace(/\r?\n/g,"")})),-1!==e.indexOf("[caption")&&(c=!0,e=e.replace(/\[caption[\s\S]+?\[\/caption\]/g,function(e){return e.replace(/]*)>/g,"").replace(/[\r\n\t]+/,"")})),n="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset",e=e.replace(new RegExp("\\s*("+n+")>\\s*","g"),"$1>\n"),e=e.replace(new RegExp("\\s*<((?:"+n+")(?: [^>]*)?)>","g"),"\n<$1>"),e=e.replace(/(]+>.*?)<\/p>/g,"$1"),e=e.replace(/]*)?>\s*/gi,"\n\n"),e=e.replace(/\s*/gi,""),e=e.replace(/\s*<\/p>\s*/gi,"\n\n"),e=e.replace(/\n[\s\u00a0]+\n/g,"\n\n"),e=e.replace(/\s*\s*/gi,"\n"),e=e.replace(/\s*\s*/g,"\n"),e=e.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n"),e=e.replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption"),p="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset",e=e.replace(new RegExp("\\s*<((?:"+p+")(?: [^>]*)?)\\s*>","g"),"\n<$1>"),e=e.replace(new RegExp("\\s*("+p+")>\\s*","g"),"$1>\n"),e=e.replace(/]*)>/g," "),-1!==e.indexOf("/g,"\n")),-1!==e.indexOf("]*)?>\s*/g,"\n\n\n\n")),-1!==e.indexOf("/g,function(e){return e.replace(/[\r\n]+/g,"")})),e=e.replace(/<\/p#>/g,"\n"),e=e.replace(/\s*(]+>[\s\S]*?<\/p>)/g,"\n$1"),e=e.replace(/^\s+/,""),e=e.replace(/[\s\u00a0]+$/,""),r&&(e=e.replace(//g,"\n")),c&&(e=e.replace(/]*)>/g,"")),e}}(); !function(e,t){"function"==typeof define&&define.amd?define(e):"undefined"!=typeof module&&"object"==typeof exports?module.exports=e():t.rangy=e()}(function(){function e(e,t){var n=typeof e[t];return n==v||!(n!=R||!e[t])||"unknown"==n}function t(e,t){return!(typeof e[t]!=R||!e[t])}function n(e,t){return typeof e[t]!=C}function r(e){return function(t,n){for(var r=n.length;r--;)if(!e(t,n[r]))return!1;return!0}}function o(e){return e&&w(e,y)&&T(e,S)}function i(e){return t(e,"body")?e.body:e.getElementsByTagName("body")[0]}function a(t){typeof console!=C&&e(console,"log")&&console.log(t)}function s(e,t){x&&t?alert(e):a(e)}function c(e){b.initialized=!0,b.supported=!1,s("Rangy is not supported in this environment. Reason: "+e,b.config.alertOnFail)}function f(e){s("Rangy warning: "+e,b.config.alertOnWarn)}function d(e){return e.message||e.description||String(e)}function u(){if(x&&!b.initialized){var t,n=!1,r=!1;e(document,"createRange")&&(t=document.createRange(),w(t,E)&&T(t,N)&&(n=!0));var s=i(document);if(!s||"body"!=s.nodeName.toLowerCase())return void c("No body element found");if(s&&e(s,"createTextRange")&&(t=s.createTextRange(),o(t)&&(r=!0)),!n&&!r)return void c("Neither Range nor TextRange are available");b.initialized=!0,b.features={implementsDomRange:n,implementsTextRange:r};var f,u;for(var l in D)(f=D[l])instanceof h&&f.init(f,b);for(var g=0,p=B.length;p>g;++g)try{B[g](b)}catch(m){u="Rangy init listener threw an exception. Continuing. Detail: "+d(m),a(u)}}}function l(e){e=e||window,u();for(var t=0,n=H.length;n>t;++t)H[t](e)}function h(e,t,n){this.name=e,this.dependencies=t,this.initialized=!1,this.supported=!1,this.initializer=n}function g(e,t,n){var r=new h(e,t,function(t){if(!t.initialized){t.initialized=!0;try{n(b,t),t.supported=!0}catch(r){var o="Module '"+e+"' failed to load: "+d(r);a(o),r.stack&&a(r.stack)}}});return D[e]=r,r}function p(){}function m(){}var R="object",v="function",C="undefined",N=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],E=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],S=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],y=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],w=r(e),O=r(t),T=r(n),_=[].forEach?function(e,t){e.forEach(t)}:function(e,t){for(var n=0,r=e.length;r>n;++n)t(e[n],n)},D={},x=typeof window!=C&&typeof document!=C,A={isHostMethod:e,isHostObject:t,isHostProperty:n,areHostMethods:w,areHostObjects:O,areHostProperties:T,isTextRange:o,getBody:i,forEach:_},b={version:"1.3.0-beta.2",initialized:!1,isBrowser:x,supported:!0,util:A,features:{},modules:D,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==C?!0:rangyAutoInitialize}};b.fail=c,b.warn=f;var P;({}).hasOwnProperty?(A.extend=P=function(e,t,n){var r,o;for(var i in t)t.hasOwnProperty(i)&&(r=e[i],o=t[i],n&&null!==r&&"object"==typeof r&&null!==o&&"object"==typeof o&&P(r,o,!0),e[i]=o);return t.hasOwnProperty("toString")&&(e.toString=t.toString),e},A.createOptions=function(e,t){var n={};return P(n,t),e&&P(n,e),n}):c("hasOwnProperty not supported"),x||c("Rangy can only run in a browser"),function(){var e;if(x){var t=document.createElement("div");t.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(t.childNodes,0)[0].nodeType&&(e=function(e){return n.call(e,0)})}catch(r){}}e||(e=function(e){for(var t=[],n=0,r=e.length;r>n;++n)t[n]=e[n];return t}),A.toArray=e}();var I;x&&(e(document,"addEventListener")?I=function(e,t,n){e.addEventListener(t,n,!1)}:e(document,"attachEvent")?I=function(e,t,n){e.attachEvent("on"+t,n)}:c("Document does not have required addEventListener or attachEvent method"),A.addListener=I);var B=[];b.init=u,b.addInitListener=function(e){b.initialized?e(b):B.push(e)};var H=[];b.addShimListener=function(e){H.push(e)},x&&(b.shim=b.createMissingNativeApi=l),h.prototype={init:function(){for(var e,t,n=this.dependencies||[],r=0,o=n.length;o>r;++r){if(t=n[r],e=D[t],!(e&&e instanceof h))throw new Error("required module '"+t+"' not found");if(e.init(),!e.supported)throw new Error("required module '"+t+"' not supported")}this.initializer(this)},fail:function(e){throw this.initialized=!0,this.supported=!1,new Error(e)},warn:function(e){b.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){b.warn("DEPRECATED: "+e+" in module "+this.name+"is deprecated. Please use "+t+" instead")},createError:function(e){return new Error("Error in Rangy "+this.name+" module: "+e)}},b.createModule=function(e){var t,n;2==arguments.length?(t=arguments[1],n=[]):(t=arguments[2],n=arguments[1]);var r=g(e,n,t);b.initialized&&b.supported&&r.init()},b.createCoreModule=function(e,t,n){g(e,t,n)},b.RangePrototype=p,b.rangePrototype=new p,b.selectionPrototype=new m,b.createCoreModule("DomUtil",[],function(e,t){function n(e){var t;return typeof e.namespaceURI==b||null===(t=e.namespaceURI)||"http://www.w3.org/1999/xhtml"==t}function r(e){var t=e.parentNode;return 1==t.nodeType?t:null}function o(e){for(var t=0;e=e.previousSibling;)++t;return t}function i(e){switch(e.nodeType){case 7:case 10:return 0;case 3:case 8:return e.length;default:return e.childNodes.length}}function a(e,t){var n,r=[];for(n=e;n;n=n.parentNode)r.push(n);for(n=t;n;n=n.parentNode)if(M(r,n))return n;return null}function s(e,t,n){for(var r=n?t:t.parentNode;r;){if(r===e)return!0;r=r.parentNode}return!1}function c(e,t){return s(e,t,!0)}function f(e,t,n){for(var r,o=n?e:e.parentNode;o;){if(r=o.parentNode,r===t)return o;o=r}return null}function d(e){var t=e.nodeType;return 3==t||4==t||8==t}function u(e){if(!e)return!1;var t=e.nodeType;return 3==t||8==t}function l(e,t){var n=t.nextSibling,r=t.parentNode;return n?r.insertBefore(e,n):r.appendChild(e),e}function h(e,t,n){var r=e.cloneNode(!1);if(r.deleteData(0,t),e.deleteData(t,e.length-t),l(r,e),n)for(var i,a=0;i=n[a++];)i.node==e&&i.offset>t?(i.node=r,i.offset-=t):i.node==e.parentNode&&i.offset>o(e)&&++i.offset;return r}function g(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!=b)return e.ownerDocument;if(typeof e.document!=b)return e.document;if(e.parentNode)return g(e.parentNode);throw t.createError("getDocument: no document found for node")}function p(e){var n=g(e);if(typeof n.defaultView!=b)return n.defaultView;if(typeof n.parentWindow!=b)return n.parentWindow;throw t.createError("Cannot get a window object for node")}function m(e){if(typeof e.contentDocument!=b)return e.contentDocument;if(typeof e.contentWindow!=b)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function R(e){if(typeof e.contentWindow!=b)return e.contentWindow;if(typeof e.contentDocument!=b)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")}function v(e){return e&&P.isHostMethod(e,"setTimeout")&&P.isHostObject(e,"document")}function C(e,t,n){var r;if(e?P.isHostProperty(e,"nodeType")?r=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?m(e):g(e):v(e)&&(r=e.document):r=document,!r)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return r}function N(e){for(var t;t=e.parentNode;)e=t;return e}function E(e,n,r,i){var s,c,d,u,l;if(e==r)return n===i?0:i>n?-1:1;if(s=f(r,e,!0))return n<=o(s)?-1:1;if(s=f(e,r,!0))return o(s)[index:"+o(e)+",length:"+e.childNodes.length+"]["+(e.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return e.nodeName}function w(e){for(var t,n=g(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n}function O(e,t,n){var r=I(e),o=e.createElement("div");o.contentEditable=""+!!n,t&&(o.innerHTML=t);var i=r.firstChild;return i?r.insertBefore(o,i):r.appendChild(o),o}function T(e){return e.parentNode.removeChild(e)}function _(e){this.root=e,this._next=e}function D(e){return new _(e)}function x(e,t){this.node=e,this.offset=t}function A(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}var b="undefined",P=e.util,I=P.getBody;P.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),P.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var B=document.createElement("div");P.areHostMethods(B,["insertBefore","appendChild","cloneNode"]||!P.areHostObjects(B,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),P.isHostProperty(B,"innerHTML")||t.fail("Element is missing innerHTML property");var H=document.createTextNode("test");P.areHostMethods(H,["splitText","deleteData","insertData","appendData","cloneNode"]||!P.areHostObjects(B,["previousSibling","nextSibling","childNodes","parentNode"])||!P.areHostProperties(H,["data"]))||t.fail("Incomplete Text Node implementation");var M=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1},k=!1;!function(){var t=document.createElement("b");t.innerHTML="1";var n=t.firstChild;t.innerHTML="",k=S(n),e.features.crashyTextNodes=k}();var L;typeof window.getComputedStyle!=b?L=function(e,t){return p(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!=b?L=function(e,t){return e.currentStyle[t]}:t.fail("No means of obtaining computed style properties found"),_.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},x.prototype={equals:function(e){return!!e&&this.node===e.node&&this.offset==e.offset},inspect:function(){return"[DomPosition("+y(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},A.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},A.prototype.toString=function(){return this.message},e.dom={arrayContains:M,isHtmlNamespace:n,parentElement:r,getNodeIndex:o,getNodeLength:i,getCommonAncestor:a,isAncestorOf:s,isOrIsAncestorOf:c,getClosestAncestorIn:f,isCharacterDataNode:d,isTextOrCommentNode:u,insertAfter:l,splitDataNode:h,getDocument:g,getWindow:p,getIframeWindow:R,getIframeDocument:m,getBody:I,isWindow:v,getContentDocument:C,getRootContainer:N,comparePoints:E,isBrokenNode:S,inspectNode:y,getComputedStyleProperty:L,createTestElement:O,removeNode:T,fragmentFromNodeChildren:w,createIterator:D,DomPosition:x},e.DOMException=A}),b.createCoreModule("DomRange",["DomUtil"],function(e){function t(e,t){return 3!=e.nodeType&&(F(e,t.startContainer)||F(e,t.endContainer))}function n(e){return e.document||j(e.startContainer)}function r(e){return new M(e.parentNode,W(e))}function o(e){return new M(e.parentNode,W(e)+1)}function i(e,t,n){var r=11==e.nodeType?e.firstChild:e;return L(t)?n==t.length?B.insertAfter(e,t):t.parentNode.insertBefore(e,0==n?t:U(t,n)):n>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[n]),r}function a(e,t,r){if(w(e),w(t),n(t)!=n(e))throw new k("WRONG_DOCUMENT_ERR");var o=z(e.startContainer,e.startOffset,t.endContainer,t.endOffset),i=z(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return r?0>=o&&i>=0:0>o&&i>0}function s(e){for(var t,r,o,i=n(e.range).createDocumentFragment();r=e.next();){if(t=e.isPartiallySelectedSubtree(),r=r.cloneNode(!t),t&&(o=e.getSubtreeIterator(),r.appendChild(s(o)),o.detach()),10==r.nodeType)throw new k("HIERARCHY_REQUEST_ERR");i.appendChild(r)}return i}function c(e,t,n){var r,o;n=n||{stop:!1};for(var i,a;i=e.next();)if(e.isPartiallySelectedSubtree()){if(t(i)===!1)return void(n.stop=!0);if(a=e.getSubtreeIterator(),c(a,t,n),a.detach(),n.stop)return}else for(r=B.createIterator(i);o=r.next();)if(t(o)===!1)return void(n.stop=!0)}function f(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(t=e.getSubtreeIterator(),f(t),t.detach()):e.remove()}function d(e){for(var t,r,o=n(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),r=e.getSubtreeIterator(),t.appendChild(d(r)),r.detach()):e.remove(),10==t.nodeType)throw new k("HIERARCHY_REQUEST_ERR");o.appendChild(t)}return o}function u(e,t,n){var r,o=!(!t||!t.length),i=!!n;o&&(r=new RegExp("^("+t.join("|")+")$"));var a=[];return c(new h(e,!1),function(t){if(!(o&&!r.test(t.nodeType)||i&&!n(t))){var s=e.startContainer;if(t!=s||!L(s)||e.startOffset!=s.length){var c=e.endContainer;t==c&&L(c)&&0==e.endOffset||a.push(t)}}}),a}function l(e){var t="undefined"==typeof e.getName?"Range":e.getName();return"["+t+"("+B.inspectNode(e.startContainer)+":"+e.startOffset+", "+B.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function h(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&L(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||L(this.sc)?V(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||L(this.ec)?V(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}function g(e){return function(t,n){for(var r,o=n?t:t.parentNode;o;){if(r=o.nodeType,Y(e,r))return o;o=o.parentNode}return null}}function p(e,t){if(rt(e,t))throw new k("INVALID_NODE_TYPE_ERR")}function m(e,t){if(!Y(t,e.nodeType))throw new k("INVALID_NODE_TYPE_ERR")}function R(e,t){if(0>t||t>(L(e)?e.length:e.childNodes.length))throw new k("INDEX_SIZE_ERR")}function v(e,t){if(tt(e,!0)!==tt(t,!0))throw new k("WRONG_DOCUMENT_ERR")}function C(e){if(nt(e,!0))throw new k("NO_MODIFICATION_ALLOWED_ERR")}function N(e,t){if(!e)throw new k(t)}function E(e){return G&&B.isBrokenNode(e)||!Y($,e.nodeType)&&!tt(e,!0)}function S(e,t){return t<=(L(e)?e.length:e.childNodes.length)}function y(e){return!!e.startContainer&&!!e.endContainer&&!E(e.startContainer)&&!E(e.endContainer)&&S(e.startContainer,e.startOffset)&&S(e.endContainer,e.endOffset)}function w(e){if(!y(e))throw new Error("Range error: Range is no longer valid after DOM mutation ("+e.inspect()+")")}function O(e,t){w(e);var n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,a=n===o;L(o)&&i>0&&i0&&r=W(n)&&i++,r=0),e.setStartAndEnd(n,r,o,i)}function T(e){w(e);var t=e.commonAncestorContainer.parentNode.cloneNode(!1);return t.appendChild(e.cloneContents()),t.innerHTML}function _(e){e.START_TO_START=ft,e.START_TO_END=dt,e.END_TO_END=ut,e.END_TO_START=lt,e.NODE_BEFORE=ht,e.NODE_AFTER=gt,e.NODE_BEFORE_AND_AFTER=pt,e.NODE_INSIDE=mt}function D(e){_(e),_(e.prototype)}function x(e,t){return function(){w(this);var n,r,i=this.startContainer,a=this.startOffset,s=this.commonAncestorContainer,f=new h(this,!0);i!==s&&(n=V(i,s,!0),r=o(n),i=r.node,a=r.offset),c(f,C),f.reset();var d=e(f);return f.detach(),t(this,i,a,i,a),d}}function A(n,i){function a(e,t){return function(n){m(n,Z),m(Q(n),$);var i=(e?r:o)(n);(t?s:c)(this,i.node,i.offset)}}function s(e,t,n){var r=e.endContainer,o=e.endOffset;(t!==e.startContainer||n!==e.startOffset)&&((Q(t)!=Q(r)||1==z(t,n,r,o))&&(r=t,o=n),i(e,t,n,r,o))}function c(e,t,n){var r=e.startContainer,o=e.startOffset;(t!==e.endContainer||n!==e.endOffset)&&((Q(t)!=Q(r)||-1==z(t,n,r,o))&&(r=t,o=n),i(e,r,o,t,n))}var u=function(){};u.prototype=e.rangePrototype,n.prototype=new u,H.extend(n.prototype,{setStart:function(e,t){p(e,!0),R(e,t),s(this,e,t)},setEnd:function(e,t){p(e,!0),R(e,t),c(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],n=e[1],r=t,o=n;switch(e.length){case 3:o=e[2];break;case 4:r=e[2],o=e[3]}i(this,t,n,r,o)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:a(!0,!0),setStartAfter:a(!1,!0),setEndBefore:a(!0,!1),setEndAfter:a(!1,!1),collapse:function(e){w(this),e?i(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):i(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){p(e,!0),i(this,e,0,e,q(e))},selectNode:function(e){p(e,!1),m(e,Z);var t=r(e),n=o(e);i(this,t.node,t.offset,n.node,n.offset)},extractContents:x(d,i),deleteContents:x(f,i),canSurroundContents:function(){w(this),C(this.startContainer),C(this.endContainer);var e=new h(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},splitBoundaries:function(){O(this)},splitBoundariesPreservingPositions:function(e){O(this,e)},normalizeBoundaries:function(){w(this);var e=this.startContainer,t=this.startOffset,n=this.endContainer,r=this.endOffset,o=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(n=e,r=e.length,e.appendData(t.data),X(t))},a=function(o){var i=o.previousSibling;if(i&&i.nodeType==o.nodeType){e=o;var a=o.length;if(t=i.length,o.insertData(0,i.data),X(i),e==n)r+=t,n=e;else if(n==o.parentNode){var s=W(o);r==s?(n=o,r=a):r>s&&r--}}},s=!0;if(L(n))n.length==r&&o(n);else{if(r>0){var c=n.childNodes[r-1];c&&L(c)&&o(c)}s=!this.collapsed}if(s){if(L(e))0==t&&a(e);else if(tx",it=3==ot.firstChild.nodeType}catch(at){}e.features.htmlParsingConforms=it;var st=it?function(e){var t=this.startContainer,n=j(t);if(!t)throw new k("INVALID_STATE_ERR");var r=null;return 1==t.nodeType?r=t:L(t)&&(r=B.parentElement(t)),r=null===r||"HTML"==r.nodeName&&B.isHtmlNamespace(j(r).documentElement)&&B.isHtmlNamespace(r)?n.createElement("body"):r.cloneNode(!1),r.innerHTML=e,B.fragmentFromNodeChildren(r)}:function(e){var t=n(this),r=t.createElement("body");return r.innerHTML=e,B.fragmentFromNodeChildren(r)},ct=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ft=0,dt=1,ut=2,lt=3,ht=0,gt=1,pt=2,mt=3;H.extend(e.rangePrototype,{compareBoundaryPoints:function(e,t){w(this),v(this.startContainer,t.startContainer);var n,r,o,i,a=e==lt||e==ft?"start":"end",s=e==dt||e==ft?"start":"end";return n=this[a+"Container"],r=this[a+"Offset"],o=t[s+"Container"],i=t[s+"Offset"],z(n,r,o,i)},insertNode:function(e){if(w(this),m(e,K),C(this.startContainer),F(e,this.startContainer))throw new k("HIERARCHY_REQUEST_ERR");var t=i(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){w(this);var e,t;if(this.collapsed)return n(this).createDocumentFragment();if(this.startContainer===this.endContainer&&L(this.startContainer))return e=this.startContainer.cloneNode(!0),e.data=e.data.slice(this.startOffset,this.endOffset),t=n(this).createDocumentFragment(),t.appendChild(e),t;var r=new h(this,!0);return e=s(r),r.detach(),e},canSurroundContents:function(){w(this),C(this.startContainer),C(this.endContainer);var e=new h(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},surroundContents:function(e){if(m(e,et),!this.canSurroundContents())throw new k("INVALID_STATE_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);i(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){w(this);for(var e,t=new I(n(this)),r=ct.length;r--;)e=ct[r],t[e]=this[e];return t},toString:function(){w(this);var e=this.startContainer;if(e===this.endContainer&&L(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new h(this,!0);return c(n,function(e){(3==e.nodeType||4==e.nodeType)&&t.push(e.data)}),n.detach(),t.join("")},compareNode:function(e){w(this);var t=e.parentNode,n=W(e);if(!t)throw new k("NOT_FOUND_ERR");var r=this.comparePoint(t,n),o=this.comparePoint(t,n+1);return 0>r?o>0?pt:ht:o>0?gt:mt},comparePoint:function(e,t){return w(this),N(e,"HIERARCHY_REQUEST_ERR"),v(e,this.startContainer),z(e,t,this.startContainer,this.startOffset)<0?-1:z(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:st,toHtml:function(){return T(this)},intersectsNode:function(e,t){if(w(this),N(e,"NOT_FOUND_ERR"),j(e)!==n(this))return!1;var r=e.parentNode,o=W(e);N(r,"NOT_FOUND_ERR");var i=z(r,o,this.endContainer,this.endOffset),a=z(r,o+1,this.startContainer,this.startOffset);return t?0>=i&&a>=0:0>i&&a>0},isPointInRange:function(e,t){return w(this),N(e,"HIERARCHY_REQUEST_ERR"),v(e,this.startContainer),z(e,t,this.startContainer,this.startOffset)>=0&&z(e,t,this.endContainer,this.endOffset)<=0},intersectsRange:function(e){return a(this,e,!1)},intersectsOrTouchesRange:function(e){return a(this,e,!0)},intersection:function(e){if(this.intersectsRange(e)){var t=z(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=z(this.endContainer,this.endOffset,e.endContainer,e.endOffset),r=this.cloneRange();return-1==t&&r.setStart(e.startContainer,e.startOffset),1==n&&r.setEnd(e.endContainer,e.endOffset),r}return null},union:function(e){if(this.intersectsOrTouchesRange(e)){var t=this.cloneRange();return-1==z(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==z(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new k("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==mt},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&this.comparePoint(e,q(e))<=0},containsRange:function(e){var t=this.intersection(e);return null!==t&&e.equals(t)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var r=n.pop();return t.setEnd(r,r.length),this.containsRange(t)}return this.containsNodeContents(e)},getNodes:function(e,t){return w(this),u(this,e,t)},getDocument:function(){return n(this)},collapseBefore:function(e){this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){this.setStartAfter(e),this.collapse(!0)},getBookmark:function(t){var r=n(this),o=e.createRange(r);t=t||B.getBody(r),o.selectNodeContents(t);var i=this.intersection(o),a=0,s=0;return i&&(o.setEnd(i.startContainer,i.startOffset),a=o.toString().length,s=a+i.toString().length),{start:a,end:s,containerNode:t}},moveToBookmark:function(e){var t=e.containerNode,n=0;this.setStart(t,0),this.collapse(!0);for(var r,o,i,a,s=[t],c=!1,f=!1;!f&&(r=s.pop());)if(3==r.nodeType)o=n+r.length,!c&&e.start>=n&&e.start<=o&&(this.setStart(r,e.start-n),c=!0),c&&e.end>=n&&e.end<=o&&(this.setEnd(r,e.end-n),f=!0),n=o;else for(a=r.childNodes,i=a.length;i--;)s.push(a[i])},getName:function(){return"DomRange"},equals:function(e){return I.rangesEqual(this,e)},isValid:function(){return y(this)},inspect:function(){return l(this)},detach:function(){}}),A(I,P),H.extend(I,{rangeProperties:ct,RangeIterator:h,copyComparisonConstants:D,createPrototypeRange:A,inspect:l,toHtml:T,getRangeDocument:n,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=I}),b.createCoreModule("WrappedRange",["DomRange"],function(e,t){var n,r,o=e.dom,i=e.util,a=o.DomPosition,s=e.DomRange,c=o.getBody,f=o.getContentDocument,d=o.isCharacterDataNode;if(e.features.implementsDomRange&&!function(){function r(e){for(var t,n=l.length;n--;)t=l[n],e[t]=e.nativeRange[t];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}function a(e,t,n,r,o){var i=e.startContainer!==t||e.startOffset!=n,a=e.endContainer!==r||e.endOffset!=o,s=!e.equals(e.nativeRange);(i||a||s)&&(e.setEnd(r,o),e.setStart(t,n))}var d,u,l=s.rangeProperties;n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,r(this)},s.createPrototypeRange(n,a),d=n.prototype,d.selectNode=function(e){this.nativeRange.selectNode(e),r(this)},d.cloneContents=function(){return this.nativeRange.cloneContents()},d.surroundContents=function(e){this.nativeRange.surroundContents(e),r(this)},d.collapse=function(e){this.nativeRange.collapse(e),r(this)},d.cloneRange=function(){return new n(this.nativeRange.cloneRange())},d.refresh=function(){r(this)},d.toString=function(){return this.nativeRange.toString()};var h=document.createTextNode("test");c(document).appendChild(h);var g=document.createRange();g.setStart(h,0),g.setEnd(h,0);try{g.setStart(h,1),d.setStart=function(e,t){this.nativeRange.setStart(e,t),r(this)},d.setEnd=function(e,t){this.nativeRange.setEnd(e,t),r(this)},u=function(e){return function(t){this.nativeRange[e](t),r(this)}}}catch(p){d.setStart=function(e,t){try{this.nativeRange.setStart(e,t)}catch(n){this.nativeRange.setEnd(e,t),this.nativeRange.setStart(e,t)}r(this)},d.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}r(this)},u=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(o){this.nativeRange[t](n),this.nativeRange[e](n)}r(this)}}}d.setStartBefore=u("setStartBefore","setEndBefore"),d.setStartAfter=u("setStartAfter","setEndAfter"),d.setEndBefore=u("setEndBefore","setStartBefore"),d.setEndAfter=u("setEndAfter","setStartAfter"),d.selectNodeContents=function(e){this.setStartAndEnd(e,0,o.getNodeLength(e))},g.selectNodeContents(h),g.setEnd(h,3);var m=document.createRange();m.selectNodeContents(h),m.setEnd(h,4),m.setStart(h,2),d.compareBoundaryPoints=-1==g.compareBoundaryPoints(g.START_TO_END,m)&&1==g.compareBoundaryPoints(g.END_TO_START,m)?function(e,t){return t=t.nativeRange||t,e==t.START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)};var R=document.createElement("div");R.innerHTML="123";var v=R.firstChild,C=c(document);C.appendChild(R),g.setStart(v,1),g.setEnd(v,2),g.deleteContents(),"13"==v.data&&(d.deleteContents=function(){this.nativeRange.deleteContents(),r(this)},d.extractContents=function(){var e=this.nativeRange.extractContents();return r(this),e}),C.removeChild(R),C=null,i.isHostMethod(g,"createContextualFragment")&&(d.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),c(document).removeChild(h),d.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return e=f(e,t,"createNativeRange"),e.createRange()}}(),e.features.implementsTextRange){var u=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var r=n.parentElement();n=e.duplicate(),n.collapse(!1);var i=n.parentElement(),a=r==i?r:o.getCommonAncestor(r,i);return a==t?a:o.getCommonAncestor(t,a)},l=function(e){return 0==e.compareEndPoints("StartToEnd",e)},h=function(e,t,n,r,i){var s=e.duplicate();s.collapse(n);var c=s.parentElement();if(o.isOrIsAncestorOf(t,c)||(c=t),!c.canHaveHTML){var f=new a(c.parentNode,o.getNodeIndex(c));return{boundaryPosition:f,nodeInfo:{nodeIndex:f.offset,containerElement:f.node}}}var u=o.getDocument(c).createElement("span");u.parentNode&&o.removeNode(u);for(var l,h,g,p,m,R=n?"StartToStart":"StartToEnd",v=i&&i.containerElement==c?i.nodeIndex:0,C=c.childNodes.length,N=C,E=N;;){if(E==C?c.appendChild(u):c.insertBefore(u,c.childNodes[E]),s.moveToElementText(u),l=s.compareEndPoints(R,e),0==l||v==N)break;if(-1==l){if(N==v+1)break;v=E}else N=N==v+1?v:E;E=Math.floor((v+N)/2),c.removeChild(u)}if(m=u.nextSibling,-1==l&&m&&d(m)){s.setEndPoint(n?"EndToStart":"EndToEnd",e);var S;if(/[\r\n]/.test(m.data)){var y=s.duplicate(),w=y.text.replace(/\r\n/g,"\r").length;for(S=y.moveStart("character",w);-1==(l=y.compareEndPoints("StartToEnd",y));)S++,y.moveStart("character",1)}else S=s.text.length;p=new a(m,S)}else h=(r||!n)&&u.previousSibling,g=(r||n)&&u.nextSibling,p=g&&d(g)?new a(g,0):h&&d(h)?new a(h,h.data.length):new a(c,o.getNodeIndex(u));return o.removeNode(u),{boundaryPosition:p,nodeInfo:{nodeIndex:E,containerElement:c}}},g=function(e,t){var n,r,i,a,s=e.offset,f=o.getDocument(e.node),u=c(f).createTextRange(),l=d(e.node);return l?(n=e.node,r=n.parentNode):(a=e.node.childNodes,n=s diff --git a/Leanote/editor/EditorAssets/editor.min.html b/Leanote/editor/EditorAssets/editor.min.html index e81c052..faec0ff 100755 --- a/Leanote/editor/EditorAssets/editor.min.html +++ b/Leanote/editor/EditorAssets/editor.min.html @@ -41,5 +41,11 @@ // $(document).ready(function() { ZSSEditor.init(callbacker, logger); + + if (/ipad/.test(location)) { + ZSSEditor.getField('zss_field_title').setHTML("你好啊 hello world"); + ZSSEditor.getField('zss_field_content').setHTML("你好 hello world"); + $('body').addClass('ipad-body'); + } });
"+i[1]+"
]*>[\s\S]+?<\/\1>/g,function(e){return e.replace(/(\r\n|\n)/g,"")})),-1!==e.indexOf("[caption")&&(r=!0,e=e.replace(/\[caption[\s\S]+?\[\/caption\]/g,function(e){return e=e.replace(/]*)>/g,""),e=e.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g,function(e){return e.replace(/[\r\n\t]+/," ")}),e.replace(/\s*\n\s*/g,"")})),e+="\n\n",e=e.replace(/\s*/gi,"\n\n"),e=e.replace(new RegExp("(<(?:"+n+")(?: [^>]*)?>)","gi"),"\n$1"),e=e.replace(new RegExp("((?:"+n+")>)","gi"),"$1\n\n"),e=e.replace(/]*)?>/gi,"\n\n"),e=e.replace(/\s*\s*/gi,""),e=e.replace(/\r\n|\r/g,"\n"),e=e.replace(/\n\s*\n+/g,"\n\n"),e=e.replace(/([\s\S]+?)\n\n/g,"$1\n"),e=e.replace(/\s*?<\/p>/gi,""),e=e.replace(new RegExp("\\s*(?(?:"+n+")(?: [^>]*)?>)\\s*","gi"),"$1"),e=e.replace(/(/gi,"$1"),e=e.replace(/\s*]*)>/gi,""),e=e.replace(/<\/blockquote>\s*<\/p>/gi,""),e=e.replace(new RegExp("\\s*(?(?:"+n+")(?: [^>]*)?>)","gi"),"$1"),e=e.replace(new RegExp("(?(?:"+n+")(?: [^>]*)?>)\\s*","gi"),"$1"),e=e.replace(/\s*\n/gi,"\n"),e=e.replace(new RegExp("(?(?:"+n+")[^>]*>)\\s*","gi"),"$1"),e=e.replace(/(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi,"$1"),e=e.replace(/(?:|)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|)*/gi,"[caption$1[/caption]"),e=e.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g,function(e,p,r){return r.match(/]*)?>/)?e:p+""+r+""}),p&&(e=e.replace(//g,"\n")),r&&(e=e.replace(/]*)>/g,"")),e}}(); window.wp=window.wp||{},function(){wp.saveText=function(e){if(null==e||!e.trim())return"";var n,p,r=!1,c=!1;return(-1!==e.indexOf("]*>[\s\S]+?<\/\1>/g,function(e){return e=e.replace(/(\r\n|\n)?/g,""),e=e.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,""),e.replace(/\r?\n/g,"")})),-1!==e.indexOf("[caption")&&(c=!0,e=e.replace(/\[caption[\s\S]+?\[\/caption\]/g,function(e){return e.replace(/]*)>/g,"").replace(/[\r\n\t]+/,"")})),n="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset",e=e.replace(new RegExp("\\s*("+n+")>\\s*","g"),"$1>\n"),e=e.replace(new RegExp("\\s*<((?:"+n+")(?: [^>]*)?)>","g"),"\n<$1>"),e=e.replace(/(]+>.*?)<\/p>/g,"$1"),e=e.replace(/]*)?>\s*/gi,"\n\n"),e=e.replace(/\s*/gi,""),e=e.replace(/\s*<\/p>\s*/gi,"\n\n"),e=e.replace(/\n[\s\u00a0]+\n/g,"\n\n"),e=e.replace(/\s*\s*/gi,"\n"),e=e.replace(/\s*\s*/g,"\n"),e=e.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n"),e=e.replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption"),p="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset",e=e.replace(new RegExp("\\s*<((?:"+p+")(?: [^>]*)?)\\s*>","g"),"\n<$1>"),e=e.replace(new RegExp("\\s*("+p+")>\\s*","g"),"$1>\n"),e=e.replace(/]*)>/g," "),-1!==e.indexOf("/g,"\n")),-1!==e.indexOf("]*)?>\s*/g,"\n\n\n\n")),-1!==e.indexOf("/g,function(e){return e.replace(/[\r\n]+/g,"")})),e=e.replace(/<\/p#>/g,"\n"),e=e.replace(/\s*(]+>[\s\S]*?<\/p>)/g,"\n$1"),e=e.replace(/^\s+/,""),e=e.replace(/[\s\u00a0]+$/,""),r&&(e=e.replace(//g,"\n")),c&&(e=e.replace(/]*)>/g,"")),e}}(); !function(e,t){"function"==typeof define&&define.amd?define(e):"undefined"!=typeof module&&"object"==typeof exports?module.exports=e():t.rangy=e()}(function(){function e(e,t){var n=typeof e[t];return n==v||!(n!=R||!e[t])||"unknown"==n}function t(e,t){return!(typeof e[t]!=R||!e[t])}function n(e,t){return typeof e[t]!=C}function r(e){return function(t,n){for(var r=n.length;r--;)if(!e(t,n[r]))return!1;return!0}}function o(e){return e&&w(e,y)&&T(e,S)}function i(e){return t(e,"body")?e.body:e.getElementsByTagName("body")[0]}function a(t){typeof console!=C&&e(console,"log")&&console.log(t)}function s(e,t){x&&t?alert(e):a(e)}function c(e){b.initialized=!0,b.supported=!1,s("Rangy is not supported in this environment. Reason: "+e,b.config.alertOnFail)}function f(e){s("Rangy warning: "+e,b.config.alertOnWarn)}function d(e){return e.message||e.description||String(e)}function u(){if(x&&!b.initialized){var t,n=!1,r=!1;e(document,"createRange")&&(t=document.createRange(),w(t,E)&&T(t,N)&&(n=!0));var s=i(document);if(!s||"body"!=s.nodeName.toLowerCase())return void c("No body element found");if(s&&e(s,"createTextRange")&&(t=s.createTextRange(),o(t)&&(r=!0)),!n&&!r)return void c("Neither Range nor TextRange are available");b.initialized=!0,b.features={implementsDomRange:n,implementsTextRange:r};var f,u;for(var l in D)(f=D[l])instanceof h&&f.init(f,b);for(var g=0,p=B.length;p>g;++g)try{B[g](b)}catch(m){u="Rangy init listener threw an exception. Continuing. Detail: "+d(m),a(u)}}}function l(e){e=e||window,u();for(var t=0,n=H.length;n>t;++t)H[t](e)}function h(e,t,n){this.name=e,this.dependencies=t,this.initialized=!1,this.supported=!1,this.initializer=n}function g(e,t,n){var r=new h(e,t,function(t){if(!t.initialized){t.initialized=!0;try{n(b,t),t.supported=!0}catch(r){var o="Module '"+e+"' failed to load: "+d(r);a(o),r.stack&&a(r.stack)}}});return D[e]=r,r}function p(){}function m(){}var R="object",v="function",C="undefined",N=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],E=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],S=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],y=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],w=r(e),O=r(t),T=r(n),_=[].forEach?function(e,t){e.forEach(t)}:function(e,t){for(var n=0,r=e.length;r>n;++n)t(e[n],n)},D={},x=typeof window!=C&&typeof document!=C,A={isHostMethod:e,isHostObject:t,isHostProperty:n,areHostMethods:w,areHostObjects:O,areHostProperties:T,isTextRange:o,getBody:i,forEach:_},b={version:"1.3.0-beta.2",initialized:!1,isBrowser:x,supported:!0,util:A,features:{},modules:D,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==C?!0:rangyAutoInitialize}};b.fail=c,b.warn=f;var P;({}).hasOwnProperty?(A.extend=P=function(e,t,n){var r,o;for(var i in t)t.hasOwnProperty(i)&&(r=e[i],o=t[i],n&&null!==r&&"object"==typeof r&&null!==o&&"object"==typeof o&&P(r,o,!0),e[i]=o);return t.hasOwnProperty("toString")&&(e.toString=t.toString),e},A.createOptions=function(e,t){var n={};return P(n,t),e&&P(n,e),n}):c("hasOwnProperty not supported"),x||c("Rangy can only run in a browser"),function(){var e;if(x){var t=document.createElement("div");t.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(t.childNodes,0)[0].nodeType&&(e=function(e){return n.call(e,0)})}catch(r){}}e||(e=function(e){for(var t=[],n=0,r=e.length;r>n;++n)t[n]=e[n];return t}),A.toArray=e}();var I;x&&(e(document,"addEventListener")?I=function(e,t,n){e.addEventListener(t,n,!1)}:e(document,"attachEvent")?I=function(e,t,n){e.attachEvent("on"+t,n)}:c("Document does not have required addEventListener or attachEvent method"),A.addListener=I);var B=[];b.init=u,b.addInitListener=function(e){b.initialized?e(b):B.push(e)};var H=[];b.addShimListener=function(e){H.push(e)},x&&(b.shim=b.createMissingNativeApi=l),h.prototype={init:function(){for(var e,t,n=this.dependencies||[],r=0,o=n.length;o>r;++r){if(t=n[r],e=D[t],!(e&&e instanceof h))throw new Error("required module '"+t+"' not found");if(e.init(),!e.supported)throw new Error("required module '"+t+"' not supported")}this.initializer(this)},fail:function(e){throw this.initialized=!0,this.supported=!1,new Error(e)},warn:function(e){b.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){b.warn("DEPRECATED: "+e+" in module "+this.name+"is deprecated. Please use "+t+" instead")},createError:function(e){return new Error("Error in Rangy "+this.name+" module: "+e)}},b.createModule=function(e){var t,n;2==arguments.length?(t=arguments[1],n=[]):(t=arguments[2],n=arguments[1]);var r=g(e,n,t);b.initialized&&b.supported&&r.init()},b.createCoreModule=function(e,t,n){g(e,t,n)},b.RangePrototype=p,b.rangePrototype=new p,b.selectionPrototype=new m,b.createCoreModule("DomUtil",[],function(e,t){function n(e){var t;return typeof e.namespaceURI==b||null===(t=e.namespaceURI)||"http://www.w3.org/1999/xhtml"==t}function r(e){var t=e.parentNode;return 1==t.nodeType?t:null}function o(e){for(var t=0;e=e.previousSibling;)++t;return t}function i(e){switch(e.nodeType){case 7:case 10:return 0;case 3:case 8:return e.length;default:return e.childNodes.length}}function a(e,t){var n,r=[];for(n=e;n;n=n.parentNode)r.push(n);for(n=t;n;n=n.parentNode)if(M(r,n))return n;return null}function s(e,t,n){for(var r=n?t:t.parentNode;r;){if(r===e)return!0;r=r.parentNode}return!1}function c(e,t){return s(e,t,!0)}function f(e,t,n){for(var r,o=n?e:e.parentNode;o;){if(r=o.parentNode,r===t)return o;o=r}return null}function d(e){var t=e.nodeType;return 3==t||4==t||8==t}function u(e){if(!e)return!1;var t=e.nodeType;return 3==t||8==t}function l(e,t){var n=t.nextSibling,r=t.parentNode;return n?r.insertBefore(e,n):r.appendChild(e),e}function h(e,t,n){var r=e.cloneNode(!1);if(r.deleteData(0,t),e.deleteData(t,e.length-t),l(r,e),n)for(var i,a=0;i=n[a++];)i.node==e&&i.offset>t?(i.node=r,i.offset-=t):i.node==e.parentNode&&i.offset>o(e)&&++i.offset;return r}function g(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!=b)return e.ownerDocument;if(typeof e.document!=b)return e.document;if(e.parentNode)return g(e.parentNode);throw t.createError("getDocument: no document found for node")}function p(e){var n=g(e);if(typeof n.defaultView!=b)return n.defaultView;if(typeof n.parentWindow!=b)return n.parentWindow;throw t.createError("Cannot get a window object for node")}function m(e){if(typeof e.contentDocument!=b)return e.contentDocument;if(typeof e.contentWindow!=b)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function R(e){if(typeof e.contentWindow!=b)return e.contentWindow;if(typeof e.contentDocument!=b)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")}function v(e){return e&&P.isHostMethod(e,"setTimeout")&&P.isHostObject(e,"document")}function C(e,t,n){var r;if(e?P.isHostProperty(e,"nodeType")?r=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?m(e):g(e):v(e)&&(r=e.document):r=document,!r)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return r}function N(e){for(var t;t=e.parentNode;)e=t;return e}function E(e,n,r,i){var s,c,d,u,l;if(e==r)return n===i?0:i>n?-1:1;if(s=f(r,e,!0))return n<=o(s)?-1:1;if(s=f(e,r,!0))return o(s)[index:"+o(e)+",length:"+e.childNodes.length+"]["+(e.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return e.nodeName}function w(e){for(var t,n=g(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n}function O(e,t,n){var r=I(e),o=e.createElement("div");o.contentEditable=""+!!n,t&&(o.innerHTML=t);var i=r.firstChild;return i?r.insertBefore(o,i):r.appendChild(o),o}function T(e){return e.parentNode.removeChild(e)}function _(e){this.root=e,this._next=e}function D(e){return new _(e)}function x(e,t){this.node=e,this.offset=t}function A(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}var b="undefined",P=e.util,I=P.getBody;P.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),P.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var B=document.createElement("div");P.areHostMethods(B,["insertBefore","appendChild","cloneNode"]||!P.areHostObjects(B,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),P.isHostProperty(B,"innerHTML")||t.fail("Element is missing innerHTML property");var H=document.createTextNode("test");P.areHostMethods(H,["splitText","deleteData","insertData","appendData","cloneNode"]||!P.areHostObjects(B,["previousSibling","nextSibling","childNodes","parentNode"])||!P.areHostProperties(H,["data"]))||t.fail("Incomplete Text Node implementation");var M=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1},k=!1;!function(){var t=document.createElement("b");t.innerHTML="1";var n=t.firstChild;t.innerHTML="",k=S(n),e.features.crashyTextNodes=k}();var L;typeof window.getComputedStyle!=b?L=function(e,t){return p(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!=b?L=function(e,t){return e.currentStyle[t]}:t.fail("No means of obtaining computed style properties found"),_.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},x.prototype={equals:function(e){return!!e&&this.node===e.node&&this.offset==e.offset},inspect:function(){return"[DomPosition("+y(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},A.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},A.prototype.toString=function(){return this.message},e.dom={arrayContains:M,isHtmlNamespace:n,parentElement:r,getNodeIndex:o,getNodeLength:i,getCommonAncestor:a,isAncestorOf:s,isOrIsAncestorOf:c,getClosestAncestorIn:f,isCharacterDataNode:d,isTextOrCommentNode:u,insertAfter:l,splitDataNode:h,getDocument:g,getWindow:p,getIframeWindow:R,getIframeDocument:m,getBody:I,isWindow:v,getContentDocument:C,getRootContainer:N,comparePoints:E,isBrokenNode:S,inspectNode:y,getComputedStyleProperty:L,createTestElement:O,removeNode:T,fragmentFromNodeChildren:w,createIterator:D,DomPosition:x},e.DOMException=A}),b.createCoreModule("DomRange",["DomUtil"],function(e){function t(e,t){return 3!=e.nodeType&&(F(e,t.startContainer)||F(e,t.endContainer))}function n(e){return e.document||j(e.startContainer)}function r(e){return new M(e.parentNode,W(e))}function o(e){return new M(e.parentNode,W(e)+1)}function i(e,t,n){var r=11==e.nodeType?e.firstChild:e;return L(t)?n==t.length?B.insertAfter(e,t):t.parentNode.insertBefore(e,0==n?t:U(t,n)):n>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[n]),r}function a(e,t,r){if(w(e),w(t),n(t)!=n(e))throw new k("WRONG_DOCUMENT_ERR");var o=z(e.startContainer,e.startOffset,t.endContainer,t.endOffset),i=z(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return r?0>=o&&i>=0:0>o&&i>0}function s(e){for(var t,r,o,i=n(e.range).createDocumentFragment();r=e.next();){if(t=e.isPartiallySelectedSubtree(),r=r.cloneNode(!t),t&&(o=e.getSubtreeIterator(),r.appendChild(s(o)),o.detach()),10==r.nodeType)throw new k("HIERARCHY_REQUEST_ERR");i.appendChild(r)}return i}function c(e,t,n){var r,o;n=n||{stop:!1};for(var i,a;i=e.next();)if(e.isPartiallySelectedSubtree()){if(t(i)===!1)return void(n.stop=!0);if(a=e.getSubtreeIterator(),c(a,t,n),a.detach(),n.stop)return}else for(r=B.createIterator(i);o=r.next();)if(t(o)===!1)return void(n.stop=!0)}function f(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(t=e.getSubtreeIterator(),f(t),t.detach()):e.remove()}function d(e){for(var t,r,o=n(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),r=e.getSubtreeIterator(),t.appendChild(d(r)),r.detach()):e.remove(),10==t.nodeType)throw new k("HIERARCHY_REQUEST_ERR");o.appendChild(t)}return o}function u(e,t,n){var r,o=!(!t||!t.length),i=!!n;o&&(r=new RegExp("^("+t.join("|")+")$"));var a=[];return c(new h(e,!1),function(t){if(!(o&&!r.test(t.nodeType)||i&&!n(t))){var s=e.startContainer;if(t!=s||!L(s)||e.startOffset!=s.length){var c=e.endContainer;t==c&&L(c)&&0==e.endOffset||a.push(t)}}}),a}function l(e){var t="undefined"==typeof e.getName?"Range":e.getName();return"["+t+"("+B.inspectNode(e.startContainer)+":"+e.startOffset+", "+B.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function h(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&L(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||L(this.sc)?V(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||L(this.ec)?V(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}function g(e){return function(t,n){for(var r,o=n?t:t.parentNode;o;){if(r=o.nodeType,Y(e,r))return o;o=o.parentNode}return null}}function p(e,t){if(rt(e,t))throw new k("INVALID_NODE_TYPE_ERR")}function m(e,t){if(!Y(t,e.nodeType))throw new k("INVALID_NODE_TYPE_ERR")}function R(e,t){if(0>t||t>(L(e)?e.length:e.childNodes.length))throw new k("INDEX_SIZE_ERR")}function v(e,t){if(tt(e,!0)!==tt(t,!0))throw new k("WRONG_DOCUMENT_ERR")}function C(e){if(nt(e,!0))throw new k("NO_MODIFICATION_ALLOWED_ERR")}function N(e,t){if(!e)throw new k(t)}function E(e){return G&&B.isBrokenNode(e)||!Y($,e.nodeType)&&!tt(e,!0)}function S(e,t){return t<=(L(e)?e.length:e.childNodes.length)}function y(e){return!!e.startContainer&&!!e.endContainer&&!E(e.startContainer)&&!E(e.endContainer)&&S(e.startContainer,e.startOffset)&&S(e.endContainer,e.endOffset)}function w(e){if(!y(e))throw new Error("Range error: Range is no longer valid after DOM mutation ("+e.inspect()+")")}function O(e,t){w(e);var n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,a=n===o;L(o)&&i>0&&i0&&r=W(n)&&i++,r=0),e.setStartAndEnd(n,r,o,i)}function T(e){w(e);var t=e.commonAncestorContainer.parentNode.cloneNode(!1);return t.appendChild(e.cloneContents()),t.innerHTML}function _(e){e.START_TO_START=ft,e.START_TO_END=dt,e.END_TO_END=ut,e.END_TO_START=lt,e.NODE_BEFORE=ht,e.NODE_AFTER=gt,e.NODE_BEFORE_AND_AFTER=pt,e.NODE_INSIDE=mt}function D(e){_(e),_(e.prototype)}function x(e,t){return function(){w(this);var n,r,i=this.startContainer,a=this.startOffset,s=this.commonAncestorContainer,f=new h(this,!0);i!==s&&(n=V(i,s,!0),r=o(n),i=r.node,a=r.offset),c(f,C),f.reset();var d=e(f);return f.detach(),t(this,i,a,i,a),d}}function A(n,i){function a(e,t){return function(n){m(n,Z),m(Q(n),$);var i=(e?r:o)(n);(t?s:c)(this,i.node,i.offset)}}function s(e,t,n){var r=e.endContainer,o=e.endOffset;(t!==e.startContainer||n!==e.startOffset)&&((Q(t)!=Q(r)||1==z(t,n,r,o))&&(r=t,o=n),i(e,t,n,r,o))}function c(e,t,n){var r=e.startContainer,o=e.startOffset;(t!==e.endContainer||n!==e.endOffset)&&((Q(t)!=Q(r)||-1==z(t,n,r,o))&&(r=t,o=n),i(e,r,o,t,n))}var u=function(){};u.prototype=e.rangePrototype,n.prototype=new u,H.extend(n.prototype,{setStart:function(e,t){p(e,!0),R(e,t),s(this,e,t)},setEnd:function(e,t){p(e,!0),R(e,t),c(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],n=e[1],r=t,o=n;switch(e.length){case 3:o=e[2];break;case 4:r=e[2],o=e[3]}i(this,t,n,r,o)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:a(!0,!0),setStartAfter:a(!1,!0),setEndBefore:a(!0,!1),setEndAfter:a(!1,!1),collapse:function(e){w(this),e?i(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):i(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){p(e,!0),i(this,e,0,e,q(e))},selectNode:function(e){p(e,!1),m(e,Z);var t=r(e),n=o(e);i(this,t.node,t.offset,n.node,n.offset)},extractContents:x(d,i),deleteContents:x(f,i),canSurroundContents:function(){w(this),C(this.startContainer),C(this.endContainer);var e=new h(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},splitBoundaries:function(){O(this)},splitBoundariesPreservingPositions:function(e){O(this,e)},normalizeBoundaries:function(){w(this);var e=this.startContainer,t=this.startOffset,n=this.endContainer,r=this.endOffset,o=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(n=e,r=e.length,e.appendData(t.data),X(t))},a=function(o){var i=o.previousSibling;if(i&&i.nodeType==o.nodeType){e=o;var a=o.length;if(t=i.length,o.insertData(0,i.data),X(i),e==n)r+=t,n=e;else if(n==o.parentNode){var s=W(o);r==s?(n=o,r=a):r>s&&r--}}},s=!0;if(L(n))n.length==r&&o(n);else{if(r>0){var c=n.childNodes[r-1];c&&L(c)&&o(c)}s=!this.collapsed}if(s){if(L(e))0==t&&a(e);else if(tx",it=3==ot.firstChild.nodeType}catch(at){}e.features.htmlParsingConforms=it;var st=it?function(e){var t=this.startContainer,n=j(t);if(!t)throw new k("INVALID_STATE_ERR");var r=null;return 1==t.nodeType?r=t:L(t)&&(r=B.parentElement(t)),r=null===r||"HTML"==r.nodeName&&B.isHtmlNamespace(j(r).documentElement)&&B.isHtmlNamespace(r)?n.createElement("body"):r.cloneNode(!1),r.innerHTML=e,B.fragmentFromNodeChildren(r)}:function(e){var t=n(this),r=t.createElement("body");return r.innerHTML=e,B.fragmentFromNodeChildren(r)},ct=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ft=0,dt=1,ut=2,lt=3,ht=0,gt=1,pt=2,mt=3;H.extend(e.rangePrototype,{compareBoundaryPoints:function(e,t){w(this),v(this.startContainer,t.startContainer);var n,r,o,i,a=e==lt||e==ft?"start":"end",s=e==dt||e==ft?"start":"end";return n=this[a+"Container"],r=this[a+"Offset"],o=t[s+"Container"],i=t[s+"Offset"],z(n,r,o,i)},insertNode:function(e){if(w(this),m(e,K),C(this.startContainer),F(e,this.startContainer))throw new k("HIERARCHY_REQUEST_ERR");var t=i(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){w(this);var e,t;if(this.collapsed)return n(this).createDocumentFragment();if(this.startContainer===this.endContainer&&L(this.startContainer))return e=this.startContainer.cloneNode(!0),e.data=e.data.slice(this.startOffset,this.endOffset),t=n(this).createDocumentFragment(),t.appendChild(e),t;var r=new h(this,!0);return e=s(r),r.detach(),e},canSurroundContents:function(){w(this),C(this.startContainer),C(this.endContainer);var e=new h(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},surroundContents:function(e){if(m(e,et),!this.canSurroundContents())throw new k("INVALID_STATE_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);i(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){w(this);for(var e,t=new I(n(this)),r=ct.length;r--;)e=ct[r],t[e]=this[e];return t},toString:function(){w(this);var e=this.startContainer;if(e===this.endContainer&&L(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new h(this,!0);return c(n,function(e){(3==e.nodeType||4==e.nodeType)&&t.push(e.data)}),n.detach(),t.join("")},compareNode:function(e){w(this);var t=e.parentNode,n=W(e);if(!t)throw new k("NOT_FOUND_ERR");var r=this.comparePoint(t,n),o=this.comparePoint(t,n+1);return 0>r?o>0?pt:ht:o>0?gt:mt},comparePoint:function(e,t){return w(this),N(e,"HIERARCHY_REQUEST_ERR"),v(e,this.startContainer),z(e,t,this.startContainer,this.startOffset)<0?-1:z(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:st,toHtml:function(){return T(this)},intersectsNode:function(e,t){if(w(this),N(e,"NOT_FOUND_ERR"),j(e)!==n(this))return!1;var r=e.parentNode,o=W(e);N(r,"NOT_FOUND_ERR");var i=z(r,o,this.endContainer,this.endOffset),a=z(r,o+1,this.startContainer,this.startOffset);return t?0>=i&&a>=0:0>i&&a>0},isPointInRange:function(e,t){return w(this),N(e,"HIERARCHY_REQUEST_ERR"),v(e,this.startContainer),z(e,t,this.startContainer,this.startOffset)>=0&&z(e,t,this.endContainer,this.endOffset)<=0},intersectsRange:function(e){return a(this,e,!1)},intersectsOrTouchesRange:function(e){return a(this,e,!0)},intersection:function(e){if(this.intersectsRange(e)){var t=z(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=z(this.endContainer,this.endOffset,e.endContainer,e.endOffset),r=this.cloneRange();return-1==t&&r.setStart(e.startContainer,e.startOffset),1==n&&r.setEnd(e.endContainer,e.endOffset),r}return null},union:function(e){if(this.intersectsOrTouchesRange(e)){var t=this.cloneRange();return-1==z(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==z(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new k("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==mt},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&this.comparePoint(e,q(e))<=0},containsRange:function(e){var t=this.intersection(e);return null!==t&&e.equals(t)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var r=n.pop();return t.setEnd(r,r.length),this.containsRange(t)}return this.containsNodeContents(e)},getNodes:function(e,t){return w(this),u(this,e,t)},getDocument:function(){return n(this)},collapseBefore:function(e){this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){this.setStartAfter(e),this.collapse(!0)},getBookmark:function(t){var r=n(this),o=e.createRange(r);t=t||B.getBody(r),o.selectNodeContents(t);var i=this.intersection(o),a=0,s=0;return i&&(o.setEnd(i.startContainer,i.startOffset),a=o.toString().length,s=a+i.toString().length),{start:a,end:s,containerNode:t}},moveToBookmark:function(e){var t=e.containerNode,n=0;this.setStart(t,0),this.collapse(!0);for(var r,o,i,a,s=[t],c=!1,f=!1;!f&&(r=s.pop());)if(3==r.nodeType)o=n+r.length,!c&&e.start>=n&&e.start<=o&&(this.setStart(r,e.start-n),c=!0),c&&e.end>=n&&e.end<=o&&(this.setEnd(r,e.end-n),f=!0),n=o;else for(a=r.childNodes,i=a.length;i--;)s.push(a[i])},getName:function(){return"DomRange"},equals:function(e){return I.rangesEqual(this,e)},isValid:function(){return y(this)},inspect:function(){return l(this)},detach:function(){}}),A(I,P),H.extend(I,{rangeProperties:ct,RangeIterator:h,copyComparisonConstants:D,createPrototypeRange:A,inspect:l,toHtml:T,getRangeDocument:n,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=I}),b.createCoreModule("WrappedRange",["DomRange"],function(e,t){var n,r,o=e.dom,i=e.util,a=o.DomPosition,s=e.DomRange,c=o.getBody,f=o.getContentDocument,d=o.isCharacterDataNode;if(e.features.implementsDomRange&&!function(){function r(e){for(var t,n=l.length;n--;)t=l[n],e[t]=e.nativeRange[t];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}function a(e,t,n,r,o){var i=e.startContainer!==t||e.startOffset!=n,a=e.endContainer!==r||e.endOffset!=o,s=!e.equals(e.nativeRange);(i||a||s)&&(e.setEnd(r,o),e.setStart(t,n))}var d,u,l=s.rangeProperties;n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,r(this)},s.createPrototypeRange(n,a),d=n.prototype,d.selectNode=function(e){this.nativeRange.selectNode(e),r(this)},d.cloneContents=function(){return this.nativeRange.cloneContents()},d.surroundContents=function(e){this.nativeRange.surroundContents(e),r(this)},d.collapse=function(e){this.nativeRange.collapse(e),r(this)},d.cloneRange=function(){return new n(this.nativeRange.cloneRange())},d.refresh=function(){r(this)},d.toString=function(){return this.nativeRange.toString()};var h=document.createTextNode("test");c(document).appendChild(h);var g=document.createRange();g.setStart(h,0),g.setEnd(h,0);try{g.setStart(h,1),d.setStart=function(e,t){this.nativeRange.setStart(e,t),r(this)},d.setEnd=function(e,t){this.nativeRange.setEnd(e,t),r(this)},u=function(e){return function(t){this.nativeRange[e](t),r(this)}}}catch(p){d.setStart=function(e,t){try{this.nativeRange.setStart(e,t)}catch(n){this.nativeRange.setEnd(e,t),this.nativeRange.setStart(e,t)}r(this)},d.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}r(this)},u=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(o){this.nativeRange[t](n),this.nativeRange[e](n)}r(this)}}}d.setStartBefore=u("setStartBefore","setEndBefore"),d.setStartAfter=u("setStartAfter","setEndAfter"),d.setEndBefore=u("setEndBefore","setStartBefore"),d.setEndAfter=u("setEndAfter","setStartAfter"),d.selectNodeContents=function(e){this.setStartAndEnd(e,0,o.getNodeLength(e))},g.selectNodeContents(h),g.setEnd(h,3);var m=document.createRange();m.selectNodeContents(h),m.setEnd(h,4),m.setStart(h,2),d.compareBoundaryPoints=-1==g.compareBoundaryPoints(g.START_TO_END,m)&&1==g.compareBoundaryPoints(g.END_TO_START,m)?function(e,t){return t=t.nativeRange||t,e==t.START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)};var R=document.createElement("div");R.innerHTML="123";var v=R.firstChild,C=c(document);C.appendChild(R),g.setStart(v,1),g.setEnd(v,2),g.deleteContents(),"13"==v.data&&(d.deleteContents=function(){this.nativeRange.deleteContents(),r(this)},d.extractContents=function(){var e=this.nativeRange.extractContents();return r(this),e}),C.removeChild(R),C=null,i.isHostMethod(g,"createContextualFragment")&&(d.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),c(document).removeChild(h),d.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return e=f(e,t,"createNativeRange"),e.createRange()}}(),e.features.implementsTextRange){var u=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var r=n.parentElement();n=e.duplicate(),n.collapse(!1);var i=n.parentElement(),a=r==i?r:o.getCommonAncestor(r,i);return a==t?a:o.getCommonAncestor(t,a)},l=function(e){return 0==e.compareEndPoints("StartToEnd",e)},h=function(e,t,n,r,i){var s=e.duplicate();s.collapse(n);var c=s.parentElement();if(o.isOrIsAncestorOf(t,c)||(c=t),!c.canHaveHTML){var f=new a(c.parentNode,o.getNodeIndex(c));return{boundaryPosition:f,nodeInfo:{nodeIndex:f.offset,containerElement:f.node}}}var u=o.getDocument(c).createElement("span");u.parentNode&&o.removeNode(u);for(var l,h,g,p,m,R=n?"StartToStart":"StartToEnd",v=i&&i.containerElement==c?i.nodeIndex:0,C=c.childNodes.length,N=C,E=N;;){if(E==C?c.appendChild(u):c.insertBefore(u,c.childNodes[E]),s.moveToElementText(u),l=s.compareEndPoints(R,e),0==l||v==N)break;if(-1==l){if(N==v+1)break;v=E}else N=N==v+1?v:E;E=Math.floor((v+N)/2),c.removeChild(u)}if(m=u.nextSibling,-1==l&&m&&d(m)){s.setEndPoint(n?"EndToStart":"EndToEnd",e);var S;if(/[\r\n]/.test(m.data)){var y=s.duplicate(),w=y.text.replace(/\r\n/g,"\r").length;for(S=y.moveStart("character",w);-1==(l=y.compareEndPoints("StartToEnd",y));)S++,y.moveStart("character",1)}else S=s.text.length;p=new a(m,S)}else h=(r||!n)&&u.previousSibling,g=(r||n)&&u.nextSibling,p=g&&d(g)?new a(g,0):h&&d(h)?new a(h,h.data.length):new a(c,o.getNodeIndex(u));return o.removeNode(u),{boundaryPosition:p,nodeInfo:{nodeIndex:E,containerElement:c}}},g=function(e,t){var n,r,i,a,s=e.offset,f=o.getDocument(e.node),u=c(f).createTextRange(),l=d(e.node);return l?(n=e.node,r=n.parentNode):(a=e.node.childNodes,n=s diff --git a/Leanote/editor/EditorAssets/editor.min.html b/Leanote/editor/EditorAssets/editor.min.html index e81c052..faec0ff 100755 --- a/Leanote/editor/EditorAssets/editor.min.html +++ b/Leanote/editor/EditorAssets/editor.min.html @@ -41,5 +41,11 @@ // $(document).ready(function() { ZSSEditor.init(callbacker, logger); + + if (/ipad/.test(location)) { + ZSSEditor.getField('zss_field_title').setHTML("你好啊 hello world"); + ZSSEditor.getField('zss_field_content').setHTML("你好 hello world"); + $('body').addClass('ipad-body'); + } });
$1
\s*?<\/p>/gi,""),e=e.replace(new RegExp("
\\s*(?(?:"+n+")(?: [^>]*)?>)\\s*
(
\s*
]*)>/gi,""),e=e.replace(/<\/blockquote>\s*<\/p>/gi,""),e=e.replace(new RegExp("\\s*(?(?:"+n+")(?: [^>]*)?>)","gi"),"$1"),e=e.replace(new RegExp("(?(?:"+n+")(?: [^>]*)?>)\\s*","gi"),"$1"),e=e.replace(/\s*\n/gi,"\n"),e=e.replace(new RegExp("(?(?:"+n+")[^>]*>)\\s*","gi"),"$1"),e=e.replace(/(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi,"$1"),e=e.replace(/(?:|)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|)*/gi,"[caption$1[/caption]"),e=e.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g,function(e,p,r){return r.match(/]*)?>/)?e:p+""+r+""}),p&&(e=e.replace(//g,"\n")),r&&(e=e.replace(/]*)>/g,"")),e}}(); window.wp=window.wp||{},function(){wp.saveText=function(e){if(null==e||!e.trim())return"";var n,p,r=!1,c=!1;return(-1!==e.indexOf("]*>[\s\S]+?<\/\1>/g,function(e){return e=e.replace(/(\r\n|\n)?/g,""),e=e.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,""),e.replace(/\r?\n/g,"")})),-1!==e.indexOf("[caption")&&(c=!0,e=e.replace(/\[caption[\s\S]+?\[\/caption\]/g,function(e){return e.replace(/]*)>/g,"").replace(/[\r\n\t]+/,"")})),n="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset",e=e.replace(new RegExp("\\s*("+n+")>\\s*","g"),"$1>\n"),e=e.replace(new RegExp("\\s*<((?:"+n+")(?: [^>]*)?)>","g"),"\n<$1>"),e=e.replace(/(]+>.*?)<\/p>/g,"$1"),e=e.replace(/]*)?>\s*/gi,"\n\n"),e=e.replace(/\s*/gi,""),e=e.replace(/\s*<\/p>\s*/gi,"\n\n"),e=e.replace(/\n[\s\u00a0]+\n/g,"\n\n"),e=e.replace(/\s*\s*/gi,"\n"),e=e.replace(/\s*\s*/g,"\n"),e=e.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n"),e=e.replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption"),p="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset",e=e.replace(new RegExp("\\s*<((?:"+p+")(?: [^>]*)?)\\s*>","g"),"\n<$1>"),e=e.replace(new RegExp("\\s*("+p+")>\\s*","g"),"$1>\n"),e=e.replace(/]*)>/g," "),-1!==e.indexOf("/g,"\n")),-1!==e.indexOf("]*)?>\s*/g,"\n\n\n\n")),-1!==e.indexOf("/g,function(e){return e.replace(/[\r\n]+/g,"")})),e=e.replace(/<\/p#>/g,"\n"),e=e.replace(/\s*(]+>[\s\S]*?<\/p>)/g,"\n$1"),e=e.replace(/^\s+/,""),e=e.replace(/[\s\u00a0]+$/,""),r&&(e=e.replace(//g,"\n")),c&&(e=e.replace(/]*)>/g,"")),e}}(); !function(e,t){"function"==typeof define&&define.amd?define(e):"undefined"!=typeof module&&"object"==typeof exports?module.exports=e():t.rangy=e()}(function(){function e(e,t){var n=typeof e[t];return n==v||!(n!=R||!e[t])||"unknown"==n}function t(e,t){return!(typeof e[t]!=R||!e[t])}function n(e,t){return typeof e[t]!=C}function r(e){return function(t,n){for(var r=n.length;r--;)if(!e(t,n[r]))return!1;return!0}}function o(e){return e&&w(e,y)&&T(e,S)}function i(e){return t(e,"body")?e.body:e.getElementsByTagName("body")[0]}function a(t){typeof console!=C&&e(console,"log")&&console.log(t)}function s(e,t){x&&t?alert(e):a(e)}function c(e){b.initialized=!0,b.supported=!1,s("Rangy is not supported in this environment. Reason: "+e,b.config.alertOnFail)}function f(e){s("Rangy warning: "+e,b.config.alertOnWarn)}function d(e){return e.message||e.description||String(e)}function u(){if(x&&!b.initialized){var t,n=!1,r=!1;e(document,"createRange")&&(t=document.createRange(),w(t,E)&&T(t,N)&&(n=!0));var s=i(document);if(!s||"body"!=s.nodeName.toLowerCase())return void c("No body element found");if(s&&e(s,"createTextRange")&&(t=s.createTextRange(),o(t)&&(r=!0)),!n&&!r)return void c("Neither Range nor TextRange are available");b.initialized=!0,b.features={implementsDomRange:n,implementsTextRange:r};var f,u;for(var l in D)(f=D[l])instanceof h&&f.init(f,b);for(var g=0,p=B.length;p>g;++g)try{B[g](b)}catch(m){u="Rangy init listener threw an exception. Continuing. Detail: "+d(m),a(u)}}}function l(e){e=e||window,u();for(var t=0,n=H.length;n>t;++t)H[t](e)}function h(e,t,n){this.name=e,this.dependencies=t,this.initialized=!1,this.supported=!1,this.initializer=n}function g(e,t,n){var r=new h(e,t,function(t){if(!t.initialized){t.initialized=!0;try{n(b,t),t.supported=!0}catch(r){var o="Module '"+e+"' failed to load: "+d(r);a(o),r.stack&&a(r.stack)}}});return D[e]=r,r}function p(){}function m(){}var R="object",v="function",C="undefined",N=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],E=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],S=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],y=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],w=r(e),O=r(t),T=r(n),_=[].forEach?function(e,t){e.forEach(t)}:function(e,t){for(var n=0,r=e.length;r>n;++n)t(e[n],n)},D={},x=typeof window!=C&&typeof document!=C,A={isHostMethod:e,isHostObject:t,isHostProperty:n,areHostMethods:w,areHostObjects:O,areHostProperties:T,isTextRange:o,getBody:i,forEach:_},b={version:"1.3.0-beta.2",initialized:!1,isBrowser:x,supported:!0,util:A,features:{},modules:D,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==C?!0:rangyAutoInitialize}};b.fail=c,b.warn=f;var P;({}).hasOwnProperty?(A.extend=P=function(e,t,n){var r,o;for(var i in t)t.hasOwnProperty(i)&&(r=e[i],o=t[i],n&&null!==r&&"object"==typeof r&&null!==o&&"object"==typeof o&&P(r,o,!0),e[i]=o);return t.hasOwnProperty("toString")&&(e.toString=t.toString),e},A.createOptions=function(e,t){var n={};return P(n,t),e&&P(n,e),n}):c("hasOwnProperty not supported"),x||c("Rangy can only run in a browser"),function(){var e;if(x){var t=document.createElement("div");t.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(t.childNodes,0)[0].nodeType&&(e=function(e){return n.call(e,0)})}catch(r){}}e||(e=function(e){for(var t=[],n=0,r=e.length;r>n;++n)t[n]=e[n];return t}),A.toArray=e}();var I;x&&(e(document,"addEventListener")?I=function(e,t,n){e.addEventListener(t,n,!1)}:e(document,"attachEvent")?I=function(e,t,n){e.attachEvent("on"+t,n)}:c("Document does not have required addEventListener or attachEvent method"),A.addListener=I);var B=[];b.init=u,b.addInitListener=function(e){b.initialized?e(b):B.push(e)};var H=[];b.addShimListener=function(e){H.push(e)},x&&(b.shim=b.createMissingNativeApi=l),h.prototype={init:function(){for(var e,t,n=this.dependencies||[],r=0,o=n.length;o>r;++r){if(t=n[r],e=D[t],!(e&&e instanceof h))throw new Error("required module '"+t+"' not found");if(e.init(),!e.supported)throw new Error("required module '"+t+"' not supported")}this.initializer(this)},fail:function(e){throw this.initialized=!0,this.supported=!1,new Error(e)},warn:function(e){b.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){b.warn("DEPRECATED: "+e+" in module "+this.name+"is deprecated. Please use "+t+" instead")},createError:function(e){return new Error("Error in Rangy "+this.name+" module: "+e)}},b.createModule=function(e){var t,n;2==arguments.length?(t=arguments[1],n=[]):(t=arguments[2],n=arguments[1]);var r=g(e,n,t);b.initialized&&b.supported&&r.init()},b.createCoreModule=function(e,t,n){g(e,t,n)},b.RangePrototype=p,b.rangePrototype=new p,b.selectionPrototype=new m,b.createCoreModule("DomUtil",[],function(e,t){function n(e){var t;return typeof e.namespaceURI==b||null===(t=e.namespaceURI)||"http://www.w3.org/1999/xhtml"==t}function r(e){var t=e.parentNode;return 1==t.nodeType?t:null}function o(e){for(var t=0;e=e.previousSibling;)++t;return t}function i(e){switch(e.nodeType){case 7:case 10:return 0;case 3:case 8:return e.length;default:return e.childNodes.length}}function a(e,t){var n,r=[];for(n=e;n;n=n.parentNode)r.push(n);for(n=t;n;n=n.parentNode)if(M(r,n))return n;return null}function s(e,t,n){for(var r=n?t:t.parentNode;r;){if(r===e)return!0;r=r.parentNode}return!1}function c(e,t){return s(e,t,!0)}function f(e,t,n){for(var r,o=n?e:e.parentNode;o;){if(r=o.parentNode,r===t)return o;o=r}return null}function d(e){var t=e.nodeType;return 3==t||4==t||8==t}function u(e){if(!e)return!1;var t=e.nodeType;return 3==t||8==t}function l(e,t){var n=t.nextSibling,r=t.parentNode;return n?r.insertBefore(e,n):r.appendChild(e),e}function h(e,t,n){var r=e.cloneNode(!1);if(r.deleteData(0,t),e.deleteData(t,e.length-t),l(r,e),n)for(var i,a=0;i=n[a++];)i.node==e&&i.offset>t?(i.node=r,i.offset-=t):i.node==e.parentNode&&i.offset>o(e)&&++i.offset;return r}function g(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!=b)return e.ownerDocument;if(typeof e.document!=b)return e.document;if(e.parentNode)return g(e.parentNode);throw t.createError("getDocument: no document found for node")}function p(e){var n=g(e);if(typeof n.defaultView!=b)return n.defaultView;if(typeof n.parentWindow!=b)return n.parentWindow;throw t.createError("Cannot get a window object for node")}function m(e){if(typeof e.contentDocument!=b)return e.contentDocument;if(typeof e.contentWindow!=b)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function R(e){if(typeof e.contentWindow!=b)return e.contentWindow;if(typeof e.contentDocument!=b)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")}function v(e){return e&&P.isHostMethod(e,"setTimeout")&&P.isHostObject(e,"document")}function C(e,t,n){var r;if(e?P.isHostProperty(e,"nodeType")?r=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?m(e):g(e):v(e)&&(r=e.document):r=document,!r)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return r}function N(e){for(var t;t=e.parentNode;)e=t;return e}function E(e,n,r,i){var s,c,d,u,l;if(e==r)return n===i?0:i>n?-1:1;if(s=f(r,e,!0))return n<=o(s)?-1:1;if(s=f(e,r,!0))return o(s)[index:"+o(e)+",length:"+e.childNodes.length+"]["+(e.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return e.nodeName}function w(e){for(var t,n=g(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n}function O(e,t,n){var r=I(e),o=e.createElement("div");o.contentEditable=""+!!n,t&&(o.innerHTML=t);var i=r.firstChild;return i?r.insertBefore(o,i):r.appendChild(o),o}function T(e){return e.parentNode.removeChild(e)}function _(e){this.root=e,this._next=e}function D(e){return new _(e)}function x(e,t){this.node=e,this.offset=t}function A(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}var b="undefined",P=e.util,I=P.getBody;P.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),P.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var B=document.createElement("div");P.areHostMethods(B,["insertBefore","appendChild","cloneNode"]||!P.areHostObjects(B,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),P.isHostProperty(B,"innerHTML")||t.fail("Element is missing innerHTML property");var H=document.createTextNode("test");P.areHostMethods(H,["splitText","deleteData","insertData","appendData","cloneNode"]||!P.areHostObjects(B,["previousSibling","nextSibling","childNodes","parentNode"])||!P.areHostProperties(H,["data"]))||t.fail("Incomplete Text Node implementation");var M=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1},k=!1;!function(){var t=document.createElement("b");t.innerHTML="1";var n=t.firstChild;t.innerHTML="",k=S(n),e.features.crashyTextNodes=k}();var L;typeof window.getComputedStyle!=b?L=function(e,t){return p(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!=b?L=function(e,t){return e.currentStyle[t]}:t.fail("No means of obtaining computed style properties found"),_.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},x.prototype={equals:function(e){return!!e&&this.node===e.node&&this.offset==e.offset},inspect:function(){return"[DomPosition("+y(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},A.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},A.prototype.toString=function(){return this.message},e.dom={arrayContains:M,isHtmlNamespace:n,parentElement:r,getNodeIndex:o,getNodeLength:i,getCommonAncestor:a,isAncestorOf:s,isOrIsAncestorOf:c,getClosestAncestorIn:f,isCharacterDataNode:d,isTextOrCommentNode:u,insertAfter:l,splitDataNode:h,getDocument:g,getWindow:p,getIframeWindow:R,getIframeDocument:m,getBody:I,isWindow:v,getContentDocument:C,getRootContainer:N,comparePoints:E,isBrokenNode:S,inspectNode:y,getComputedStyleProperty:L,createTestElement:O,removeNode:T,fragmentFromNodeChildren:w,createIterator:D,DomPosition:x},e.DOMException=A}),b.createCoreModule("DomRange",["DomUtil"],function(e){function t(e,t){return 3!=e.nodeType&&(F(e,t.startContainer)||F(e,t.endContainer))}function n(e){return e.document||j(e.startContainer)}function r(e){return new M(e.parentNode,W(e))}function o(e){return new M(e.parentNode,W(e)+1)}function i(e,t,n){var r=11==e.nodeType?e.firstChild:e;return L(t)?n==t.length?B.insertAfter(e,t):t.parentNode.insertBefore(e,0==n?t:U(t,n)):n>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[n]),r}function a(e,t,r){if(w(e),w(t),n(t)!=n(e))throw new k("WRONG_DOCUMENT_ERR");var o=z(e.startContainer,e.startOffset,t.endContainer,t.endOffset),i=z(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return r?0>=o&&i>=0:0>o&&i>0}function s(e){for(var t,r,o,i=n(e.range).createDocumentFragment();r=e.next();){if(t=e.isPartiallySelectedSubtree(),r=r.cloneNode(!t),t&&(o=e.getSubtreeIterator(),r.appendChild(s(o)),o.detach()),10==r.nodeType)throw new k("HIERARCHY_REQUEST_ERR");i.appendChild(r)}return i}function c(e,t,n){var r,o;n=n||{stop:!1};for(var i,a;i=e.next();)if(e.isPartiallySelectedSubtree()){if(t(i)===!1)return void(n.stop=!0);if(a=e.getSubtreeIterator(),c(a,t,n),a.detach(),n.stop)return}else for(r=B.createIterator(i);o=r.next();)if(t(o)===!1)return void(n.stop=!0)}function f(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(t=e.getSubtreeIterator(),f(t),t.detach()):e.remove()}function d(e){for(var t,r,o=n(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),r=e.getSubtreeIterator(),t.appendChild(d(r)),r.detach()):e.remove(),10==t.nodeType)throw new k("HIERARCHY_REQUEST_ERR");o.appendChild(t)}return o}function u(e,t,n){var r,o=!(!t||!t.length),i=!!n;o&&(r=new RegExp("^("+t.join("|")+")$"));var a=[];return c(new h(e,!1),function(t){if(!(o&&!r.test(t.nodeType)||i&&!n(t))){var s=e.startContainer;if(t!=s||!L(s)||e.startOffset!=s.length){var c=e.endContainer;t==c&&L(c)&&0==e.endOffset||a.push(t)}}}),a}function l(e){var t="undefined"==typeof e.getName?"Range":e.getName();return"["+t+"("+B.inspectNode(e.startContainer)+":"+e.startOffset+", "+B.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function h(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&L(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||L(this.sc)?V(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||L(this.ec)?V(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}function g(e){return function(t,n){for(var r,o=n?t:t.parentNode;o;){if(r=o.nodeType,Y(e,r))return o;o=o.parentNode}return null}}function p(e,t){if(rt(e,t))throw new k("INVALID_NODE_TYPE_ERR")}function m(e,t){if(!Y(t,e.nodeType))throw new k("INVALID_NODE_TYPE_ERR")}function R(e,t){if(0>t||t>(L(e)?e.length:e.childNodes.length))throw new k("INDEX_SIZE_ERR")}function v(e,t){if(tt(e,!0)!==tt(t,!0))throw new k("WRONG_DOCUMENT_ERR")}function C(e){if(nt(e,!0))throw new k("NO_MODIFICATION_ALLOWED_ERR")}function N(e,t){if(!e)throw new k(t)}function E(e){return G&&B.isBrokenNode(e)||!Y($,e.nodeType)&&!tt(e,!0)}function S(e,t){return t<=(L(e)?e.length:e.childNodes.length)}function y(e){return!!e.startContainer&&!!e.endContainer&&!E(e.startContainer)&&!E(e.endContainer)&&S(e.startContainer,e.startOffset)&&S(e.endContainer,e.endOffset)}function w(e){if(!y(e))throw new Error("Range error: Range is no longer valid after DOM mutation ("+e.inspect()+")")}function O(e,t){w(e);var n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,a=n===o;L(o)&&i>0&&i0&&r=W(n)&&i++,r=0),e.setStartAndEnd(n,r,o,i)}function T(e){w(e);var t=e.commonAncestorContainer.parentNode.cloneNode(!1);return t.appendChild(e.cloneContents()),t.innerHTML}function _(e){e.START_TO_START=ft,e.START_TO_END=dt,e.END_TO_END=ut,e.END_TO_START=lt,e.NODE_BEFORE=ht,e.NODE_AFTER=gt,e.NODE_BEFORE_AND_AFTER=pt,e.NODE_INSIDE=mt}function D(e){_(e),_(e.prototype)}function x(e,t){return function(){w(this);var n,r,i=this.startContainer,a=this.startOffset,s=this.commonAncestorContainer,f=new h(this,!0);i!==s&&(n=V(i,s,!0),r=o(n),i=r.node,a=r.offset),c(f,C),f.reset();var d=e(f);return f.detach(),t(this,i,a,i,a),d}}function A(n,i){function a(e,t){return function(n){m(n,Z),m(Q(n),$);var i=(e?r:o)(n);(t?s:c)(this,i.node,i.offset)}}function s(e,t,n){var r=e.endContainer,o=e.endOffset;(t!==e.startContainer||n!==e.startOffset)&&((Q(t)!=Q(r)||1==z(t,n,r,o))&&(r=t,o=n),i(e,t,n,r,o))}function c(e,t,n){var r=e.startContainer,o=e.startOffset;(t!==e.endContainer||n!==e.endOffset)&&((Q(t)!=Q(r)||-1==z(t,n,r,o))&&(r=t,o=n),i(e,r,o,t,n))}var u=function(){};u.prototype=e.rangePrototype,n.prototype=new u,H.extend(n.prototype,{setStart:function(e,t){p(e,!0),R(e,t),s(this,e,t)},setEnd:function(e,t){p(e,!0),R(e,t),c(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],n=e[1],r=t,o=n;switch(e.length){case 3:o=e[2];break;case 4:r=e[2],o=e[3]}i(this,t,n,r,o)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:a(!0,!0),setStartAfter:a(!1,!0),setEndBefore:a(!0,!1),setEndAfter:a(!1,!1),collapse:function(e){w(this),e?i(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):i(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){p(e,!0),i(this,e,0,e,q(e))},selectNode:function(e){p(e,!1),m(e,Z);var t=r(e),n=o(e);i(this,t.node,t.offset,n.node,n.offset)},extractContents:x(d,i),deleteContents:x(f,i),canSurroundContents:function(){w(this),C(this.startContainer),C(this.endContainer);var e=new h(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},splitBoundaries:function(){O(this)},splitBoundariesPreservingPositions:function(e){O(this,e)},normalizeBoundaries:function(){w(this);var e=this.startContainer,t=this.startOffset,n=this.endContainer,r=this.endOffset,o=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(n=e,r=e.length,e.appendData(t.data),X(t))},a=function(o){var i=o.previousSibling;if(i&&i.nodeType==o.nodeType){e=o;var a=o.length;if(t=i.length,o.insertData(0,i.data),X(i),e==n)r+=t,n=e;else if(n==o.parentNode){var s=W(o);r==s?(n=o,r=a):r>s&&r--}}},s=!0;if(L(n))n.length==r&&o(n);else{if(r>0){var c=n.childNodes[r-1];c&&L(c)&&o(c)}s=!this.collapsed}if(s){if(L(e))0==t&&a(e);else if(tx",it=3==ot.firstChild.nodeType}catch(at){}e.features.htmlParsingConforms=it;var st=it?function(e){var t=this.startContainer,n=j(t);if(!t)throw new k("INVALID_STATE_ERR");var r=null;return 1==t.nodeType?r=t:L(t)&&(r=B.parentElement(t)),r=null===r||"HTML"==r.nodeName&&B.isHtmlNamespace(j(r).documentElement)&&B.isHtmlNamespace(r)?n.createElement("body"):r.cloneNode(!1),r.innerHTML=e,B.fragmentFromNodeChildren(r)}:function(e){var t=n(this),r=t.createElement("body");return r.innerHTML=e,B.fragmentFromNodeChildren(r)},ct=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ft=0,dt=1,ut=2,lt=3,ht=0,gt=1,pt=2,mt=3;H.extend(e.rangePrototype,{compareBoundaryPoints:function(e,t){w(this),v(this.startContainer,t.startContainer);var n,r,o,i,a=e==lt||e==ft?"start":"end",s=e==dt||e==ft?"start":"end";return n=this[a+"Container"],r=this[a+"Offset"],o=t[s+"Container"],i=t[s+"Offset"],z(n,r,o,i)},insertNode:function(e){if(w(this),m(e,K),C(this.startContainer),F(e,this.startContainer))throw new k("HIERARCHY_REQUEST_ERR");var t=i(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){w(this);var e,t;if(this.collapsed)return n(this).createDocumentFragment();if(this.startContainer===this.endContainer&&L(this.startContainer))return e=this.startContainer.cloneNode(!0),e.data=e.data.slice(this.startOffset,this.endOffset),t=n(this).createDocumentFragment(),t.appendChild(e),t;var r=new h(this,!0);return e=s(r),r.detach(),e},canSurroundContents:function(){w(this),C(this.startContainer),C(this.endContainer);var e=new h(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},surroundContents:function(e){if(m(e,et),!this.canSurroundContents())throw new k("INVALID_STATE_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);i(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){w(this);for(var e,t=new I(n(this)),r=ct.length;r--;)e=ct[r],t[e]=this[e];return t},toString:function(){w(this);var e=this.startContainer;if(e===this.endContainer&&L(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new h(this,!0);return c(n,function(e){(3==e.nodeType||4==e.nodeType)&&t.push(e.data)}),n.detach(),t.join("")},compareNode:function(e){w(this);var t=e.parentNode,n=W(e);if(!t)throw new k("NOT_FOUND_ERR");var r=this.comparePoint(t,n),o=this.comparePoint(t,n+1);return 0>r?o>0?pt:ht:o>0?gt:mt},comparePoint:function(e,t){return w(this),N(e,"HIERARCHY_REQUEST_ERR"),v(e,this.startContainer),z(e,t,this.startContainer,this.startOffset)<0?-1:z(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:st,toHtml:function(){return T(this)},intersectsNode:function(e,t){if(w(this),N(e,"NOT_FOUND_ERR"),j(e)!==n(this))return!1;var r=e.parentNode,o=W(e);N(r,"NOT_FOUND_ERR");var i=z(r,o,this.endContainer,this.endOffset),a=z(r,o+1,this.startContainer,this.startOffset);return t?0>=i&&a>=0:0>i&&a>0},isPointInRange:function(e,t){return w(this),N(e,"HIERARCHY_REQUEST_ERR"),v(e,this.startContainer),z(e,t,this.startContainer,this.startOffset)>=0&&z(e,t,this.endContainer,this.endOffset)<=0},intersectsRange:function(e){return a(this,e,!1)},intersectsOrTouchesRange:function(e){return a(this,e,!0)},intersection:function(e){if(this.intersectsRange(e)){var t=z(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=z(this.endContainer,this.endOffset,e.endContainer,e.endOffset),r=this.cloneRange();return-1==t&&r.setStart(e.startContainer,e.startOffset),1==n&&r.setEnd(e.endContainer,e.endOffset),r}return null},union:function(e){if(this.intersectsOrTouchesRange(e)){var t=this.cloneRange();return-1==z(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==z(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new k("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==mt},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&this.comparePoint(e,q(e))<=0},containsRange:function(e){var t=this.intersection(e);return null!==t&&e.equals(t)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var r=n.pop();return t.setEnd(r,r.length),this.containsRange(t)}return this.containsNodeContents(e)},getNodes:function(e,t){return w(this),u(this,e,t)},getDocument:function(){return n(this)},collapseBefore:function(e){this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){this.setStartAfter(e),this.collapse(!0)},getBookmark:function(t){var r=n(this),o=e.createRange(r);t=t||B.getBody(r),o.selectNodeContents(t);var i=this.intersection(o),a=0,s=0;return i&&(o.setEnd(i.startContainer,i.startOffset),a=o.toString().length,s=a+i.toString().length),{start:a,end:s,containerNode:t}},moveToBookmark:function(e){var t=e.containerNode,n=0;this.setStart(t,0),this.collapse(!0);for(var r,o,i,a,s=[t],c=!1,f=!1;!f&&(r=s.pop());)if(3==r.nodeType)o=n+r.length,!c&&e.start>=n&&e.start<=o&&(this.setStart(r,e.start-n),c=!0),c&&e.end>=n&&e.end<=o&&(this.setEnd(r,e.end-n),f=!0),n=o;else for(a=r.childNodes,i=a.length;i--;)s.push(a[i])},getName:function(){return"DomRange"},equals:function(e){return I.rangesEqual(this,e)},isValid:function(){return y(this)},inspect:function(){return l(this)},detach:function(){}}),A(I,P),H.extend(I,{rangeProperties:ct,RangeIterator:h,copyComparisonConstants:D,createPrototypeRange:A,inspect:l,toHtml:T,getRangeDocument:n,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=I}),b.createCoreModule("WrappedRange",["DomRange"],function(e,t){var n,r,o=e.dom,i=e.util,a=o.DomPosition,s=e.DomRange,c=o.getBody,f=o.getContentDocument,d=o.isCharacterDataNode;if(e.features.implementsDomRange&&!function(){function r(e){for(var t,n=l.length;n--;)t=l[n],e[t]=e.nativeRange[t];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}function a(e,t,n,r,o){var i=e.startContainer!==t||e.startOffset!=n,a=e.endContainer!==r||e.endOffset!=o,s=!e.equals(e.nativeRange);(i||a||s)&&(e.setEnd(r,o),e.setStart(t,n))}var d,u,l=s.rangeProperties;n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,r(this)},s.createPrototypeRange(n,a),d=n.prototype,d.selectNode=function(e){this.nativeRange.selectNode(e),r(this)},d.cloneContents=function(){return this.nativeRange.cloneContents()},d.surroundContents=function(e){this.nativeRange.surroundContents(e),r(this)},d.collapse=function(e){this.nativeRange.collapse(e),r(this)},d.cloneRange=function(){return new n(this.nativeRange.cloneRange())},d.refresh=function(){r(this)},d.toString=function(){return this.nativeRange.toString()};var h=document.createTextNode("test");c(document).appendChild(h);var g=document.createRange();g.setStart(h,0),g.setEnd(h,0);try{g.setStart(h,1),d.setStart=function(e,t){this.nativeRange.setStart(e,t),r(this)},d.setEnd=function(e,t){this.nativeRange.setEnd(e,t),r(this)},u=function(e){return function(t){this.nativeRange[e](t),r(this)}}}catch(p){d.setStart=function(e,t){try{this.nativeRange.setStart(e,t)}catch(n){this.nativeRange.setEnd(e,t),this.nativeRange.setStart(e,t)}r(this)},d.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}r(this)},u=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(o){this.nativeRange[t](n),this.nativeRange[e](n)}r(this)}}}d.setStartBefore=u("setStartBefore","setEndBefore"),d.setStartAfter=u("setStartAfter","setEndAfter"),d.setEndBefore=u("setEndBefore","setStartBefore"),d.setEndAfter=u("setEndAfter","setStartAfter"),d.selectNodeContents=function(e){this.setStartAndEnd(e,0,o.getNodeLength(e))},g.selectNodeContents(h),g.setEnd(h,3);var m=document.createRange();m.selectNodeContents(h),m.setEnd(h,4),m.setStart(h,2),d.compareBoundaryPoints=-1==g.compareBoundaryPoints(g.START_TO_END,m)&&1==g.compareBoundaryPoints(g.END_TO_START,m)?function(e,t){return t=t.nativeRange||t,e==t.START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)};var R=document.createElement("div");R.innerHTML="123";var v=R.firstChild,C=c(document);C.appendChild(R),g.setStart(v,1),g.setEnd(v,2),g.deleteContents(),"13"==v.data&&(d.deleteContents=function(){this.nativeRange.deleteContents(),r(this)},d.extractContents=function(){var e=this.nativeRange.extractContents();return r(this),e}),C.removeChild(R),C=null,i.isHostMethod(g,"createContextualFragment")&&(d.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),c(document).removeChild(h),d.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return e=f(e,t,"createNativeRange"),e.createRange()}}(),e.features.implementsTextRange){var u=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var r=n.parentElement();n=e.duplicate(),n.collapse(!1);var i=n.parentElement(),a=r==i?r:o.getCommonAncestor(r,i);return a==t?a:o.getCommonAncestor(t,a)},l=function(e){return 0==e.compareEndPoints("StartToEnd",e)},h=function(e,t,n,r,i){var s=e.duplicate();s.collapse(n);var c=s.parentElement();if(o.isOrIsAncestorOf(t,c)||(c=t),!c.canHaveHTML){var f=new a(c.parentNode,o.getNodeIndex(c));return{boundaryPosition:f,nodeInfo:{nodeIndex:f.offset,containerElement:f.node}}}var u=o.getDocument(c).createElement("span");u.parentNode&&o.removeNode(u);for(var l,h,g,p,m,R=n?"StartToStart":"StartToEnd",v=i&&i.containerElement==c?i.nodeIndex:0,C=c.childNodes.length,N=C,E=N;;){if(E==C?c.appendChild(u):c.insertBefore(u,c.childNodes[E]),s.moveToElementText(u),l=s.compareEndPoints(R,e),0==l||v==N)break;if(-1==l){if(N==v+1)break;v=E}else N=N==v+1?v:E;E=Math.floor((v+N)/2),c.removeChild(u)}if(m=u.nextSibling,-1==l&&m&&d(m)){s.setEndPoint(n?"EndToStart":"EndToEnd",e);var S;if(/[\r\n]/.test(m.data)){var y=s.duplicate(),w=y.text.replace(/\r\n/g,"\r").length;for(S=y.moveStart("character",w);-1==(l=y.compareEndPoints("StartToEnd",y));)S++,y.moveStart("character",1)}else S=s.text.length;p=new a(m,S)}else h=(r||!n)&&u.previousSibling,g=(r||n)&&u.nextSibling,p=g&&d(g)?new a(g,0):h&&d(h)?new a(h,h.data.length):new a(c,o.getNodeIndex(u));return o.removeNode(u),{boundaryPosition:p,nodeInfo:{nodeIndex:E,containerElement:c}}},g=function(e,t){var n,r,i,a,s=e.offset,f=o.getDocument(e.node),u=c(f).createTextRange(),l=d(e.node);return l?(n=e.node,r=n.parentNode):(a=e.node.childNodes,n=s diff --git a/Leanote/editor/EditorAssets/editor.min.html b/Leanote/editor/EditorAssets/editor.min.html index e81c052..faec0ff 100755 --- a/Leanote/editor/EditorAssets/editor.min.html +++ b/Leanote/editor/EditorAssets/editor.min.html @@ -41,5 +41,11 @@ // $(document).ready(function() { ZSSEditor.init(callbacker, logger); + + if (/ipad/.test(location)) { + ZSSEditor.getField('zss_field_title').setHTML("你好啊 hello world"); + ZSSEditor.getField('zss_field_content').setHTML("你好 hello world"); + $('body').addClass('ipad-body'); + } });
"),e=e.replace(/<\/blockquote>\s*<\/p>/gi,"
\\s*(?(?:"+n+")(?: [^>]*)?>)","gi"),"$1"),e=e.replace(new RegExp("(?(?:"+n+")(?: [^>]*)?>)\\s*
|)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|)*/gi,"[caption$1[/caption]"),e=e.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g,function(e,p,r){return r.match(/
]*)?>/)?e:p+"
"+r+"
]*>[\s\S]+?<\/\1>/g,function(e){return e=e.replace(/(\r\n|\n)?/g,""),e=e.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,""),e.replace(/\r?\n/g,"")})),-1!==e.indexOf("[caption")&&(c=!0,e=e.replace(/\[caption[\s\S]+?\[\/caption\]/g,function(e){return e.replace(/]*)>/g,"").replace(/[\r\n\t]+/,"")})),n="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset",e=e.replace(new RegExp("\\s*("+n+")>\\s*","g"),"$1>\n"),e=e.replace(new RegExp("\\s*<((?:"+n+")(?: [^>]*)?)>","g"),"\n<$1>"),e=e.replace(/(]+>.*?)<\/p>/g,"$1"),e=e.replace(/]*)?>\s*/gi,"\n\n"),e=e.replace(/\s*/gi,""),e=e.replace(/\s*<\/p>\s*/gi,"\n\n"),e=e.replace(/\n[\s\u00a0]+\n/g,"\n\n"),e=e.replace(/\s*\s*/gi,"\n"),e=e.replace(/\s*\s*/g,"\n"),e=e.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n"),e=e.replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption"),p="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset",e=e.replace(new RegExp("\\s*<((?:"+p+")(?: [^>]*)?)\\s*>","g"),"\n<$1>"),e=e.replace(new RegExp("\\s*("+p+")>\\s*","g"),"$1>\n"),e=e.replace(/]*)>/g," "),-1!==e.indexOf("/g,"\n")),-1!==e.indexOf("]*)?>\s*/g,"\n\n\n\n")),-1!==e.indexOf("/g,function(e){return e.replace(/[\r\n]+/g,"")})),e=e.replace(/<\/p#>/g,"\n"),e=e.replace(/\s*(]+>[\s\S]*?<\/p>)/g,"\n$1"),e=e.replace(/^\s+/,""),e=e.replace(/[\s\u00a0]+$/,""),r&&(e=e.replace(//g,"\n")),c&&(e=e.replace(/]*)>/g,"")),e}}(); !function(e,t){"function"==typeof define&&define.amd?define(e):"undefined"!=typeof module&&"object"==typeof exports?module.exports=e():t.rangy=e()}(function(){function e(e,t){var n=typeof e[t];return n==v||!(n!=R||!e[t])||"unknown"==n}function t(e,t){return!(typeof e[t]!=R||!e[t])}function n(e,t){return typeof e[t]!=C}function r(e){return function(t,n){for(var r=n.length;r--;)if(!e(t,n[r]))return!1;return!0}}function o(e){return e&&w(e,y)&&T(e,S)}function i(e){return t(e,"body")?e.body:e.getElementsByTagName("body")[0]}function a(t){typeof console!=C&&e(console,"log")&&console.log(t)}function s(e,t){x&&t?alert(e):a(e)}function c(e){b.initialized=!0,b.supported=!1,s("Rangy is not supported in this environment. Reason: "+e,b.config.alertOnFail)}function f(e){s("Rangy warning: "+e,b.config.alertOnWarn)}function d(e){return e.message||e.description||String(e)}function u(){if(x&&!b.initialized){var t,n=!1,r=!1;e(document,"createRange")&&(t=document.createRange(),w(t,E)&&T(t,N)&&(n=!0));var s=i(document);if(!s||"body"!=s.nodeName.toLowerCase())return void c("No body element found");if(s&&e(s,"createTextRange")&&(t=s.createTextRange(),o(t)&&(r=!0)),!n&&!r)return void c("Neither Range nor TextRange are available");b.initialized=!0,b.features={implementsDomRange:n,implementsTextRange:r};var f,u;for(var l in D)(f=D[l])instanceof h&&f.init(f,b);for(var g=0,p=B.length;p>g;++g)try{B[g](b)}catch(m){u="Rangy init listener threw an exception. Continuing. Detail: "+d(m),a(u)}}}function l(e){e=e||window,u();for(var t=0,n=H.length;n>t;++t)H[t](e)}function h(e,t,n){this.name=e,this.dependencies=t,this.initialized=!1,this.supported=!1,this.initializer=n}function g(e,t,n){var r=new h(e,t,function(t){if(!t.initialized){t.initialized=!0;try{n(b,t),t.supported=!0}catch(r){var o="Module '"+e+"' failed to load: "+d(r);a(o),r.stack&&a(r.stack)}}});return D[e]=r,r}function p(){}function m(){}var R="object",v="function",C="undefined",N=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],E=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],S=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],y=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],w=r(e),O=r(t),T=r(n),_=[].forEach?function(e,t){e.forEach(t)}:function(e,t){for(var n=0,r=e.length;r>n;++n)t(e[n],n)},D={},x=typeof window!=C&&typeof document!=C,A={isHostMethod:e,isHostObject:t,isHostProperty:n,areHostMethods:w,areHostObjects:O,areHostProperties:T,isTextRange:o,getBody:i,forEach:_},b={version:"1.3.0-beta.2",initialized:!1,isBrowser:x,supported:!0,util:A,features:{},modules:D,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==C?!0:rangyAutoInitialize}};b.fail=c,b.warn=f;var P;({}).hasOwnProperty?(A.extend=P=function(e,t,n){var r,o;for(var i in t)t.hasOwnProperty(i)&&(r=e[i],o=t[i],n&&null!==r&&"object"==typeof r&&null!==o&&"object"==typeof o&&P(r,o,!0),e[i]=o);return t.hasOwnProperty("toString")&&(e.toString=t.toString),e},A.createOptions=function(e,t){var n={};return P(n,t),e&&P(n,e),n}):c("hasOwnProperty not supported"),x||c("Rangy can only run in a browser"),function(){var e;if(x){var t=document.createElement("div");t.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(t.childNodes,0)[0].nodeType&&(e=function(e){return n.call(e,0)})}catch(r){}}e||(e=function(e){for(var t=[],n=0,r=e.length;r>n;++n)t[n]=e[n];return t}),A.toArray=e}();var I;x&&(e(document,"addEventListener")?I=function(e,t,n){e.addEventListener(t,n,!1)}:e(document,"attachEvent")?I=function(e,t,n){e.attachEvent("on"+t,n)}:c("Document does not have required addEventListener or attachEvent method"),A.addListener=I);var B=[];b.init=u,b.addInitListener=function(e){b.initialized?e(b):B.push(e)};var H=[];b.addShimListener=function(e){H.push(e)},x&&(b.shim=b.createMissingNativeApi=l),h.prototype={init:function(){for(var e,t,n=this.dependencies||[],r=0,o=n.length;o>r;++r){if(t=n[r],e=D[t],!(e&&e instanceof h))throw new Error("required module '"+t+"' not found");if(e.init(),!e.supported)throw new Error("required module '"+t+"' not supported")}this.initializer(this)},fail:function(e){throw this.initialized=!0,this.supported=!1,new Error(e)},warn:function(e){b.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){b.warn("DEPRECATED: "+e+" in module "+this.name+"is deprecated. Please use "+t+" instead")},createError:function(e){return new Error("Error in Rangy "+this.name+" module: "+e)}},b.createModule=function(e){var t,n;2==arguments.length?(t=arguments[1],n=[]):(t=arguments[2],n=arguments[1]);var r=g(e,n,t);b.initialized&&b.supported&&r.init()},b.createCoreModule=function(e,t,n){g(e,t,n)},b.RangePrototype=p,b.rangePrototype=new p,b.selectionPrototype=new m,b.createCoreModule("DomUtil",[],function(e,t){function n(e){var t;return typeof e.namespaceURI==b||null===(t=e.namespaceURI)||"http://www.w3.org/1999/xhtml"==t}function r(e){var t=e.parentNode;return 1==t.nodeType?t:null}function o(e){for(var t=0;e=e.previousSibling;)++t;return t}function i(e){switch(e.nodeType){case 7:case 10:return 0;case 3:case 8:return e.length;default:return e.childNodes.length}}function a(e,t){var n,r=[];for(n=e;n;n=n.parentNode)r.push(n);for(n=t;n;n=n.parentNode)if(M(r,n))return n;return null}function s(e,t,n){for(var r=n?t:t.parentNode;r;){if(r===e)return!0;r=r.parentNode}return!1}function c(e,t){return s(e,t,!0)}function f(e,t,n){for(var r,o=n?e:e.parentNode;o;){if(r=o.parentNode,r===t)return o;o=r}return null}function d(e){var t=e.nodeType;return 3==t||4==t||8==t}function u(e){if(!e)return!1;var t=e.nodeType;return 3==t||8==t}function l(e,t){var n=t.nextSibling,r=t.parentNode;return n?r.insertBefore(e,n):r.appendChild(e),e}function h(e,t,n){var r=e.cloneNode(!1);if(r.deleteData(0,t),e.deleteData(t,e.length-t),l(r,e),n)for(var i,a=0;i=n[a++];)i.node==e&&i.offset>t?(i.node=r,i.offset-=t):i.node==e.parentNode&&i.offset>o(e)&&++i.offset;return r}function g(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!=b)return e.ownerDocument;if(typeof e.document!=b)return e.document;if(e.parentNode)return g(e.parentNode);throw t.createError("getDocument: no document found for node")}function p(e){var n=g(e);if(typeof n.defaultView!=b)return n.defaultView;if(typeof n.parentWindow!=b)return n.parentWindow;throw t.createError("Cannot get a window object for node")}function m(e){if(typeof e.contentDocument!=b)return e.contentDocument;if(typeof e.contentWindow!=b)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function R(e){if(typeof e.contentWindow!=b)return e.contentWindow;if(typeof e.contentDocument!=b)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")}function v(e){return e&&P.isHostMethod(e,"setTimeout")&&P.isHostObject(e,"document")}function C(e,t,n){var r;if(e?P.isHostProperty(e,"nodeType")?r=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?m(e):g(e):v(e)&&(r=e.document):r=document,!r)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return r}function N(e){for(var t;t=e.parentNode;)e=t;return e}function E(e,n,r,i){var s,c,d,u,l;if(e==r)return n===i?0:i>n?-1:1;if(s=f(r,e,!0))return n<=o(s)?-1:1;if(s=f(e,r,!0))return o(s)[index:"+o(e)+",length:"+e.childNodes.length+"]["+(e.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return e.nodeName}function w(e){for(var t,n=g(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n}function O(e,t,n){var r=I(e),o=e.createElement("div");o.contentEditable=""+!!n,t&&(o.innerHTML=t);var i=r.firstChild;return i?r.insertBefore(o,i):r.appendChild(o),o}function T(e){return e.parentNode.removeChild(e)}function _(e){this.root=e,this._next=e}function D(e){return new _(e)}function x(e,t){this.node=e,this.offset=t}function A(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}var b="undefined",P=e.util,I=P.getBody;P.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),P.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var B=document.createElement("div");P.areHostMethods(B,["insertBefore","appendChild","cloneNode"]||!P.areHostObjects(B,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),P.isHostProperty(B,"innerHTML")||t.fail("Element is missing innerHTML property");var H=document.createTextNode("test");P.areHostMethods(H,["splitText","deleteData","insertData","appendData","cloneNode"]||!P.areHostObjects(B,["previousSibling","nextSibling","childNodes","parentNode"])||!P.areHostProperties(H,["data"]))||t.fail("Incomplete Text Node implementation");var M=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1},k=!1;!function(){var t=document.createElement("b");t.innerHTML="1";var n=t.firstChild;t.innerHTML="",k=S(n),e.features.crashyTextNodes=k}();var L;typeof window.getComputedStyle!=b?L=function(e,t){return p(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!=b?L=function(e,t){return e.currentStyle[t]}:t.fail("No means of obtaining computed style properties found"),_.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},x.prototype={equals:function(e){return!!e&&this.node===e.node&&this.offset==e.offset},inspect:function(){return"[DomPosition("+y(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},A.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},A.prototype.toString=function(){return this.message},e.dom={arrayContains:M,isHtmlNamespace:n,parentElement:r,getNodeIndex:o,getNodeLength:i,getCommonAncestor:a,isAncestorOf:s,isOrIsAncestorOf:c,getClosestAncestorIn:f,isCharacterDataNode:d,isTextOrCommentNode:u,insertAfter:l,splitDataNode:h,getDocument:g,getWindow:p,getIframeWindow:R,getIframeDocument:m,getBody:I,isWindow:v,getContentDocument:C,getRootContainer:N,comparePoints:E,isBrokenNode:S,inspectNode:y,getComputedStyleProperty:L,createTestElement:O,removeNode:T,fragmentFromNodeChildren:w,createIterator:D,DomPosition:x},e.DOMException=A}),b.createCoreModule("DomRange",["DomUtil"],function(e){function t(e,t){return 3!=e.nodeType&&(F(e,t.startContainer)||F(e,t.endContainer))}function n(e){return e.document||j(e.startContainer)}function r(e){return new M(e.parentNode,W(e))}function o(e){return new M(e.parentNode,W(e)+1)}function i(e,t,n){var r=11==e.nodeType?e.firstChild:e;return L(t)?n==t.length?B.insertAfter(e,t):t.parentNode.insertBefore(e,0==n?t:U(t,n)):n>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[n]),r}function a(e,t,r){if(w(e),w(t),n(t)!=n(e))throw new k("WRONG_DOCUMENT_ERR");var o=z(e.startContainer,e.startOffset,t.endContainer,t.endOffset),i=z(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return r?0>=o&&i>=0:0>o&&i>0}function s(e){for(var t,r,o,i=n(e.range).createDocumentFragment();r=e.next();){if(t=e.isPartiallySelectedSubtree(),r=r.cloneNode(!t),t&&(o=e.getSubtreeIterator(),r.appendChild(s(o)),o.detach()),10==r.nodeType)throw new k("HIERARCHY_REQUEST_ERR");i.appendChild(r)}return i}function c(e,t,n){var r,o;n=n||{stop:!1};for(var i,a;i=e.next();)if(e.isPartiallySelectedSubtree()){if(t(i)===!1)return void(n.stop=!0);if(a=e.getSubtreeIterator(),c(a,t,n),a.detach(),n.stop)return}else for(r=B.createIterator(i);o=r.next();)if(t(o)===!1)return void(n.stop=!0)}function f(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(t=e.getSubtreeIterator(),f(t),t.detach()):e.remove()}function d(e){for(var t,r,o=n(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),r=e.getSubtreeIterator(),t.appendChild(d(r)),r.detach()):e.remove(),10==t.nodeType)throw new k("HIERARCHY_REQUEST_ERR");o.appendChild(t)}return o}function u(e,t,n){var r,o=!(!t||!t.length),i=!!n;o&&(r=new RegExp("^("+t.join("|")+")$"));var a=[];return c(new h(e,!1),function(t){if(!(o&&!r.test(t.nodeType)||i&&!n(t))){var s=e.startContainer;if(t!=s||!L(s)||e.startOffset!=s.length){var c=e.endContainer;t==c&&L(c)&&0==e.endOffset||a.push(t)}}}),a}function l(e){var t="undefined"==typeof e.getName?"Range":e.getName();return"["+t+"("+B.inspectNode(e.startContainer)+":"+e.startOffset+", "+B.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function h(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&L(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||L(this.sc)?V(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||L(this.ec)?V(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}function g(e){return function(t,n){for(var r,o=n?t:t.parentNode;o;){if(r=o.nodeType,Y(e,r))return o;o=o.parentNode}return null}}function p(e,t){if(rt(e,t))throw new k("INVALID_NODE_TYPE_ERR")}function m(e,t){if(!Y(t,e.nodeType))throw new k("INVALID_NODE_TYPE_ERR")}function R(e,t){if(0>t||t>(L(e)?e.length:e.childNodes.length))throw new k("INDEX_SIZE_ERR")}function v(e,t){if(tt(e,!0)!==tt(t,!0))throw new k("WRONG_DOCUMENT_ERR")}function C(e){if(nt(e,!0))throw new k("NO_MODIFICATION_ALLOWED_ERR")}function N(e,t){if(!e)throw new k(t)}function E(e){return G&&B.isBrokenNode(e)||!Y($,e.nodeType)&&!tt(e,!0)}function S(e,t){return t<=(L(e)?e.length:e.childNodes.length)}function y(e){return!!e.startContainer&&!!e.endContainer&&!E(e.startContainer)&&!E(e.endContainer)&&S(e.startContainer,e.startOffset)&&S(e.endContainer,e.endOffset)}function w(e){if(!y(e))throw new Error("Range error: Range is no longer valid after DOM mutation ("+e.inspect()+")")}function O(e,t){w(e);var n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,a=n===o;L(o)&&i>0&&i0&&r=W(n)&&i++,r=0),e.setStartAndEnd(n,r,o,i)}function T(e){w(e);var t=e.commonAncestorContainer.parentNode.cloneNode(!1);return t.appendChild(e.cloneContents()),t.innerHTML}function _(e){e.START_TO_START=ft,e.START_TO_END=dt,e.END_TO_END=ut,e.END_TO_START=lt,e.NODE_BEFORE=ht,e.NODE_AFTER=gt,e.NODE_BEFORE_AND_AFTER=pt,e.NODE_INSIDE=mt}function D(e){_(e),_(e.prototype)}function x(e,t){return function(){w(this);var n,r,i=this.startContainer,a=this.startOffset,s=this.commonAncestorContainer,f=new h(this,!0);i!==s&&(n=V(i,s,!0),r=o(n),i=r.node,a=r.offset),c(f,C),f.reset();var d=e(f);return f.detach(),t(this,i,a,i,a),d}}function A(n,i){function a(e,t){return function(n){m(n,Z),m(Q(n),$);var i=(e?r:o)(n);(t?s:c)(this,i.node,i.offset)}}function s(e,t,n){var r=e.endContainer,o=e.endOffset;(t!==e.startContainer||n!==e.startOffset)&&((Q(t)!=Q(r)||1==z(t,n,r,o))&&(r=t,o=n),i(e,t,n,r,o))}function c(e,t,n){var r=e.startContainer,o=e.startOffset;(t!==e.endContainer||n!==e.endOffset)&&((Q(t)!=Q(r)||-1==z(t,n,r,o))&&(r=t,o=n),i(e,r,o,t,n))}var u=function(){};u.prototype=e.rangePrototype,n.prototype=new u,H.extend(n.prototype,{setStart:function(e,t){p(e,!0),R(e,t),s(this,e,t)},setEnd:function(e,t){p(e,!0),R(e,t),c(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],n=e[1],r=t,o=n;switch(e.length){case 3:o=e[2];break;case 4:r=e[2],o=e[3]}i(this,t,n,r,o)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:a(!0,!0),setStartAfter:a(!1,!0),setEndBefore:a(!0,!1),setEndAfter:a(!1,!1),collapse:function(e){w(this),e?i(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):i(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){p(e,!0),i(this,e,0,e,q(e))},selectNode:function(e){p(e,!1),m(e,Z);var t=r(e),n=o(e);i(this,t.node,t.offset,n.node,n.offset)},extractContents:x(d,i),deleteContents:x(f,i),canSurroundContents:function(){w(this),C(this.startContainer),C(this.endContainer);var e=new h(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},splitBoundaries:function(){O(this)},splitBoundariesPreservingPositions:function(e){O(this,e)},normalizeBoundaries:function(){w(this);var e=this.startContainer,t=this.startOffset,n=this.endContainer,r=this.endOffset,o=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(n=e,r=e.length,e.appendData(t.data),X(t))},a=function(o){var i=o.previousSibling;if(i&&i.nodeType==o.nodeType){e=o;var a=o.length;if(t=i.length,o.insertData(0,i.data),X(i),e==n)r+=t,n=e;else if(n==o.parentNode){var s=W(o);r==s?(n=o,r=a):r>s&&r--}}},s=!0;if(L(n))n.length==r&&o(n);else{if(r>0){var c=n.childNodes[r-1];c&&L(c)&&o(c)}s=!this.collapsed}if(s){if(L(e))0==t&&a(e);else if(tx",it=3==ot.firstChild.nodeType}catch(at){}e.features.htmlParsingConforms=it;var st=it?function(e){var t=this.startContainer,n=j(t);if(!t)throw new k("INVALID_STATE_ERR");var r=null;return 1==t.nodeType?r=t:L(t)&&(r=B.parentElement(t)),r=null===r||"HTML"==r.nodeName&&B.isHtmlNamespace(j(r).documentElement)&&B.isHtmlNamespace(r)?n.createElement("body"):r.cloneNode(!1),r.innerHTML=e,B.fragmentFromNodeChildren(r)}:function(e){var t=n(this),r=t.createElement("body");return r.innerHTML=e,B.fragmentFromNodeChildren(r)},ct=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ft=0,dt=1,ut=2,lt=3,ht=0,gt=1,pt=2,mt=3;H.extend(e.rangePrototype,{compareBoundaryPoints:function(e,t){w(this),v(this.startContainer,t.startContainer);var n,r,o,i,a=e==lt||e==ft?"start":"end",s=e==dt||e==ft?"start":"end";return n=this[a+"Container"],r=this[a+"Offset"],o=t[s+"Container"],i=t[s+"Offset"],z(n,r,o,i)},insertNode:function(e){if(w(this),m(e,K),C(this.startContainer),F(e,this.startContainer))throw new k("HIERARCHY_REQUEST_ERR");var t=i(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){w(this);var e,t;if(this.collapsed)return n(this).createDocumentFragment();if(this.startContainer===this.endContainer&&L(this.startContainer))return e=this.startContainer.cloneNode(!0),e.data=e.data.slice(this.startOffset,this.endOffset),t=n(this).createDocumentFragment(),t.appendChild(e),t;var r=new h(this,!0);return e=s(r),r.detach(),e},canSurroundContents:function(){w(this),C(this.startContainer),C(this.endContainer);var e=new h(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},surroundContents:function(e){if(m(e,et),!this.canSurroundContents())throw new k("INVALID_STATE_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);i(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){w(this);for(var e,t=new I(n(this)),r=ct.length;r--;)e=ct[r],t[e]=this[e];return t},toString:function(){w(this);var e=this.startContainer;if(e===this.endContainer&&L(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new h(this,!0);return c(n,function(e){(3==e.nodeType||4==e.nodeType)&&t.push(e.data)}),n.detach(),t.join("")},compareNode:function(e){w(this);var t=e.parentNode,n=W(e);if(!t)throw new k("NOT_FOUND_ERR");var r=this.comparePoint(t,n),o=this.comparePoint(t,n+1);return 0>r?o>0?pt:ht:o>0?gt:mt},comparePoint:function(e,t){return w(this),N(e,"HIERARCHY_REQUEST_ERR"),v(e,this.startContainer),z(e,t,this.startContainer,this.startOffset)<0?-1:z(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:st,toHtml:function(){return T(this)},intersectsNode:function(e,t){if(w(this),N(e,"NOT_FOUND_ERR"),j(e)!==n(this))return!1;var r=e.parentNode,o=W(e);N(r,"NOT_FOUND_ERR");var i=z(r,o,this.endContainer,this.endOffset),a=z(r,o+1,this.startContainer,this.startOffset);return t?0>=i&&a>=0:0>i&&a>0},isPointInRange:function(e,t){return w(this),N(e,"HIERARCHY_REQUEST_ERR"),v(e,this.startContainer),z(e,t,this.startContainer,this.startOffset)>=0&&z(e,t,this.endContainer,this.endOffset)<=0},intersectsRange:function(e){return a(this,e,!1)},intersectsOrTouchesRange:function(e){return a(this,e,!0)},intersection:function(e){if(this.intersectsRange(e)){var t=z(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=z(this.endContainer,this.endOffset,e.endContainer,e.endOffset),r=this.cloneRange();return-1==t&&r.setStart(e.startContainer,e.startOffset),1==n&&r.setEnd(e.endContainer,e.endOffset),r}return null},union:function(e){if(this.intersectsOrTouchesRange(e)){var t=this.cloneRange();return-1==z(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==z(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new k("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==mt},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&this.comparePoint(e,q(e))<=0},containsRange:function(e){var t=this.intersection(e);return null!==t&&e.equals(t)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var r=n.pop();return t.setEnd(r,r.length),this.containsRange(t)}return this.containsNodeContents(e)},getNodes:function(e,t){return w(this),u(this,e,t)},getDocument:function(){return n(this)},collapseBefore:function(e){this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){this.setStartAfter(e),this.collapse(!0)},getBookmark:function(t){var r=n(this),o=e.createRange(r);t=t||B.getBody(r),o.selectNodeContents(t);var i=this.intersection(o),a=0,s=0;return i&&(o.setEnd(i.startContainer,i.startOffset),a=o.toString().length,s=a+i.toString().length),{start:a,end:s,containerNode:t}},moveToBookmark:function(e){var t=e.containerNode,n=0;this.setStart(t,0),this.collapse(!0);for(var r,o,i,a,s=[t],c=!1,f=!1;!f&&(r=s.pop());)if(3==r.nodeType)o=n+r.length,!c&&e.start>=n&&e.start<=o&&(this.setStart(r,e.start-n),c=!0),c&&e.end>=n&&e.end<=o&&(this.setEnd(r,e.end-n),f=!0),n=o;else for(a=r.childNodes,i=a.length;i--;)s.push(a[i])},getName:function(){return"DomRange"},equals:function(e){return I.rangesEqual(this,e)},isValid:function(){return y(this)},inspect:function(){return l(this)},detach:function(){}}),A(I,P),H.extend(I,{rangeProperties:ct,RangeIterator:h,copyComparisonConstants:D,createPrototypeRange:A,inspect:l,toHtml:T,getRangeDocument:n,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=I}),b.createCoreModule("WrappedRange",["DomRange"],function(e,t){var n,r,o=e.dom,i=e.util,a=o.DomPosition,s=e.DomRange,c=o.getBody,f=o.getContentDocument,d=o.isCharacterDataNode;if(e.features.implementsDomRange&&!function(){function r(e){for(var t,n=l.length;n--;)t=l[n],e[t]=e.nativeRange[t];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}function a(e,t,n,r,o){var i=e.startContainer!==t||e.startOffset!=n,a=e.endContainer!==r||e.endOffset!=o,s=!e.equals(e.nativeRange);(i||a||s)&&(e.setEnd(r,o),e.setStart(t,n))}var d,u,l=s.rangeProperties;n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,r(this)},s.createPrototypeRange(n,a),d=n.prototype,d.selectNode=function(e){this.nativeRange.selectNode(e),r(this)},d.cloneContents=function(){return this.nativeRange.cloneContents()},d.surroundContents=function(e){this.nativeRange.surroundContents(e),r(this)},d.collapse=function(e){this.nativeRange.collapse(e),r(this)},d.cloneRange=function(){return new n(this.nativeRange.cloneRange())},d.refresh=function(){r(this)},d.toString=function(){return this.nativeRange.toString()};var h=document.createTextNode("test");c(document).appendChild(h);var g=document.createRange();g.setStart(h,0),g.setEnd(h,0);try{g.setStart(h,1),d.setStart=function(e,t){this.nativeRange.setStart(e,t),r(this)},d.setEnd=function(e,t){this.nativeRange.setEnd(e,t),r(this)},u=function(e){return function(t){this.nativeRange[e](t),r(this)}}}catch(p){d.setStart=function(e,t){try{this.nativeRange.setStart(e,t)}catch(n){this.nativeRange.setEnd(e,t),this.nativeRange.setStart(e,t)}r(this)},d.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}r(this)},u=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(o){this.nativeRange[t](n),this.nativeRange[e](n)}r(this)}}}d.setStartBefore=u("setStartBefore","setEndBefore"),d.setStartAfter=u("setStartAfter","setEndAfter"),d.setEndBefore=u("setEndBefore","setStartBefore"),d.setEndAfter=u("setEndAfter","setStartAfter"),d.selectNodeContents=function(e){this.setStartAndEnd(e,0,o.getNodeLength(e))},g.selectNodeContents(h),g.setEnd(h,3);var m=document.createRange();m.selectNodeContents(h),m.setEnd(h,4),m.setStart(h,2),d.compareBoundaryPoints=-1==g.compareBoundaryPoints(g.START_TO_END,m)&&1==g.compareBoundaryPoints(g.END_TO_START,m)?function(e,t){return t=t.nativeRange||t,e==t.START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)};var R=document.createElement("div");R.innerHTML="123";var v=R.firstChild,C=c(document);C.appendChild(R),g.setStart(v,1),g.setEnd(v,2),g.deleteContents(),"13"==v.data&&(d.deleteContents=function(){this.nativeRange.deleteContents(),r(this)},d.extractContents=function(){var e=this.nativeRange.extractContents();return r(this),e}),C.removeChild(R),C=null,i.isHostMethod(g,"createContextualFragment")&&(d.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),c(document).removeChild(h),d.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return e=f(e,t,"createNativeRange"),e.createRange()}}(),e.features.implementsTextRange){var u=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var r=n.parentElement();n=e.duplicate(),n.collapse(!1);var i=n.parentElement(),a=r==i?r:o.getCommonAncestor(r,i);return a==t?a:o.getCommonAncestor(t,a)},l=function(e){return 0==e.compareEndPoints("StartToEnd",e)},h=function(e,t,n,r,i){var s=e.duplicate();s.collapse(n);var c=s.parentElement();if(o.isOrIsAncestorOf(t,c)||(c=t),!c.canHaveHTML){var f=new a(c.parentNode,o.getNodeIndex(c));return{boundaryPosition:f,nodeInfo:{nodeIndex:f.offset,containerElement:f.node}}}var u=o.getDocument(c).createElement("span");u.parentNode&&o.removeNode(u);for(var l,h,g,p,m,R=n?"StartToStart":"StartToEnd",v=i&&i.containerElement==c?i.nodeIndex:0,C=c.childNodes.length,N=C,E=N;;){if(E==C?c.appendChild(u):c.insertBefore(u,c.childNodes[E]),s.moveToElementText(u),l=s.compareEndPoints(R,e),0==l||v==N)break;if(-1==l){if(N==v+1)break;v=E}else N=N==v+1?v:E;E=Math.floor((v+N)/2),c.removeChild(u)}if(m=u.nextSibling,-1==l&&m&&d(m)){s.setEndPoint(n?"EndToStart":"EndToEnd",e);var S;if(/[\r\n]/.test(m.data)){var y=s.duplicate(),w=y.text.replace(/\r\n/g,"\r").length;for(S=y.moveStart("character",w);-1==(l=y.compareEndPoints("StartToEnd",y));)S++,y.moveStart("character",1)}else S=s.text.length;p=new a(m,S)}else h=(r||!n)&&u.previousSibling,g=(r||n)&&u.nextSibling,p=g&&d(g)?new a(g,0):h&&d(h)?new a(h,h.data.length):new a(c,o.getNodeIndex(u));return o.removeNode(u),{boundaryPosition:p,nodeInfo:{nodeIndex:E,containerElement:c}}},g=function(e,t){var n,r,i,a,s=e.offset,f=o.getDocument(e.node),u=c(f).createTextRange(),l=d(e.node);return l?(n=e.node,r=n.parentNode):(a=e.node.childNodes,n=s diff --git a/Leanote/editor/EditorAssets/editor.min.html b/Leanote/editor/EditorAssets/editor.min.html index e81c052..faec0ff 100755 --- a/Leanote/editor/EditorAssets/editor.min.html +++ b/Leanote/editor/EditorAssets/editor.min.html @@ -41,5 +41,11 @@ // $(document).ready(function() { ZSSEditor.init(callbacker, logger); + + if (/ipad/.test(location)) { + ZSSEditor.getField('zss_field_title').setHTML("你好啊 hello world"); + ZSSEditor.getField('zss_field_content').setHTML("你好 hello world"); + $('body').addClass('ipad-body'); + } });
]+>.*?)<\/p>/g,"$1
/gi,"
/gi,""),e=e.replace(/\s*<\/p>\s*/gi,"\n\n"),e=e.replace(/\n[\s\u00a0]+\n/g,"\n\n"),e=e.replace(/\s*\s*/gi,"\n"),e=e.replace(/\s*
]+>[\s\S]*?<\/p>)/g,"\n$1"),e=e.replace(/^\s+/,""),e=e.replace(/[\s\u00a0]+$/,""),r&&(e=e.replace(//g,"\n")),c&&(e=e.replace(/]*)>/g,"")),e}}(); !function(e,t){"function"==typeof define&&define.amd?define(e):"undefined"!=typeof module&&"object"==typeof exports?module.exports=e():t.rangy=e()}(function(){function e(e,t){var n=typeof e[t];return n==v||!(n!=R||!e[t])||"unknown"==n}function t(e,t){return!(typeof e[t]!=R||!e[t])}function n(e,t){return typeof e[t]!=C}function r(e){return function(t,n){for(var r=n.length;r--;)if(!e(t,n[r]))return!1;return!0}}function o(e){return e&&w(e,y)&&T(e,S)}function i(e){return t(e,"body")?e.body:e.getElementsByTagName("body")[0]}function a(t){typeof console!=C&&e(console,"log")&&console.log(t)}function s(e,t){x&&t?alert(e):a(e)}function c(e){b.initialized=!0,b.supported=!1,s("Rangy is not supported in this environment. Reason: "+e,b.config.alertOnFail)}function f(e){s("Rangy warning: "+e,b.config.alertOnWarn)}function d(e){return e.message||e.description||String(e)}function u(){if(x&&!b.initialized){var t,n=!1,r=!1;e(document,"createRange")&&(t=document.createRange(),w(t,E)&&T(t,N)&&(n=!0));var s=i(document);if(!s||"body"!=s.nodeName.toLowerCase())return void c("No body element found");if(s&&e(s,"createTextRange")&&(t=s.createTextRange(),o(t)&&(r=!0)),!n&&!r)return void c("Neither Range nor TextRange are available");b.initialized=!0,b.features={implementsDomRange:n,implementsTextRange:r};var f,u;for(var l in D)(f=D[l])instanceof h&&f.init(f,b);for(var g=0,p=B.length;p>g;++g)try{B[g](b)}catch(m){u="Rangy init listener threw an exception. Continuing. Detail: "+d(m),a(u)}}}function l(e){e=e||window,u();for(var t=0,n=H.length;n>t;++t)H[t](e)}function h(e,t,n){this.name=e,this.dependencies=t,this.initialized=!1,this.supported=!1,this.initializer=n}function g(e,t,n){var r=new h(e,t,function(t){if(!t.initialized){t.initialized=!0;try{n(b,t),t.supported=!0}catch(r){var o="Module '"+e+"' failed to load: "+d(r);a(o),r.stack&&a(r.stack)}}});return D[e]=r,r}function p(){}function m(){}var R="object",v="function",C="undefined",N=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],E=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],S=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],y=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],w=r(e),O=r(t),T=r(n),_=[].forEach?function(e,t){e.forEach(t)}:function(e,t){for(var n=0,r=e.length;r>n;++n)t(e[n],n)},D={},x=typeof window!=C&&typeof document!=C,A={isHostMethod:e,isHostObject:t,isHostProperty:n,areHostMethods:w,areHostObjects:O,areHostProperties:T,isTextRange:o,getBody:i,forEach:_},b={version:"1.3.0-beta.2",initialized:!1,isBrowser:x,supported:!0,util:A,features:{},modules:D,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==C?!0:rangyAutoInitialize}};b.fail=c,b.warn=f;var P;({}).hasOwnProperty?(A.extend=P=function(e,t,n){var r,o;for(var i in t)t.hasOwnProperty(i)&&(r=e[i],o=t[i],n&&null!==r&&"object"==typeof r&&null!==o&&"object"==typeof o&&P(r,o,!0),e[i]=o);return t.hasOwnProperty("toString")&&(e.toString=t.toString),e},A.createOptions=function(e,t){var n={};return P(n,t),e&&P(n,e),n}):c("hasOwnProperty not supported"),x||c("Rangy can only run in a browser"),function(){var e;if(x){var t=document.createElement("div");t.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(t.childNodes,0)[0].nodeType&&(e=function(e){return n.call(e,0)})}catch(r){}}e||(e=function(e){for(var t=[],n=0,r=e.length;r>n;++n)t[n]=e[n];return t}),A.toArray=e}();var I;x&&(e(document,"addEventListener")?I=function(e,t,n){e.addEventListener(t,n,!1)}:e(document,"attachEvent")?I=function(e,t,n){e.attachEvent("on"+t,n)}:c("Document does not have required addEventListener or attachEvent method"),A.addListener=I);var B=[];b.init=u,b.addInitListener=function(e){b.initialized?e(b):B.push(e)};var H=[];b.addShimListener=function(e){H.push(e)},x&&(b.shim=b.createMissingNativeApi=l),h.prototype={init:function(){for(var e,t,n=this.dependencies||[],r=0,o=n.length;o>r;++r){if(t=n[r],e=D[t],!(e&&e instanceof h))throw new Error("required module '"+t+"' not found");if(e.init(),!e.supported)throw new Error("required module '"+t+"' not supported")}this.initializer(this)},fail:function(e){throw this.initialized=!0,this.supported=!1,new Error(e)},warn:function(e){b.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){b.warn("DEPRECATED: "+e+" in module "+this.name+"is deprecated. Please use "+t+" instead")},createError:function(e){return new Error("Error in Rangy "+this.name+" module: "+e)}},b.createModule=function(e){var t,n;2==arguments.length?(t=arguments[1],n=[]):(t=arguments[2],n=arguments[1]);var r=g(e,n,t);b.initialized&&b.supported&&r.init()},b.createCoreModule=function(e,t,n){g(e,t,n)},b.RangePrototype=p,b.rangePrototype=new p,b.selectionPrototype=new m,b.createCoreModule("DomUtil",[],function(e,t){function n(e){var t;return typeof e.namespaceURI==b||null===(t=e.namespaceURI)||"http://www.w3.org/1999/xhtml"==t}function r(e){var t=e.parentNode;return 1==t.nodeType?t:null}function o(e){for(var t=0;e=e.previousSibling;)++t;return t}function i(e){switch(e.nodeType){case 7:case 10:return 0;case 3:case 8:return e.length;default:return e.childNodes.length}}function a(e,t){var n,r=[];for(n=e;n;n=n.parentNode)r.push(n);for(n=t;n;n=n.parentNode)if(M(r,n))return n;return null}function s(e,t,n){for(var r=n?t:t.parentNode;r;){if(r===e)return!0;r=r.parentNode}return!1}function c(e,t){return s(e,t,!0)}function f(e,t,n){for(var r,o=n?e:e.parentNode;o;){if(r=o.parentNode,r===t)return o;o=r}return null}function d(e){var t=e.nodeType;return 3==t||4==t||8==t}function u(e){if(!e)return!1;var t=e.nodeType;return 3==t||8==t}function l(e,t){var n=t.nextSibling,r=t.parentNode;return n?r.insertBefore(e,n):r.appendChild(e),e}function h(e,t,n){var r=e.cloneNode(!1);if(r.deleteData(0,t),e.deleteData(t,e.length-t),l(r,e),n)for(var i,a=0;i=n[a++];)i.node==e&&i.offset>t?(i.node=r,i.offset-=t):i.node==e.parentNode&&i.offset>o(e)&&++i.offset;return r}function g(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!=b)return e.ownerDocument;if(typeof e.document!=b)return e.document;if(e.parentNode)return g(e.parentNode);throw t.createError("getDocument: no document found for node")}function p(e){var n=g(e);if(typeof n.defaultView!=b)return n.defaultView;if(typeof n.parentWindow!=b)return n.parentWindow;throw t.createError("Cannot get a window object for node")}function m(e){if(typeof e.contentDocument!=b)return e.contentDocument;if(typeof e.contentWindow!=b)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function R(e){if(typeof e.contentWindow!=b)return e.contentWindow;if(typeof e.contentDocument!=b)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")}function v(e){return e&&P.isHostMethod(e,"setTimeout")&&P.isHostObject(e,"document")}function C(e,t,n){var r;if(e?P.isHostProperty(e,"nodeType")?r=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?m(e):g(e):v(e)&&(r=e.document):r=document,!r)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return r}function N(e){for(var t;t=e.parentNode;)e=t;return e}function E(e,n,r,i){var s,c,d,u,l;if(e==r)return n===i?0:i>n?-1:1;if(s=f(r,e,!0))return n<=o(s)?-1:1;if(s=f(e,r,!0))return o(s)[index:"+o(e)+",length:"+e.childNodes.length+"]["+(e.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return e.nodeName}function w(e){for(var t,n=g(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n}function O(e,t,n){var r=I(e),o=e.createElement("div");o.contentEditable=""+!!n,t&&(o.innerHTML=t);var i=r.firstChild;return i?r.insertBefore(o,i):r.appendChild(o),o}function T(e){return e.parentNode.removeChild(e)}function _(e){this.root=e,this._next=e}function D(e){return new _(e)}function x(e,t){this.node=e,this.offset=t}function A(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}var b="undefined",P=e.util,I=P.getBody;P.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),P.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var B=document.createElement("div");P.areHostMethods(B,["insertBefore","appendChild","cloneNode"]||!P.areHostObjects(B,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),P.isHostProperty(B,"innerHTML")||t.fail("Element is missing innerHTML property");var H=document.createTextNode("test");P.areHostMethods(H,["splitText","deleteData","insertData","appendData","cloneNode"]||!P.areHostObjects(B,["previousSibling","nextSibling","childNodes","parentNode"])||!P.areHostProperties(H,["data"]))||t.fail("Incomplete Text Node implementation");var M=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1},k=!1;!function(){var t=document.createElement("b");t.innerHTML="1";var n=t.firstChild;t.innerHTML="",k=S(n),e.features.crashyTextNodes=k}();var L;typeof window.getComputedStyle!=b?L=function(e,t){return p(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!=b?L=function(e,t){return e.currentStyle[t]}:t.fail("No means of obtaining computed style properties found"),_.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},x.prototype={equals:function(e){return!!e&&this.node===e.node&&this.offset==e.offset},inspect:function(){return"[DomPosition("+y(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},A.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},A.prototype.toString=function(){return this.message},e.dom={arrayContains:M,isHtmlNamespace:n,parentElement:r,getNodeIndex:o,getNodeLength:i,getCommonAncestor:a,isAncestorOf:s,isOrIsAncestorOf:c,getClosestAncestorIn:f,isCharacterDataNode:d,isTextOrCommentNode:u,insertAfter:l,splitDataNode:h,getDocument:g,getWindow:p,getIframeWindow:R,getIframeDocument:m,getBody:I,isWindow:v,getContentDocument:C,getRootContainer:N,comparePoints:E,isBrokenNode:S,inspectNode:y,getComputedStyleProperty:L,createTestElement:O,removeNode:T,fragmentFromNodeChildren:w,createIterator:D,DomPosition:x},e.DOMException=A}),b.createCoreModule("DomRange",["DomUtil"],function(e){function t(e,t){return 3!=e.nodeType&&(F(e,t.startContainer)||F(e,t.endContainer))}function n(e){return e.document||j(e.startContainer)}function r(e){return new M(e.parentNode,W(e))}function o(e){return new M(e.parentNode,W(e)+1)}function i(e,t,n){var r=11==e.nodeType?e.firstChild:e;return L(t)?n==t.length?B.insertAfter(e,t):t.parentNode.insertBefore(e,0==n?t:U(t,n)):n>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[n]),r}function a(e,t,r){if(w(e),w(t),n(t)!=n(e))throw new k("WRONG_DOCUMENT_ERR");var o=z(e.startContainer,e.startOffset,t.endContainer,t.endOffset),i=z(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return r?0>=o&&i>=0:0>o&&i>0}function s(e){for(var t,r,o,i=n(e.range).createDocumentFragment();r=e.next();){if(t=e.isPartiallySelectedSubtree(),r=r.cloneNode(!t),t&&(o=e.getSubtreeIterator(),r.appendChild(s(o)),o.detach()),10==r.nodeType)throw new k("HIERARCHY_REQUEST_ERR");i.appendChild(r)}return i}function c(e,t,n){var r,o;n=n||{stop:!1};for(var i,a;i=e.next();)if(e.isPartiallySelectedSubtree()){if(t(i)===!1)return void(n.stop=!0);if(a=e.getSubtreeIterator(),c(a,t,n),a.detach(),n.stop)return}else for(r=B.createIterator(i);o=r.next();)if(t(o)===!1)return void(n.stop=!0)}function f(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(t=e.getSubtreeIterator(),f(t),t.detach()):e.remove()}function d(e){for(var t,r,o=n(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),r=e.getSubtreeIterator(),t.appendChild(d(r)),r.detach()):e.remove(),10==t.nodeType)throw new k("HIERARCHY_REQUEST_ERR");o.appendChild(t)}return o}function u(e,t,n){var r,o=!(!t||!t.length),i=!!n;o&&(r=new RegExp("^("+t.join("|")+")$"));var a=[];return c(new h(e,!1),function(t){if(!(o&&!r.test(t.nodeType)||i&&!n(t))){var s=e.startContainer;if(t!=s||!L(s)||e.startOffset!=s.length){var c=e.endContainer;t==c&&L(c)&&0==e.endOffset||a.push(t)}}}),a}function l(e){var t="undefined"==typeof e.getName?"Range":e.getName();return"["+t+"("+B.inspectNode(e.startContainer)+":"+e.startOffset+", "+B.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function h(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&L(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||L(this.sc)?V(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||L(this.ec)?V(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}function g(e){return function(t,n){for(var r,o=n?t:t.parentNode;o;){if(r=o.nodeType,Y(e,r))return o;o=o.parentNode}return null}}function p(e,t){if(rt(e,t))throw new k("INVALID_NODE_TYPE_ERR")}function m(e,t){if(!Y(t,e.nodeType))throw new k("INVALID_NODE_TYPE_ERR")}function R(e,t){if(0>t||t>(L(e)?e.length:e.childNodes.length))throw new k("INDEX_SIZE_ERR")}function v(e,t){if(tt(e,!0)!==tt(t,!0))throw new k("WRONG_DOCUMENT_ERR")}function C(e){if(nt(e,!0))throw new k("NO_MODIFICATION_ALLOWED_ERR")}function N(e,t){if(!e)throw new k(t)}function E(e){return G&&B.isBrokenNode(e)||!Y($,e.nodeType)&&!tt(e,!0)}function S(e,t){return t<=(L(e)?e.length:e.childNodes.length)}function y(e){return!!e.startContainer&&!!e.endContainer&&!E(e.startContainer)&&!E(e.endContainer)&&S(e.startContainer,e.startOffset)&&S(e.endContainer,e.endOffset)}function w(e){if(!y(e))throw new Error("Range error: Range is no longer valid after DOM mutation ("+e.inspect()+")")}function O(e,t){w(e);var n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,a=n===o;L(o)&&i>0&&i0&&r=W(n)&&i++,r=0),e.setStartAndEnd(n,r,o,i)}function T(e){w(e);var t=e.commonAncestorContainer.parentNode.cloneNode(!1);return t.appendChild(e.cloneContents()),t.innerHTML}function _(e){e.START_TO_START=ft,e.START_TO_END=dt,e.END_TO_END=ut,e.END_TO_START=lt,e.NODE_BEFORE=ht,e.NODE_AFTER=gt,e.NODE_BEFORE_AND_AFTER=pt,e.NODE_INSIDE=mt}function D(e){_(e),_(e.prototype)}function x(e,t){return function(){w(this);var n,r,i=this.startContainer,a=this.startOffset,s=this.commonAncestorContainer,f=new h(this,!0);i!==s&&(n=V(i,s,!0),r=o(n),i=r.node,a=r.offset),c(f,C),f.reset();var d=e(f);return f.detach(),t(this,i,a,i,a),d}}function A(n,i){function a(e,t){return function(n){m(n,Z),m(Q(n),$);var i=(e?r:o)(n);(t?s:c)(this,i.node,i.offset)}}function s(e,t,n){var r=e.endContainer,o=e.endOffset;(t!==e.startContainer||n!==e.startOffset)&&((Q(t)!=Q(r)||1==z(t,n,r,o))&&(r=t,o=n),i(e,t,n,r,o))}function c(e,t,n){var r=e.startContainer,o=e.startOffset;(t!==e.endContainer||n!==e.endOffset)&&((Q(t)!=Q(r)||-1==z(t,n,r,o))&&(r=t,o=n),i(e,r,o,t,n))}var u=function(){};u.prototype=e.rangePrototype,n.prototype=new u,H.extend(n.prototype,{setStart:function(e,t){p(e,!0),R(e,t),s(this,e,t)},setEnd:function(e,t){p(e,!0),R(e,t),c(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],n=e[1],r=t,o=n;switch(e.length){case 3:o=e[2];break;case 4:r=e[2],o=e[3]}i(this,t,n,r,o)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:a(!0,!0),setStartAfter:a(!1,!0),setEndBefore:a(!0,!1),setEndAfter:a(!1,!1),collapse:function(e){w(this),e?i(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):i(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){p(e,!0),i(this,e,0,e,q(e))},selectNode:function(e){p(e,!1),m(e,Z);var t=r(e),n=o(e);i(this,t.node,t.offset,n.node,n.offset)},extractContents:x(d,i),deleteContents:x(f,i),canSurroundContents:function(){w(this),C(this.startContainer),C(this.endContainer);var e=new h(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},splitBoundaries:function(){O(this)},splitBoundariesPreservingPositions:function(e){O(this,e)},normalizeBoundaries:function(){w(this);var e=this.startContainer,t=this.startOffset,n=this.endContainer,r=this.endOffset,o=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(n=e,r=e.length,e.appendData(t.data),X(t))},a=function(o){var i=o.previousSibling;if(i&&i.nodeType==o.nodeType){e=o;var a=o.length;if(t=i.length,o.insertData(0,i.data),X(i),e==n)r+=t,n=e;else if(n==o.parentNode){var s=W(o);r==s?(n=o,r=a):r>s&&r--}}},s=!0;if(L(n))n.length==r&&o(n);else{if(r>0){var c=n.childNodes[r-1];c&&L(c)&&o(c)}s=!this.collapsed}if(s){if(L(e))0==t&&a(e);else if(tx",it=3==ot.firstChild.nodeType}catch(at){}e.features.htmlParsingConforms=it;var st=it?function(e){var t=this.startContainer,n=j(t);if(!t)throw new k("INVALID_STATE_ERR");var r=null;return 1==t.nodeType?r=t:L(t)&&(r=B.parentElement(t)),r=null===r||"HTML"==r.nodeName&&B.isHtmlNamespace(j(r).documentElement)&&B.isHtmlNamespace(r)?n.createElement("body"):r.cloneNode(!1),r.innerHTML=e,B.fragmentFromNodeChildren(r)}:function(e){var t=n(this),r=t.createElement("body");return r.innerHTML=e,B.fragmentFromNodeChildren(r)},ct=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ft=0,dt=1,ut=2,lt=3,ht=0,gt=1,pt=2,mt=3;H.extend(e.rangePrototype,{compareBoundaryPoints:function(e,t){w(this),v(this.startContainer,t.startContainer);var n,r,o,i,a=e==lt||e==ft?"start":"end",s=e==dt||e==ft?"start":"end";return n=this[a+"Container"],r=this[a+"Offset"],o=t[s+"Container"],i=t[s+"Offset"],z(n,r,o,i)},insertNode:function(e){if(w(this),m(e,K),C(this.startContainer),F(e,this.startContainer))throw new k("HIERARCHY_REQUEST_ERR");var t=i(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){w(this);var e,t;if(this.collapsed)return n(this).createDocumentFragment();if(this.startContainer===this.endContainer&&L(this.startContainer))return e=this.startContainer.cloneNode(!0),e.data=e.data.slice(this.startOffset,this.endOffset),t=n(this).createDocumentFragment(),t.appendChild(e),t;var r=new h(this,!0);return e=s(r),r.detach(),e},canSurroundContents:function(){w(this),C(this.startContainer),C(this.endContainer);var e=new h(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},surroundContents:function(e){if(m(e,et),!this.canSurroundContents())throw new k("INVALID_STATE_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);i(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){w(this);for(var e,t=new I(n(this)),r=ct.length;r--;)e=ct[r],t[e]=this[e];return t},toString:function(){w(this);var e=this.startContainer;if(e===this.endContainer&&L(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new h(this,!0);return c(n,function(e){(3==e.nodeType||4==e.nodeType)&&t.push(e.data)}),n.detach(),t.join("")},compareNode:function(e){w(this);var t=e.parentNode,n=W(e);if(!t)throw new k("NOT_FOUND_ERR");var r=this.comparePoint(t,n),o=this.comparePoint(t,n+1);return 0>r?o>0?pt:ht:o>0?gt:mt},comparePoint:function(e,t){return w(this),N(e,"HIERARCHY_REQUEST_ERR"),v(e,this.startContainer),z(e,t,this.startContainer,this.startOffset)<0?-1:z(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:st,toHtml:function(){return T(this)},intersectsNode:function(e,t){if(w(this),N(e,"NOT_FOUND_ERR"),j(e)!==n(this))return!1;var r=e.parentNode,o=W(e);N(r,"NOT_FOUND_ERR");var i=z(r,o,this.endContainer,this.endOffset),a=z(r,o+1,this.startContainer,this.startOffset);return t?0>=i&&a>=0:0>i&&a>0},isPointInRange:function(e,t){return w(this),N(e,"HIERARCHY_REQUEST_ERR"),v(e,this.startContainer),z(e,t,this.startContainer,this.startOffset)>=0&&z(e,t,this.endContainer,this.endOffset)<=0},intersectsRange:function(e){return a(this,e,!1)},intersectsOrTouchesRange:function(e){return a(this,e,!0)},intersection:function(e){if(this.intersectsRange(e)){var t=z(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=z(this.endContainer,this.endOffset,e.endContainer,e.endOffset),r=this.cloneRange();return-1==t&&r.setStart(e.startContainer,e.startOffset),1==n&&r.setEnd(e.endContainer,e.endOffset),r}return null},union:function(e){if(this.intersectsOrTouchesRange(e)){var t=this.cloneRange();return-1==z(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==z(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new k("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==mt},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&this.comparePoint(e,q(e))<=0},containsRange:function(e){var t=this.intersection(e);return null!==t&&e.equals(t)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var r=n.pop();return t.setEnd(r,r.length),this.containsRange(t)}return this.containsNodeContents(e)},getNodes:function(e,t){return w(this),u(this,e,t)},getDocument:function(){return n(this)},collapseBefore:function(e){this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){this.setStartAfter(e),this.collapse(!0)},getBookmark:function(t){var r=n(this),o=e.createRange(r);t=t||B.getBody(r),o.selectNodeContents(t);var i=this.intersection(o),a=0,s=0;return i&&(o.setEnd(i.startContainer,i.startOffset),a=o.toString().length,s=a+i.toString().length),{start:a,end:s,containerNode:t}},moveToBookmark:function(e){var t=e.containerNode,n=0;this.setStart(t,0),this.collapse(!0);for(var r,o,i,a,s=[t],c=!1,f=!1;!f&&(r=s.pop());)if(3==r.nodeType)o=n+r.length,!c&&e.start>=n&&e.start<=o&&(this.setStart(r,e.start-n),c=!0),c&&e.end>=n&&e.end<=o&&(this.setEnd(r,e.end-n),f=!0),n=o;else for(a=r.childNodes,i=a.length;i--;)s.push(a[i])},getName:function(){return"DomRange"},equals:function(e){return I.rangesEqual(this,e)},isValid:function(){return y(this)},inspect:function(){return l(this)},detach:function(){}}),A(I,P),H.extend(I,{rangeProperties:ct,RangeIterator:h,copyComparisonConstants:D,createPrototypeRange:A,inspect:l,toHtml:T,getRangeDocument:n,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=I}),b.createCoreModule("WrappedRange",["DomRange"],function(e,t){var n,r,o=e.dom,i=e.util,a=o.DomPosition,s=e.DomRange,c=o.getBody,f=o.getContentDocument,d=o.isCharacterDataNode;if(e.features.implementsDomRange&&!function(){function r(e){for(var t,n=l.length;n--;)t=l[n],e[t]=e.nativeRange[t];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}function a(e,t,n,r,o){var i=e.startContainer!==t||e.startOffset!=n,a=e.endContainer!==r||e.endOffset!=o,s=!e.equals(e.nativeRange);(i||a||s)&&(e.setEnd(r,o),e.setStart(t,n))}var d,u,l=s.rangeProperties;n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,r(this)},s.createPrototypeRange(n,a),d=n.prototype,d.selectNode=function(e){this.nativeRange.selectNode(e),r(this)},d.cloneContents=function(){return this.nativeRange.cloneContents()},d.surroundContents=function(e){this.nativeRange.surroundContents(e),r(this)},d.collapse=function(e){this.nativeRange.collapse(e),r(this)},d.cloneRange=function(){return new n(this.nativeRange.cloneRange())},d.refresh=function(){r(this)},d.toString=function(){return this.nativeRange.toString()};var h=document.createTextNode("test");c(document).appendChild(h);var g=document.createRange();g.setStart(h,0),g.setEnd(h,0);try{g.setStart(h,1),d.setStart=function(e,t){this.nativeRange.setStart(e,t),r(this)},d.setEnd=function(e,t){this.nativeRange.setEnd(e,t),r(this)},u=function(e){return function(t){this.nativeRange[e](t),r(this)}}}catch(p){d.setStart=function(e,t){try{this.nativeRange.setStart(e,t)}catch(n){this.nativeRange.setEnd(e,t),this.nativeRange.setStart(e,t)}r(this)},d.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}r(this)},u=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(o){this.nativeRange[t](n),this.nativeRange[e](n)}r(this)}}}d.setStartBefore=u("setStartBefore","setEndBefore"),d.setStartAfter=u("setStartAfter","setEndAfter"),d.setEndBefore=u("setEndBefore","setStartBefore"),d.setEndAfter=u("setEndAfter","setStartAfter"),d.selectNodeContents=function(e){this.setStartAndEnd(e,0,o.getNodeLength(e))},g.selectNodeContents(h),g.setEnd(h,3);var m=document.createRange();m.selectNodeContents(h),m.setEnd(h,4),m.setStart(h,2),d.compareBoundaryPoints=-1==g.compareBoundaryPoints(g.START_TO_END,m)&&1==g.compareBoundaryPoints(g.END_TO_START,m)?function(e,t){return t=t.nativeRange||t,e==t.START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)};var R=document.createElement("div");R.innerHTML="123";var v=R.firstChild,C=c(document);C.appendChild(R),g.setStart(v,1),g.setEnd(v,2),g.deleteContents(),"13"==v.data&&(d.deleteContents=function(){this.nativeRange.deleteContents(),r(this)},d.extractContents=function(){var e=this.nativeRange.extractContents();return r(this),e}),C.removeChild(R),C=null,i.isHostMethod(g,"createContextualFragment")&&(d.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),c(document).removeChild(h),d.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return e=f(e,t,"createNativeRange"),e.createRange()}}(),e.features.implementsTextRange){var u=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var r=n.parentElement();n=e.duplicate(),n.collapse(!1);var i=n.parentElement(),a=r==i?r:o.getCommonAncestor(r,i);return a==t?a:o.getCommonAncestor(t,a)},l=function(e){return 0==e.compareEndPoints("StartToEnd",e)},h=function(e,t,n,r,i){var s=e.duplicate();s.collapse(n);var c=s.parentElement();if(o.isOrIsAncestorOf(t,c)||(c=t),!c.canHaveHTML){var f=new a(c.parentNode,o.getNodeIndex(c));return{boundaryPosition:f,nodeInfo:{nodeIndex:f.offset,containerElement:f.node}}}var u=o.getDocument(c).createElement("span");u.parentNode&&o.removeNode(u);for(var l,h,g,p,m,R=n?"StartToStart":"StartToEnd",v=i&&i.containerElement==c?i.nodeIndex:0,C=c.childNodes.length,N=C,E=N;;){if(E==C?c.appendChild(u):c.insertBefore(u,c.childNodes[E]),s.moveToElementText(u),l=s.compareEndPoints(R,e),0==l||v==N)break;if(-1==l){if(N==v+1)break;v=E}else N=N==v+1?v:E;E=Math.floor((v+N)/2),c.removeChild(u)}if(m=u.nextSibling,-1==l&&m&&d(m)){s.setEndPoint(n?"EndToStart":"EndToEnd",e);var S;if(/[\r\n]/.test(m.data)){var y=s.duplicate(),w=y.text.replace(/\r\n/g,"\r").length;for(S=y.moveStart("character",w);-1==(l=y.compareEndPoints("StartToEnd",y));)S++,y.moveStart("character",1)}else S=s.text.length;p=new a(m,S)}else h=(r||!n)&&u.previousSibling,g=(r||n)&&u.nextSibling,p=g&&d(g)?new a(g,0):h&&d(h)?new a(h,h.data.length):new a(c,o.getNodeIndex(u));return o.removeNode(u),{boundaryPosition:p,nodeInfo:{nodeIndex:E,containerElement:c}}},g=function(e,t){var n,r,i,a,s=e.offset,f=o.getDocument(e.node),u=c(f).createTextRange(),l=d(e.node);return l?(n=e.node,r=n.parentNode):(a=e.node.childNodes,n=s diff --git a/Leanote/editor/EditorAssets/editor.min.html b/Leanote/editor/EditorAssets/editor.min.html index e81c052..faec0ff 100755 --- a/Leanote/editor/EditorAssets/editor.min.html +++ b/Leanote/editor/EditorAssets/editor.min.html @@ -41,5 +41,11 @@ // $(document).ready(function() { ZSSEditor.init(callbacker, logger); + + if (/ipad/.test(location)) { + ZSSEditor.getField('zss_field_title').setHTML("你好啊 hello world"); + ZSSEditor.getField('zss_field_content').setHTML("你好 hello world"); + $('body').addClass('ipad-body'); + } });