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

[livejournal] r21208: LJSUP-11031 <lj-spoiler> tag

Committer: vkurkin
LJSUP-11031 <lj-spoiler> tag
U   trunk/bin/upgrading/en.dat
U   trunk/cgi-bin/LJ/Widget/EntryForm.pm
U   trunk/htdocs/js/ck/config.js
U   trunk/htdocs/js/ck/plugins/livejournal/plugin.js
U   trunk/htdocs/js/ck/plugins/livejournal/plugin.orig.js
Modified: trunk/bin/upgrading/en.dat
===================================================================
--- trunk/bin/upgrading/en.dat	2012-02-17 08:02:19 UTC (rev 21207)
+++ trunk/bin/upgrading/en.dat	2012-02-17 12:13:16 UTC (rev 21208)
@@ -2679,6 +2679,17 @@
 fcklang.ljimage=Insert/Edit Image
 fcklang.ljimage.beta=Insert/Edit Image Beta
 
+
+fcklang.ljspoiler=LiveJournal Spoiler
+
+fcklang.ljspoiler.wizardnotice=Spoiler must be edited inside the Spoiler Wizard
+
+fcklang.ljspoiler.wizardnoticelink=Go to Spoiler wizard
+
+fcklang.ljspoiler.prompt=Spoiler text?
+
+fcklang.ljspoiler.prompt.text=Spoiler (click to open)
+
 fcklang.cutcontents=Type your cut contents here.
 
 fcklang.cutprompt=Cut link text?

Modified: trunk/cgi-bin/LJ/Widget/EntryForm.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/EntryForm.pm	2012-02-17 08:02:19 UTC (rev 21207)
+++ trunk/cgi-bin/LJ/Widget/EntryForm.pm	2012-02-17 12:13:16 UTC (rev 21208)
@@ -1743,18 +1743,18 @@
             'LJUser' => 'ljuser',
             'VideoPrompt' => 'videoprompt',
             'LJVideo' => 'ljvideo2',
-            'CutPrompt' => 'cutprompt',
-            'ReadMore' => 'readmore',
             'CutContents' => 'cutcontents',
-            'LJCut' => 'ljcut',
+
             'LJEmbedPrompt' => 'ljembedprompt',
             'LJEmbedPromptTitle' => 'ljembedprompttitle',
             'LJEmbed' => 'ljembed',
+
             'Poll_PollWizardNotice' => 'poll.pollwizardnotice',
             'Poll_PollWizardNoticeLink' => 'poll.pollwizardnoticelink',
             'Poll_AccountLevelNotice' => 'poll.accountlevelnotice',
             'Poll_PollWizardTitle' => 'poll.pollwizardtitle',
-            'Poll' => 'poll',
+            'Poll_Title' => 'poll',
+
             'LJLike_name' => 'ljlike.name',
             'LJLike_dialogText' => 'ljlike.dialog.text',
             'LJLike_button_google' => 'ljlike.button.google',
@@ -1764,16 +1764,30 @@
             'LJLike_button_give' => 'ljlike.button.give',
             'LJLike_WizardNotice' => 'ljlike.wizardnotice',
             'LJLike_WizardNoticeLink' => 'ljlike.wizardnoticelink',
+
             'LJUser_WizardNotice' => 'ljuser.wizardnotice',
             'LJUser_WizardNoticeLink' => 'ljuser.wizardnoticelink',
+
             'LJLink_WizardNotice' => 'ljlink.wizardnotice',
             'LJLink_WizardNoticeLink' => 'ljlink.wizardnoticelink',
-            'LJImage_title' => 'ljimage',
-            'LJImage_beta_title' => 'ljimage.beta',
+
+            'LJImage_Title' => 'ljimage',
+            'LJImage_BetaTitle' => 'ljimage.beta',
             'LJImage_WizardNotice' => 'ljimage.wizardnotice',
             'LJImage_WizardNoticeLink' => 'ljimage.wizardnoticelink',
+
+            'LJCut_Title' => 'ljcut',
+            'LJCut_PromptTitle' => 'cutprompt',
+            'LJCut_PromptText' => 'readmore',
             'LJCut_WizardNotice' => 'ljcut.wizardnotice',
             'LJCut_WizardNoticeLink' => 'ljcut.wizardnoticelink',
+
+            'LJSpoiler_Title' => 'ljspoiler',
+            'LJSpoiler_PromptTitle' => 'ljspoiler.prompt',
+            'LJSpoiler_PromptText' => 'ljspoiler.prompt.text',
+            'LJSpoiler_WizardNotice' => 'ljspoiler.wizardnotice',
+            'LJSpoiler_WizardNoticeLink' => 'ljspoiler.wizardnoticelink',
+
             'LJRepost_Value' => 'ljrepost',
         );
 

Modified: trunk/htdocs/js/ck/config.js
===================================================================
--- trunk/htdocs/js/ck/config.js	2012-02-17 08:02:19 UTC (rev 21207)
+++ trunk/htdocs/js/ck/config.js	2012-02-17 12:13:16 UTC (rev 21208)
@@ -64,7 +64,7 @@
 		config.toolbar_Full[0].push('LJEmbedLink');
 	}
 
-	config.toolbar_Full[0].push('LJPollLink', 'LJCutLink', 'LJCut', 'LJLike', '-', 'UnorderedList', 'OrderedList', 'NumberedList', 'BulletedList', '-', 'LJJustifyLeft', 'LJJustifyCenter', 'LJJustifyRight', '-', 'Undo', 'Redo');
+	config.toolbar_Full[0].push('LJPollLink', 'LJCutLink', 'LJCut', 'LJLike', 'LJSpoiler', '-', 'UnorderedList', 'OrderedList', 'NumberedList', 'BulletedList', '-', 'LJJustifyLeft', 'LJJustifyCenter', 'LJJustifyRight', '-', 'Undo', 'Redo');
 
 	config.enterMode = CKEDITOR.ENTER_BR;
 	config.shiftEnterMode = CKEDITOR.ENTER_P;

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