Committer: vkurkin
LJSUP-10936: Disappearing content in the lj-cutU trunk/htdocs/js/ck/plugins/livejournal/plugin.js U trunk/htdocs/js/ck/plugins/livejournal/plugin.orig.js
Modified: trunk/htdocs/js/ck/plugins/livejournal/plugin.js =================================================================== --- trunk/htdocs/js/ck/plugins/livejournal/plugin.js 2012-01-12 12:16:57 UTC (rev 20885) +++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js 2012-01-12 12:30:22 UTC (rev 20886) @@ -1 +1 @@ -(function(){function B(d){function h(){var a=this.getAttribute("lj-cmd");if(c.hasOwnProperty(a))i[a].node=c[a].node,(new CKEDITOR.dom.selection(d.document)).selectElement(i[a].node),u=!0,d.execCommand(a),CKEDITOR.note.hide(!0);return!1}function l(){window.switchedRteOn||CKEDITOR.note.hide(!0);if(b){c=j;j=null;var d="",g;for(g in c)c.hasOwnProperty(g)&&(d+='<div class="noteItem">'+c[g].content+"</div>");e.innerHTML=decodeURIComponent(d);d=e.getElementsByTagName("a");g=0;for(var q=d.length;g<q;g++){var o= d[g];if(i.hasOwnProperty(o.getAttribute("lj-cmd")))o.onclick=h}}else c=null;w(b);a=null}var a,b,c,j,e=document.createElement("lj-note"),g="string"!=typeof document.body.style.opacity,w=function(){function a(){var d=c.shift(),d=(j?d.time/b:-(d.time/b-1)).toFixed(1);c.length||(d=j?1:0);g?e.style.filter=1<=d?null:"progid:DXImageTransform.Microsoft.Alpha(opacity="+100*d+")":e.style.opacity=d;0==d&&e&&e.parentNode&&e.parentNode.removeChild(e)}var b=100,d=60*b/1E3,c=[],j,i=document.getElementById("draft-container")|| document.body;return function(b){if((j=b)&&e.parentNode)g?e.style.filter=null:e.style.opacity=1;else for(b=1;b<=d;b++){var h=Math.floor(1E3/60)*b;c.push({time:h,timer:setTimeout(a,h)})}i.appendChild(e);e.style.marginTop=-e.offsetHeight/2+"px";e.style.marginLeft=-e.offsetWidth/2+"px"}}();e.className="note-popup";e.onmouseout=function(){(!c||!c.cmd)&&CKEDITOR.note.hide()};e.onmouseover=function(){a&&!b&&(b=1,a=clearTimeout(a))};g?e.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0)":e.style.opacity= 0;CKEDITOR.note={show:function(d,c){!c&&d==j||window.switchedRteOn||(a&&(a=clearTimeout(a)),b=1,j=d,!0===c?l():a=setTimeout(l,1E3))},hide:function(d){b&&(b=0,a&&(a=clearTimeout(a)),e.parentNode&&(!0===d?l():a=setTimeout(l,500)))}}}var h=CKEDITOR.dtd;h.$block["lj-template"]=1;h.$block["lj-raw"]=1;h.$block["lj-cut"]=1;h.$block["lj-poll"]=1;h.$block["lj-pq"]=1;h.$block["lj-pi"]=1;h.$nonEditable["lj-template"]=1;h["lj-template"]={};h["lj-map"]={};h["lj-raw"]=h.div;h["lj-cut"]=h.div;h["lj-poll"]={"lj-pq":1}; h["lj-pq"]={"#":1,"lj-pi":1};h["lj-pi"]={"#":1};h.$block.iframe=h.$inline.iframe;delete h.$inline.iframe;CKEDITOR.tools.extend(h.div,h.$block);CKEDITOR.tools.extend(h.$body,h.$block);delete h["lj-cut"]["lj-cut"];var l=[{label:top.CKLang.LJLike_button_facebook,id:"facebook",abbr:"fb",html:'<span class="lj-like-item fb">'+top.CKLang.LJLike_button_facebook+"</span>",htmlOpt:'<li class="like-fb"><input type="checkbox" id="like-fb" /><label for="like-fb">'+top.CKLang.LJLike_button_facebook+"</label></li>"}, {label:top.CKLang.LJLike_button_twitter,id:"twitter",abbr:"tw",html:'<span class="lj-like-item tw">'+top.CKLang.LJLike_button_twitter+"</span>",htmlOpt:'<li class="like-tw"><input type="checkbox" id="like-tw" /><label for="like-tw">'+top.CKLang.LJLike_button_twitter+"</label></li>"},{label:top.CKLang.LJLike_button_google,id:"google",abbr:"go",html:'<span class="lj-like-item go">'+top.CKLang.LJLike_button_google+"</span>",htmlOpt:'<li class="like-go"><input type="checkbox" id="like-go" /><label for="like-go">'+ top.CKLang.LJLike_button_google+"</label></li>"},{label:top.CKLang.LJLike_button_vkontakte,id:"vkontakte",abbr:"vk",html:'<span class="lj-like-item vk">'+top.CKLang.LJLike_button_vkontakte+"</span>",htmlOpt:window.isSupUser?'<li class="like-vk"><input type="checkbox" id="like-vk" /><label for="like-vk">'+top.CKLang.LJLike_button_vkontakte+"</label></li>":""},{label:top.CKLang.LJLike_button_give,id:"livejournal",abbr:"lj",html:'<span class="lj-like-item lj">'+top.CKLang.LJLike_button_give+"</span>", htmlOpt:'<li class="like-lj"><input type="checkbox" id="like-lj" /><label for="like-lj">'+top.CKLang.LJLike_button_give+"</label></li>"}],i={LJPollLink:{html:encodeURIComponent(top.CKLang.Poll_PollWizardNotice+'<br /><a href="#" lj-cmd="LJPollLink">'+top.CKLang.Poll_PollWizardNoticeLink+"</a>")},LJLike:{html:encodeURIComponent(top.CKLang.LJLike_WizardNotice+'<br /><a href="#" lj-cmd="LJLike">'+top.CKLang.LJLike_WizardNoticeLink+"</a>")},LJUserLink:{html:encodeURIComponent(top.CKLang.LJUser_WizardNotice+ '<br /><a href="#" lj-cmd="LJUserLink">'+top.CKLang.LJUser_WizardNoticeLink+"</a>")},LJLink:{html:encodeURIComponent(top.CKLang.LJLink_WizardNotice+'<br /><a href="#" lj-cmd="LJLink">'+top.CKLang.LJLink_WizardNoticeLink+"</a>")},image:{html:encodeURIComponent(top.CKLang.LJImage_WizardNotice+'<br /><a href="#" lj-cmd="image">'+top.CKLang.LJImage_WizardNoticeLink+"</a>")},LJCut:{html:encodeURIComponent(top.CKLang.LJCut_WizardNotice+'<br /><a href="#" lj-cmd="LJCut">'+top.CKLang.LJCut_WizardNoticeLink+ "</a>")}},t={},u;CKEDITOR.plugins.add("livejournal",{init:function(d){function h(a){if(this.$!=d.document.$)this.$.className=(this.frame.getAttribute("lj-class")||"")+" lj-selected","LJPollLink"==this.getAttribute("lj-cmd")&&this.frame.setStyle("height",this.getDocument().$.body.scrollHeight+"px"),(new CKEDITOR.dom.selection(d.document)).selectElement(this.frame);1==a.data.getKey()&&a.data.preventDefault()}function y(a){if(46==a.data.getKey())for(var a=(new CKEDITOR.dom.selection(d.document)).getRanges(), b=a.length;b--;)a[b].deleteContents()}function a(){var a=this.$.contentWindow.document,b=new CKEDITOR.dom.element.get(a.body);if(b.on&&(b.on("dblclick",j),b.on("click",h),b.on("keyup",y),"LJPollLink"==this.getAttribute("lj-cmd")&&this.hasAttribute("style")))a.body.className="lj-poll lj-poll-open";a=new CKEDITOR.dom.element.get(a);a.frame=b.frame=this}function b(){var b=d.document.getElementsByTag("iframe"),c=b.count(),n,k,f,e,m;for(u=!1;c--;)n=b.getItem(c),k=n.getAttribute("lj-cmd"),f=n.$.contentWindow, e=f.document,m=n.getAttribute("lj-style")||"",n.removeListener("load",a),n.on("load",a),e.open(),e.write('<!DOCTYPE html><html style="'+m+'"><head><style type="text/css">'+CKEDITOR.styleText+'</style></head><body scroll="no" class="'+(n.getAttribute("lj-class")||"")+'" style="'+m+'" '+(k?'lj-cmd="'+k+'"':"")+">"+decodeURIComponent(n.getAttribute("lj-content")||"")+"</body></html>"),e.close()}function c(a){if(!0===d.onSwitch)delete d.onSwitch;else{var b,c="click"==a.name,k="selectionChange"==a.name|| c,f=a.data.element||a.data.getTarget(),e;c&&(1==a.data.getKey()||0==a.data.$.button)&&a.data.preventDefault();1!=f.type&&(f=f.getParent());a=f;if(k){var f=d.document.getElementsByTag("iframe"),m;if(c&&a.is("iframe"))m=a.$.contentWindow.document.body,m.className=(a.getAttribute("lj-class")||"")+" lj-selected","LJPollLink"==a.getAttribute("lj-cmd")&&a.setStyle("height",m.scrollHeight+"px");for(var g=0,C=f.count();g<C;g++)if(c=f.getItem(g),c.$!=a.$)m=c.$.contentWindow.document.body,m.className=c.getAttribute("lj-class")|| "","LJPollLink"==c.getAttribute("lj-cmd")&&"lj-poll"==m.className&&c.removeAttribute("style")}do if(f=a.getAttribute("lj-cmd"),!f&&1==a.type&&(c=a.getParent(),a.is("img")&&c.getParent()&&!c.getParent().hasAttribute("lj:user")?(f="image",a.setAttribute("lj-cmd",f)):a.is("a")&&!c.hasAttribute("lj:user")&&(f="LJLink",a.setAttribute("lj-cmd",f))),f&&i.hasOwnProperty(f)){if(k)i[f].node=a,d.getCommand(f).setState(CKEDITOR.TRISTATE_ON);(b||(b={}))[f]={content:i[f].html,node:a}}while(a=a.getParent());if(k)for(e in i)if(i.hasOwnProperty(e)&& (!b||!b.hasOwnProperty(e)))delete i[e].node,d.getCommand(e).setState(CKEDITOR.TRISTATE_OFF);b?CKEDITOR.note.show(b):CKEDITOR.note.hide()}}function j(a){var b=a.data.element||a.data.getTarget();for(1!=b.type&&(b=b.getParent());b;){var c=b.getAttribute("lj-cmd");if(i.hasOwnProperty(c)){var k=d.getCommand(c);if(k.state==CKEDITOR.TRISTATE_ON){var f=new CKEDITOR.dom.selection(d.document);i[c].node=b.is("body")?new CKEDITOR.dom.element.get(b.getWindow().$.frameElement):b;f.selectElement(i[c].node);a.data.dialog= "";u=!0;k.exec();break}}b=b.getParent()}}function e(a){if(a&&a.length&&window.switchedRteOn){var c=new CKEDITOR.dom.element("iframe",d.document);c.setAttribute("lj-data",encodeURIComponent(a));c.setAttribute("lj-class","lj-embed");c.setAttribute("class","lj-embed-wrap");c.setAttribute("frameBorder",0);c.setAttribute("allowTransparency","true");d.insertElement(c);b()}}function g(){d.getCommand("LJLike")==CKEDITOR.TRISTATE_OFF&&(this.$.checked?o++:o--,r.getButton("LJLike_Ok").getElement()[0==o?"addClass": "removeClass"]("btn-disabled"))}d.dataProcessor.toHtml=function(a,b){a=a.replace(/(<lj [^>]+)(?!\/)>/gi,"$1 />").replace(/(<lj-map[^>]+)(?!\/)>/gi,"$1 />").replace(/(<lj-template[^>]*)(?!\/)>/gi,"$1 />").replace(/(<lj-cut.*?)\/>/gi,"$1>").replace(/<((?!br)[^\s>]+)([^>]*?)\/>/gi,"<$1$2></$1>").replace(/<lj-poll.*?>[\s\S]*?<\/lj-poll>/gi,function(a){a=new Poll(a);return'<iframe class="lj-poll-wrap" lj-class="lj-poll" frameborder="0" allowTransparency="true" lj-cmd="LJPollLink" lj-data="'+a.outputLJtags()+ '" lj-content="'+a.outputHTML()+'"></iframe>'}).replace(/<lj-embed(.*?)>([\s\S]*?)<\/lj-embed>/gi,function(a,b,d){return"<iframe"+b+' lj-class="lj-embed" class="lj-embed-wrap" lj-data="'+encodeURIComponent(d)+'" frameborder="0" allowTransparency="true"></iframe>'});$("event_format").checked||(a=a.replace(/(<lj-raw.*?>)([\s\S]*?)(<\/lj-raw>)/gi,function(a,b,d,c){return b+d.replace(/\n/g,"")+c}),window.switchedRteOn||(a=a.replace(/\n/g,"<br />")));a=CKEDITOR.htmlDataProcessor.prototype.toHtml.call(this, a,b);CKEDITOR.env.ie&&(a='<xml:namespace ns="livejournal" prefix="lj" />'+a);return a};d.dataProcessor.toDataFormat=function(a,b){a=CKEDITOR.htmlDataProcessor.prototype.toDataFormat.call(this,a,b);$("event_format").checked||(a=a.replace(/<br\s*\/>/gi,"\n"));return a.replace(/\t/g," ")};d.dataProcessor.writer.indentationChars="";d.dataProcessor.writer.lineBreakChars="";d.on("selectionChange",c);d.on("doubleclick",j);d.on("afterCommandExec",b);d.on("dialogHide",b);d.on("dataReady",function(){CKEDITOR.note|| B(d);d.document.on("click",c);d.document.on("mouseout",CKEDITOR.note.hide);d.document.on("mouseover",c);d.document.getBody().on("keyup",y);b()});var w=top.Site.siteroot+"/tools/endpoints/ljuser.bml";d.addCommand("LJUserLink",{exec:function(a){var b="",d=new CKEDITOR.dom.selection(a.document),c=i.LJUserLink.node,e;c?(CKEDITOR.note&&CKEDITOR.note.hide(!0),e=i.LJUserLink.node.getElementsByTag("b").getItem(0).getText(),b=prompt(top.CKLang.UserPrompt,e)):2==d.getType()&&(b=d.getSelectedText());""==b&& (b=prompt(top.CKLang.UserPrompt,b));b&&e!=b&&parent.HTTPReq.getJSON({data:parent.HTTPReq.formEncoded({username:b}),method:"POST",url:w,onData:function(d){if(d.error)alert(d.error);else if(d.success)d.ljuser=d.ljuser.replace('<span class="useralias-value">*</span>',""),t[b]=d.ljuser,d=new CKEDITOR.dom.element.createFromHtml(d.ljuser),d.setAttribute("lj-cmd","LJUserLink"),c?c.$.parentNode.replaceChild(d.$,c.$):a.insertElement(d)}})}});d.ui.addButton("LJUserLink",{label:top.CKLang.LJUser,command:"LJUserLink"}); d.ui.addButton("image",{label:d.lang.common.imageButton,command:"image"});window.ljphotoEnabled&&(d.addCommand("LJImage_beta",{exec:function(a){jQuery("#updateForm").photouploader({type:"upload"}).photouploader("show").bind("htmlready",function(b){for(var b=b.htmlStrings,d=0,c=b.length;d<c;d++)a.insertElement(new CKEDITOR.dom.element.createFromHtml(b[d],a.document))})},editorFocus:!1}),d.ui.addButton("LJImage_beta",{label:d.lang.common.imageButton,command:"LJImage_beta"}));d.addCommand("LJLink",{exec:function(a){!u&& this.state==CKEDITOR.TRISTATE_ON?a.execCommand("unlink"):a.openDialog("link");CKEDITOR.note&&CKEDITOR.note.hide(!0)},editorFocus:!1});d.ui.addButton("LJLink",{label:d.lang.link.toolbar,command:"LJLink"});d.addCommand("LJEmbedLink",{exec:function(){top.LJ_IPPU.textPrompt(top.CKLang.LJEmbedPromptTitle,top.CKLang.LJEmbedPrompt,e,{width:"350px"})}});d.ui.addButton("LJEmbedLink",{label:top.CKLang.LJEmbed,command:"LJEmbedLink"});d.addCommand("LJCut",{exec:function(){var a,b=i.LJCut.node;if(b){if(a=prompt(top.CKLang.CutPrompt, b.getAttribute("text")||top.CKLang.ReadMore))a==top.CKLang.ReadMore?b.removeAttribute("text"):b.setAttribute("text",a)}else{if(a=prompt(top.CKLang.CutPrompt,top.CKLang.ReadMore)){var b=new CKEDITOR.dom.selection(d.document),c=b.getRanges(),e=new CKEDITOR.dom.element("iframe",d.document),f=new CKEDITOR.dom.element("iframe",d.document);e.setAttribute("lj-cmd","LJCut");e.setAttribute("lj-class","lj-cut lj-cut-open");e.setAttribute("class","lj-cut-wrap");e.setAttribute("frameBorder",0);e.setAttribute("allowTransparency", "true");a!=top.CKLang.ReadMore&&e.setAttribute("text",a);f.setAttribute("lj-class","lj-cut lj-cut-close");f.setAttribute("class","lj-cut-wrap");f.setAttribute("frameBorder",0);f.setAttribute("allowTransparency","true");a=c[0];if(!0===a.collapsed)d.insertElement(f),f.insertBeforeMe(e),f.insertBeforeMe(new CKEDITOR.dom.element("br",d.document)),f.insertBeforeMe(new CKEDITOR.dom.element("br",d.document));else{b.lock();a.getTouchedStartNode();var g=new CKEDITOR.dom.documentFragment(d.document);g.append(e); for(var m=0,j=c.length;m<j;m++)g.append(c[m].extractContents());d.insertElement(f);f.insertBeforeMe(g);b.unlock()}e.insertBeforeMe(new CKEDITOR.dom.element("br",d.document));(new CKEDITOR.dom.element("br",d.document)).insertAfter(f);c.length=1;a.setStartAfter(e);a.setEndBefore(f);b.selectRanges(c)}CKEDITOR.note&&CKEDITOR.note.hide(!0)}},editorFocus:!1});d.ui.addButton("LJCut",{label:top.CKLang.LJCut,command:"LJCut"});(function(){function a(b,d){var d=void 0===d||d,c;if(i.LJLike.node)c=(c=b.getAttribute("lj-style"))? c.replace(/text-align:\s*(left|right|center)/i,"$1"):"left";else if(d)c=b.getComputedStyle("text-align");else{for(;!b.hasAttribute||!b.hasAttribute("align")&&!b.getStyle("text-align");){c=b.getParent();if(!c)break;b=c}c=b.getStyle("text-align")||b.getAttribute("align")||""}c&&(c=c.replace(/-moz-|-webkit-|start|auto/i,""));!c&&d&&(c="rtl"==b.getComputedStyle("direction")?"right":"left");return c}function b(c){if(!c.editor.readOnly){var e=c.editor.getCommand(this.name),c=c.data.element;e.state="LJLike"== (1==c.type&&c.hasAttribute("lj-cmd")&&c.getAttribute("lj-cmd"))?a(c,d.config.useComputedState)==this.value?CKEDITOR.TRISTATE_ON:CKEDITOR.TRISTATE_OFF:!c||1!=c.type||"body"==c.getName()||"iframe"==c.getName()?CKEDITOR.TRISTATE_OFF:a(c,d.config.useComputedState)==this.value?CKEDITOR.TRISTATE_ON:CKEDITOR.TRISTATE_OFF;e.fire("state")}}function c(a,b,d){this.name=b;this.value=d;if(a=a.config.justifyClasses){switch(d){case "left":this.cssClassName=a[0];break;case "center":this.cssClassName=a[1];break;case "right":this.cssClassName= a[2]}this.cssClassRegex=RegExp("(?:^|\\s+)(?:"+a.join("|")+")(?=$|\\s)")}}c.prototype={exec:function(b){var c=b.getSelection(),d=b.config.enterMode;if(c){var e=c.createBookmarks();if(i.LJLike.node)i.LJLike.node.setAttribute("lj-style","text-align: "+this.value);else for(var g=c.getRanges(!0),f=this.cssClassName,j,k,n=b.config.useComputedState,n=void 0===n||n,h=g.length-1;0<=h;h--){j=g[h];if((k=j.getEnclosedNode())&&k.is("iframe"))return;j=j.createIterator();for(j.enlargeBr=d!=CKEDITOR.ENTER_BR;k= j.getNextParagraph(d==CKEDITOR.ENTER_P?"p":"div");){k.removeAttribute("align");k.removeStyle("text-align");var l=f&&(k.$.className=CKEDITOR.tools.ltrim(k.$.className.replace(this.cssClassRegex,""))),A=this.state==CKEDITOR.TRISTATE_OFF&&(!n||a(k,!0)!=this.value);f?A?k.addClass(f):l||k.removeAttribute("class"):A&&k.setStyle("text-align",this.value)}}b.focus();b.forceNextSelectionCheck();c.selectBookmarks(e)}}};var e=new c(d,"LJJustifyLeft","left"),f=new c(d,"LJJustifyCenter","center"),g=new c(d,"LJJustifyRight", "right");d.addCommand("LJJustifyLeft",e);d.addCommand("LJJustifyCenter",f);d.addCommand("LJJustifyRight",g);d.ui.addButton("LJJustifyLeft",{label:d.lang.justify.left,command:"LJJustifyLeft"});d.ui.addButton("LJJustifyCenter",{label:d.lang.justify.center,command:"LJJustifyCenter"});d.ui.addButton("LJJustifyRight",{label:d.lang.justify.right,command:"LJJustifyRight"});d.on("selectionChange",CKEDITOR.tools.bind(b,e));d.on("selectionChange",CKEDITOR.tools.bind(b,g));d.on("selectionChange",CKEDITOR.tools.bind(b, f));d.on("dirChanged",function(a){var b=a.editor,c=new CKEDITOR.dom.range(b.document);c.setStartBefore(a.data.node);c.setEndAfter(a.data.node);for(var d=new CKEDITOR.dom.walker(c),e;e=d.next();)if(e.type==CKEDITOR.NODE_ELEMENT){var f=b.config.justifyClasses;if(!e.equals(a.data.node)&&e.getDirection())c.setStartAfter(e),d=new CKEDITOR.dom.walker(c);else switch(f&&(e.hasClass(f[0])?(e.removeClass(f[0]),e.addClass(f[2])):e.hasClass(f[2])&&(e.removeClass(f[2]),e.addClass(f[0]))),e.getStyle("text-align")){case "left":e.setStyle("text-align", "right");break;case "right":e.setStyle("text-align","left")}}})})();if(top.canmakepoll){var p;CKEDITOR.dialog.add("LJPollDialog",function(){var a=0,c,e,g,f=function(){this.removeListener&&this.removeListener("load",f);a&&c?(p=new Poll(i.LJPollLink.node&&decodeURIComponent(i.LJPollLink.node.getAttribute("lj-data")),e.document,g.document,e.Questions),e.ready(p),g.ready(p),c.style.display="block",CKEDITOR.note&&CKEDITOR.note.hide(!0)):a++},j=[new CKEDITOR.ui.button({type:"button",id:"LJPoll_Ok",label:d.lang.common.ok, onClick:function(a){a.data.dialog.hide();var c=new Poll(p,e.document,g.document,e.Questions),a=c.outputHTML(),c=c.outputLJtags();if(0<a.length){var f=i.LJPollLink.node;f?(f.setAttribute("lj-content",a),f.setAttribute("lj-data",c),f.removeAttribute("style"),f.$.contentWindow.document.body.className="lj-poll"):(f=new CKEDITOR.dom.element("iframe",d.document),f.setAttribute("lj-content",a),f.setAttribute("lj-cmd","LJPollLink"),f.setAttribute("lj-data",c),f.setAttribute("lj-class","lj-poll"),f.setAttribute("class", "lj-poll-wrap"),f.setAttribute("frameBorder",0),f.setAttribute("allowTransparency","true"),d.insertElement(f));i.LJPollLink.node=null;b()}}}),CKEDITOR.dialog.cancelButton];CKEDITOR.env.mac&&j.reverse();return{title:top.CKLang.Poll_PollWizardTitle,width:420,height:270,resizable:!1,onShow:function(){a&&(p=new Poll(i.LJPollLink.node&&unescape(i.LJPollLink.node.getAttribute("data")),e.document,g.document,e.Questions),e.ready(p),g.ready(p))},contents:[{id:"LJPoll_Setup",label:"Setup",padding:0,elements:[{type:"html", html:'<iframe src="/tools/ck_poll_setup.bml" allowTransparency="true" frameborder="0" style="width:100%; height:320px;"></iframe>',onShow:function(a){if(!c)(c=document.getElementById(a.sender.getButton("LJPoll_Ok").domId).parentNode).style.display="none";a=this.getElement("iframe");g=a.$.contentWindow;if(g.ready)f();else a.on("load",f)}}]},{id:"LJPoll_Questions",label:"Questions",padding:0,elements:[{type:"html",html:'<iframe src="/tools/ck_poll_questions.bml" allowTransparency="true" frameborder="0" style="width:100%; height:320px;"></iframe>', onShow:function(){var a=this.getElement("iframe");e=a.$.contentWindow;if(e.ready)f();else a.on("load",f)}}]}],buttons:j}});d.addCommand("LJPollLink",new CKEDITOR.dialogCommand("LJPollDialog"))}else d.addCommand("LJPollLink",{exec:function(){CKEDITOR.note&&CKEDITOR.note.show(top.CKLang.Poll_AccountLevelNotice,null,null,!0)}}),d.getCommand("LJPollLink").setState(CKEDITOR.TRISTATE_DISABLED);d.ui.addButton("LJPollLink",{label:top.CKLang.Poll,command:"LJPollLink"});var v=l.length,q='<div class="cke-dialog-likes"><ul class="cke-dialog-likes-list">', o=0,r,z;l.defaultButtons=[];for(var x=0;x<v;x++){var s=l[x];l[s.id]=l[s.abbr]=s;l.defaultButtons.push(s.id);q+=s.htmlOpt}q+='</ul><p class="cke-dialog-likes-faq">'+window.faqLink+"</p></div>";CKEDITOR.dialog.add("LJLikeDialog",function(){var a=[new CKEDITOR.ui.button({type:"button",id:"LJLike_Ok",label:d.lang.common.ok,onClick:function(){var a=[],b='<span class="lj-like-wrapper">',c=i.LJLike.node;if(r.getButton("LJLike_Ok").getElement().hasClass("btn-disabled"))return!1;for(var e=0;e<v;e++){var g= l[e],j=document.getElementById("like-"+g.abbr),h=c&&c.getAttribute("buttons");if(j&&j.checked||h&&!g.htmlOpt&&(h.indexOf(g.abbr)+1||h.indexOf(g.id)+1))a.push(g.id),b+=g.html}b+="</span>";a.length?c?(i.LJLike.node.setAttribute("buttons",a.join(",")),i.LJLike.node.setAttribute("lj-content",encodeURIComponent(b))):(c=new CKEDITOR.dom.element("iframe",d.document),c.setAttribute("lj-class","lj-like"),c.setAttribute("class","lj-like-wrap"),c.setAttribute("buttons",a.join(",")),c.setAttribute("lj-content", encodeURIComponent(b)),c.setAttribute("lj-cmd","LJLike"),c.setAttribute("frameBorder",0),c.setAttribute("allowTransparency","true"),d.insertElement(c)):c&&i.LJLike.node.remove();r.hide()}}),CKEDITOR.dialog.cancelButton];CKEDITOR.env.mac&&a.reverse();return{title:top.CKLang.LJLike_name,width:145,height:window.isSupUser?180:145,resizable:!1,contents:[{id:"LJLike_Options",elements:[{type:"html",html:q}]}],onShow:function(){var a=d.getCommand("LJLike"),b=o=0,a=a.state==CKEDITOR.TRISTATE_ON,c=i.LJLike.node&& i.LJLike.node.getAttribute("buttons");for(CKEDITOR.note&&CKEDITOR.note.hide(!0);b<v;b++){var e=c?!!(c.indexOf(l[b].abbr)+1||c.indexOf(l[b].id)+1):!0,g=document.getElementById("like-"+l[b].abbr);if(g)e&&!a&&o++,g.checked=e}0<o&&r.getButton("LJLike_Ok").getElement().removeClass("btn-disabled")},onLoad:function(){r=this;z=r.parts.contents.getElementsByTag("input");for(var a=0;a<v;a++){var b=z.getItem(a);b&&b.on("click",g)}},buttons:a}});d.addCommand("LJLike",new CKEDITOR.dialogCommand("LJLikeDialog")); d.ui.addButton("LJLike",{label:top.CKLang.LJLike_name,command:"LJLike"})},afterInit:function(d){function h(a){var b=new CKEDITOR.htmlParser.element("iframe");b.attributes["lj-class"]="lj-cut lj-cut-open";b.attributes["class"]="lj-cut-wrap";b.attributes["lj-cmd"]="LJCut";b.attributes.frameBorder=0;b.attributes.allowTransparency="true";if(a.attributes.hasOwnProperty("text"))b.attributes.text=a.attributes.text;a.children.unshift(b);b=new CKEDITOR.htmlParser.element("iframe");b.attributes["lj-class"]= "lj-cut lj-cut-close";b.attributes["class"]="lj-cut-wrap";b.attributes.frameBorder=0;b.attributes.allowTransparency="true";a.children.push(b);delete a.name}var i=d.dataProcessor;i.dataFilter.addRules({elements:{"lj-like":function(a){var b=[],c=new CKEDITOR.htmlParser.element("iframe");c.attributes["lj-class"]="lj-like";c.attributes["class"]="lj-like-wrap";if(a.attributes.hasOwnProperty("style"))c.attributes["lj-style"]=a.attributes.style;c.attributes["lj-cmd"]="LJLike";c.attributes["lj-content"]= '<span class="lj-like-wrapper">';c.attributes.frameBorder=0;c.attributes.allowTransparency="true";for(var a=a.attributes.buttons&&a.attributes.buttons.split(",")||l.defaultButtons,d=a.length,e=0;e<d;e++){var g=a[e].replace(/^\s*([a-z]{2,})\s*$/i,"$1"),h=l[g];h&&(c.attributes["lj-content"]+=encodeURIComponent(h.html),b.push(g))}c.attributes["lj-content"]+="</span>";c.attributes.buttons=b.join(",");return c},lj:function(){function a(b){for(var c=d.document.getElementsByTag("lj"),j=0,e=c.count();j<e;j++){var g= c.getItem(j),h=g.getAttribute("user"),i=g.getAttribute("title");if(b==(i?h+":"+i:h))h=new CKEDITOR.dom.element.createFromHtml(t[b],d.document),h.setAttribute("lj-cmd","LJUserLink"),g.insertBeforeMe(h),g.remove()}d.removeListener("dataReady",a)}return function(b){var c=b.attributes.user;if(c&&c.length){var j=(b=b.attributes.title)?c+":"+b:c;if(t.hasOwnProperty(j))return b=(new CKEDITOR.htmlParser.fragment.fromHtml(t[j])).children[0],b.attributes["lj-cmd"]="LJUserLink",b;var e={username:c};if(b)e.usertitle= b;HTTPReq.getJSON({data:HTTPReq.formEncoded(e),method:"POST",url:Site.siteroot+"/tools/endpoints/ljuser.bml",onError:function(a){alert(a+' "'+c+'"')},onData:function(b){if(b.error)return alert(b.error+' "'+username+'"');if(b.success)if(t[j]=b.ljuser,b.ljuser=b.ljuser.replace('<span class="useralias-value">*</span>',""),d.document)a(j);else d.on("dataReady",function(){a(j)})}})}}}(),"lj-map":function(a){var b=new CKEDITOR.htmlParser.element("iframe"),c="",d="",e=Number(a.attributes.width),g=Number(a.attributes.height); isNaN(e)||(c+="width:"+e+"px;",d+="width:"+(e-2)+"px;");isNaN(g)||(c+="height:"+g+"px;",d+="height:"+(g-2)+"px;");if(c.length)b.attributes.style=c,b.attributes["lj-style"]=d;b.attributes["lj-url"]=a.attributes.url?encodeURIComponent(a.attributes.url):"";b.attributes["lj-class"]="lj-map";b.attributes["class"]="lj-map-wrap";b.attributes["lj-content"]='<p class="lj-map">map</p>';b.attributes.frameBorder=0;b.attributes.allowTransparency="true";return b},"lj-repost":function(a){var b=new CKEDITOR.htmlParser.element("input"); b.attributes.type="button";b.attributes.value=a.attributes&&a.attributes.button||top.CKLang.LJRepost_Value;b.attributes["class"]="lj-repost";return b},"lj-raw":function(a){a.name="lj:raw"},"lj-wishlist":function(a){a.name="lj:wishlist"},"lj-template":function(a){a.name="lj:template";a.children.length=0},"lj-cut":h,iframe:function(a){if(a.attributes["lj-class"]&&1==a.attributes["lj-class"].indexOf("lj-")+1)return a;var b=new CKEDITOR.htmlParser.element("iframe"),c="",d="",e=Number(a.attributes.width), g=Number(a.attributes.height);isNaN(e)||(c+="width:"+e+"px;",d+="width:"+(e-2)+"px;");isNaN(g)||(c+="height:"+g+"px;",d+="height:"+(g-2)+"px;");if(c.length)b.attributes.style=c,b.attributes["lj-style"]=d;b.attributes["lj-url"]=a.attributes.src?encodeURIComponent(a.attributes.src):"";b.attributes["lj-class"]="lj-iframe";b.attributes["class"]="lj-iframe-wrap";b.attributes["lj-content"]='<p class="lj-iframe">iframe</p>';b.attributes.frameBorder=0;b.attributes.allowTransparency="true";return b},a:function(a){a.parent.attributes&& !a.parent.attributes["lj:user"]&&(a.attributes["lj-cmd"]="LJLink")},img:function(a){var b=a.parent&&a.parent.parent;if(!b||!b.attributes||!b.attributes["lj:user"])a.attributes["lj-cmd"]="image"},div:function(a){"lj-cut"==a.attributes["class"]&&h(a)}}},5);i.htmlFilter.addRules({elements:{iframe:function(a){var b=a,c=/lj-[a-z]+/i.exec(a.attributes["lj-class"]);if(c)c=c[0];else return a;switch(c){case "lj-like":b=new CKEDITOR.htmlParser.element("lj-like");b.attributes.buttons=a.attributes.buttons;if(a.attributes.hasOwnProperty("lj-style"))b.attributes.style= a.attributes["lj-style"];b.isEmpty=!0;b.isOptionalClose=!0;break;case "lj-embed":b=new CKEDITOR.htmlParser.element("lj-embed");b.attributes.id=a.attributes.id;if(a.attributes.hasOwnProperty("source_user"))b.attributes.source_user=a.attributes.source_user;b.children=(new CKEDITOR.htmlParser.fragment.fromHtml(decodeURIComponent(a.attributes["lj-data"]))).children;b.isOptionalClose=!0;break;case "lj-map":b=new CKEDITOR.htmlParser.element("lj-map");b.attributes.url=decodeURIComponent(a.attributes["lj-url"]); a.attributes.style&&(a.attributes.style+";").replace(/([a-z-]+):(.*?);/gi,function(a,c,d){b.attributes[c.toLowerCase()]=parseInt(d)});b.isOptionalClose=b.isEmpty=!0;break;case "lj-iframe":b=new CKEDITOR.htmlParser.element("iframe");b.attributes.src=decodeURIComponent(a.attributes["lj-url"]);a.attributes.style&&(a.attributes.style+";").replace(/([a-z-]+):(.*?);/gi,function(a,c,d){b.attributes[c.toLowerCase()]=parseInt(d)});b.attributes.frameBorder=0;break;case "lj-poll":b=(new CKEDITOR.htmlParser.fragment.fromHtml(decodeURIComponent(a.attributes["lj-data"]))).children[0]; break;case "lj-cut":if(a.attributes["lj-class"].indexOf("lj-cut-open")+1){c=a.next;b=new CKEDITOR.htmlParser.element("lj-cut");if(a.attributes.hasOwnProperty("text"))b.attributes.text=a.attributes.text;for(;c;){if("iframe"==c.name)if(a=c.attributes["lj-class"],a.indexOf("lj-cut-close")+1){b.next=c;break}else if(a.indexOf("lj-cut-open")+1){b.next=c;break}c.parent.children.remove(c);b.add(c);a=c.next;c.next=null;c=a}}else b=!1;break;default:a.children.length||(b=!1)}return b},span:function(a){var b= a.attributes["lj:user"];if(b){var c=new CKEDITOR.htmlParser.element("lj");c.attributes.user=b;try{var d=a.children[1].children[0].children[0].value}catch(e){return!1}if(d&&d!=b)c.attributes.title=d;c.isOptionalClose=c.isEmpty=!0;return c}if("display: none;"==a.attributes.style||!a.children.length)return!1},input:function(a){if("lj-repost"==a.attributes["class"]){var b=new CKEDITOR.htmlParser.element("lj-repost");if(a.attributes.value!=top.CKLang.LJRepost_Value)b.attributes.button=a.attributes.value; b.isOptionalClose=b.isEmpty=!0;return b}},div:function(a){if(!a.children.length)return!1},"lj:template":function(a){a.name="lj-template";a.isOptionalClose=a.isEmpty=!0},"lj:raw":function(a){a.name="lj-raw"},"lj:wishlist":function(a){a.name="lj-wishlist"}},attributes:{"lj-cmd":function(){return!1},contenteditable:function(){return!1}}})},requires:["fakeobjects","domiterator"]})})(); \ No newline at end of file +(function(){function B(d){function h(){var a=this.getAttribute("lj-cmd");if(c.hasOwnProperty(a))i[a].node=c[a].node,(new CKEDITOR.dom.selection(d.document)).selectElement(i[a].node),u=!0,d.execCommand(a),CKEDITOR.note.hide(!0);return!1}function l(){window.switchedRteOn||CKEDITOR.note.hide(!0);if(b){c=j;j=null;var d="",g;for(g in c)c.hasOwnProperty(g)&&(d+='<div class="noteItem">'+c[g].content+"</div>");e.innerHTML=decodeURIComponent(d);d=e.getElementsByTagName("a");g=0;for(var q=d.length;g<q;g++){var o= d[g];if(i.hasOwnProperty(o.getAttribute("lj-cmd")))o.onclick=h}}else c=null;w(b);a=null}var a,b,c,j,e=document.createElement("lj-note"),g="string"!=typeof document.body.style.opacity,w=function(){function a(){var d=c.shift(),d=(j?d.time/b:-(d.time/b-1)).toFixed(1);c.length||(d=j?1:0);g?e.style.filter=1<=d?null:"progid:DXImageTransform.Microsoft.Alpha(opacity="+100*d+")":e.style.opacity=d;0==d&&e&&e.parentNode&&e.parentNode.removeChild(e)}var b=100,d=60*b/1E3,c=[],j,i=document.getElementById("draft-container")|| document.body;return function(b){if((j=b)&&e.parentNode)g?e.style.filter=null:e.style.opacity=1;else for(b=1;b<=d;b++){var h=Math.floor(1E3/60)*b;c.push({time:h,timer:setTimeout(a,h)})}i.appendChild(e);e.style.marginTop=-e.offsetHeight/2+"px";e.style.marginLeft=-e.offsetWidth/2+"px"}}();e.className="note-popup";e.onmouseout=function(){(!c||!c.cmd)&&CKEDITOR.note.hide()};e.onmouseover=function(){a&&!b&&(b=1,a=clearTimeout(a))};g?e.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0)":e.style.opacity= 0;CKEDITOR.note={show:function(d,c){!c&&d==j||window.switchedRteOn||(a&&(a=clearTimeout(a)),b=1,j=d,!0===c?l():a=setTimeout(l,1E3))},hide:function(d){b&&(b=0,a&&(a=clearTimeout(a)),e.parentNode&&(!0===d?l():a=setTimeout(l,500)))}}}var h=CKEDITOR.dtd;h.$block["lj-template"]=1;h.$block["lj-raw"]=1;h.$block["lj-cut"]=1;h.$block["lj-poll"]=1;h.$block["lj-pq"]=1;h.$block["lj-pi"]=1;h.$nonEditable["lj-template"]=1;h["lj-template"]={};h["lj-map"]={};h["lj-raw"]=h.div;h["lj-cut"]=h.div;h["lj-poll"]={"lj-pq":1}; h["lj-pq"]={"#":1,"lj-pi":1};h["lj-pi"]={"#":1};h.$block.iframe=h.$inline.iframe;delete h.$inline.iframe;CKEDITOR.tools.extend(h.div,h.$block);CKEDITOR.tools.extend(h.$body,h.$block);delete h["lj-cut"]["lj-cut"];var l=[{label:top.CKLang.LJLike_button_facebook,id:"facebook",abbr:"fb",html:'<span class="lj-like-item fb">'+top.CKLang.LJLike_button_facebook+"</span>",htmlOpt:'<li class="like-fb"><input type="checkbox" id="like-fb" /><label for="like-fb">'+top.CKLang.LJLike_button_facebook+"</label></li>"}, {label:top.CKLang.LJLike_button_twitter,id:"twitter",abbr:"tw",html:'<span class="lj-like-item tw">'+top.CKLang.LJLike_button_twitter+"</span>",htmlOpt:'<li class="like-tw"><input type="checkbox" id="like-tw" /><label for="like-tw">'+top.CKLang.LJLike_button_twitter+"</label></li>"},{label:top.CKLang.LJLike_button_google,id:"google",abbr:"go",html:'<span class="lj-like-item go">'+top.CKLang.LJLike_button_google+"</span>",htmlOpt:'<li class="like-go"><input type="checkbox" id="like-go" /><label for="like-go">'+ top.CKLang.LJLike_button_google+"</label></li>"},{label:top.CKLang.LJLike_button_vkontakte,id:"vkontakte",abbr:"vk",html:'<span class="lj-like-item vk">'+top.CKLang.LJLike_button_vkontakte+"</span>",htmlOpt:window.isSupUser?'<li class="like-vk"><input type="checkbox" id="like-vk" /><label for="like-vk">'+top.CKLang.LJLike_button_vkontakte+"</label></li>":""},{label:top.CKLang.LJLike_button_give,id:"livejournal",abbr:"lj",html:'<span class="lj-like-item lj">'+top.CKLang.LJLike_button_give+"</span>", htmlOpt:'<li class="like-lj"><input type="checkbox" id="like-lj" /><label for="like-lj">'+top.CKLang.LJLike_button_give+"</label></li>"}],i={LJPollLink:{html:encodeURIComponent(top.CKLang.Poll_PollWizardNotice+'<br /><a href="#" lj-cmd="LJPollLink">'+top.CKLang.Poll_PollWizardNoticeLink+"</a>")},LJLike:{html:encodeURIComponent(top.CKLang.LJLike_WizardNotice+'<br /><a href="#" lj-cmd="LJLike">'+top.CKLang.LJLike_WizardNoticeLink+"</a>")},LJUserLink:{html:encodeURIComponent(top.CKLang.LJUser_WizardNotice+ '<br /><a href="#" lj-cmd="LJUserLink">'+top.CKLang.LJUser_WizardNoticeLink+"</a>")},LJLink:{html:encodeURIComponent(top.CKLang.LJLink_WizardNotice+'<br /><a href="#" lj-cmd="LJLink">'+top.CKLang.LJLink_WizardNoticeLink+"</a>")},image:{html:encodeURIComponent(top.CKLang.LJImage_WizardNotice+'<br /><a href="#" lj-cmd="image">'+top.CKLang.LJImage_WizardNoticeLink+"</a>")},LJCut:{html:encodeURIComponent(top.CKLang.LJCut_WizardNotice+'<br /><a href="#" lj-cmd="LJCut">'+top.CKLang.LJCut_WizardNoticeLink+ "</a>")}},t={},u;CKEDITOR.plugins.add("livejournal",{init:function(d){function h(a){if(this.$!=d.document.$)this.$.className=(this.frame.getAttribute("lj-class")||"")+" lj-selected","LJPollLink"==this.getAttribute("lj-cmd")&&this.frame.setStyle("height",this.getDocument().$.body.scrollHeight+"px"),(new CKEDITOR.dom.selection(d.document)).selectElement(this.frame);1==a.data.getKey()&&a.data.preventDefault()}function y(a){if(46==a.data.getKey())for(var a=(new CKEDITOR.dom.selection(d.document)).getRanges(), b=a.length;b--;)a[b].deleteContents()}function a(){var a=this.$.contentWindow.document,b=new CKEDITOR.dom.element.get(a.body);if(b.on&&(b.on("dblclick",j),b.on("click",h),b.on("keyup",y),"LJPollLink"==this.getAttribute("lj-cmd")&&this.hasAttribute("style")))a.body.className="lj-poll lj-poll-open";a=new CKEDITOR.dom.element.get(a);a.frame=b.frame=this}function b(){var b=d.document.getElementsByTag("iframe"),c=b.count(),n,k,f,e,m;for(u=!1;c--;)n=b.getItem(c),k=n.getAttribute("lj-cmd"),f=n.$.contentWindow, e=f.document,m=n.getAttribute("lj-style")||"",n.removeListener("load",a),n.on("load",a),e.open(),e.write('<!DOCTYPE html><html style="'+m+'"><head><style type="text/css">'+CKEDITOR.styleText+'</style></head><body scroll="no" class="'+(n.getAttribute("lj-class")||"")+'" style="'+m+'" '+(k?'lj-cmd="'+k+'"':"")+">"+decodeURIComponent(n.getAttribute("lj-content")||"")+"</body></html>"),e.close()}function c(a){if(!0===d.onSwitch)delete d.onSwitch;else{var b,c="click"==a.name,k="selectionChange"==a.name|| c,f=a.data.element||a.data.getTarget(),e;c&&(1==a.data.getKey()||0==a.data.$.button)&&a.data.preventDefault();1!=f.type&&(f=f.getParent());a=f;if(k){var f=d.document.getElementsByTag("iframe"),m;if(c&&a.is("iframe"))m=a.$.contentWindow.document.body,m.className=(a.getAttribute("lj-class")||"")+" lj-selected","LJPollLink"==a.getAttribute("lj-cmd")&&a.setStyle("height",m.scrollHeight+"px");for(var g=0,C=f.count();g<C;g++)if(c=f.getItem(g),c.$!=a.$)m=c.$.contentWindow.document.body,m.className=c.getAttribute("lj-class")|| "","LJPollLink"==c.getAttribute("lj-cmd")&&"lj-poll"==m.className&&c.removeAttribute("style")}do if(f=a.getAttribute("lj-cmd"),!f&&1==a.type&&(c=a.getParent(),a.is("img")&&c.getParent()&&!c.getParent().hasAttribute("lj:user")?(f="image",a.setAttribute("lj-cmd",f)):a.is("a")&&!c.hasAttribute("lj:user")&&(f="LJLink",a.setAttribute("lj-cmd",f))),f&&i.hasOwnProperty(f)){if(k)i[f].node=a,d.getCommand(f).setState(CKEDITOR.TRISTATE_ON);(b||(b={}))[f]={content:i[f].html,node:a}}while(a=a.getParent());if(k)for(e in i)if(i.hasOwnProperty(e)&& (!b||!b.hasOwnProperty(e)))delete i[e].node,d.getCommand(e).setState(CKEDITOR.TRISTATE_OFF);b?CKEDITOR.note.show(b):CKEDITOR.note.hide()}}function j(a){var b=a.data.element||a.data.getTarget();for(1!=b.type&&(b=b.getParent());b;){var c=b.getAttribute("lj-cmd");if(i.hasOwnProperty(c)){var k=d.getCommand(c);if(k.state==CKEDITOR.TRISTATE_ON){var f=new CKEDITOR.dom.selection(d.document);i[c].node=b.is("body")?new CKEDITOR.dom.element.get(b.getWindow().$.frameElement):b;f.selectElement(i[c].node);a.data.dialog= "";u=!0;k.exec();break}}b=b.getParent()}}function e(a){if(a&&a.length&&window.switchedRteOn){var c=new CKEDITOR.dom.element("iframe",d.document);c.setAttribute("lj-data",encodeURIComponent(a));c.setAttribute("lj-class","lj-embed");c.setAttribute("class","lj-embed-wrap");c.setAttribute("frameBorder",0);c.setAttribute("allowTransparency","true");d.insertElement(c);b()}}function g(){d.getCommand("LJLike")==CKEDITOR.TRISTATE_OFF&&(this.$.checked?o++:o--,r.getButton("LJLike_Ok").getElement()[0==o?"addClass": "removeClass"]("btn-disabled"))}d.dataProcessor.toHtml=function(a,b){a=a.replace(/(<lj [^>]+)(?!\/)>/gi,"$1 />").replace(/(<lj-map[^>]+)(?!\/)>/gi,"$1 />").replace(/(<lj-template[^>]*)(?!\/)>/gi,"$1 />").replace(/(<lj-cut.*?)\/>/gi,"$1>").replace(/<((?!br)[^\s>]+)([^>]*?)\/>/gi,"<$1$2></$1>").replace(/<lj-poll.*?>[\s\S]*?<\/lj-poll>/gi,function(a){a=new Poll(a);return'<iframe class="lj-poll-wrap" lj-class="lj-poll" frameborder="0" allowTransparency="true" lj-cmd="LJPollLink" lj-data="'+a.outputLJtags()+ '" lj-content="'+a.outputHTML()+'"></iframe>'}).replace(/<lj-embed(.*?)>([\s\S]*?)<\/lj-embed>/gi,function(a,b,d){return"<iframe"+b+' lj-class="lj-embed" class="lj-embed-wrap" lj-data="'+encodeURIComponent(d)+'" frameborder="0" allowTransparency="true"></iframe>'});$("event_format").checked||(a=a.replace(/(<lj-raw.*?>)([\s\S]*?)(<\/lj-raw>)/gi,function(a,b,d,c){return b+d.replace(/\n/g,"")+c}),window.switchedRteOn||(a=a.replace(/\n/g,"<br />")));a=CKEDITOR.htmlDataProcessor.prototype.toHtml.call(this, a,b);CKEDITOR.env.ie&&(a='<xml:namespace ns="livejournal" prefix="lj" />'+a);return a};d.dataProcessor.toDataFormat=function(a,b){a=CKEDITOR.htmlDataProcessor.prototype.toDataFormat.call(this,a,b);$("event_format").checked||(a=a.replace(/<br\s*\/>/gi,"\n"));return a.replace(/\t/g," ")};d.dataProcessor.writer.indentationChars="";d.dataProcessor.writer.lineBreakChars="";d.on("selectionChange",c);d.on("doubleclick",j);d.on("afterCommandExec",b);d.on("dialogHide",b);d.on("dataReady",function(){CKEDITOR.note|| B(d);d.document.on("click",c);d.document.on("mouseout",CKEDITOR.note.hide);d.document.on("mouseover",c);d.document.getBody().on("keyup",y);b()});var w=top.Site.siteroot+"/tools/endpoints/ljuser.bml";d.addCommand("LJUserLink",{exec:function(a){var b="",d=new CKEDITOR.dom.selection(a.document),c=i.LJUserLink.node,e;c?(CKEDITOR.note&&CKEDITOR.note.hide(!0),e=i.LJUserLink.node.getElementsByTag("b").getItem(0).getText(),b=prompt(top.CKLang.UserPrompt,e)):2==d.getType()&&(b=d.getSelectedText());""==b&& (b=prompt(top.CKLang.UserPrompt,b));b&&e!=b&&parent.HTTPReq.getJSON({data:parent.HTTPReq.formEncoded({username:b}),method:"POST",url:w,onData:function(d){if(d.error)alert(d.error);else if(d.success)d.ljuser=d.ljuser.replace('<span class="useralias-value">*</span>',""),t[b]=d.ljuser,d=new CKEDITOR.dom.element.createFromHtml(d.ljuser),d.setAttribute("lj-cmd","LJUserLink"),c?c.$.parentNode.replaceChild(d.$,c.$):a.insertElement(d)}})}});d.ui.addButton("LJUserLink",{label:top.CKLang.LJUser,command:"LJUserLink"}); d.ui.addButton("image",{label:d.lang.common.imageButton,command:"image"});window.ljphotoEnabled&&(d.addCommand("LJImage_beta",{exec:function(a){jQuery("#updateForm").photouploader({type:"upload"}).photouploader("show").bind("htmlready",function(b){for(var b=b.htmlStrings,d=0,c=b.length;d<c;d++)a.insertElement(new CKEDITOR.dom.element.createFromHtml(b[d],a.document))})},editorFocus:!1}),d.ui.addButton("LJImage_beta",{label:d.lang.common.imageButton,command:"LJImage_beta"}));d.addCommand("LJLink",{exec:function(a){!u&& this.state==CKEDITOR.TRISTATE_ON?a.execCommand("unlink"):a.openDialog("link");CKEDITOR.note&&CKEDITOR.note.hide(!0)},editorFocus:!1});d.ui.addButton("LJLink",{label:d.lang.link.toolbar,command:"LJLink"});d.addCommand("LJEmbedLink",{exec:function(){top.LJ_IPPU.textPrompt(top.CKLang.LJEmbedPromptTitle,top.CKLang.LJEmbedPrompt,e,{width:"350px"})}});d.ui.addButton("LJEmbedLink",{label:top.CKLang.LJEmbed,command:"LJEmbedLink"});d.addCommand("LJCut",{exec:function(){var a,b=i.LJCut.node;if(b){if(a=prompt(top.CKLang.CutPrompt, b.getAttribute("text")||top.CKLang.ReadMore))a==top.CKLang.ReadMore?b.removeAttribute("text"):b.setAttribute("text",a)}else{if(a=prompt(top.CKLang.CutPrompt,top.CKLang.ReadMore)){var b=new CKEDITOR.dom.selection(d.document),c=b.getRanges(),e=new CKEDITOR.dom.element("iframe",d.document),f=new CKEDITOR.dom.element("iframe",d.document);e.setAttribute("lj-cmd","LJCut");e.setAttribute("lj-class","lj-cut lj-cut-open");e.setAttribute("class","lj-cut-wrap");e.setAttribute("frameBorder",0);e.setAttribute("allowTransparency", "true");a!=top.CKLang.ReadMore&&e.setAttribute("text",a);f.setAttribute("lj-class","lj-cut lj-cut-close");f.setAttribute("class","lj-cut-wrap");f.setAttribute("frameBorder",0);f.setAttribute("allowTransparency","true");a=c[0];if(!0===a.collapsed)d.insertElement(f),f.insertBeforeMe(e),f.insertBeforeMe(new CKEDITOR.dom.element("br",d.document)),f.insertBeforeMe(new CKEDITOR.dom.element("br",d.document));else{b.lock();a.getTouchedStartNode();var g=new CKEDITOR.dom.documentFragment(d.document);g.append(e); for(var m=0,j=c.length;m<j;m++)g.append(c[m].extractContents());d.insertElement(f);f.insertBeforeMe(g);a.setStartAfter(e);a.setEndBefore(f);b.unlock()}e.insertBeforeMe(new CKEDITOR.dom.element("br",d.document));(new CKEDITOR.dom.element("br",d.document)).insertAfter(f);c.length=1;b.selectRanges(c)}CKEDITOR.note&&CKEDITOR.note.hide(!0)}},editorFocus:!1});d.ui.addButton("LJCut",{label:top.CKLang.LJCut,command:"LJCut"});(function(){function a(b,d){var d=void 0===d||d,c;if(i.LJLike.node)c=(c=b.getAttribute("lj-style"))? c.replace(/text-align:\s*(left|right|center)/i,"$1"):"left";else if(d)c=b.getComputedStyle("text-align");else{for(;!b.hasAttribute||!b.hasAttribute("align")&&!b.getStyle("text-align");){c=b.getParent();if(!c)break;b=c}c=b.getStyle("text-align")||b.getAttribute("align")||""}c&&(c=c.replace(/-moz-|-webkit-|start|auto/i,""));!c&&d&&(c="rtl"==b.getComputedStyle("direction")?"right":"left");return c}function b(c){if(!c.editor.readOnly){var e=c.editor.getCommand(this.name),c=c.data.element;e.state="LJLike"== (1==c.type&&c.hasAttribute("lj-cmd")&&c.getAttribute("lj-cmd"))?a(c,d.config.useComputedState)==this.value?CKEDITOR.TRISTATE_ON:CKEDITOR.TRISTATE_OFF:!c||1!=c.type||"body"==c.getName()||"iframe"==c.getName()?CKEDITOR.TRISTATE_OFF:a(c,d.config.useComputedState)==this.value?CKEDITOR.TRISTATE_ON:CKEDITOR.TRISTATE_OFF;e.fire("state")}}function c(a,b,d){this.name=b;this.value=d;if(a=a.config.justifyClasses){switch(d){case "left":this.cssClassName=a[0];break;case "center":this.cssClassName=a[1];break;case "right":this.cssClassName= a[2]}this.cssClassRegex=RegExp("(?:^|\\s+)(?:"+a.join("|")+")(?=$|\\s)")}}c.prototype={exec:function(b){var c=b.getSelection(),d=b.config.enterMode;if(c){var e=c.createBookmarks();if(i.LJLike.node)i.LJLike.node.setAttribute("lj-style","text-align: "+this.value);else for(var g=c.getRanges(!0),f=this.cssClassName,j,k,n=b.config.useComputedState,n=void 0===n||n,h=g.length-1;0<=h;h--){j=g[h];if((k=j.getEnclosedNode())&&k.is("iframe"))return;j=j.createIterator();for(j.enlargeBr=d!=CKEDITOR.ENTER_BR;k= j.getNextParagraph(d==CKEDITOR.ENTER_P?"p":"div");){k.removeAttribute("align");k.removeStyle("text-align");var l=f&&(k.$.className=CKEDITOR.tools.ltrim(k.$.className.replace(this.cssClassRegex,""))),A=this.state==CKEDITOR.TRISTATE_OFF&&(!n||a(k,!0)!=this.value);f?A?k.addClass(f):l||k.removeAttribute("class"):A&&k.setStyle("text-align",this.value)}}b.focus();b.forceNextSelectionCheck();c.selectBookmarks(e)}}};var e=new c(d,"LJJustifyLeft","left"),f=new c(d,"LJJustifyCenter","center"),g=new c(d,"LJJustifyRight", "right");d.addCommand("LJJustifyLeft",e);d.addCommand("LJJustifyCenter",f);d.addCommand("LJJustifyRight",g);d.ui.addButton("LJJustifyLeft",{label:d.lang.justify.left,command:"LJJustifyLeft"});d.ui.addButton("LJJustifyCenter",{label:d.lang.justify.center,command:"LJJustifyCenter"});d.ui.addButton("LJJustifyRight",{label:d.lang.justify.right,command:"LJJustifyRight"});d.on("selectionChange",CKEDITOR.tools.bind(b,e));d.on("selectionChange",CKEDITOR.tools.bind(b,g));d.on("selectionChange",CKEDITOR.tools.bind(b, f));d.on("dirChanged",function(a){var b=a.editor,c=new CKEDITOR.dom.range(b.document);c.setStartBefore(a.data.node);c.setEndAfter(a.data.node);for(var d=new CKEDITOR.dom.walker(c),e;e=d.next();)if(e.type==CKEDITOR.NODE_ELEMENT){var f=b.config.justifyClasses;if(!e.equals(a.data.node)&&e.getDirection())c.setStartAfter(e),d=new CKEDITOR.dom.walker(c);else switch(f&&(e.hasClass(f[0])?(e.removeClass(f[0]),e.addClass(f[2])):e.hasClass(f[2])&&(e.removeClass(f[2]),e.addClass(f[0]))),e.getStyle("text-align")){case "left":e.setStyle("text-align", "right");break;case "right":e.setStyle("text-align","left")}}})})();if(top.canmakepoll){var p;CKEDITOR.dialog.add("LJPollDialog",function(){var a=0,c,e,g,f=function(){this.removeListener&&this.removeListener("load",f);a&&c?(p=new Poll(i.LJPollLink.node&&decodeURIComponent(i.LJPollLink.node.getAttribute("lj-data")),e.document,g.document,e.Questions),e.ready(p),g.ready(p),c.style.display="block",CKEDITOR.note&&CKEDITOR.note.hide(!0)):a++},j=[new CKEDITOR.ui.button({type:"button",id:"LJPoll_Ok",label:d.lang.common.ok, onClick:function(a){a.data.dialog.hide();var c=new Poll(p,e.document,g.document,e.Questions),a=c.outputHTML(),c=c.outputLJtags();if(0<a.length){var f=i.LJPollLink.node;f?(f.setAttribute("lj-content",a),f.setAttribute("lj-data",c),f.removeAttribute("style"),f.$.contentWindow.document.body.className="lj-poll"):(f=new CKEDITOR.dom.element("iframe",d.document),f.setAttribute("lj-content",a),f.setAttribute("lj-cmd","LJPollLink"),f.setAttribute("lj-data",c),f.setAttribute("lj-class","lj-poll"),f.setAttribute("class", "lj-poll-wrap"),f.setAttribute("frameBorder",0),f.setAttribute("allowTransparency","true"),d.insertElement(f));i.LJPollLink.node=null;b()}}}),CKEDITOR.dialog.cancelButton];CKEDITOR.env.mac&&j.reverse();return{title:top.CKLang.Poll_PollWizardTitle,width:420,height:270,resizable:!1,onShow:function(){a&&(p=new Poll(i.LJPollLink.node&&unescape(i.LJPollLink.node.getAttribute("data")),e.document,g.document,e.Questions),e.ready(p),g.ready(p))},contents:[{id:"LJPoll_Setup",label:"Setup",padding:0,elements:[{type:"html", html:'<iframe src="/tools/ck_poll_setup.bml" allowTransparency="true" frameborder="0" style="width:100%; height:320px;"></iframe>',onShow:function(a){if(!c)(c=document.getElementById(a.sender.getButton("LJPoll_Ok").domId).parentNode).style.display="none";a=this.getElement("iframe");g=a.$.contentWindow;if(g.ready)f();else a.on("load",f)}}]},{id:"LJPoll_Questions",label:"Questions",padding:0,elements:[{type:"html",html:'<iframe src="/tools/ck_poll_questions.bml" allowTransparency="true" frameborder="0" style="width:100%; height:320px;"></iframe>', onShow:function(){var a=this.getElement("iframe");e=a.$.contentWindow;if(e.ready)f();else a.on("load",f)}}]}],buttons:j}});d.addCommand("LJPollLink",new CKEDITOR.dialogCommand("LJPollDialog"))}else d.addCommand("LJPollLink",{exec:function(){CKEDITOR.note&&CKEDITOR.note.show(top.CKLang.Poll_AccountLevelNotice,null,null,!0)}}),d.getCommand("LJPollLink").setState(CKEDITOR.TRISTATE_DISABLED);d.ui.addButton("LJPollLink",{label:top.CKLang.Poll,command:"LJPollLink"});var v=l.length,q='<div class="cke-dialog-likes"><ul class="cke-dialog-likes-list">', o=0,r,z;l.defaultButtons=[];for(var x=0;x<v;x++){var s=l[x];l[s.id]=l[s.abbr]=s;l.defaultButtons.push(s.id);q+=s.htmlOpt}q+='</ul><p class="cke-dialog-likes-faq">'+window.faqLink+"</p></div>";CKEDITOR.dialog.add("LJLikeDialog",function(){var a=[new CKEDITOR.ui.button({type:"button",id:"LJLike_Ok",label:d.lang.common.ok,onClick:function(){var a=[],b='<span class="lj-like-wrapper">',c=i.LJLike.node;if(r.getButton("LJLike_Ok").getElement().hasClass("btn-disabled"))return!1;for(var e=0;e<v;e++){var g= l[e],j=document.getElementById("like-"+g.abbr),h=c&&c.getAttribute("buttons");if(j&&j.checked||h&&!g.htmlOpt&&(h.indexOf(g.abbr)+1||h.indexOf(g.id)+1))a.push(g.id),b+=g.html}b+="</span>";a.length?c?(i.LJLike.node.setAttribute("buttons",a.join(",")),i.LJLike.node.setAttribute("lj-content",encodeURIComponent(b))):(c=new CKEDITOR.dom.element("iframe",d.document),c.setAttribute("lj-class","lj-like"),c.setAttribute("class","lj-like-wrap"),c.setAttribute("buttons",a.join(",")),c.setAttribute("lj-content", encodeURIComponent(b)),c.setAttribute("lj-cmd","LJLike"),c.setAttribute("frameBorder",0),c.setAttribute("allowTransparency","true"),d.insertElement(c)):c&&i.LJLike.node.remove();r.hide()}}),CKEDITOR.dialog.cancelButton];CKEDITOR.env.mac&&a.reverse();return{title:top.CKLang.LJLike_name,width:145,height:window.isSupUser?180:145,resizable:!1,contents:[{id:"LJLike_Options",elements:[{type:"html",html:q}]}],onShow:function(){var a=d.getCommand("LJLike"),b=o=0,a=a.state==CKEDITOR.TRISTATE_ON,c=i.LJLike.node&& i.LJLike.node.getAttribute("buttons");for(CKEDITOR.note&&CKEDITOR.note.hide(!0);b<v;b++){var e=c?!!(c.indexOf(l[b].abbr)+1||c.indexOf(l[b].id)+1):!0,g=document.getElementById("like-"+l[b].abbr);if(g)e&&!a&&o++,g.checked=e}0<o&&r.getButton("LJLike_Ok").getElement().removeClass("btn-disabled")},onLoad:function(){r=this;z=r.parts.contents.getElementsByTag("input");for(var a=0;a<v;a++){var b=z.getItem(a);b&&b.on("click",g)}},buttons:a}});d.addCommand("LJLike",new CKEDITOR.dialogCommand("LJLikeDialog")); d.ui.addButton("LJLike",{label:top.CKLang.LJLike_name,command:"LJLike"})},afterInit:function(d){function h(a){var b=new CKEDITOR.htmlParser.element("iframe");b.attributes["lj-class"]="lj-cut lj-cut-open";b.attributes["class"]="lj-cut-wrap";b.attributes["lj-cmd"]="LJCut";b.attributes.frameBorder=0;b.attributes.allowTransparency="true";if(a.attributes.hasOwnProperty("text"))b.attributes.text=a.attributes.text;a.children.unshift(b);b=new CKEDITOR.htmlParser.element("iframe");b.attributes["lj-class"]= "lj-cut lj-cut-close";b.attributes["class"]="lj-cut-wrap";b.attributes.frameBorder=0;b.attributes.allowTransparency="true";a.children.push(b);delete a.name}var i=d.dataProcessor;i.dataFilter.addRules({elements:{"lj-like":function(a){var b=[],c=new CKEDITOR.htmlParser.element("iframe");c.attributes["lj-class"]="lj-like";c.attributes["class"]="lj-like-wrap";if(a.attributes.hasOwnProperty("style"))c.attributes["lj-style"]=a.attributes.style;c.attributes["lj-cmd"]="LJLike";c.attributes["lj-content"]= '<span class="lj-like-wrapper">';c.attributes.frameBorder=0;c.attributes.allowTransparency="true";for(var a=a.attributes.buttons&&a.attributes.buttons.split(",")||l.defaultButtons,d=a.length,e=0;e<d;e++){var g=a[e].replace(/^\s*([a-z]{2,})\s*$/i,"$1"),h=l[g];h&&(c.attributes["lj-content"]+=encodeURIComponent(h.html),b.push(g))}c.attributes["lj-content"]+="</span>";c.attributes.buttons=b.join(",");return c},lj:function(){function a(b){for(var c=d.document.getElementsByTag("lj"),j=0,e=c.count();j<e;j++){var g= c.getItem(j),h=g.getAttribute("user"),i=g.getAttribute("title");if(b==(i?h+":"+i:h))h=new CKEDITOR.dom.element.createFromHtml(t[b],d.document),h.setAttribute("lj-cmd","LJUserLink"),g.insertBeforeMe(h),g.remove()}d.removeListener("dataReady",a)}return function(b){var c=b.attributes.user;if(c&&c.length){var j=(b=b.attributes.title)?c+":"+b:c;if(t.hasOwnProperty(j))return b=(new CKEDITOR.htmlParser.fragment.fromHtml(t[j])).children[0],b.attributes["lj-cmd"]="LJUserLink",b;var e={username:c};if(b)e.usertitle= b;HTTPReq.getJSON({data:HTTPReq.formEncoded(e),method:"POST",url:Site.siteroot+"/tools/endpoints/ljuser.bml",onError:function(a){alert(a+' "'+c+'"')},onData:function(b){if(b.error)return alert(b.error+' "'+c+'"');if(b.success)if(t[j]=b.ljuser,b.ljuser=b.ljuser.replace('<span class="useralias-value">*</span>',""),d.document)a(j);else d.on("dataReady",function(){a(j)})}})}}}(),"lj-map":function(a){var b=new CKEDITOR.htmlParser.element("iframe"),c="",d="",e=Number(a.attributes.width),g=Number(a.attributes.height); isNaN(e)||(c+="width:"+e+"px;",d+="width:"+(e-2)+"px;");isNaN(g)||(c+="height:"+g+"px;",d+="height:"+(g-2)+"px;");if(c.length)b.attributes.style=c,b.attributes["lj-style"]=d;b.attributes["lj-url"]=a.attributes.url?encodeURIComponent(a.attributes.url):"";b.attributes["lj-class"]="lj-map";b.attributes["class"]="lj-map-wrap";b.attributes["lj-content"]='<p class="lj-map">map</p>';b.attributes.frameBorder=0;b.attributes.allowTransparency="true";return b},"lj-repost":function(a){var b=new CKEDITOR.htmlParser.element("input"); b.attributes.type="button";b.attributes.value=a.attributes&&a.attributes.button||top.CKLang.LJRepost_Value;b.attributes["class"]="lj-repost";return b},"lj-raw":function(a){a.name="lj:raw"},"lj-wishlist":function(a){a.name="lj:wishlist"},"lj-template":function(a){a.name="lj:template";a.children.length=0},"lj-cut":h,iframe:function(a){if(a.attributes["lj-class"]&&1==a.attributes["lj-class"].indexOf("lj-")+1)return a;var b=new CKEDITOR.htmlParser.element("iframe"),c="",d="",e=Number(a.attributes.width), g=Number(a.attributes.height);isNaN(e)||(c+="width:"+e+"px;",d+="width:"+(e-2)+"px;");isNaN(g)||(c+="height:"+g+"px;",d+="height:"+(g-2)+"px;");if(c.length)b.attributes.style=c,b.attributes["lj-style"]=d;b.attributes["lj-url"]=a.attributes.src?encodeURIComponent(a.attributes.src):"";b.attributes["lj-class"]="lj-iframe";b.attributes["class"]="lj-iframe-wrap";b.attributes["lj-content"]='<p class="lj-iframe">iframe</p>';b.attributes.frameBorder=0;b.attributes.allowTransparency="true";return b},a:function(a){a.parent.attributes&& !a.parent.attributes["lj:user"]&&(a.attributes["lj-cmd"]="LJLink")},img:function(a){var b=a.parent&&a.parent.parent;if(!b||!b.attributes||!b.attributes["lj:user"])a.attributes["lj-cmd"]="image"},div:function(a){"lj-cut"==a.attributes["class"]&&h(a)}}},5);i.htmlFilter.addRules({elements:{iframe:function(a){var b=a,c=/lj-[a-z]+/i.exec(a.attributes["lj-class"]);if(c)c=c[0];else return a;switch(c){case "lj-like":b=new CKEDITOR.htmlParser.element("lj-like");b.attributes.buttons=a.attributes.buttons;if(a.attributes.hasOwnProperty("lj-style"))b.attributes.style= a.attributes["lj-style"];b.isEmpty=!0;b.isOptionalClose=!0;break;case "lj-embed":b=new CKEDITOR.htmlParser.element("lj-embed");b.attributes.id=a.attributes.id;if(a.attributes.hasOwnProperty("source_user"))b.attributes.source_user=a.attributes.source_user;b.children=(new CKEDITOR.htmlParser.fragment.fromHtml(decodeURIComponent(a.attributes["lj-data"]))).children;b.isOptionalClose=!0;break;case "lj-map":b=new CKEDITOR.htmlParser.element("lj-map");b.attributes.url=decodeURIComponent(a.attributes["lj-url"]); a.attributes.style&&(a.attributes.style+";").replace(/([a-z-]+):(.*?);/gi,function(a,c,d){b.attributes[c.toLowerCase()]=parseInt(d)});b.isOptionalClose=b.isEmpty=!0;break;case "lj-iframe":b=new CKEDITOR.htmlParser.element("iframe");b.attributes.src=decodeURIComponent(a.attributes["lj-url"]);a.attributes.style&&(a.attributes.style+";").replace(/([a-z-]+):(.*?);/gi,function(a,c,d){b.attributes[c.toLowerCase()]=parseInt(d)});b.attributes.frameBorder=0;break;case "lj-poll":b=(new CKEDITOR.htmlParser.fragment.fromHtml(decodeURIComponent(a.attributes["lj-data"]))).children[0]; break;case "lj-cut":if(a.attributes["lj-class"].indexOf("lj-cut-open")+1){c=a.next;b=new CKEDITOR.htmlParser.element("lj-cut");if(a.attributes.hasOwnProperty("text"))b.attributes.text=a.attributes.text;for(;c;){if("iframe"==c.name)if(a=c.attributes["lj-class"],a.indexOf("lj-cut-close")+1){b.next=c;break}else if(a.indexOf("lj-cut-open")+1){b.next=c;break}c.parent.children.remove(c);b.add(c);a=c.next;c.next=null;c=a}}else b=!1;break;default:a.children.length||(b=!1)}return b},span:function(a){var b= a.attributes["lj:user"];if(b){var c=new CKEDITOR.htmlParser.element("lj");c.attributes.user=b;try{var d=a.children[1].children[0].children[0].value}catch(e){return!1}if(d&&d!=b)c.attributes.title=d;c.isOptionalClose=c.isEmpty=!0;return c}if("display: none;"==a.attributes.style||!a.children.length)return!1},input:function(a){if("lj-repost"==a.attributes["class"]){var b=new CKEDITOR.htmlParser.element("lj-repost");if(a.attributes.value!=top.CKLang.LJRepost_Value)b.attributes.button=a.attributes.value; b.isOptionalClose=b.isEmpty=!0;return b}},div:function(a){if(!a.children.length)return!1},"lj:template":function(a){a.name="lj-template";a.isOptionalClose=a.isEmpty=!0},"lj:raw":function(a){a.name="lj-raw"},"lj:wishlist":function(a){a.name="lj-wishlist"}},attributes:{"lj-cmd":function(){return!1},contenteditable:function(){return!1}}})},requires:["fakeobjects","domiterator"]})})(); \ No newline at end of file Modified: trunk/htdocs/js/ck/plugins/livejournal/plugin.orig.js =================================================================== --- trunk/htdocs/js/ck/plugins/livejournal/plugin.orig.js 2012-01-12 12:16:57 UTC (rev 20885) +++ trunk/htdocs/js/ck/plugins/livejournal/plugin.orig.js 2012-01-12 12:30:22 UTC (rev 20886) @@ -246,8 +246,6 @@ }; } - var styleSheet; - CKEDITOR.plugins.add('livejournal', { init: function(editor) { @@ -653,6 +651,8 @@ } editor.insertElement(iframeClose); iframeClose.insertBeforeMe(fragment); + range.setStartAfter(iframeOpen); + range.setEndBefore(iframeClose); selection.unlock(); } @@ -660,8 +660,6 @@ new CKEDITOR.dom.element('br', editor.document).insertAfter(iframeClose); ranges.length = 1; - range.setStartAfter(iframeOpen); - range.setEndBefore(iframeClose); selection.selectRanges(ranges); } @@ -1237,7 +1235,7 @@ }, onData: function(data) { if (data.error) { - return alert(data.error + ' "' + username + '"'); + return alert(data.error + ' "' + ljUserName + '"'); } if (!data.success) {