!function(e,t){"use strict";function n(e,t){for(var n,r=[],i=0;i]+src=\"data:image[^>]+>/g,"")),n=r.fire("BeforePastePreProcess",{content:e}),n=r.fire("PastePreProcess",n),e=n.content,!n.isDefaultPrevented()){if(r.hasEventListeners("PastePostProcess")&&!n.isDefaultPrevented()){var a=o.add(r.getBody(),"div",{style:"display:none"},e);n=r.fire("PastePostProcess",{node:a}),o.remove(a),e=n.node.innerHTML}if(!n.isDefaultPrevented()){var s=r.selection.getNode();if("PRE"==s.nodeName){if(!t)try{t=$(e).text()}catch(l){}t=t.replace(//g,">"),r.insertRawContent(t)}else if(m.copyImage){var c=UrlPrefix,d={},u=(new Date).getTime();try{for(var f=$(""+e+"
"),i&&/^(PRE|DIV)$/.test(i.nodeName)||!a?e=n.filter(e,[[/\n/g,"
"]]):(e=n.filter(e,[[/\n\n/g,"
"+s],[/^(.*<\/p>)()$/,s+"$1"],[/\n/g,"
"]]),-1!=e.indexOf("
")&&(e=s+e)),o(e,t)}function s(){var e=r.dom,t=r.getBody(),n=r.dom.getViewPort(r.getWin()),i=r.inline?t.scrollTop:n.y,o=r.inline?t.clientHeight:n.h;l(),h=e.add(r.getBody(),"div",{id:"mcepastebin",contentEditable:!0,"data-mce-bogus":"1",style:"position: absolute; top: "+(i+20)+"px;width: 10px; height: "+(o-40)+"px; overflow: hidden; opacity: 0"},y),e.setStyle(h,"left","rtl"==e.getStyle(t,"direction",!0)?65535:-65535),e.bind(h,"beforedeactivate focusin focusout",function(e){e.stopPropagation()}),g=r.selection.getRng(),h.focus(),r.selection.select(h,!0)}function l(){h&&(r.dom.unbind(h),r.dom.remove(h),g&&r.selection.setRng(g)),b=!1,h=g=null}function c(){return h?h.innerHTML:y}function d(e){var t={},n=e.clipboardData||r.getDoc().dataTransfer;if(n&&n.types){t["text/plain"]=n.getData("Text");for(var i=0;i600&&(e.width=600),o.width=e.width,i.setAttrib(a,"width",o.width)),i.setAttrib(a,"src",n)}),i.setAttrib(a,"id",null)})},i.readAsDataURL(n),!0}return!1}var m=this,h,g,v=0,y="%MCEPASTEBIN%",b;r.on("keydown",function(n){if(!n.isDefaultPrevented()&&(t.metaKeyPressed(n)&&86==n.keyCode||n.shiftKey&&45==n.keyCode)){if(u())return;if(b=n.shiftKey&&86==n.keyCode,n.stopImmediatePropagation(),v=(new Date).getTime(),e.ie&&b)return n.preventDefault(),void r.fire("paste",{ieFake:!0});s()}}),r.on("paste",function(t){if(!u()){var i=d(t),f=(new Date).getTime()-v<100,p="text"==m.pasteFormat||b;f||t.preventDefault(),!e.ie||f&&!t.ieFake||(s(),r.dom.bind(h,"paste",function(e){e.stopPropagation()}),r.getDoc().execCommand("Paste",!1,null),i["text/html"]=c(),l()),setTimeout(function(){var e=c();h&&h.firstChild&&"mcepastebin"===h.firstChild.id&&(p=!0),l(),(e!=y&&f||(e=i["text/html"]||i["text/plain"]||y,e!=y))&&(p?a(i["text/plain"]||n.innerText(e)):o(e,i["text/plain"]))},0);try{}catch(t){}}}),m.pasteHtml=o,m.pasteText=a}}),r(h,[c,d,u,g,v,l],function(e,t,n,r,i,o){function a(e){return/class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(e)}function s(s){var l=s.settings;s.on("BeforePastePreProcess",function(c){function d(e){function t(e,t,a,s){var l=e._listLevel||o;l!=o&&(o>l?n&&(n=n.parent.parent):(r=n,n=null)),n&&n.name==a?n.append(e):(r=r||n,n=new i(a,1),s>1&&n.attr("start",""+s),e.wrap(n)),e.name="li",t.value="";var c=t.next;c&&3==c.type&&(c.value=c.value.replace(/^\u00a0+/,"")),l>o&&r&&r.lastChild.append(n),o=l}for(var n,r,o=1,a=e.getAll("p"),s=0;s/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,"\xa0"],[/([\s\u00a0]*)<\/span>/gi,function(e,t){return t.length>0?t.replace(/./," ").slice(Math.floor(t.length/2)).split("").join("\xa0"):""}]]);var h=l.paste_word_valid_elements;h||(h="@[style],-strong/b,-em/i,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-table,-tr,-td[colspan|rowspan],-th,-thead,-tfoot,-tbody,-a[!href],sub,sup,strike,br");var g=new n({valid_elements:h}),v=new t({},g);v.addAttributeFilter("style",function(e){for(var t=e.length,n;t--;)n=e[t],n.attr("style",u(n,n.attr("style"))),"span"!=n.name||n.attributes.length||n.unwrap()});var y=v.parse(f);d(y),c.content=new r({},g).serialize(y)}})}return s.isWordContent=a,s}),r(y,[p,c,h,l],function(e,t,n,r){return function(i){function o(e){i.on("BeforePastePreProcess",function(t){t.content=e(t.content)})}function a(e){return e=r.filter(e,[/^[\s\S]*|[\s\S]*$/g,[/\u00a0<\/span>/g,"\xa0"],/
$/])}function s(e){if(!n.isWordContent(e))return e;var o=[];t.each(i.schema.getBlockElements(),function(e,t){o.push(t)});var a=new RegExp("(?:
[\\s\\r\\n]+|
)*(<\\/?("+o.join("|")+")[^>]*>)(?:
[\\s\\r\\n]+|
)*","g");return e=r.filter(e,[[a,"$1"]]),e=r.filter(e,[[/
/g,"
"],[/
/g," "],[/
/g,"
"]])}function l(e){return(i.settings.paste_remove_styles||i.settings.paste_remove_styles_if_webkit!==!1)&&(e=e.replace(/ style=\"[^\"]+\"/g,"")),e}e.webkit&&(o(l),o(a)),e.ie&&o(s)}}),r(b,[C,f,h,y],function(e,t,n,r){var i,o;e.add("paste",function(e){function a(){"text"==c.pasteFormat?(this.active(!1),c.pasteFormat="html"):(c.pasteFormat="text",this.active(!0),i||(e.windowManager.alert("Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off."),i=!0))}function s(){c.copyImage?(this.active(!1),c.copyImage=!1):(c.copyImage=!0,this.active(!0),o||(e.windowManager.alert("When copy other site's images (not in leanote) into editor, it will copy the image into your album."),o=!0))}var l=this,c,d=e.settings;l.clipboard=c=new t(e),l.quirks=new r(e),l.wordFilter=new n(e),e.settings.paste_as_text&&(l.clipboard.pasteFormat="text"),d.paste_preprocess&&e.on("PastePreProcess",function(e){d.paste_preprocess.call(l,l,e)}),d.paste_postprocess&&e.on("PastePostProcess",function(e){d.paste_postprocess.call(l,l,e)}),e.addCommand("mceInsertClipboardContent",function(e,t){t.content&&l.clipboard.pasteHtml(t.content),t.text&&l.clipboard.pasteText(t.text)}),e.paste_block_drop&&e.on("dragend dragover draggesture dragdrop drop drag",function(e){e.preventDefault(),e.stopPropagation()}),e.settings.paste_data_images||e.on("drop",function(e){var t=e.dataTransfer;t&&t.files&&t.files.length>0&&e.preventDefault()}),e.addButton("pastetext",{icon:"pastetext",tooltip:"Paste as text",onclick:a,active:"text"==l.clipboard.pasteFormat}),e.addButton("pasteCopyImage",{icon:"copy",tooltip:"When Paste other site's image, copy it into my album as public image",onclick:s,active:l.clipboard.copyImage===!0}),e.addMenuItem("pastetext",{text:"Paste as text",selectable:!0,active:c.pasteFormat,onclick:a})})}),a([l,f,h,y,b])}(this);