Vlad Kurkin (b_vladi) wrote in changelog,
Vlad Kurkin
b_vladi
changelog

[livejournal] r21608: LJSV-1920: QOTD entries blank when using...

Committer: vkurkin
LJSV-1920: QOTD entries blank when using RTE in some browsers
U   trunk/htdocs/js/ck/plugins/livejournal/plugin.js
U   trunk/htdocs/js/ck/plugins/livejournal/plugin.orig.js
U   trunk/htdocs/js/livejournal.js
Modified: trunk/htdocs/js/ck/plugins/livejournal/plugin.js
===================================================================
--- trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2012-03-30 11:34:48 UTC (rev 21607)
+++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2012-03-30 11:39:55 UTC (rev 21608)
@@ -1,57 +1 @@
-(function(){function t(d){function f(){var a=this.getAttribute("lj-cmd");c.hasOwnProperty(a)&&(j[a].node=c[a].node,(new CKEDITOR.dom.selection(d.document)).selectElement(j[a].node),s=!0,d.execCommand(a),CKEDITOR.note.hide(!0));return!1}function m(){window.switchedRteOn||CKEDITOR.note.hide(!0);if(b){c=i;i=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 r=d.length;g<r;g++){var o=
-d[g];j.hasOwnProperty(o.getAttribute("lj-cmd"))&&(o.onclick=f)}}else c=null;k(b);a=null}var a,b,c,i,e=document.createElement("lj-note"),h="string"!=typeof document.body.style.opacity,k=function(){function a(){var k=b.shift(),k=(c?k.time/d:-(k.time/d-1)).toFixed(1);b.length||(k=c?1:0);h?e.style.filter=1<=k?null:"progid:DXImageTransform.Microsoft.Alpha(opacity="+100*k+")":e.style.opacity=k;0==k&&e&&e.parentNode&&e.parentNode.removeChild(e)}var d=100,k=60*d/1E3,b=[],c,l=document.getElementById("draft-container")||
-document.body;return function(d){if((c=d)&&e.parentNode)h?e.style.filter=null:e.style.opacity=1;else for(d=1;d<=k;d++){var g=Math.floor(1E3/60)*d;b.push({time:g,timer:setTimeout(a,g)})}l.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))};h?e.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0)":e.style.opacity=
-0;CKEDITOR.note={show:function(k,d){if((d||k!=i)&&window.switchedRteOn)a&&(a=clearTimeout(a)),b=1,i=k,!0===d?m():a=setTimeout(m,1E3)},hide:function(k){b&&(b=0,a&&(a=clearTimeout(a)),e.parentNode&&(!0===k?m():a=setTimeout(m,500)))}}}var m=[{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>"}],j={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>")},LJSpoiler:{html:encodeURIComponent(top.CKLang.LJSpoiler_WizardNotice+'<br /><a href="#" lj-cmd="LJSpoiler">'+top.CKLang.LJSpoiler_WizardNoticeLink+"</a>")}},p={},s,f=CKEDITOR.dtd;f.$block["lj-template"]=1;f.$block["lj-raw"]=1;f.$block["lj-cut"]=1;f.$block["lj-spoiler"]=1;f.$block["lj-poll"]=1;f.$block["lj-repost"]=1;f.$block["lj-pq"]=1;f.$block["lj-pi"]=1;f.$nonEditable["lj-template"]=1;f["lj-template"]={};f["lj-map"]={};f["lj-repost"]={};f["lj-raw"]=f.div;f["lj-poll"]={"lj-pq":1};f["lj-pq"]=
-{"#":1,"lj-pi":1};f["lj-pi"]={"#":1};f.$block.iframe=f.$inline.iframe;delete f.$inline.iframe;CKEDITOR.tools.extend(f["lj-cut"]={},f.$block);CKEDITOR.tools.extend(f["lj-spoiler"]={},f.$block);CKEDITOR.tools.extend(f["lj-cut"],f.$inline);CKEDITOR.tools.extend(f["lj-spoiler"],f.$inline);CKEDITOR.tools.extend(f.div,f.$block);CKEDITOR.tools.extend(f.$body,f.$block);delete f["lj-cut"]["lj-cut"];CKEDITOR.plugins.add("livejournal",{init:function(d){function f(a){var b=a.data.element||a.data.getTarget();
-for(1!=b.type&&(b=b.getParent());b;){var g=b.getAttribute("lj-cmd");if(j.hasOwnProperty(g)){var c=d.getCommand(g);if(c.state==CKEDITOR.TRISTATE_ON){var o=new CKEDITOR.dom.selection(d.document);j[g].node=b.is("body")?new CKEDITOR.dom.element.get(b.getWindow().$.frameElement):b;o.selectElement(j[g].node);a.data.dialog="";s=!0;c.exec();break}}b=b.getParent()}}function u(a){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 a(a){if(46==a.data.getKey())for(var a=(new CKEDITOR.dom.selection(d.document)).getRanges(),b=a.length;b--;)a[b].deleteContents()}function b(){var d=this.$.contentWindow.document,b=new CKEDITOR.dom.element.get(d.body);b.on&&(b.on("dblclick",f),b.on("click",u),b.on("keyup",a),"LJPollLink"==this.getAttribute("lj-cmd")&&
-this.hasAttribute("style")&&(d.body.className="lj-poll lj-poll-open"));d=new CKEDITOR.dom.element.get(d);d.frame=b.frame=this}function c(){var a=d.document.getElementsByTag("iframe"),c=a.count(),g,e,o,n;for(s=!1;c--;)g=a.getItem(c),e=g.getAttribute("lj-cmd"),o=g.$.contentWindow,o=o.document,n=g.getAttribute("lj-style")||"",g.removeListener("load",b),g.on("load",b),o.open(),o.write('<!DOCTYPE html><html style="'+n+'"><head><link rel="stylesheet" href="'+CKEDITOR.styleText+'" /></head><body scroll="no" class="'+
-(g.getAttribute("lj-class")||"")+'" style="'+n+'" '+(e?'lj-cmd="'+e+'"':"")+">"+decodeURIComponent(g.getAttribute("lj-content")||"")+"</body></html>"),o.close()}function i(a){if(!0===d.onSwitch)delete d.onSwitch;else{var b,g="click"==a.name,c="selectionChange"==a.name||g,e=a.data.element||a.data.getTarget(),n;g&&(1==a.data.getKey()||0==a.data.$.button)&&a.data.preventDefault();1!=e.type&&(e=e.getParent());a=e;if(c){var e=d.document.getElementsByTag("iframe"),l;g&&a.is("iframe")&&(l=a.$.contentWindow.document.body,
-l.className=(a.getAttribute("lj-class")||"")+" lj-selected","LJPollLink"==a.getAttribute("lj-cmd")&&a.setStyle("height",l.scrollHeight+"px"));for(var h=0,q=e.count();h<q;h++)g=e.getItem(h),g.$!=a.$&&(l=g.$.contentWindow.document.body,l.className=g.getAttribute("lj-class")||"","LJPollLink"==g.getAttribute("lj-cmd")&&"lj-poll"==l.className&&g.removeAttribute("style"))}do if(e=a.getAttribute("lj-cmd"),!e&&1==a.type&&(g=a.getParent(),a.is("img")&&g.getParent()&&!g.getParent().hasAttribute("lj:user")?
-(e="image",a.setAttribute("lj-cmd",e)):a.is("a")&&!g.hasAttribute("lj:user")&&(e="LJLink",a.setAttribute("lj-cmd",e))),e&&j.hasOwnProperty(e))c&&(j[e].node=a,d.getCommand(e).setState(CKEDITOR.TRISTATE_ON)),(b||(b={}))[e]={content:j[e].html,node:a};while(a=a.getParent());if(c)for(n in j)if(j.hasOwnProperty(n)&&(!b||!b.hasOwnProperty(n)))delete j[n].node,d.getCommand(n).setState(CKEDITOR.TRISTATE_OFF);b?CKEDITOR.note.show(b):CKEDITOR.note.hide()}}function e(a,b,g){var c,e=j[b].node;if(e){if(c=prompt(g.title,
-e.getAttribute("text")||g.text))c==g.text?e.removeAttribute("text"):e.setAttribute("text",c)}else{if(c=prompt(g.title,g.text)){d.focus();var e=new CKEDITOR.dom.selection(d.document),n=e.getRanges(),l=new CKEDITOR.dom.element("iframe",d.document),h=l.clone();l.setAttribute("lj-cmd",b);l.setAttribute("lj-class",a+" "+a+"-open");l.setAttribute("class",a+"-wrap");l.setAttribute("frameBorder",0);l.setAttribute("allowTransparency","true");c!=g.text&&l.setAttribute("text",c);h.setAttribute("lj-class",a+
-" "+a+"-close");h.setAttribute("class",a+"-wrap");h.setAttribute("frameBorder",0);h.setAttribute("allowTransparency","true");a=n[0];e.lock();b=new CKEDITOR.dom.element("br",d.document);g=b.clone();c=b.clone();var q=new CKEDITOR.dom.documentFragment(d.document);q.append(b.clone());q.append(l);q.append(g);if(!1===a.collapsed)for(var l=0,i=n.length;l<i;l++)q.append(n[l].extractContents());q.append(c);d.insertElement(h);b.clone().insertAfter(h);h.insertBeforeMe(q);a.setStart(g,0);a.setEnd(c,0);e.unlock();
-e.selectRanges(n)}CKEDITOR.note&&CKEDITOR.note.hide(!0)}}(function(){function a(b){return"/>"==b.slice(-2)?b:b.slice(0,-1)+"/>"}function b(a){a=new Poll(a);return'<iframe class="lj-poll-wrap" lj-class="lj-poll" frameborder="0" lj-cmd="LJPollLink" allowTransparency="true" lj-data="'+a.outputLJtags()+'" lj-content="'+a.outputHTML()+'"></iframe>'}function c(a,b,d){return'<iframe class="lj-embed-wrap" lj-class="lj-embed" frameborder="0" allowTransparency="true" lj-data="'+encodeURIComponent(d)+'"'+b+
-"></iframe>"}function e(a,b,d,c){return b+d.replace(/\n/g,"")+c}function h(a,b,d,c){a=b||d||top.CKLang.LJRepost_Value;b=c.replace(/"/g,"&quot;");c=b+('<br /><input type="button" value="'+a+'" />').replace(/"/g,"&quot;");return'<iframe class="lj-repost-wrap" lj-class="lj-repost" frameborder="0" allowTransparency="true" lj-text="'+b+'" lj-button="'+a+'" lj-content="'+c+'"></iframe>'}d.dataProcessor.toHtml=function(d,l){d=d.replace(/<lj [^>]*?>/gi,a).replace(/<lj-map [^>]*?>/gi,a).replace(/<lj-template[^>]*?>/gi,
-a).replace(/(<lj-cut[^>]*?)\/>/gi,"$1>").replace(/<((?!br)[^\s>]+)([^>]*?)\/>/gi,"<$1$2></$1>").replace(/<lj-poll.*?>[\s\S]*?<\/lj-poll>/gi,b).replace(/<lj-repost\s*(?:button\s*=\s*(?:"([^"]*?)")|(?:"([^']*?)"))?.*?>([\s\S]*?)<\/lj-repost>/gi,h).replace(/<lj-embed(.*?)>([\s\S]*?)<\/lj-embed>/gi,c);$("event_format").checked||(d=d.replace(/(<lj-raw.*?>)([\s\S]*?)(<\/lj-raw>)/gi,e),window.switchedRteOn||(d=d.replace(/\n/g,"<br />")));d=CKEDITOR.htmlDataProcessor.prototype.toHtml.call(this,d,l);CKEDITOR.env.ie&&
-(d='<xml:namespace ns="livejournal" prefix="lj" />'+d);return d}})();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",i);d.on("doubleclick",f);d.on("afterCommandExec",c);d.on("dialogHide",c);d.on("dataReady",function(){CKEDITOR.note||t(d);CKEDITOR.env.ie&&
-(d.document.getBody().on("dragend",c),d.document.getBody().on("paste",function(){setTimeout(c,0)}));d.document.on("click",i);d.document.on("mouseout",CKEDITOR.note.hide);d.document.on("mouseover",i);d.document.getBody().on("keyup",a);c()});(function(){var a=top.Site.siteroot+"/tools/endpoints/ljuser.bml";d.addCommand("LJUserLink",{exec:function(b){var c="",b=new CKEDITOR.dom.selection(b.document),e=j.LJUserLink.node,h;e?(CKEDITOR.note&&CKEDITOR.note.hide(!0),h=j.LJUserLink.node.getElementsByTag("b").getItem(0).getText(),
-c=prompt(top.CKLang.UserPrompt,h)):2==b.getType()&&(c=b.getSelectedText());""==c&&(c=prompt(top.CKLang.UserPrompt,c));c&&h!=c&&parent.HTTPReq.getJSON({data:parent.HTTPReq.formEncoded({username:c}),method:"POST",url:a,onData:function(a){var b=c;if(a.error)alert(a.error);else if(a.success){a.ljuser=a.ljuser.replace('<span class="useralias-value">*</span>',"");p[b]=a.ljuser;a=new CKEDITOR.dom.element.createFromHtml(a.ljuser);a.setAttribute("lj-cmd","LJUserLink");e?e.$.parentNode.replaceChild(a.$,e.$):
-d.insertElement(a)}}})}});d.ui.addButton("LJUserLink",{label:top.CKLang.LJUser,command:"LJUserLink"})})();d.ui.addButton("image",{label:top.CKLang.LJImage_Title,command:"image"});window.ljphotoEnabled&&(d.addCommand("LJImage_beta",{exec:function(){InOb.handleInsertImageBeta("upload")},editorFocus:!1}),d.ui.addButton("LJImage_beta",{label:top.CKLang.LJImage_BetaTitle,command:"LJImage_beta"}));d.addCommand("LJLink",{exec:function(a){!s&&this.state==CKEDITOR.TRISTATE_ON?a.execCommand("unlink"):a.openDialog("link");
-CKEDITOR.note&&CKEDITOR.note.hide(true)},editorFocus:!1});d.ui.addButton("LJLink",{label:d.lang.link.toolbar,command:"LJLink"});(function(){function a(b){if(b&&b.length&&window.switchedRteOn){var e=new CKEDITOR.dom.element("iframe",d.document);e.setAttribute("lj-data",encodeURIComponent(b));e.setAttribute("lj-class","lj-embed");e.setAttribute("class","lj-embed-wrap");e.setAttribute("frameBorder",0);e.setAttribute("allowTransparency","true");d.insertElement(e);c()}}d.addCommand("LJEmbedLink",{exec:function(){top.LJ_IPPU.textPrompt(top.CKLang.LJEmbedPromptTitle,
-top.CKLang.LJEmbedPrompt,a,{width:"350px"})}});d.ui.addButton("LJEmbedLink",{label:top.CKLang.LJEmbed,command:"LJEmbedLink"})})();d.addCommand("LJCut",{exec:function(){e("lj-cut","LJCut",{title:top.CKLang.LJCut_PromptTitle,text:top.CKLang.LJCut_PromptText})},editorFocus:!1});d.ui.addButton("LJCut",{label:top.CKLang.LJCut_Title,command:"LJCut"});d.addCommand("LJSpoiler",{exec:function(){e("lj-spoiler","LJSpoiler",{title:top.CKLang.LJSpoiler_PromptTitle,text:top.CKLang.LJSpoiler_PromptText})},editorFocus:!1});
-d.ui.addButton("LJSpoiler",{label:top.CKLang.LJSpoiler_Title,command:"LJSpoiler"});(function(){function a(b,d){var d=d===void 0||d,c;if(j.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=b.getComputedStyle("direction")=="rtl"?"right":"left");return c}function b(c){if(!c.editor.readOnly){var e=c.editor.getCommand(this.name),c=c.data.element;e.state=(c.type==1&&c.hasAttribute("lj-cmd")&&c.getAttribute("lj-cmd"))=="LJLike"?a(c,d.config.useComputedState)==this.value?CKEDITOR.TRISTATE_ON:CKEDITOR.TRISTATE_OFF:!c||c.type!=1||c.getName()=="body"||c.getName()=="iframe"?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(j.LJLike.node)j.LJLike.node.setAttribute("lj-style","text-align: "+this.value);else for(var h=c.getRanges(true),
-g=this.cssClassName,i,f,o=b.config.useComputedState,o=o===void 0||o,r=h.length-1;r>=0;r--){i=h[r];if((f=i.getEnclosedNode())&&f.is("iframe"))return;i=i.createIterator();for(i.enlargeBr=d!=CKEDITOR.ENTER_BR;f=i.getNextParagraph(d==CKEDITOR.ENTER_P?"p":"div");){f.removeAttribute("align");f.removeStyle("text-align");var n=g&&(f.$.className=CKEDITOR.tools.ltrim(f.$.className.replace(this.cssClassRegex,""))),m=this.state==CKEDITOR.TRISTATE_OFF&&(!o||a(f,true)!=this.value);g?m?f.addClass(g):n||f.removeAttribute("class"):
-m&&f.setStyle("text-align",this.value)}}b.focus();b.forceNextSelectionCheck();c.selectBookmarks(e)}}};var e=new c(d,"LJJustifyLeft","left"),h=new c(d,"LJJustifyCenter","center"),i=new c(d,"LJJustifyRight","right");d.addCommand("LJJustifyLeft",e);d.addCommand("LJJustifyCenter",h);d.addCommand("LJJustifyRight",i);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,i));d.on("selectionChange",CKEDITOR.tools.bind(b,h));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 g=b.config.justifyClasses;if(!e.equals(a.data.node)&&e.getDirection()){c.setStartAfter(e);
-d=new CKEDITOR.dom.walker(c)}else{if(g)if(e.hasClass(g[0])){e.removeClass(g[0]);e.addClass(g[2])}else if(e.hasClass(g[2])){e.removeClass(g[2]);e.addClass(g[0])}switch(e.getStyle("text-align")){case "left":e.setStyle("text-align","right");break;case "right":e.setStyle("text-align","left")}}}})})();if(top.canmakepoll){var h;CKEDITOR.dialog.add("LJPollDialog",function(){var a=0,b,e,i,f=function(){this.removeListener&&this.removeListener("load",f);if(a&&b){h=new Poll(j.LJPollLink.node&&decodeURIComponent(j.LJPollLink.node.getAttribute("lj-data")),
-e.document,i.document,e.Questions);e.ready(h);i.ready(h);b.style.display="block";CKEDITOR.note&&CKEDITOR.note.hide(true)}else a++},n=[new CKEDITOR.ui.button({type:"button",id:"LJPoll_Ok",label:d.lang.common.ok,onClick:function(a){a.data.dialog.hide();var b=new Poll(h,e.document,i.document,e.Questions),a=b.outputHTML(),b=b.outputLJtags();if(a.length>0){var f=j.LJPollLink.node;if(f){f.setAttribute("lj-content",a);f.setAttribute("lj-data",b);f.removeAttribute("style");f.$.contentWindow.document.body.className=
-"lj-poll"}else{f=new CKEDITOR.dom.element("iframe",d.document);f.setAttribute("lj-content",a);f.setAttribute("lj-cmd","LJPollLink");f.setAttribute("lj-data",b);f.setAttribute("lj-class","lj-poll");f.setAttribute("class","lj-poll-wrap");f.setAttribute("frameBorder",0);f.setAttribute("allowTransparency","true");d.insertElement(f)}j.LJPollLink.node=null;c()}}}),CKEDITOR.dialog.cancelButton];CKEDITOR.env.mac&&n.reverse();return{title:top.CKLang.Poll_PollWizardTitle,width:420,height:270,resizable:false,
-onShow:function(){if(a){h=new Poll(j.LJPollLink.node&&unescape(j.LJPollLink.node.getAttribute("data")),e.document,i.document,e.Questions);e.ready(h);i.ready(h)}},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(!b)(b=document.getElementById(a.sender.getButton("LJPoll_Ok").domId).parentNode).style.display="none";a=this.getElement("iframe");
-i=a.$.contentWindow;if(i.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:n}});d.addCommand("LJPollLink",new CKEDITOR.dialogCommand("LJPollDialog"))}else d.addCommand("LJPollLink",{exec:function(){CKEDITOR.note&&
-CKEDITOR.note.show(top.CKLang.Poll_AccountLevelNotice,null,null,true)}}),d.getCommand("LJPollLink").setState(CKEDITOR.TRISTATE_DISABLED);d.ui.addButton("LJPollLink",{label:top.CKLang.Poll_Title,command:"LJPollLink"});(function(){function a(){if(d.getCommand("LJLike")==CKEDITOR.TRISTATE_OFF){this.$.checked?e++:e--;h.getButton("LJLike_Ok").getElement()[e==0?"addClass":"removeClass"]("btn-disabled")}}var b=m.length,c='<div class="cke-dialog-likes"><ul class="cke-dialog-likes-list">',e=0,h,f;m.defaultButtons=
-[];for(var i=0;i<b;i++){var p=m[i];m[p.id]=m[p.abbr]=p;m.defaultButtons.push(p.id);c=c+p.htmlOpt}c=c+('</ul><p class="cke-dialog-likes-faq">'+window.faqLink+"</p></div>");CKEDITOR.dialog.add("LJLikeDialog",function(){var i=[new CKEDITOR.ui.button({type:"button",id:"LJLike_Ok",label:d.lang.common.ok,onClick:function(){var a=[],c='<span class="lj-like-wrapper">',e=j.LJLike.node;if(h.getButton("LJLike_Ok").getElement().hasClass("btn-disabled"))return false;for(var f=0;f<b;f++){var i=m[f],g=document.getElementById("like-"+
-i.abbr),k=e&&e.getAttribute("buttons");if(g&&g.checked||k&&!i.htmlOpt&&(k.indexOf(i.abbr)+1||k.indexOf(i.id)+1)){a.push(i.id);c=c+i.html}}c=c+"</span>";if(a.length)if(e){j.LJLike.node.setAttribute("buttons",a.join(","));j.LJLike.node.setAttribute("lj-content",encodeURIComponent(c))}else{e=new CKEDITOR.dom.element("iframe",d.document);e.setAttribute("lj-class","lj-like");e.setAttribute("class","lj-like-wrap");e.setAttribute("buttons",a.join(","));e.setAttribute("lj-content",encodeURIComponent(c));
-e.setAttribute("lj-cmd","LJLike");e.setAttribute("frameBorder",0);e.setAttribute("allowTransparency","true");d.insertElement(e)}else e&&j.LJLike.node.remove();h.hide()}}),CKEDITOR.dialog.cancelButton];CKEDITOR.env.mac&&i.reverse();return{title:top.CKLang.LJLike_name,width:145,height:window.isSupUser?180:145,resizable:false,contents:[{id:"LJLike_Options",elements:[{type:"html",html:c}]}],onShow:function(){var a=d.getCommand("LJLike"),c=e=0,a=a.state==CKEDITOR.TRISTATE_ON,i=j.LJLike.node&&j.LJLike.node.getAttribute("buttons");
-for(CKEDITOR.note&&CKEDITOR.note.hide(true);c<b;c++){var f=i?!!(i.indexOf(m[c].abbr)+1||i.indexOf(m[c].id)+1):true,g=document.getElementById("like-"+m[c].abbr);if(g){f&&!a&&e++;g.checked=f}}e>0&&h.getButton("LJLike_Ok").getElement().removeClass("btn-disabled")},onLoad:function(){h=this;f=h.parts.contents.getElementsByTag("input");for(var c=0;c<b;c++){var e=f.getItem(c);e&&e.on("click",a)}},buttons:i}});d.addCommand("LJLike",new CKEDITOR.dialogCommand("LJLikeDialog"));d.ui.addButton("LJLike",{label:top.CKLang.LJLike_name,
-command:"LJLike"})})()},afterInit:function(d){function f(a,b,c,d){var d=d||"text",e=new CKEDITOR.htmlParser.element("iframe");e.attributes["lj-class"]=b+" "+b+"-open";e.attributes["class"]=b+"-wrap";e.attributes["lj-cmd"]=c;e.attributes.frameBorder=0;e.attributes.allowTransparency="true";a.attributes.hasOwnProperty(d)&&(e.attributes.text=a.attributes[d]);a.children.unshift(e);c=new CKEDITOR.htmlParser.element("iframe");c.attributes["lj-class"]=b+" "+b+"-close";c.attributes["class"]=b+"-wrap";c.attributes.frameBorder=
-0;c.attributes.allowTransparency="true";a.children.push(c);delete a.name}var j=d.dataProcessor;j.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";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(",")||m.defaultButtons,d=a.length,e=0;e<d;e++){var f=a[e].replace(/^\s*([a-z]{2,})\s*$/i,"$1"),k=m[f];k&&(c.attributes["lj-content"]+=encodeURIComponent(k.html),b.push(f))}c.attributes["lj-content"]+="</span>";c.attributes.buttons=b.join(",");return c},lj:function(){function a(b){for(var c=d.document.getElementsByTag("lj"),f=0,e=c.count();f<e;f++){var h=c.getItem(f);if(h){var k=h.getAttribute("user"),j=h.getAttribute("title");if(b==
-(j?k+":"+j:k))k=new CKEDITOR.dom.element.createFromHtml(p[b],d.document),k.setAttribute("lj-cmd","LJUserLink"),h.insertBeforeMe(k),h.remove()}}d.removeListener("dataReady",a)}return function(b){var c=b.attributes.user;if(c&&c.length){var f=(b=b.attributes.title)?c+":"+b:c;if(p.hasOwnProperty(f))return b=(new CKEDITOR.htmlParser.fragment.fromHtml(p[f])).children[0],b.attributes["lj-cmd"]="LJUserLink",b;var e={username:c};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){p[f]=b.ljuser;b.ljuser=b.ljuser.replace('<span class="useralias-value">*</span>',"");if(d.document)a(f);else d.on("dataReady",function(){a(f)})}}})}}}(),"lj-map":function(a){var b=new CKEDITOR.htmlParser.element("iframe"),c="",d="",e=Number(a.attributes.width),f=Number(a.attributes.height);isNaN(e)||(c+="width:"+e+"px;",d+="width:"+(e-
-2)+"px;");isNaN(f)||(c+="height:"+f+"px;",d+="height:"+(f-2)+"px;");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-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":function(a){f(a,"lj-cut","LJCut")},"lj-spoiler":function(a){f(a,"lj-spoiler","LJSpoiler","title")},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),f=Number(a.attributes.height);isNaN(e)||(c+="width:"+e+"px;",d+="width:"+(e-2)+"px;");isNaN(f)||(c+="height:"+f+"px;",d+="height:"+(f-2)+"px;");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"]&&f(a,"lj-cut","LJCut")}}},5);j.htmlFilter.addRules({elements:{iframe:function(a){var b=a,c=!1,d="text",e=/lj-[a-z]+/i.exec(a.attributes["lj-class"]);if(e)e=e[0];else return a;switch(e){case "lj-like":b=new CKEDITOR.htmlParser.element("lj-like");b.attributes.buttons=a.attributes.buttons;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;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-repost":b=new CKEDITOR.htmlParser.element("lj-repost");
-b.attributes.button=a.attributes["lj-button"];b.children=(new CKEDITOR.htmlParser.fragment.fromHtml(a.attributes["lj-text"])).children;break;case "lj-spoiler":c=!0,d="title";case "lj-cut":if(a.attributes["lj-class"].indexOf(e+"-open")+1){var f=a.next,j=0,b=new CKEDITOR.htmlParser.element(e);for(a.attributes.hasOwnProperty("text")&&(b.attributes[d]=a.attributes.text);f;){if("iframe"==f.name)if(a=f.attributes["lj-class"],a.indexOf(e+"-close")+1)if(c&&j)j--;else{b.next=f;break}else if(a.indexOf(e+"-open")+
-1)if(c)j++;else{b.next=f;break}f.parent.children.remove(f);b.add(f);a=f.next;f.next=null;f=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}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},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"]})})();
+(function(){function t(d){function f(){var b=this.getAttribute("lj-cmd");c.hasOwnProperty(b)&&(i[b].node=c[b].node,(new CKEDITOR.dom.selection(d.document)).selectElement(i[b].node),s=!0,d.execCommand(b),CKEDITOR.note.hide(!0));return!1}function l(){window.switchedRteOn||CKEDITOR.note.hide(!0);if(a){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 r=d.length;g<r;g++){var n= d[g];i.hasOwnProperty(n.getAttribute("lj-cmd"))&&(n.onclick=f)}}else c=null;p(a);b=null}var b,a,c,j,e=document.createElement("lj-note"),h="string"!=typeof document.body.style.opacity,p=function(){function b(){var d=p.shift(),d=(c?d.time/a:-(d.time/a-1)).toFixed(1);p.length||(d=c?1:0);h?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 a=100,d=60*a/1E3,p=[],c,k=document.getElementById("draft-container")|| document.body;return function(a){if((c=a)&&e.parentNode)h?e.style.filter=null:e.style.opacity=1;else for(a=1;a<=d;a++){var g=Math.floor(1E3/60)*a;p.push({time:g,timer:setTimeout(b,g)})}k.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(){b&&!a&&(a=1,b=clearTimeout(b))};h?e.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0)":e.style.opacity= 0;CKEDITOR.note={show:function(d,p){if((p||d!=j)&&window.switchedRteOn)b&&(b=clearTimeout(b)),a=1,j=d,!0===p?l():b=setTimeout(l,1E3)},hide:function(d){a&&(a=0,b&&(b=clearTimeout(b)),e.parentNode&&(!0===d?l():b=setTimeout(l,500)))}}}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>")},LJSpoiler:{html:encodeURIComponent(top.CKLang.LJSpoiler_WizardNotice+'<br /><a href="#" lj-cmd="LJSpoiler">'+top.CKLang.LJSpoiler_WizardNoticeLink+"</a>")}},o={},s,f=CKEDITOR.dtd;f.$block["lj-template"]=1;f.$block["lj-raw"]=1;f.$block["lj-cut"]=1;f.$block["lj-spoiler"]=1;f.$block["lj-poll"]=1;f.$block["lj-repost"]=1;f.$block["lj-pq"]=1;f.$block["lj-pi"]=1;f.$nonEditable["lj-template"]=1;f["lj-template"]={};f["lj-map"]={};f["lj-repost"]={};f["lj-raw"]=f.div;f["lj-poll"]={"lj-pq":1};f["lj-pq"]= {"#":1,"lj-pi":1};f["lj-pi"]={"#":1};f.$block.iframe=f.$inline.iframe;delete f.$inline.iframe;CKEDITOR.tools.extend(f["lj-cut"]={},f.$block);CKEDITOR.tools.extend(f["lj-spoiler"]={},f.$block);CKEDITOR.tools.extend(f["lj-cut"],f.$inline);CKEDITOR.tools.extend(f["lj-spoiler"],f.$inline);CKEDITOR.tools.extend(f.div,f.$block);CKEDITOR.tools.extend(f.$body,f.$block);delete f["lj-cut"]["lj-cut"];CKEDITOR.plugins.add("livejournal",{init:function(d){function f(b){var a=b.data.element||b.data.getTarget(); for(1!=a.type&&(a=a.getParent());a;){var g=a.getAttribute("lj-cmd");if(i.hasOwnProperty(g)){var c=d.getCommand(g);if(c.state==CKEDITOR.TRISTATE_ON){var n=new CKEDITOR.dom.selection(d.document);i[g].node=a.is("body")?new CKEDITOR.dom.element.get(a.getWindow().$.frameElement):a;n.selectElement(i[g].node);b.data.dialog="";s=!0;c.exec();break}}a=a.getParent()}}function u(a){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 b(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,d=new CKEDITOR.dom.element.get(a.body);d.on&&(d.on("dblclick",f),d.on("click",u),d.on("keyup",b),"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=d.frame=this}function c(){var b=d.document.getElementsByTag("iframe"),c=b.count(),g,e,n,m;for(s=!1;c--;)g=b.getItem(c),e=g.getAttribute("lj-cmd"),n=g.$.contentWindow,n=n.document,m=g.getAttribute("lj-style")||"",g.removeListener("load",a),g.on("load",a),n.open(),n.write('<!DOCTYPE html><html style="'+m+'"><head><link rel="stylesheet" href="'+CKEDITOR.styleText+'" /></head><body scroll="no" class="'+ (g.getAttribute("lj-class")||"")+'" style="'+m+'" '+(e?'lj-cmd="'+e+'"':"")+">"+decodeURIComponent(g.getAttribute("lj-content")||"")+"</body></html>"),n.close()}function j(a){if(!0===d.onSwitch)delete d.onSwitch;else{var b,g="click"==a.name,c="selectionChange"==a.name||g,e=a.data.element||a.data.getTarget(),m;g&&(1==a.data.getKey()||0==a.data.$.button)&&a.data.preventDefault();1!=e.type&&(e=e.getParent());a=e;if(c){var e=d.document.getElementsByTag("iframe"),k;g&&a.is("iframe")&&(k=a.$.contentWindow.document.body, k.className=(a.getAttribute("lj-class")||"")+" lj-selected","LJPollLink"==a.getAttribute("lj-cmd")&&a.setStyle("height",k.scrollHeight+"px"));for(var h=0,q=e.count();h<q;h++)g=e.getItem(h),g.$!=a.$&&(k=g.$.contentWindow.document.body,k.className=g.getAttribute("lj-class")||"","LJPollLink"==g.getAttribute("lj-cmd")&&"lj-poll"==k.className&&g.removeAttribute("style"))}do if(e=a.getAttribute("lj-cmd"),!e&&1==a.type&&(g=a.getParent(),a.is("img")&&g.getParent()&&!g.getParent().hasAttribute("lj:user")? (e="image",a.setAttribute("lj-cmd",e)):a.is("a")&&!g.hasAttribute("lj:user")&&(e="LJLink",a.setAttribute("lj-cmd",e))),e&&i.hasOwnProperty(e))c&&(i[e].node=a,d.getCommand(e).setState(CKEDITOR.TRISTATE_ON)),(b||(b={}))[e]={content:i[e].html,node:a};while(a=a.getParent());if(c)for(m in i)if(i.hasOwnProperty(m)&&(!b||!b.hasOwnProperty(m)))delete i[m].node,d.getCommand(m).setState(CKEDITOR.TRISTATE_OFF);b?CKEDITOR.note.show(b):CKEDITOR.note.hide()}}function e(a,b,g){var c,e=i[b].node;if(e){if(c=prompt(g.title, e.getAttribute("text")||g.text))c==g.text?e.removeAttribute("text"):e.setAttribute("text",c)}else{if(c=prompt(g.title,g.text)){d.focus();var e=new CKEDITOR.dom.selection(d.document),m=e.getRanges(),k=new CKEDITOR.dom.element("iframe",d.document),h=k.clone();k.setAttribute("lj-cmd",b);k.setAttribute("lj-class",a+" "+a+"-open");k.setAttribute("class",a+"-wrap");k.setAttribute("frameBorder",0);k.setAttribute("allowTransparency","true");c!=g.text&&k.setAttribute("text",c);h.setAttribute("lj-class",a+ " "+a+"-close");h.setAttribute("class",a+"-wrap");h.setAttribute("frameBorder",0);h.setAttribute("allowTransparency","true");a=m[0];e.lock();b=new CKEDITOR.dom.element("br",d.document);g=b.clone();c=b.clone();var q=new CKEDITOR.dom.documentFragment(d.document);q.append(b.clone());q.append(k);q.append(g);if(!1===a.collapsed)for(var k=0,j=m.length;k<j;k++)q.append(m[k].extractContents());q.append(c);d.insertElement(h);b.clone().insertAfter(h);h.insertBeforeMe(q);a.setStart(g,0);a.setEnd(c,0);e.unlock(); e.selectRanges(m)}CKEDITOR.note&&CKEDITOR.note.hide(!0)}}(function(){function a(b){return"/>"==b.slice(-2)?b:b.slice(0,-1)+"/>"}function b(a){a=new Poll(a);return'<iframe class="lj-poll-wrap" lj-class="lj-poll" frameborder="0" lj-cmd="LJPollLink" allowTransparency="true" lj-data="'+a.outputLJtags()+'" lj-content="'+a.outputHTML()+'"></iframe>'}function c(a,b,d){return'<iframe class="lj-embed-wrap" lj-class="lj-embed" frameborder="0" allowTransparency="true" lj-data="'+encodeURIComponent(d)+'"'+b+ "></iframe>"}function e(a,b,d,c){return b+d.replace(/\n/g,"")+c}function h(a,b,d,c){a=b||d||top.CKLang.LJRepost_Value;b=c.replace(/"/g,"&quot;");c=b+('<br /><input type="button" value="'+a+'" />').replace(/"/g,"&quot;");return'<iframe class="lj-repost-wrap" lj-class="lj-repost" frameborder="0" allowTransparency="true" lj-text="'+b+'" lj-button="'+a+'" lj-content="'+c+'"></iframe>'}d.dataProcessor.toHtml=function(d,k){d=d.replace(/<lj [^>]*?>/gi,a).replace(/<lj-map [^>]*?>/gi,a).replace(/<lj-template[^>]*?>/gi, a).replace(/(<lj-cut[^>]*?)\/>/gi,"$1>").replace(/<((?!br)[^\s>]+)([^>]*?)\/>/gi,"<$1$2></$1>").replace(/<lj-poll.*?>[\s\S]*?<\/lj-poll>/gi,b).replace(/<lj-repost\s*(?:button\s*=\s*(?:"([^"]*?)")|(?:"([^']*?)"))?.*?>([\s\S]*?)<\/lj-repost>/gi,h).replace(/<lj-embed(.*?)>([\s\S]*?)<\/lj-embed>/gi,c);$("event_format").checked||(d=d.replace(/(<lj-raw.*?>)([\s\S]*?)(<\/lj-raw>)/gi,e),window.switchedRteOn||(d=d.replace(/\n/g,"<br />")));d=CKEDITOR.htmlDataProcessor.prototype.toHtml.call(this,d,k);CKEDITOR.env.ie&& (d='<xml:namespace ns="livejournal" prefix="lj" />'+d);return d}})();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",j);d.on("doubleclick",f);d.on("afterCommandExec",c);d.on("dialogHide",c);d.on("dataReady",function(){CKEDITOR.note||t(d);CKEDITOR.env.ie&& (d.document.getBody().on("dragend",c),d.document.getBody().on("paste",function(){setTimeout(c,0)}));d.document.on("click",j);d.document.on("mouseout",CKEDITOR.note.hide);d.document.on("mouseover",j);d.document.getBody().on("keyup",b);c()});(function(){var a=top.Site.siteroot+"/tools/endpoints/ljuser.bml";d.addCommand("LJUserLink",{exec:function(b){var c="",b=new CKEDITOR.dom.selection(b.document),e=i.LJUserLink.node,h;e?(CKEDITOR.note&&CKEDITOR.note.hide(!0),h=i.LJUserLink.node.getElementsByTag("b").getItem(0).getText(), c=prompt(top.CKLang.UserPrompt,h)):2==b.getType()&&(c=b.getSelectedText());""==c&&(c=prompt(top.CKLang.UserPrompt,c));c&&h!=c&&parent.HTTPReq.getJSON({data:parent.HTTPReq.formEncoded({username:c}),method:"POST",url:a,onData:function(a){var b=c;if(a.error)alert(a.error);else if(a.success){a.ljuser=a.ljuser.replace('<span class="useralias-value">*</span>',"");o[b]=a.ljuser;a=new CKEDITOR.dom.element.createFromHtml(a.ljuser);a.setAttribute("lj-cmd","LJUserLink");e?e.$.parentNode.replaceChild(a.$,e.$): d.insertElement(a)}}})}});d.ui.addButton("LJUserLink",{label:top.CKLang.LJUser,command:"LJUserLink"})})();d.ui.addButton("image",{label:top.CKLang.LJImage_Title,command:"image"});window.ljphotoEnabled&&(d.addCommand("LJImage_beta",{exec:function(){InOb.handleInsertImageBeta("upload")},editorFocus:!1}),d.ui.addButton("LJImage_beta",{label:top.CKLang.LJImage_BetaTitle,command:"LJImage_beta"}));d.addCommand("LJLink",{exec:function(a){!s&&this.state==CKEDITOR.TRISTATE_ON?a.execCommand("unlink"):a.openDialog("link"); CKEDITOR.note&&CKEDITOR.note.hide(true)},editorFocus:!1});d.ui.addButton("LJLink",{label:d.lang.link.toolbar,command:"LJLink"});(function(){function a(b){if(b&&b.length&&window.switchedRteOn){var e=new CKEDITOR.dom.element("iframe",d.document);e.setAttribute("lj-data",encodeURIComponent(b));e.setAttribute("lj-class","lj-embed");e.setAttribute("class","lj-embed-wrap");e.setAttribute("frameBorder",0);e.setAttribute("allowTransparency","true");d.insertElement(e);c()}}d.addCommand("LJEmbedLink",{exec:function(){top.LJ_IPPU.textPrompt(top.CKLang.LJEmbedPromptTitle, top.CKLang.LJEmbedPrompt,a,{width:"350px"})}});d.ui.addButton("LJEmbedLink",{label:top.CKLang.LJEmbed,command:"LJEmbedLink"})})();d.addCommand("LJCut",{exec:function(){e("lj-cut","LJCut",{title:top.CKLang.LJCut_PromptTitle,text:top.CKLang.LJCut_PromptText})},editorFocus:!1});d.ui.addButton("LJCut",{label:top.CKLang.LJCut_Title,command:"LJCut"});d.addCommand("LJSpoiler",{exec:function(){e("lj-spoiler","LJSpoiler",{title:top.CKLang.LJSpoiler_PromptTitle,text:top.CKLang.LJSpoiler_PromptText})},editorFocus:!1}); d.ui.addButton("LJSpoiler",{label:top.CKLang.LJSpoiler_Title,command:"LJSpoiler"});(function(){function a(b,d){var d=d===void 0||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=b.getComputedStyle("direction")=="rtl"?"right":"left");return c}function b(c){if(!c.editor.readOnly){var e=c.editor.getCommand(this.name),c=c.data.element;e.state=(c.type==1&&c.hasAttribute("lj-cmd")&&c.getAttribute("lj-cmd"))=="LJLike"?a(c,d.config.useComputedState)==this.value?CKEDITOR.TRISTATE_ON:CKEDITOR.TRISTATE_OFF:!c||c.type!=1||c.getName()=="body"||c.getName()=="iframe"?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 h=c.getRanges(true), g=this.cssClassName,j,f,n=b.config.useComputedState,n=n===void 0||n,r=h.length-1;r>=0;r--){j=h[r];if((f=j.getEnclosedNode())&&f.is("iframe"))return;j=j.createIterator();for(j.enlargeBr=d!=CKEDITOR.ENTER_BR;f=j.getNextParagraph(d==CKEDITOR.ENTER_P?"p":"div");){f.removeAttribute("align");f.removeStyle("text-align");var m=g&&(f.$.className=CKEDITOR.tools.ltrim(f.$.className.replace(this.cssClassRegex,""))),l=this.state==CKEDITOR.TRISTATE_OFF&&(!n||a(f,true)!=this.value);g?l?f.addClass(g):m||f.removeAttribute("class"): l&&f.setStyle("text-align",this.value)}}b.focus();b.forceNextSelectionCheck();c.selectBookmarks(e)}}};var e=new c(d,"LJJustifyLeft","left"),h=new c(d,"LJJustifyCenter","center"),j=new c(d,"LJJustifyRight","right");d.addCommand("LJJustifyLeft",e);d.addCommand("LJJustifyCenter",h);d.addCommand("LJJustifyRight",j);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,j));d.on("selectionChange",CKEDITOR.tools.bind(b,h));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 g=b.config.justifyClasses;if(!e.equals(a.data.node)&&e.getDirection()){c.setStartAfter(e); d=new CKEDITOR.dom.walker(c)}else{if(g)if(e.hasClass(g[0])){e.removeClass(g[0]);e.addClass(g[2])}else if(e.hasClass(g[2])){e.removeClass(g[2]);e.addClass(g[0])}switch(e.getStyle("text-align")){case "left":e.setStyle("text-align","right");break;case "right":e.setStyle("text-align","left")}}}})})();if(top.canmakepoll){var h;CKEDITOR.dialog.add("LJPollDialog",function(){var a=0,b,e,j,f=function(){this.removeListener&&this.removeListener("load",f);if(a&&b){h=new Poll(i.LJPollLink.node&&decodeURIComponent(i.LJPollLink.node.getAttribute("lj-data")), e.document,j.document,e.Questions);e.ready(h);j.ready(h);b.style.display="block";CKEDITOR.note&&CKEDITOR.note.hide(true)}else a++},m=[new CKEDITOR.ui.button({type:"button",id:"LJPoll_Ok",label:d.lang.common.ok,onClick:function(a){a.data.dialog.hide();var b=new Poll(h,e.document,j.document,e.Questions),a=b.outputHTML(),b=b.outputLJtags();if(a.length>0){var f=i.LJPollLink.node;if(f){f.setAttribute("lj-content",a);f.setAttribute("lj-data",b);f.removeAttribute("style");f.$.contentWindow.document.body.className= "lj-poll"}else{f=new CKEDITOR.dom.element("iframe",d.document);f.setAttribute("lj-content",a);f.setAttribute("lj-cmd","LJPollLink");f.setAttribute("lj-data",b);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;c()}}}),CKEDITOR.dialog.cancelButton];CKEDITOR.env.mac&&m.reverse();return{title:top.CKLang.Poll_PollWizardTitle,width:420,height:270,resizable:false, onShow:function(){if(a){h=new Poll(i.LJPollLink.node&&unescape(i.LJPollLink.node.getAttribute("data")),e.document,j.document,e.Questions);e.ready(h);j.ready(h)}},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(!b)(b=document.getElementById(a.sender.getButton("LJPoll_Ok").domId).parentNode).style.display="none";a=this.getElement("iframe"); j=a.$.contentWindow;if(j.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:m}});d.addCommand("LJPollLink",new CKEDITOR.dialogCommand("LJPollDialog"))}else d.addCommand("LJPollLink",{exec:function(){CKEDITOR.note&& CKEDITOR.note.show(top.CKLang.Poll_AccountLevelNotice,null,null,true)}}),d.getCommand("LJPollLink").setState(CKEDITOR.TRISTATE_DISABLED);d.ui.addButton("LJPollLink",{label:top.CKLang.Poll_Title,command:"LJPollLink"});(function(){function a(){if(d.getCommand("LJLike")==CKEDITOR.TRISTATE_OFF){this.$.checked?e++:e--;h.getButton("LJLike_Ok").getElement()[e==0?"addClass":"removeClass"]("btn-disabled")}}var b=l.length,c='<div class="cke-dialog-likes"><ul class="cke-dialog-likes-list">',e=0,h,f;l.defaultButtons= [];for(var j=0;j<b;j++){var o=l[j];l[o.id]=l[o.abbr]=o;l.defaultButtons.push(o.id);c=c+o.htmlOpt}c=c+('</ul><p class="cke-dialog-likes-faq">'+window.faqLink+"</p></div>");CKEDITOR.dialog.add("LJLikeDialog",function(){var j=[new CKEDITOR.ui.button({type:"button",id:"LJLike_Ok",label:d.lang.common.ok,onClick:function(){var a=[],c='<span class="lj-like-wrapper">',e=i.LJLike.node;if(h.getButton("LJLike_Ok").getElement().hasClass("btn-disabled"))return false;for(var f=0;f<b;f++){var j=l[f],g=document.getElementById("like-"+ j.abbr),k=e&&e.getAttribute("buttons");if(g&&g.checked||k&&!j.htmlOpt&&(k.indexOf(j.abbr)+1||k.indexOf(j.id)+1)){a.push(j.id);c=c+j.html}}c=c+"</span>";if(a.length)if(e){i.LJLike.node.setAttribute("buttons",a.join(","));i.LJLike.node.setAttribute("lj-content",encodeURIComponent(c))}else{e=new CKEDITOR.dom.element("iframe",d.document);e.setAttribute("lj-class","lj-like");e.setAttribute("class","lj-like-wrap");e.setAttribute("buttons",a.join(","));e.setAttribute("lj-content",encodeURIComponent(c)); e.setAttribute("lj-cmd","LJLike");e.setAttribute("frameBorder",0);e.setAttribute("allowTransparency","true");d.insertElement(e)}else e&&i.LJLike.node.remove();h.hide()}}),CKEDITOR.dialog.cancelButton];CKEDITOR.env.mac&&j.reverse();return{title:top.CKLang.LJLike_name,width:145,height:window.isSupUser?180:145,resizable:false,contents:[{id:"LJLike_Options",elements:[{type:"html",html:c}]}],onShow:function(){var a=d.getCommand("LJLike"),c=e=0,a=a.state==CKEDITOR.TRISTATE_ON,j=i.LJLike.node&&i.LJLike.node.getAttribute("buttons"); for(CKEDITOR.note&&CKEDITOR.note.hide(true);c<b;c++){var f=j?!!(j.indexOf(l[c].abbr)+1||j.indexOf(l[c].id)+1):true,g=document.getElementById("like-"+l[c].abbr);if(g){f&&!a&&e++;g.checked=f}}e>0&&h.getButton("LJLike_Ok").getElement().removeClass("btn-disabled")},onLoad:function(){h=this;f=h.parts.contents.getElementsByTag("input");for(var c=0;c<b;c++){var e=f.getItem(c);e&&e.on("click",a)}},buttons:j}});d.addCommand("LJLike",new CKEDITOR.dialogCommand("LJLikeDialog"));d.ui.addButton("LJLike",{label:top.CKLang.LJLike_name, command:"LJLike"})})()},afterInit:function(d){function f(b,a,c,d){var d=d||"text",e=new CKEDITOR.htmlParser.element("iframe");e.attributes["lj-class"]=a+" "+a+"-open";e.attributes["class"]=a+"-wrap";e.attributes["lj-cmd"]=c;e.attributes.frameBorder=0;e.attributes.allowTransparency="true";b.attributes.hasOwnProperty(d)&&(e.attributes.text=b.attributes[d]);b.children.unshift(e);c=new CKEDITOR.htmlParser.element("iframe");c.attributes["lj-class"]=a+" "+a+"-close";c.attributes["class"]=a+"-wrap";c.attributes.frameBorder= 0;c.attributes.allowTransparency="true";b.children.push(c);delete b.name}var i=d.dataProcessor;i.dataFilter.addRules({elements:{"lj-like":function(b){var a=[],c=new CKEDITOR.htmlParser.element("iframe");c.attributes["lj-class"]="lj-like";c.attributes["class"]="lj-like-wrap";b.attributes.hasOwnProperty("style")&&(c.attributes["lj-style"]=b.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 b=b.attributes.buttons&&b.attributes.buttons.split(",")||l.defaultButtons,d=b.length,e=0;e<d;e++){var f=b[e].replace(/^\s*([a-z]{2,})\s*$/i,"$1"),i=l[f];i&&(c.attributes["lj-content"]+=encodeURIComponent(i.html),a.push(f))}c.attributes["lj-content"]+="</span>";c.attributes.buttons=a.join(",");return c},lj:function(){function b(a){for(var c=d.document.getElementsByTag("lj"),f=0,e=c.count();f<e;f++){var h=c.getItem(f);if(h){var i=h.getAttribute("user"),l=h.getAttribute("title");if(a== (l?i+":"+l:i))i=new CKEDITOR.dom.element.createFromHtml(o[a],d.document),i.setAttribute("lj-cmd","LJUserLink"),h.insertBeforeMe(i),h.remove()}}d.removeListener("dataReady",b)}return function(a){var c=a.attributes.user;if(c&&c.length){var f=(a=a.attributes.title)?c+":"+a:c;if(o.hasOwnProperty(f))return a=(new CKEDITOR.htmlParser.fragment.fromHtml(o[f])).children[0],a.attributes["lj-cmd"]="LJUserLink",a;var e={username:c};a&&(e.usertitle=a);HTTPReq.getJSON({data:HTTPReq.formEncoded(e),method:"POST", url:Site.siteroot+"/tools/endpoints/ljuser.bml",onError:function(a){alert(a+' "'+c+'"')},onData:function(a){if(a.error)return alert(a.error+' "'+c+'"');if(a.success){o[f]=a.ljuser;a.ljuser=a.ljuser.replace('<span class="useralias-value">*</span>',"");if(d.document)b(f);else d.on("dataReady",function(){b(f)})}}})}}}(),"lj-map":function(b){var a=new CKEDITOR.htmlParser.element("iframe"),c="",d="",e=Number(b.attributes.width),f=Number(b.attributes.height);isNaN(e)||(c+="width:"+e+"px;",d+="width:"+(e- 2)+"px;");isNaN(f)||(c+="height:"+f+"px;",d+="height:"+(f-2)+"px;");c.length&&(a.attributes.style=c,a.attributes["lj-style"]=d);a.attributes["lj-url"]=b.attributes.url?encodeURIComponent(b.attributes.url):"";a.attributes["lj-class"]="lj-map";a.attributes["class"]="lj-map-wrap";a.attributes["lj-content"]='<p class="lj-map">map</p>';a.attributes.frameBorder=0;a.attributes.allowTransparency="true";return a},"lj-raw":function(b){b.name="lj:raw"},"lj-wishlist":function(b){b.name="lj:wishlist"},"lj-template":function(b){var a= new CKEDITOR.htmlParser.element("iframe");a.attributes["lj-class"]="lj-template";a.attributes["class"]="lj-template-wrap";a.attributes.frameBorder=0;a.attributes.allowTransparency="true";a.attributes["lj-attributes"]=LiveJournal.JSON.stringify(b.attributes);return a},"lj-cut":function(b){f(b,"lj-cut","LJCut")},"lj-spoiler":function(b){f(b,"lj-spoiler","LJSpoiler","title")},iframe:function(b){if(b.attributes["lj-class"]&&1==b.attributes["lj-class"].indexOf("lj-")+1)return b;var a=new CKEDITOR.htmlParser.element("iframe"), c="",d="",e=Number(b.attributes.width),f=Number(b.attributes.height);isNaN(e)||(c+="width:"+e+"px;",d+="width:"+(e-2)+"px;");isNaN(f)||(c+="height:"+f+"px;",d+="height:"+(f-2)+"px;");c.length&&(a.attributes.style=c,a.attributes["lj-style"]=d);a.attributes["lj-url"]=b.attributes.src?encodeURIComponent(b.attributes.src):"";a.attributes["lj-class"]="lj-iframe";a.attributes["class"]="lj-iframe-wrap";a.attributes["lj-content"]='<p class="lj-iframe">iframe</p>';a.attributes.frameBorder=0;a.attributes.allowTransparency= "true";return a},a:function(b){b.parent.attributes&&!b.parent.attributes["lj:user"]&&(b.attributes["lj-cmd"]="LJLink")},img:function(b){var a=b.parent&&b.parent.parent;if(!a||!a.attributes||!a.attributes["lj:user"])b.attributes["lj-cmd"]="image"},div:function(b){"lj-cut"==b.attributes["class"]&&f(b,"lj-cut","LJCut")}}},5);i.htmlFilter.addRules({elements:{iframe:function(b){var a=b,c=!1,d="text",e=/lj-[a-z]+/i.exec(b.attributes["lj-class"]);if(e)e=e[0];else return b;switch(e){case "lj-like":a=new CKEDITOR.htmlParser.element("lj-like"); a.attributes.buttons=b.attributes.buttons;b.attributes.hasOwnProperty("lj-style")&&(a.attributes.style=b.attributes["lj-style"]);a.isEmpty=!0;a.isOptionalClose=!0;break;case "lj-embed":a=new CKEDITOR.htmlParser.element("lj-embed");a.attributes.id=b.attributes.id;b.attributes.hasOwnProperty("source_user")&&(a.attributes.source_user=b.attributes.source_user);a.children=(new CKEDITOR.htmlParser.fragment.fromHtml(decodeURIComponent(b.attributes["lj-data"]))).children;a.isOptionalClose=!0;break;case "lj-map":a= new CKEDITOR.htmlParser.element("lj-map");a.attributes.url=decodeURIComponent(b.attributes["lj-url"]);b.attributes.style&&(b.attributes.style+";").replace(/([a-z-]+):(.*?);/gi,function(b,c,d){a.attributes[c.toLowerCase()]=parseInt(d)});a.isOptionalClose=a.isEmpty=!0;break;case "lj-iframe":a=new CKEDITOR.htmlParser.element("iframe");a.attributes.src=decodeURIComponent(b.attributes["lj-url"]);b.attributes.style&&(b.attributes.style+";").replace(/([a-z-]+):(.*?);/gi,function(b,c,d){a.attributes[c.toLowerCase()]= parseInt(d)});a.attributes.frameBorder=0;break;case "lj-poll":a=(new CKEDITOR.htmlParser.fragment.fromHtml(decodeURIComponent(b.attributes["lj-data"]))).children[0];break;case "lj-repost":a=new CKEDITOR.htmlParser.element("lj-repost");a.attributes.button=b.attributes["lj-button"];a.children=(new CKEDITOR.htmlParser.fragment.fromHtml(b.attributes["lj-text"])).children;break;case "lj-template":a=new CKEDITOR.htmlParser.element("lj-template");a.attributes=LiveJournal.JSON.parse(b.attributes["lj-attributes"].replace(/&quot;/g, '"'));a.isOptionalClose=a.isEmpty=!0;break;case "lj-spoiler":c=!0,d="title";case "lj-cut":if(b.attributes["lj-class"].indexOf(e+"-open")+1){var f=b.next,i=0,a=new CKEDITOR.htmlParser.element(e);for(b.attributes.hasOwnProperty("text")&&(a.attributes[d]=b.attributes.text);f;){if("iframe"==f.name)if(b=f.attributes["lj-class"],b.indexOf(e+"-close")+1)if(c&&i)i--;else{a.next=f;break}else if(b.indexOf(e+"-open")+1)if(c)i++;else{a.next=f;break}f.parent.children.remove(f);a.add(f);b=f.next;f.next=null;f= b}}else a=!1;break;default:b.children.length||(a=!1)}return a},span:function(b){var a=b.a...
 (truncated)
Tags: b_vladi, js, livejournal, vkurkin
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments