spacevillain (spacevillain) wrote in changelog,
spacevillain
spacevillain
changelog

[livejournal] r23378: LJSUP-14347: Can't undo image adding

Committer: atyurin
LJSUP-14347: Can't undo image adding
U   trunk/htdocs/js/ck/ckeditor.js
U   trunk/htdocs/js/ck/plugins/livejournal/plugin.js
Modified: trunk/htdocs/js/ck/ckeditor.js
===================================================================
--- trunk/htdocs/js/ck/ckeditor.js	2012-11-28 10:51:22 UTC (rev 23377)
+++ trunk/htdocs/js/ck/ckeditor.js	2012-11-28 11:10:30 UTC (rev 23378)
@@ -137,27 +137,27 @@
 A.selectNodeContents(u.document.getBody());A.collapse(true);v.selectRanges([A]);}},100);};a.editor.prototype.isFocusAt=function(t){var u=this.getSelection(),v=u.getRanges()[0],w=this.document.getBody();if(t==='end'&&v.checkEndOfBlock())if(w.equals(v.endContainer)||w.getLast().equals(v.endContainer))return true;if(t==='start')throw new Error('Not implemented');return false;};a.editor.prototype.isSelectionCollapsed=function(){var t=this.getSelection(),u=t&&t.getRanges()[0];if(u)return!!u.collapsed;return false;};var m=a.lang[a.lang.detect()]||{};jQuery.extend(m,LJ.pageVar('rtedata'));window.CKLang=a.CKLang=m;if(Site.page.ljpost)a.styleText=Site.statprefix+'/js/ck/contents_new.css?t='+Site.version;else a.styleText=Site.statprefix+'/js/ck/contents.css?t='+Site.version;var n='@focus@',o='<input type="hidden" id="__focus"/>';function p(t,u,v){v=v||{};v&&jQuery.extend(v,{fromDoubleClick:this.execFromEditor});LiveJournal.run_hook('rteButton',u,jQuery('.cke_button_'+t),v);this.execFromEditor=false;};var q=[{label:m.LJLike_button_repost,id:'repost',abbr:'rp',checked:true,html:'<span class="lj-like-item rp">'+m.LJLike_button_repost+'</span>',htmlOpt:'<li class="like-rp"><input type="checkbox" id="like-rp" /><label for="like-rp">'+m.LJLike_button_repost+'</label></li>'},{label:m.LJLike_button_facebook,id:'facebook',abbr:'fb',checked:true,html:'<span class="lj-like-item fb">'+m.LJLike_button_facebook+'</span>',htmlOpt:'<li class="like-fb"><input type="checkbox" id="like-fb" /><label for="like-fb">'+m.LJLike_button_facebook+'</label></li>'},{label:m.LJLike_button_twitter,id:'twitter',abbr:'tw',checked:true,html:'<span class="lj-like-item tw">'+m.LJLike_button_twitter+'</span>',htmlOpt:'<li class="like-tw"><input type="checkbox" id="like-tw" /><label for="like-tw">'+m.LJLike_button_twitter+'</label></li>'},{label:m.LJLike_button_google,id:'google',abbr:'go',checked:true,html:'<span class="lj-like-item go">'+m.LJLike_button_google+'</span>',htmlOpt:'<li class="like-go"><input type="checkbox" id="like-go" /><label for="like-go">'+m.LJLike_button_google+'</label></li>'},{label:m.LJLike_button_vkontakte,id:'vkontakte',abbr:'vk',checked:Site.remote_is_sup?true:false,html:'<span class="lj-like-item vk">'+m.LJLike_button_vkontakte+'</span>',htmlOpt:Site.remote_is_sup?'<li class="like-vk"><input type="checkbox" id="like-vk" /><label for="like-vk">'+m.LJLike_button_vkontakte+'</label></li>':''},{label:m.LJLike_button_surfingbird,id:'surfingbird',abbr:'sb',checked:Site.remote_is_sup?true:false,html:'<span class="lj-like-item sb">'+m.LJLike_button_surfingbird+'</span>',htmlOpt:Site.remote_is_sup?'<li class="like-sb"><input type="checkbox" id="like-sb" /><label for="like-sb">'+m.LJLike_button_surfingbird+'</label></li>':''},{label:m.LJLike_button_tumblr,id:'tumblr',abbr:'tb',checked:true,html:'<span class="lj-like-item tb">'+m.LJLike_button_tumblr+'</span>',htmlOpt:'<li class="like-tb"><input type="checkbox" id="like-tb" /><label for="like-tb">'+m.LJLike_button_tumblr+'</label></li>'},{label:m.LJLike_button_give,id:'livejournal',abbr:'lj',checked:false,html:'<span class="lj-like-item lj">'+m.LJLike_button_give+'</span>',htmlOpt:'<li class="like-lj"><input type="checkbox" id="like-lj" /><label for="like-lj">'+m.LJLike_button_give+'</label></li>'}],r={LJPollLink:{html:encodeURIComponent(m.Poll_PollWizardNotice+'<br /><a href="#" lj-cmd="LJPollLink">'+m.Poll_PollWizardNoticeLink+'</a>')},LJLike:{html:encodeURIComponent(m.LJLike_WizardNotice+'<br /><a href="#" lj-cmd="LJLike">'+m.LJLike_WizardNoticeLink+'</a>')},LJLink2:{html:encodeURIComponent(m.LJLink_WizardNotice+'<br /><a href="#" lj-cmd="LJLink2">'+m.LJLink_WizardNoticeLink+'</a>')},LJImage:{html:encodeURIComponent(m.LJImage_WizardNotice+'<br /><a href="#" lj-cmd="LJImage">'+m.LJImage_WizardNoticeLink+'</a>')},LJCut:{html:encodeURIComponent(m.LJCut_WizardNotice+'<br /><a href="#" lj-cmd="LJCut">'+m.LJCut_WizardNoticeLink+'</a>')},LJSpoiler:{html:encodeURIComponent(m.LJSpoiler_WizardNotice+'<br /><a href="#" lj-cmd="LJSpoiler">'+m.LJSpoiler_WizardNoticeLink+'</a>')},LJEmbedLink:{},LJMap:{}},s=f;
 s.$block['lj-template']=1;s.$block['lj-raw']=1;s.$block['lj-cut']=1;s.$block['lj-spoiler']=1;s.$block['lj-poll']=1;s.$block['lj-repost']=1;s.$block['lj-pq']=1;s.$block['lj-pi']=1;s.$nonEditable['lj-template']=1;s.$empty['lj-random']=1;s['lj-template']={};s['lj-map']={};s['lj-repost']={};s['lj-raw']=s.div;s['lj-poll']={'lj-pq':1};s['lj-pq']={'#':1,'lj-pi':1};s['lj-pi']={'#':1};['a','b','em','i','img','strong','u','lj-user'].forEach(function(t){s['lj-pq'][t]=1;s['lj-pi'][t]=1;});s.$block.iframe=s.$inline.iframe;delete s.$inline.iframe;e.extend(s['lj-cut']={},s.$block);e.extend(s['lj-spoiler']={},s.$block);e.extend(s['lj-cut'],s.$inline);e.extend(s['lj-spoiler'],s.$inline);e.extend(s.div,s.$block);e.extend(s.$body,s.$block);delete s['lj-cut']['lj-cut'];f.p.iframe=1;f['lj-cut'].iframe=1;f['lj-spoiler'].iframe=1;j.add('livejournal',{init:function(t){t.rteButton=p;function u(A){var B=A.data.element||A.data.getTarget();if(B.type!=1)B=B.getParent();while(B){var C=B.getAttribute('lj-cmd');if(r.hasOwnProperty(C)){var D=t.getCommand(C);if(D.state==1){var E=new d.selection(t.document);r[C].node=B.is('body')?new h.get(B.getWindow().$.frameElement):B;E.selectElement(r[C].node);A.data.dialog='';t.execFromEditor=true;t.execCommand(C,true);break;}}B=B.getParent();}};function v(A){var B=this;if(B.$!=t.document.$){B.$.className=(B.frame.getAttribute('lj-class')||'')+' lj-selected';if(B.getAttribute('lj-cmd')=='LJPollLink')B.frame.setStyle('height',B.getDocument().$.body.scrollHeight+'px');t.focus();new d.selection(t.document).selectElement(B.frame);}A.data.getKey()==1&&A.data.preventDefault();};function w(A){if(A.data.getKey()==46){var B=new d.selection(t.document).getRanges(),C=B.length;while(C--)B[C].deleteContents();}};function x(){var D=this;var A=D.$.contentWindow,B=A.document,C=new h.get(B.body);if(C.on&&!Site.page.disabled_input){C.on('dblclick',u);C.on('click',v);C.on('keyup',w);if(D.getAttribute('lj-cmd')=='LJPollLink'&&D.hasAttribute('style'))B.body.className='lj-poll lj-poll-open';}B=new h.get(B);B.frame=C.frame=D;};function y(){var A=t.document.getElementsByTag('iframe'),B=A.count(),C,D,E,F,G;t.execFromEditor=false;while(B--){C=A.getItem(B),D=C.getAttribute('lj-cmd'),E=C.$.contentWindow,F=E.document,G=C.getAttribute('lj-style')||'';if(C.getAttribute('data-update')==='false')continue;if(F&&F.body&&F.body.getAttribute('data-loaded'))continue;C.removeListener('load',x);C.on('load',x);F.open();F.write('<!DOCTYPE html><html style="'+G+'">'+'<head><link rel="stylesheet" href="'+a.styleText+'" /></head>'+'<body data-loaded="true" scroll="no" class="'+(C.getAttribute('lj-class')||'')+'" style="'+G+'" '+(D?'lj-cmd="'+D+'"':'')+'>'+decodeURIComponent(C.getAttribute('lj-content')||'')+'</body>'+'</html>');
 F.close();}};t.updateFrames=y;t.on('dataReady',function(){setTimeout(y,100);});function z(A){t.fire('updateSnapshot');if(t.onSwitch===true){delete t.onSwitch;return;}var B,C=A.name=='click',D=A.name=='selectionChange'||C,E=A.data.element||A.data.getTarget(),F,G;if(C&&(A.data.getKey()===1||A.data.$.button===0))A.data.preventDefault();if(E.type!=1)E=E.getParent();F=E;if(D){var H=t.document.getElementsByTag('iframe'),I,J;if(C&&F.is('iframe')){J=F.$.contentWindow.document.body;J.className=(F.getAttribute('lj-class')||'')+' lj-selected';if(F.getAttribute('lj-cmd')=='LJPollLink')F.setStyle('height',J.scrollHeight+'px');}for(var K=0,L=H.count();K<L;K++){I=H.getItem(K);if(I.$!=F.$){J=I.$.contentWindow.document.body;J.className=I.getAttribute('lj-class')||'';if(I.getAttribute('lj-cmd')=='LJPollLink'&&J.className.indexOf('lj-poll')!=-1)I.removeAttribute('style');}}}do{var M=F.getAttribute('lj-cmd');if(!M&&F.type==1){var N=F.getParent();if(F.is('img')&&!F.hasAttribute('data-user')&&N.getParent()&&!N.getParent().hasAttribute('data-user')){M='LJImage';F.setAttribute('lj-cmd',M);}else if(F.is('a')&&!F.hasAttribute('data-user')&&!N.hasAttribute('lj:user')){M='LJLink2';F.setAttribute('lj-cmd',M);}}if(M&&r.hasOwnProperty(M)){if(D){r[M].node=F;t.getCommand(M).setState(1);}(B||(B={}))[M]={content:r[M].html,node:F};}}while(F=F.getParent());var O;if(D)for(G in r){if(r.hasOwnProperty(G)&&(!B||!B.hasOwnProperty(G))){delete r[G].node;O=t.getCommand(G);if(O)O.setState(2);}}t.fire('updateSnapshot');};(function(){function A(J){return J.slice(-2)=='/>'?J:J.slice(0,-1)+'/>';};function B(J){var K=new Poll(J),L="<div class='lj-poll-inner lj-rtebox-inner'>"+K.outputHTML()+'</div>';return '<iframe class="lj-poll-wrap lj-rtebox" lj-class="lj-poll" frameborder="0" lj-cmd="LJPollLink" allowTransparency="true" lj-data="'+K.outputLJtags()+'" lj-content="'+L+'"></iframe>';};function C(J,K){var L="<div class='lj-poll-inner lj-rtebox-inner'>Poll id: "+K+'</div>';return '<iframe class="lj-poll-wrap lj-poll-wrap-done lj-rtebox" lj-class="lj-poll" frameborder="0" lj-cmd="LJPollLink" allowTransparency="true" lj-data="'+escape(J)+'" lj-content="'+L+'" data-disabledPoll="true"></iframe>';};function D(J,K,L){var M="<div class='lj-embed-inner lj-rtebox-inner'>Embed video</div>";return '<iframe class="lj-embed-wrap lj-rtebox" lj-class="lj-embed" frameborder="0" lj-cmd="LJEmbedLink" allowTransparency="true" lj-data="'+encodeURIComponent(L)+'"'+K+'lj-content="'+M+'"></iframe>';};function E(J,K,L,M){return K+L.replace(/\n/g,'')+M;
-};function F(J,K,L,M){var N=K||L||m.LJRepost_Value,O=M.replace(/"/g,'&quot;');M=O+('<br /><input type="button" value="'+N+'" />').replace(/"/g,'&quot;');return '<iframe class="lj-repost-wrap" lj-class="lj-repost" frameborder="0" allowTransparency="true" lj-text="'+O+'" lj-button="'+N+'" lj-content="'+M+'"></iframe>';};function G(J,K){var L,M,N=0;do{if(!L)L=K.call(J,N)===false;if(!L&&(M=J.firstChild))N++;else if(M=J.nextSibling)L=false;else{M=J.parentNode;N--;L=true;}J=M;}while(N>0);};function H(J,K){return J.replace(/<(.|\n)*?>/g,function(L){var M=L;if(M.indexOf(K)!==-1){M=M.replace(K,'');return M+K;}else return L;});};function I(J,K,L){return[J.slice(0,K),L,J.slice(K)].join('');};t.on('contentDom',function(J){var K=J.editor.document.getById('__focus');if(K){this._domBuilt=true;setTimeout(function(){J.editor.focus();var L=J.editor.getSelection();if(L){var M=new d.range(J.editor.document);M.setEndAfter(K);L.selectRanges([M]);}K.remove();},this._domBuilt?0:100);}});t.dataProcessor.toHtml=function(J,K){var L=Site.page.__htmlLast;if(typeof L==='number')if(J.length>0)J=H(I(J,L,n),n).replace(n,o);else J=o;J=J.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-poll-([0-9]+)>/gi,C).replace(/<lj-repost\s*(?:button\s*=\s*(?:"([^"]*?)")|(?:"([^']*?)"))?.*?>([\s\S]*?)<\/lj-repost>/gi,F).replace(/<lj-embed(.*?)>([\s\S]*?)<\/lj-embed>/gi,D);J=J.replace(/<table[^>]*>((.|\n)*?)<\/table>/i,function(M){var N=document.createElement('span');N.innerHTML=M;G(N,function(){var O=this;if(O.nodeType===3)if(O.parentNode.nodeName.toLowerCase()!=='td')O.nodeValue=O.nodeValue.replace(/\n/ig,'');});return N.innerHTML;});if(!$('event_format').checked){J=J.replace(/(<lj-raw.*?>)([\s\S]*?)(<\/lj-raw>)/gi,E);J=J.replace(/\n/g,'<br/>');}J=a.htmlDataProcessor.prototype.toHtml.call(this,J,K);if(c)J='<xml:namespace ns="livejournal" prefix="lj" />'+J;return J;};})();t.dataProcessor.toDataFormat=function(A,B){A=a.htmlDataProcessor.prototype.toDataFormat.call(this,A,B);if(!$('event_format').checked)A=A.replace(/<br\s*\/>/gi,'\n');return A.replace(/\t/g,' ');};t.dataProcessor.writer.indentationChars='';t.dataProcessor.writer.lineBreakChars='';t.on('selectionChange',z);t.on('doubleclick',u);t.on('afterCommandExec',y);t.on('dialogHide',y);t.on('dataReady',function(){if(c){t.document.getBody().on('dragend',y);t.document.getBody().on('paste',function(){setTimeout(y,0);
-});}if(!Site.page.disabled_input){t.document.on('click',z);t.document.on('mouseover',z);t.document.getBody().on('keyup',w);y();}});(function(){var A='LJFont',B=t.config,C=false,D={},E='normal',F=B.LJFontDefault,G=B.LJFontSize,H=B.LJFontStyle,I='b-fontsize-select-item-active',J,K,L,M,N=jQuery();for(M in G){D[M]=new a.style(H,{size:G[M]});D[M]._.definition.name=M;}function O(P){F=P;N.removeClass(I).filter('.b-fontsize-select-item-'+F).addClass(I);};t.addCommand(A,{exec:function(P){P.rteButton(A,'font');if(!C){N=jQuery('.b-fontsize-select-item');LiveJournal.register_hook('font_response',function(R){P.focus();P.fire('saveSnapshot');var S=D[R],T,U,V;if(F===R)S.remove(P.document);else{U=P.getSelection();V=parseFloat(S._.definition.styles['font-size']);for(T in D)D[T].remove(P.document);S.apply(P.document);}P.fire('saveSnapshot');});C=true;var Q=P.getCommand(A);Q.setState(1);O(F);}}});t.ui.addButton(A,{label:m[A],command:A});t.on('selectionChange',function(P){var Q=P.data.path,R=Q.elements,S=t.getCommand(A),T,U,V;for(T=0;T<R.length;T++){U=R[T];for(V in D){if(D[V].checkElementRemovable(U,true)){if(V!==F){O(V);S.setState(1);}return;}}}O(E);S.setState(2);});})();(function(){var A='LJImage',B=null;LiveJournal.register_hook('editpic_response',function(C){var D=B,E=D&&D.getParent();if(!D)return;if(C.url){D.setAttribute('src',C.url);D.setAttribute('data-cke-saved-src',C.url);}else{if(E&&E.getName()==='a')E.remove();else D.remove();return;}if(C.width)D.setAttribute('width',C.width);else D.removeAttribute('width');if(C.height)D.setAttribute('height',C.height);else D.removeAttribute('height');if(C.title)D.setAttribute('title',C.title);else D.removeAttribute('title');if(C.border)D.setStyle('border-width',C.border+'px');else{D.removeStyle('border-width');D.removeStyle('border-style');}if(C.vspace)D.setStyles({'margin-top':C.vspace+'px','margin-bottom':C.vspace+'px'});else{D.removeStyle('margin-top');D.removeStyle('margin-bottom');}if(C.hspace)D.setStyles({'margin-left':C.hspace+'px','margin-right':C.hspace+'px'});else{D.removeStyle('margin-left');D.removeStyle('margin-right');}var E=D&&D.getParent();if(C.link){C.link=C.link.replace(/^[\s\t]*(?:http:\/\/)?/,'http://');if(E&&E.getName()==='a'){E.setAttribute('href',C.link);E.setAttribute('data-cke-saved-href',C.link);if(C.blank)E.setAttribute('target','_blank');else E.removeAttribute('target');}else{var F=new h('a',t.document);F.setAttribute('href',C.link);if(C.blank)F.setAttribute('target','_blank');D.insertBeforeMe(F);F.append(D);
-t.getSelection()&&t.getSelection().selectElement(F);}}else if(E.getName()==='a'){E.insertBeforeMe(D);E.remove();}if(C.aligment&&C.aligment!=='none')D.setStyle('float',C.aligment);else D.removeStyle('float');B=null;});t.addCommand(A,{exec:function(C,D){var E=C.getSelection();E=E?E.getSelectedElement():null;B=E;if(E){var F=E&&E.getParent(),G=F.getName()==='a',H=G&&F,I=G&&F.getAttribute('href'),J={};if('naturalWidth' in E.$){J.width=E.$.naturalWidth;J.height=E.$.naturalHeight;}else{var K=new Image();K.src=E.$.src;J={width:K.width,height:K.height};}C.rteButton(A,'editpic',{picData:{url:E.getAttribute('src'),title:E.getAttribute('title'),width:E.getAttribute('width')||E.$.width,height:E.getAttribute('height')||E.$.height,defaultWidth:J.width,defaultHeight:J.height,link:I||'',blank:G?!!H.getAttribute('target'):true,border:parseInt(E.getStyle('border-width'),10),vspace:parseInt(E.getStyle('margin-top'),10),hspace:parseInt(E.getStyle('margin-left'),10),aligment:E.getStyle('float')||'none'}});}else jQuery('.b-updatepage-event-section').editor('handleImageUpload','upload');},editorFocus:false});t.ui.addButton(A,{label:m.LJImage_Title,command:A});})();(function(){var A=null;t.on('selectionChange',function(E){var F=E.data.element;if(F.is('iframe'))A=F;else A=null;});var B='LJEmbedLink',C='video';function D(E){var F=new h('iframe',t.document);if(E!==LiveJournal.getEmbed(E)){var G=h.createFromHtml(LiveJournal.getEmbed(E)),H='',I=LiveJournal.parseMediaLink(E);if(I.preview)H='style="background-image: url('+I.preview+');"';F.setAttribute('lj-url',G.getAttribute('src'));F.setAttribute('data-link',E);F.setAttribute('lj-class','lj-iframe');F.setAttribute('class','lj-iframe-wrap lj-rtebox');F.setAttribute('style','width: 490px; height:370px;');F.setAttribute('lj-style','width: 480px; height:360px;');F.setAttribute('allowfullscreen','true');F.setAttribute('lj-content',encodeURIComponent('<div '+H+" class='lj-embed-inner lj-rtebox-inner'>"+(H?'':'iframe')+'</div>'));}else{F.setAttribute('lj-class','lj-embed');F.setAttribute('class','lj-embed-wrap lj-rtebox');F.setAttribute('lj-content',encodeURIComponent('<div '+H+" class='lj-embed-inner lj-rtebox-inner'>Embed</div>"));}F.setAttribute('lj-data',encodeURIComponent(LiveJournal.getEmbed(E)));F.setAttribute('frameBorder',0);F.setAttribute('allowTransparency','true');F.setAttribute('lj-cmd',B);t.insertElement(F);y();};LiveJournal.register_hook(C+'_response',function(E){D(E);});t.addCommand(B,{exec:function(E){var F=r[B].node||A;if(F)E.rteButton(B,C,{defaultText:F&&decodeURIComponent(F.getAttribute('data-link')||F.getAttribute('lj-url')||F.getAttribute('lj-data')),editMode:true});
-else E.rteButton(B,C);}});t.ui.addButton(B,{label:m.LJEmbed,command:B});})();(function(){var A='LJMap',B='map';LiveJournal.register_hook('map_response',function(C){var D=new h('iframe',t.document),E=425,F=350,G='',H='';if(!isNaN(E)){G+='width:'+E+'px;';H+='width:'+(E-2)+'px;';}if(!isNaN(F)){G+='height:'+F+'px;';H+='height:'+(F-2)+'px;';}var I=r[A].node;if(I)I.setAttributes({'lj-url':C});else{D.setAttributes({'lj-url':C,'class':'lj-map-wrap lj-rtebox','lj-content':'<div class="lj-map-inner lj-rtebox-inner"><p class="lj-map">map</p></div>','lj-cmd':'LJMap','lj-class':'lj-map',frameborder:0,allowTransparency:'true',style:G,'lj-style':H});t.insertElement(D);}y();});t.addCommand(A,{exec:function(){var C=r[A].node;t.rteButton(A,B,{defaultText:C?C.getAttribute('lj-url'):'',editMode:C?true:false});},editorFocus:false});t.ui.addButton(A,{label:m.LJMap_Title,command:A});})();(function(){function A(H,I){I=I===undefined||I;var J,K=r.LJLike.node;if(K){var L=H.getAttribute('lj-style');J=L?L.replace(/text-align:\s*(left|right|center)/i,'$1'):'left';}else if(I)J=H.getComputedStyle('text-align');else{while(!H.hasAttribute||!(H.hasAttribute('align')||H.getStyle('text-align'))){var M=H.getParent();if(!M)break;H=M;}J=H.getStyle('text-align')||H.getAttribute('align')||'';}J&&(J=J.replace(/-moz-|-webkit-|start|auto/i,''));!J&&I&&(J=H.getComputedStyle('direction')=='rtl'?'right':'left');return J;};function B(H){if(H.editor.readOnly)return;var I=H.editor.getCommand(this.name),J=H.data.element;if((J.type==1&&J.hasAttribute('lj-cmd')&&J.getAttribute('lj-cmd'))=='LJLike')I.state=A(J,t.config.useComputedState)==this.value?1:2;else if(!J||J.type!=1||J.getName()=='body'||J.getName()=='iframe')I.state=2;else I.state=A(J,t.config.useComputedState)==this.value?1:2;I.fire('state');};function C(H,I,J){var L=this;L.name=I;L.value=J;var K=H.config.justifyClasses;if(K){switch(J){case 'left':L.cssClassName=K[0];break;case 'center':L.cssClassName=K[1];break;case 'right':L.cssClassName=K[2];break;}L.cssClassRegex=new RegExp('(?:^|\\s+)(?:'+K.join('|')+')(?=$|\\s)');}};function D(H){var I=H.editor,J=new d.range(I.document);J.setStartBefore(H.data.node);J.setEndAfter(H.data.node);var K=new d.walker(J),L;while(L=K.next()){if(L.type==1){var M='text-align',N=I.config.justifyClasses;if(!L.equals(H.data.node)&&L.getDirection()){J.setStartAfter(L);K=new d.walker(J);continue;}if(N)if(L.hasClass(N[0])){L.removeClass(N[0]);L.addClass(N[2]);}else if(L.hasClass(N[2])){L.removeClass(N[2]);L.addClass(N[0]);}switch(L.getStyle(M)){case 'left':L.setStyle(M,'right');
-break;case 'right':L.setStyle(M,'left');break;}}}};C.prototype={exec:function(H){var V=this;var I=H.getSelection(),J=H.config.enterMode;if(!I)return;var K=I.createBookmarks();if(r.LJLike.node)r.LJLike.node.setAttribute('lj-style','text-align: '+V.value);else{var L=I.getRanges(true),M=V.cssClassName,N,O,P=H.config.useComputedState;P=P===undefined||P;for(var Q=L.length-1;Q>=0;Q--){var R=L[Q],S=R.getEnclosedNode();if(S&&S.type===1&&S.is('iframe'))return;N=R.createIterator();N.enlargeBr=J!=2;while(O=N.getNextParagraph(J==1?'p':'div')){O.removeAttribute('align');O.removeStyle('text-align');var T=M&&(O.$.className=e.ltrim(O.$.className.replace(V.cssClassRegex,''))),U=V.state==2&&(!P||A(O,true)!=V.value);if(M){if(U)O.addClass(M);else if(!T)O.removeAttribute('class');}else if(U)O.setStyle('text-align',V.value);}}}H.focus();H.forceNextSelectionCheck();I.selectBookmarks(K);}};var E=new C(t,'LJJustifyLeft','left'),F=new C(t,'LJJustifyCenter','center'),G=new C(t,'LJJustifyRight','right');t.addCommand('LJJustifyLeft',E);t.addCommand('LJJustifyCenter',F);t.addCommand('LJJustifyRight',G);t.ui.addButton('LJJustifyLeft',{label:t.lang.justify.left,command:'LJJustifyLeft'});t.ui.addButton('LJJustifyCenter',{label:t.lang.justify.center,command:'LJJustifyCenter'});t.ui.addButton('LJJustifyRight',{label:t.lang.justify.right,command:'LJJustifyRight'});t.on('selectionChange',e.bind(B,E));t.on('selectionChange',e.bind(B,G));t.on('selectionChange',e.bind(B,F));t.on('dirChanged',D);})();(function(){var A='LJPollLink';if(!LJ.pageVar('remoteUser',true))return;LiveJournal.register_hook('poll_response',function(B){var C=new Poll(B),D="<div class='lj-poll-inner lj-rtebox-inner'>"+C.outputHTML()+'</div>',E=C.outputLJtags(),F=r[A].node;if(F){F.setAttribute('lj-content',D);F.setAttribute('lj-data',E);F.removeAttribute('style');}else{F=new h('iframe',t.document);F.setAttribute('lj-content',D);F.setAttribute('lj-cmd','LJPollLink');F.setAttribute('lj-data',E);F.setAttribute('lj-class','lj-poll lj-rtebox');F.setAttribute('class','lj-poll-wrap');F.setAttribute('frameBorder',0);F.setAttribute('allowTransparency','true');t.insertElement(F);}y();});t.addCommand(A,{exec:function(B){var C=r.LJPollLink.node;if(C)B.rteButton(A,'poll',{ljData:decodeURIComponent(C.getAttribute('lj-data')),editMode:true,disabled:C&&(C.getAttribute('data-disabledPoll')?true:false)});else B.rteButton(A,'poll');},editorFocus:false});t.ui.addButton(A,{label:m.LJPoll_Title,command:A});})();(function(){var A='LJLike',B='like',C;
-q.defaultButtons=[];for(var D=0;D<q.length;D++){C=q[D];q[C.id]=q[C.abbr]=C;q.defaultButtons.push(C.id);}LiveJournal.register_hook('like_response',function(E){var F=[],G=[],H=typeof E==='string';for(var I=0,J;I<q.length;I++){J=q[I];if(H&&J.checked||E.indexOf(J.id)!=-1){F.push(J.id);G.push(J.html);}}var K=r[A].node,L=encodeURIComponent('<div class="lj-rtebox-inner lj-like-inner"><span class="lj-like-wrapper">'+G.join('')+'</span></div>');if(K){K.setAttribute('buttons',F.join(','));K.setAttribute('lj-content',L);K.removeAttribute('defaults');}else{K=new h('iframe',t.document);K.setAttribute('lj-class','lj-like');K.setAttribute('class','lj-like-wrap lj-rtebox');K.setAttribute('buttons',F.join(','));K.setAttribute('lj-content',L);K.setAttribute('lj-cmd','LJLike');K.setAttribute('frameBorder',0);K.setAttribute('allowTransparency','true');K.setAttribute('defaults',H);t.insertElement(K);}y();});t.addCommand(A,{exec:function(E){var F=r[A].node;if(F)E.rteButton(A,B,{buttons:F.getAttribute('buttons'),editMode:true});else E.rteButton(A,B);},editorFocus:false});t.ui.addButton(A,{label:m.LJLike_Title,command:A});})();},afterInit:function(t){var u=t.dataProcessor;u.dataFilter.addRules({elements:{'lj-like':function(v){var w=[],x=new a.htmlParser.element('iframe');x.attributes['lj-class']='lj-like';x.attributes['class']='lj-like-wrap lj-rtebox';if(v.attributes.hasOwnProperty('style'))x.attributes['lj-style']=v.attributes.style;x.attributes['lj-cmd']='LJLike';x.attributes['lj-content']='<div class="lj-rtebox-inner lj-like-inner"><span class="lj-like-wrapper">';x.attributes.frameBorder=0;x.attributes.allowTransparency='true';var y=v.attributes.buttons&&v.attributes.buttons.split(',')||q.defaultButtons,z=v.attributes.buttons?true:false,A=y.length;for(var B=0;B<A;B++){var C=y[B].replace(/^\s*([a-z]{2,})\s*$/i,'$1'),D=q[C];if(D&&(z||D.checked)){x.attributes['lj-content']+=encodeURIComponent(D.html);w.push(C);}}if(!v.attributes.buttons)x.attributes.defaults=true;x.attributes['lj-content']+='</span></div>';x.attributes.buttons=w.join(',');return x;},'lj-map':function(v){var w=new a.htmlParser.element('iframe'),x='',y='',z=Number(v.attributes.width),A=Number(v.attributes.height);if(!isNaN(z)){x+='width:'+z+'px;';y+='width:'+(z-2)+'px;';}if(!isNaN(A)){x+='height:'+A+'px;';y+='height:'+(A-2)+'px;';}if(x.length){w.attributes.style=x;w.attributes['lj-style']=y;}w.attributes['lj-url']=v.attributes.url?encodeURIComponent(v.attributes.url):'';w.attributes['lj-class']='lj-map';w.attributes['class']='lj-map-wrap lj-rtebox';
-w.attributes['lj-content']='<div class="lj-map-inner lj-rtebox-inner"><p class="lj-map">map</p></div>';w.attributes.frameBorder=0;w.attributes.allowTransparency='true';return w;},'lj-raw':function(v){v.name='lj:raw';},'lj-wishlist':function(v){v.name='lj:wishlist';},'lj-template':function(v){var w=new a.htmlParser.element('iframe');w.attributes['lj-class']='lj-template';w.attributes['class']='lj-template-wrap';w.attributes.frameBorder=0;w.attributes.allowTransparency='true';w.attributes['lj-attributes']=encodeURIComponent(LiveJournal.JSON.stringify(v.attributes));return w;},iframe:function(v){if(v.attributes['data-update']==='false')return v;var w='';if(v.attributes['data-link']){var x=LiveJournal.parseMediaLink(v.attributes['data-link']);if(x.preview)w='style="background-image: url('+x.preview+');"';}var y=v.attributes.src;if(v.attributes['lj-class']&&v.attributes['lj-class'].indexOf('lj-')+1==1)return v;var z=new a.htmlParser.element('iframe'),A='',B='',C=Number(v.attributes.width),D=Number(v.attributes.height);if(v.attributes.src.indexOf('kroogi.com')!==-1&&v.attributes.style){var E=v.attributes.style.match(/width:\s([0-9]+)px;/i),F=v.attributes.style.match(/height:\s([0-9]+)px;/i);if(F.length===2&&E.length===2){C=Number(E.pop());D=Number(F.pop());}}if(!isNaN(C)){A+='width:'+C+'px;';B+='width:'+(C-10)+'px;';}if(!isNaN(D)){A+='height:'+D+'px;';B+='height:'+(D-10)+'px;';}if(A.length){z.attributes.style=A;z.attributes['lj-style']=B;}z.attributes['lj-url']=v.attributes.src?encodeURIComponent(v.attributes.src):'';z.attributes['lj-class']='lj-iframe';z.attributes['class']='lj-iframe-wrap lj-rtebox';z.attributes['lj-content']='<div '+w+' class="lj-rtebox-inner">'+(w?'':'iframe')+'</div>';z.attributes.frameBorder=0;z.attributes.allowTransparency='true';if(y!=LiveJournal.getEmbed(decodeURIComponent(v.attributes.src))){z.attributes['lj-cmd']='LJEmbedLink';z.attributes['data-link']=v.attributes['data-link'];}return z;},a:function(v){if(v.attributes['data-user'])return;if(v.parent&&v.parent.attributes&&!v.parent.attributes['lj:user'])v.attributes['lj-cmd']='LJLink2';},img:function(v){if(v.attributes['data-user'])return;var w=v.parent&&v.parent.parent;if(!w||!v.attributes['data-user']||!w.attributes||!w.attributes['data-user'])v.attributes['lj-cmd']='LJImage';}}},5);u.htmlFilter.addRules({elements:{input:function(v){if(v.attributes&&v.attributes.id==='__focus')return false;return v;}}});u.htmlFilter.addRules({elements:{iframe:function(v){var w=v,x=false,y='text',z=/lj-[a-z]+/i.exec(v.attributes['lj-class']);
-if(z)z=z[0];else return v;switch(z){case 'lj-like':w=new a.htmlParser.element('lj-like');if(v.attributes.defaults!='true')w.attributes.buttons=v.attributes.buttons;if(v.attributes.hasOwnProperty('lj-style'))w.attributes.style=v.attributes['lj-style'];w.isEmpty=true;w.isOptionalClose=true;break;case 'lj-embed':var A=decodeURIComponent(v.attributes['lj-data']);w=new a.htmlParser.element('lj-embed');w.attributes.id=v.attributes.id;if(v.attributes.id)w.isEmpty=true;if(v.attributes.hasOwnProperty('source_user'))w.attributes.source_user=v.attributes.source_user;w.children=new a.htmlParser.fragment.fromHtml(decodeURIComponent(v.attributes['lj-data'])).children;w.isOptionalClose=true;break;case 'lj-map':w=new a.htmlParser.element('lj-map');w.attributes.url=decodeURIComponent(v.attributes['lj-url']);v.attributes.style&&(v.attributes.style+';').replace(/([a-z-]+):(.*?);/gi,function(F,G,H){w.attributes[G.toLowerCase()]=parseInt(H);});w.isOptionalClose=w.isEmpty=true;break;case 'lj-iframe':w=new a.htmlParser.element('iframe');w.attributes.src=decodeURIComponent(v.attributes['lj-url']);v.attributes.style&&(v.attributes.style+';').replace(/([a-z-]+):(.*?);/gi,function(F,G,H){w.attributes[G.toLowerCase()]=parseInt(H);});w.attributes.frameBorder=0;if(v.attributes['data-link'])w.attributes['data-link']=v.attributes['data-link'];break;case 'lj-poll':var A=decodeURIComponent(v.attributes['lj-data']);w=new a.htmlParser.fragment.fromHtml(A).children[0];break;case 'lj-repost':w=new a.htmlParser.element('lj-repost');w.attributes.button=v.attributes['lj-button'];w.children=new a.htmlParser.fragment.fromHtml(v.attributes['lj-text']).children;break;case 'lj-template':w=new a.htmlParser.element('lj-template');w.attributes=LiveJournal.JSON.parse(encodeURIComponent(v.attributes['lj-attributes']));w.isOptionalClose=w.isEmpty=true;break;case 'lj-spoiler':x=true;y='title';case 'lj-cut':if(v.attributes['lj-class'].indexOf(z+'-open')+1){var B=v.next,C=0;w=new a.htmlParser.element(z);if(v.attributes.hasOwnProperty('text'))w.attributes[y]=v.attributes.text;while(B){if(B.name=='iframe'){var D=B.attributes['lj-class'];if(D&&D.indexOf(z+'-close')+1){if(x&&C)C--;else{w.next=B;break;}}else if(D&&D.indexOf(z+'-open')+1)if(x)C++;else{w.next=B;break;}}B.parent.children.remove(B);w.add(B);var E=B.next;B.next=null;B=E;}}else w=false;break;default:if(!v.children.length)w=false;}return w;},div:function(v){if(!v.children.length)return false;},'lj:raw':function(v){v.name='lj-raw';},'lj:wishlist':function(v){v.name='lj-wishlist';
-}},attributes:{'lj-cmd':function(){return false;},contenteditable:function(){return false;}}});},requires:['fakeobjects','domiterator']});})();(function(m,n){var o;function p(v){return v.type==3&&v.getLength()>0&&(!o||!v.isReadOnly());};function q(v){return!(v.type==1&&v.isBlockBoundary(e.extend({},f.$empty,f.$nonEditable)));};var r=function(){var v=this;return{textNode:v.textNode,offset:v.offset,character:v.textNode?v.textNode.getText().charAt(v.offset):null,hitMatchBoundary:v._.matchBoundary};},s,t=function(v,w){s=new a.style(e.extend({attributes:{'data-cke-highlight':1,'data-incorrect':1,'data-id':0},fullMatch:1,ignoreReadonly:1,childRule:function(){return 1;}},{element:'span',styles:{'border-bottom':'1px solid red',cursor:'pointer'}},true));var x=function(J,K){var L=this,M=new d.walker(J);M.guard=K?q:function(N){!q(N)&&(L._.matchBoundary=true);};M.evaluator=p;M.breakOnFalse=1;if(J.startContainer.type==3){this.textNode=J.startContainer;this.offset=J.startOffset-1;}this._={matchWord:K,walker:M,matchBoundary:false};};x.prototype={next:function(){return this.move();},back:function(){return this.move(true);},move:function(J){var L=this;var K=L.textNode;if(K===null)return r.call(L);L._.matchBoundary=false;if(K&&J&&L.offset>0){L.offset--;return r.call(L);}else if(K&&L.offset<K.getLength()-1){L.offset++;return r.call(L);}else{K=null;while(!K){K=L._.walker[J?'previous':'next'].call(L._.walker);if(L._.matchWord&&!K||L._.walker._.end)break;}L.textNode=K;if(K)L.offset=J?K.getLength()-1:0;else L.offset=0;}return r.call(L);}};var y=function(J,K){this._={walker:J,cursors:[],rangeLength:K,highlightRange:null,isMatched:0};};y.prototype={toDomRange:function(){var J=new d.range(v.document),K=this._.cursors;if(K.length<1){var L=this._.walker.textNode;if(L)J.setStartAfter(L);else return null;}else{var M=K[0],N=K[K.length-1];J.setStart(M.textNode,M.offset);J.setEnd(N.textNode,N.offset+1);}return J;},updateFromDomRange:function(J){var M=this;var K,L=new x(J);M._.cursors=[];do{K=L.next();if(K.character)M._.cursors.push(K);}while(K.character);M._.rangeLength=M._.cursors.length;},setMatched:function(){this._.isMatched=true;},clearMatched:function(){this._.isMatched=false;},isMatched:function(){return this._.isMatched;},highlight:function(){var M=this;if(M._.cursors.length<1)return;if(M._.highlightRange)M.removeHighlight();var J=M.toDomRange(),K=J.createBookmark();s.applyToRange(J);J.moveToBookmark(K);M._.highlightRange=J;var L=J.startContainer;if(L.type!=1)L=L.getParent();M.updateFromDomRange(J);
-},highlightx:function(){var L=this;if(L._.cursors.length<1)return;if(L._.highlightRange)L.removeHighlight();var J=L.toDomRange(),K=J.createBookmark();J.moveToBookmark(K);L.updateFromDomRange(J);},removeHighlight:function(J){var L=this;if(!L._.highlightRange)return;var K=L._.highlightRange.createBookmark();s.removeFromRange(J||L._.highlightRange);L._.highlightRange.moveToBookmark(K);L.updateFromDomRange(L._.highlightRange);L._.highlightRange=null;},isReadOnly:function(){if(!this._.highlightRange)return 0;return this._.highlightRange.startContainer.isReadOnly();},moveBack:function(){var L=this;var J=L._.walker.back(),K=L._.cursors;if(J.hitMatchBoundary)L._.cursors=K=[];K.unshift(J);if(K.length>L._.rangeLength)K.pop();return J;},moveNext:function(){var L=this;var J=L._.walker.next(),K=L._.cursors;if(J.hitMatchBoundary)L._.cursors=K=[];K.push(J);if(K.length>L._.rangeLength)K.shift();return J;},getEndCharacter:function(){var J=this._.cursors;if(J.length<1)return null;return J[J.length-1].character;},getNextCharacterRange:function(J){var K,L,M=this._.cursors;if((K=M[M.length-1])&&K.textNode)L=new x(z(K));else L=this._.walker;return new y(L,J);},getCursors:function(){return this._.cursors;}};function z(J,K){var L=new d.range();L.setStart(J.textNode,K?J.offset:J.offset+1);L.setEndAt(v.document.getBody(),2);return L;};function A(J){var K=new d.range();K.setStartAt(v.document.getBody(),1);K.setEnd(J.textNode,J.offset);return K;};var B=0,C=1,D=2,E=function(J,K){var L=[-1];if(K)J=J.toLowerCase();for(var M=0;M<J.length;M++){L.push(L[M]+1);while(L[M+1]>0&&J.charAt(M)!=J.charAt(L[M+1]-1))L[M+1]=L[L[M+1]-1]+1;}this._={overlap:L,state:0,ignoreCase:!!K,pattern:J};};E.prototype={feedCharacter:function(J){var K=this;if(K._.ignoreCase)J=J.toLowerCase();for(;;){if(J==K._.pattern.charAt(K._.state)){K._.state++;if(K._.state==K._.pattern.length){K._.state=0;return D;}return C;}else if(!K._.state)return B;else K._.state=K._.overlap[K._.state];}return null;},reset:function(){this._.state=0;}};var F=/[.,"'?!;: \u0085\u00a0\u1680\u280e\u2028\u2029\u202f\u205f\u3000]/,G=function(J){if(!J)return true;var K=J.charCodeAt(0);return K>=9&&K<=13||K>=8192&&K<=8202||F.test(J);},H={searchRange:null,matchRange:null,find:function(J,K,L,M,N,O){var X=this;if(!X.matchRange)X.matchRange=new y(new x(X.searchRange),J.length);else X.matchRange=X.matchRange.getNextCharacterRange(J.length);var P=new E(J,!K),Q=B,R='%';while(R!==null){X.matchRange.moveNext();while(R=X.matchRange.getEndCharacter()){Q=P.feedCharacter(R);
-if(Q==D)break;if(X.matchRange.moveNext().hitMatchBoundary)P.reset();}if(Q==D){var S=X.matchRange.getCursors(),T=S[S.length-1],U=S[0],V=new x(A(U),true),W=new x(z(T),true);if(!(G(V.back().character)&&G(W.next().character)))continue;X.matchRange.setMatched();if(N!==false)X.matchRange.highlightx();return X.matchRange;}}if(M&&!O){X.searchRange=u(1);X.matchRange=null;return arguments.callee.apply(X,Array.prototype.slice.call(arguments).concat([true]));}return false;}},I=v.lang.findAndReplace;return H;};function u(v,w){var x,y=w.getSelection(),z=w.document.getBody();if(y&&!v){x=y.getRanges()[0].clone();x.collapse(true);}else{x=new d.range();x.setStartAt(z,1);}x.setEndAt(z,2);return x;};j.add('ljspell',{options:{classNames:{wordActive:'active',area:'b-spelling-textarea',skipError:'b-spelling-item-skip',bubbleContainer:'b-spelling-bubble',bubbleNoSuggestions:'b-spelling-item-no'},selectors:{bubbleItem:'.b-spelling-item',fake:'.b-spelling-faketextarea',error:'.b-spelling-error'},tmpl:{spellError:'<span class="b-spelling-word b-spelling-error" data-id="{id}"><span class="b-spelling-inner">{word}</span></span>',wrapper:'<div class="b-spelling"><div class="b-spelling-faketextarea"></div></div>',bubble:'<div class="b-spelling-bubble-container"></div>',bubbleList:'<ul class="b-spelling-items">{items}</ul>',bubbleItem:'<li class="b-spelling-item"><span class="b-spelling-item-word">{word}</span></li>',bubbleItemNoSuggestions:'<li class="b-spelling-item b-spelling-item-no"><span class="b-spelling-item-word">'+LJ.ml('widget.form.no_suggestions')+'</span></li>',bubbleItemSkip:'<li class="b-spelling-item b-spelling-item-skip"><span class="b-spelling-item-word">'+LJ.ml('widget.form.skip_word')+'</span></li>'},enabled:false},init:function(v){var w=this,x='LJSpell',y;y=(function(z){var A,B,C;return{save:function(){A=z.getSelection();B=A.getRanges()[0];C=B.createBookmark(true);z.focusManager.blur();z.focusManager.forceBlur();},restore:function(){A.unlock();B.moveToBookmark(C);z.getSelection().selectRanges([B]);}};})(v);v.on('contentDom',function(){var z=m(this.document.getBody().$),A=m('#cke_ck'),B=w.options,C=m(B.tmpl.bubble);C.bubble({showOn:'click',alwaysShowUnderTarget:true,classNames:{containerAddClass:B.classNames.bubbleContainer}});z.on('click','span[data-incorrect]',function(D){var E=m(this),F=E.data('word'),G=a.ljspell.getSuggestions(F).map(function(J){return B.tmpl.bubbleItem.supplant({word:J});}),H=null,I;if(G.length===0)G.push(B.tmpl.bubbleItemNoSuggestions);G.push(B.tmpl.bubbleItemSkip);
-Function.defer(function(){C.html(B.tmpl.bubbleList.supplant({items:G.join('')})).off('click').on('click',B.selectors.bubbleItem,function(){var J=m(this).text(),K=m(this).hasClass(B.classNames.skipError);C.bubble('hide');if(m(this).hasClass(B.classNames.bubbleNoSuggestions))return;if(K)J=F;H=z.find('span[data-id="'+E.data('id')+'"]');(function(){var L=h.get(H.first().get(0)),M=new d.range(v.document),N=v.getSelection(),O;N.selectElement(L);N.getRanges()[0].collapse();O=N.getRanges()[0].createBookmark(true);M.moveToBookmark(O);H.first().replaceWith(J);if(H.length)H.slice(1).detach();setTimeout(function(){if(!v.focusManager.hasFocus)v.focus();N.selectRanges([M]);if(K){LiveJournal.run_hook('skipWord',J);a.ljspell.removeHighlightFromWord(J);}},0);})();}).bubble('hide').bubble('show',A).bubble('absolute',D.clientX,D.clientY+A.offset().top+60);});D.preventDefault();});a.ljspell.init();});a.ljspell=(function(z,A){var B=false,C=0,D=false,E=t(z),F=LiveJournal.getAjaxUrl('spellcheck'),G={},H=[],I={},J=null,K=null,L=1000,M=null;function N(ab){var ac=z.document.getBody();return ab?m(ac.$):ac;};function O(ab){var ac=[];E.searchRange=u(1,z);E.matchRange=null;while((range=E.find(ab,false,false,false))!==false)ac.push(range);return ac;};function P(ab){D=ab;if(!J)J=m('.cke_button_'+x);J.toggleClass('active',D);};function Q(ab){var ac=[],ad=null;ab=ab.trim().toLowerCase();if(ab.trim().length===0)return[];ad=ab.replace(/\&nbsp;/ig,' ').match(/[a-zа-яё]+/gi);if(ad)return ad.reduce(function(ae,af){if(ae.indexOf(af)===-1)ae.push(af);return ae;},[]);else return[];};function R(){var ab=m('<div />',{html:z.getData()}).text(),ac=Q(ab);T(ac);return ac;};function S(ab){ab.forEach(function(ac){G[ac]=true;});};function T(ab){H=H.filter(function(ac){return ab.indexOf(ac)!==-1;});ab.forEach(function(ac){if(I.hasOwnProperty(ac)&&H.indexOf(ac)===-1)H.push(ac);});};function U(){var ab=R();ab=ab.filter(function(ac){return!G[ac];});if(ab.length>0){S(ab);return ab;}else return false;return ab.length>0?ab:false;};function V(){var ab=U();if(!ab)return;m.ajax({url:F,type:'POST',dataType:'json',data:{html:ab.join(' ')},async:false,success:function(ac){var ad=Object.keys(ac.words);if(ad.length){m.extend(I,ac.words);H=H.concat(ad);}}});};function W(ab){var ac=this,ad=null;if(!D)return;setTimeout(function(){A.save();ad=s._.definition.attributes;ad['data-word']=ab;O(ab).forEach(function(ae){C+=1;ad['data-id']=C;ae.highlight();});A.restore();},0);};function X(){V();Z();H.forEach(W);};function Y(ab){N(true).find("span[data-incorrect][data-word='"+ab+"']").each(function(){var ac=m(this);
-ac.replaceWith(ac.text());});};function Z(){if(C===0)return;A.save();m(z.document.getBody().$).find('span[data-incorrect]').each(function(ab,ac){var ad=m(ac);ad.replaceWith(ad.html());});A.restore();C=0;};function aa(ab){delete I[ab];H=H.filter(function(ac){return ac!==ab;});};M={init:function(){if(!B){P(D);if(D)setTimeout(X,1000);LiveJournal.register_hook('skipWord',function(ab){aa(ab);S([ab]);});B=true;}},on:function(){P(true);X();},off:function(){P(false);Z();},isEnabled:function(){return D;},toggle:function(){P(!D);},highlightWord:W,removeHighlightFromWord:Y,highlight:X,removeHighlight:Z,skipWord:aa,change:function(){if(K)clearTimeout(K);K=setTimeout(function(){if(D)X();else Z();},L);},getSuggestions:function(ab){return ab===undefined?I:I[ab]||[];},getWordRanges:O,debug:function(){LJ.console.log('--- already used words');LJ.console.log(Object.keys(G));LJ.console.log('--- words that are in the editor');LJ.console.log(R());LJ.console.log('--- new words in the editor');LJ.console.log(U());LJ.console.log('--- current incorrect words');LJ.console.log(H);}};return M;})(v,y);v.dataProcessor.htmlFilter.addRules({elements:{span:function(z){if(z.attributes['data-incorrect']||z.attributes['data-id']){delete z.name;var A=z.children[0];if(A)A.value=A.value.replace(/\&nbsp;/,' ');return z;}}}});v.on('change',a.ljspell.change);v.addCommand(x,{exec:function(z){a.ljspell.toggle();},editorFocus:false});v.ui.addButton(x,{label:CKLang.LJSpell_Title,command:x});}});})(jQuery,window);(function(){function m(o){var p=o.getStyle('overflow-y'),q=o.getDocument(),r=h.createFromHtml('<span style="margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;">'+(b.webkit?'&nbsp;':'')+'</span>',q);q[c?'getBody':'getDocumentElement']().append(r);var s=r.getDocumentPosition(q).y+r.$.offsetHeight;r.remove();o.setStyle('overflow-y',p);return s;};var n=function(o){if(!o.window)return;var p=o.document,q=new h(p.getWindow().$.frameElement),r=p.getBody(),s=p.getDocumentElement(),t=o.window.getViewPaneSize().height,u=p.$.compatMode=='BackCompat'?r:s,v=m(u);v+=o.config.autoGrow_bottomSpace||0;var w=o.config.autoGrow_minHeight!=undefined?o.config.autoGrow_minHeight:200,x=o.config.autoGrow_maxHeight||Infinity;v=Math.max(v,w);v=Math.min(v,x);if(v!=t){v=o.fire('autoGrow',{currentHeight:t,newHeight:v}).newHeight;o.resize(o.container.getStyle('width'),v,true);}if(u.$.scrollHeight>u.$.clientHeight&&v<x)u.setStyle('overflow-y','hidden');else u.removeStyle('overflow-y');};j.add('autogrow',{init:function(o){o.addCommand('autogrow',{exec:n,modes:{wysiwyg:1},readOnly:1,canUndo:false,editorFocus:false});
-var p={contentDom:1,key:1,selectionChange:1,insertElement:1};o.config.autoGrow_onStartup&&(p.instanceReady=1);for(var q in p)o.on(q,function(r){var s=o.getCommand('maximize');if(r.editor.mode=='wysiwyg'&&(!s||s.state!=1))setTimeout(function(){n(r.editor);n(r.editor);},100);});}});})();j.add('colorbutton',{requires:['panelbutton','floatpanel','styles'],init:function(m){var n=m.config,o=m.lang.colorButton,p;if(!b.hc){q('TextColor','fore',o.textColorTitle);q('BGColor','back',o.bgColorTitle);}function q(t,u,v){var w=e.getNextId()+'_colorBox';m.ui.add(t,'panelbutton',{label:v,title:v,className:'cke_button_'+t.toLowerCase(),modes:{wysiwyg:1},panel:{css:m.skin.editor.css,attributes:{role:'listbox','aria-label':o.panelTitle}},onBlock:function(x,y){y.autoSize=true;y.element.addClass('cke_colorblock');y.element.setHtml(r(x,u,w));y.element.getDocument().getBody().setStyle('overflow','hidden');k.fire('ready',this);var z=y.keys,A=m.lang.dir=='rtl';z[A?37:39]='next';z[40]='next';z[9]='next';z[A?39:37]='prev';z[38]='prev';z[2228224+9]='prev';z[32]='click';},onOpen:function(){var x=m.getSelection(),y=x&&x.getStartElement(),z=new d.elementPath(y),A;y=z.block||z.blockLimit||m.document.getBody();do A=y&&y.getComputedStyle(u=='back'?'background-color':'color')||'transparent';while(u=='back'&&A=='transparent'&&y&&(y=y.getParent()));if(!A||A=='transparent')A='#ffffff';this._.panel._.iframe.getFrameDocument().getById(w).setStyle('background-color',A);}});};function r(t,u,v){var w=[],x=n.colorButton_colors.split(','),y=x.length+(n.colorButton_enableMore?2:1),z=e.addFunction(function(F,G){if(F=='?'){var H=arguments.callee;function I(K){this.removeListener('ok',I);this.removeListener('cancel',I);K.name=='ok'&&H(this.getContentElement('picker','selectedColor').getValue(),G);};m.openDialog('colordialog',function(){this.on('ok',I);this.on('cancel',I);});return;}m.focus();t.hide(false);m.fire('saveSnapshot');new a.style(n['colorButton_'+G+'Style'],{color:'inherit'}).remove(m.document);if(F){var J=n['colorButton_'+G+'Style'];J.childRule=G=='back'?function(K){return s(K);}:function(K){return!(K.is('a')||K.getElementsByTag('a').count())||s(K);};new a.style(J,{color:F}).apply(m.document);}m.fire('saveSnapshot');});w.push('<a class="cke_colorauto" _cke_focus=1 hidefocus=true title="',o.auto,'" onclick="CKEDITOR.tools.callFunction(',z,",null,'",u,"');return false;\" href=\"javascript:void('",o.auto,'\')" role="option" aria-posinset="1" aria-setsize="',y,'"><table role="presentation" cellspacing=0 cellpadding=0 width="100%"><tr><td><span class="cke_colorbox" id="',v,'"></span></td><td colspan=7 align=center>',o.auto,'</td></tr></table></a><table role="presentation" cellspacing=0 cellpadding=0 width="100%">');
-for(var A=0;A<x.length;A++){if(A%8===0)w.push('</tr><tr>');var B=x[A].split('/'),C=B[0],D=B[1]||C;if(!B[1])C='#'+C.replace(/^(.)(.)(.)$/,'$1$1$2$2$3$3');var E=m.lang.colors[D]||D;w.push('<td><a class="cke_colorbox" _cke_focus=1 hidefocus=true title="',E,'" onclick="CKEDITOR.tools.callFunction(',z,",'",C,"','",u,"'); return false;\" href=\"javascript:void('",E,'\')" role="option" aria-posinset="',A+2,'" aria-setsize="',y,'"><span class="cke_colorbox" style="background-color:#',D,'"></span></a></td>');}if(n.colorButton_enableMore===undefined||n.colorButton_enableMore)w.push('</tr><tr><td colspan=8 align=center><a class="cke_colormore" _cke_focus=1 hidefocus=true title="',o.more,'" onclick="CKEDITOR.tools.callFunction(',z,",'?','",u,"');return false;\" href=\"javascript:void('",o.more,"')\"",' role="option" aria-posinset="',y,'" aria-setsize="',y,'">',o.more,'</a></td>');w.push('</tr></table>');return w.join('');};function s(t){return t.getAttribute('contentEditable')=='false'||t.getAttribute('data-nostyle');};}});i.colorButton_colors='000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF';i.colorButton_foreStyle={element:'span',styles:{color:'#(color)'},overrides:[{element:'font',attributes:{color:null}}]};i.colorButton_backStyle={element:'span',styles:{'background-color':'#(color)'}};j.colordialog={init:function(m){m.addCommand('colordialog',new a.dialogCommand('colordialog'));a.dialog.add('colordialog',this.path+'dialogs/colordialog.js');}};j.add('colordialog',j.colordialog);j.add('ljcolor',{requires:['styles'],init:function(m){var n='LJColor';m.on('selectionChange',function(t){var u=t.data.element,v=m.getCommand(n);if(u.is('span')&&u.getStyle('color'))v.setState(1);else v.setState(2);});var o=m.config,p=m.lang.colorButton;function q(t){t=t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);var u='#'+('0'+parseInt(t[1],10).toString(16)).slice(-2)+('0'+parseInt(t[2],10).toString(16)).slice(-2)+('0'+parseInt(t[3],10).toString(16)).slice(-2);return u.toUpperCase();};function r(t,u){m.focus();m.fire('saveSnapshot');new a.style(o['colorButton_'+u+'Style'],{color:'inherit'}).remove(m.document);if(t){var v=o['colorButton_'+u+'Style'];v.childRule=u=='back'?function(w){return s(w);}:function(w){return!(w.is('a')||w.getElementsByTag('a').count())||s(w);};new a.style(v,{color:t}).apply(m.document);
-}m.fire('saveSnapshot');};LiveJournal.register_hook('selectedColor',function(t){r(t,'fore');});m.ui.addButton(n,{label:p.textColorTitle,command:n});m.addCommand(n,{exec:function(t){var u=null,v=t.getSelection();if(v){var w=v.getRanges()[0],x=w.startContainer.getParent();if(x.is('span')){u=x.getStyle('color');if(u)u=q(u);}}t.rteButton(n,'color',{selectedColor:u});}});function s(t){return t.getAttribute('contentEditable')=='false'||t.getAttribute('data-nostyle');};}});i.colorButton_foreStyle={element:'span',styles:{color:'#(color)'},overrides:[{element:'font',attributes:{color:null}}]};j.add('ljlink',{init:function(m){m.addCommand('link',new a.dialogCommand('link'));m.addCommand('unlink',new a.unlinkCommand());if(jQuery.browser.webkit)m.on('contentDom',function(){this.document.on('keydown',function(B){if(B.data.getKey()===13){var C=m.getSelection(),D,E;if(!C)return;D=C.getRanges()[0];E=D.endContainer.getParent();var F=D.checkStartOfBlock(),G=D.checkEndOfBlock();if(E.is('a')&&D.collapsed||D.endContainer.type===1&&D.endContainer.is('a')){m.insertHtml('<span>&nbsp;</span>');setTimeout(function(){if(G&&E&&E.getNext())E.getNext().remove();},100);}}});});m.on('selectionChange',function(B){if(m.readOnly)return;var C=m.getCommand('unlink'),D=B.data.path.lastElement&&B.data.path.lastElement.getAscendant('a',true);if(D&&D.getName()=='a'&&D.getAttribute('href')&&D.getChildCount())C.setState(2);else C.setState(0);});var n=/^javascript:/,o=/^mailto:([^?]+)(?:\?(.+))?$/,p=/subject=([^;?:@&=$,\/]*)/,q=/body=([^;?:@&=$,\/]*)/,r=/^#(.*)$/,s=/^((?:http|https|ftp|news):\/\/)?(.*)$/,t=/^(_(?:self|top|parent|blank))$/,u=/^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/,v=/^javascript:([^(]+)\(([^)]+)\)$/,w=/\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/,x=/(?:^|,)([^=]+)=(\d+|yes|no)/gi,y=function(B,C){var D=C&&(C.data('cke-saved-href')||C.getAttribute('href'))||'',E,F,G,H,I={};if(E=D.match(n))if(emailProtection=='encode')D=D.replace(u,function(aa,ab,ac){return 'mailto:'+String.fromCharCode.apply(String,ab.split(','))+(ac&&unescapeSingleQuote(ac));});else if(emailProtection)D.replace(v,function(aa,ab,ac){if(ab==compiledProtectionFunction.name){I.type='email';var ad=I.email={},ae=/[^,\s]+/g,af=/(^')|('$)/g,ag=ac.match(ae),ah=ag.length,ai,aj;for(var ak=0;ak<ah;ak++){aj=decodeURIComponent(unescapeSingleQuote(ag[ak].replace(af,'')));ai=compiledProtectionFunction.params[ak].toLowerCase();
-ad[ai]=aj;}ad.address=[ad.name,ad.domain].join('@');}});if(!I.type)if(G=D.match(r)){I.type='anchor';I.anchor={};I.anchor.name=I.anchor.id=G[1];}else if(F=D.match(o)){var J=D.match(p),K=D.match(q);I.type='email';var L=I.email={};L.address=F[1];J&&(L.subject=decodeURIComponent(J[1]));K&&(L.body=decodeURIComponent(K[1]));}else if(D&&(H=D.match(s))){I.type='url';I.url={};I.url.protocol=H[1];I.url.url=H[2];}else I.type='url';if(C){var M=C.getAttribute('target');I.target={};I.adv={};if(!M){var N=C.data('cke-pa-onclick')||C.getAttribute('onclick'),O=N&&N.match(w);if(O){I.target.type='popup';I.target.name=O[1];var P;while(P=x.exec(O[2])){if((P[2]=='yes'||P[2]=='1')&&!(P[1] in {height:1,width:1,top:1,left:1}))I.target[P[1]]=true;else if(isFinite(P[2]))I.target[P[1]]=P[2];}}}else{var Q=M.match(t);if(Q)I.target.type=I.target.name=M;else{I.target.type='frame';I.target.name=M;}}var R=this,S=function(aa,ab){var ac=C.getAttribute(ab);if(ac!==null)I.adv[aa]=ac||'';};S('advId','id');S('advLangDir','dir');S('advAccessKey','accessKey');I.adv.advName=C.data('cke-saved-name')||C.getAttribute('name')||'';S('advLangCode','lang');S('advTabIndex','tabindex');S('advTitle','title');S('advContentType','type');j.link.synAnchorSelector?I.adv.advCSSClasses=getLinkClass(C):S('advCSSClasses','class');S('advCharset','charset');S('advStyles','style');S('advRel','rel');}var T=I.anchors=[],U;if(j.link.emptyAnchorFix){var V=B.document.getElementsByTag('a');for(i=0,count=V.count();i<count;i++){U=V.getItem(i);if(U.data('cke-saved-name')||U.hasAttribute('name'))T.push({name:U.data('cke-saved-name')||U.getAttribute('name'),id:U.getAttribute('id')});}}else{var W=new d.nodeList(B.document.$.anchors);for(var X=0,Y=W.count();X<Y;X++){U=W.getItem(X);T[X]={name:U.getAttribute('name'),id:U.getAttribute('id')};}}if(j.link.fakeAnchor){var Z=B.document.getElementsByTag('img');for(X=0,Y=Z.count();X<Y;X++){if(U=j.link.tryRestoreFakeAnchor(B,Z.getItem(X)))T.push({name:U.getAttribute('name'),id:U.getAttribute('id')});}}this.selectedElement=C;return I;};LiveJournal.register_hook('link_response',function(B){var K=this;var C=B.url,D=B.target||'';if(C.length===0){m.execCommand('unlink');delete K.selectedElement;return;}if(!C.match(/^[a-z+]+:(\/\/)?/))C='http://'+C;var E={};E['data-cke-saved-href']=C;E.href=C;if(D)E.target=D;if(!K.selectedElement){var F=new h('a'),G=m.getSelection();F.setAttributes({'data-cke-saved-href':C,href:C});if(D)F.setAttribute('target',D);F.setText(z||C);m.insertElement(F);}else{var H=K.selectedElement,I=H.data('cke-saved-href'),J=H.getHtml();
-if(!E[D])H.removeAttribute('target');H.setAttributes(E);delete K.selectedElement;}});var z;LiveJournal.register_hook('link_hide',function(B){if(this.selectedElement)delete this.selectedElement;z='';});var A='LJLink2';m.addCommand(A,{exec:function(B){var C=B.getSelection(),D={},E=null;z=C.getSelectedText();if((E=j.link.getSelectedLink(B))&&E.hasAttribute('href'))C.selectElement(E);else E=null;var F='';if(E){var G=y(B,E).url;F=(G.protocol||'http://')+G.url;}D.defaultText=F;D.hasSelectedText=!!E;D.editMode=!!E;if(E)D.hasTarget=E.hasAttribute('target')?true:false;B.rteButton(A,'link',D);},editorFocus:false});m.ui.addButton(A,{label:m.lang.link.toolbar,command:A});},afterInit:function(m){var n=m.dataProcessor,o=n&&n.dataFilter,p=n&&n.htmlFilter,q=m._.elementsPath&&m._.elementsPath.filters;if(o)o.addRules({elements:{a:function(r){var s=r.attributes;if(!s.name)return null;var t=!r.children.length;if(j.link.synAnchorSelector){var u=t?'cke_anchor_empty':'cke_anchor',v=s['class'];if(s.name&&(!v||v.indexOf(u)<0))s['class']=(v||'')+' '+u;if(t&&j.link.emptyAnchorFix){s.contenteditable='false';s['data-cke-editable']=1;}}else if(j.link.fakeAnchor&&t)return m.createFakeParserElement(r,'cke_anchor','anchor');return null;}}});if(j.link.emptyAnchorFix&&p)p.addRules({elements:{a:function(r){delete r.attributes.contenteditable;}}});if(q)q.push(function(r,s){if(s=='a')if(j.link.tryRestoreFakeAnchor(m,r)||r.getAttribute('name')&&(!r.getAttribute('href')||!r.getChildCount()))return 'anchor';});},requires:['fakeobjects']});j.link={getSelectedLink:function(m){try{var n=m.getSelection();if(n.getType()==3){var o=n.getSelectedElement();if(o.is('a'))return o;}var p=n.getRanges(true)[0];p.shrink(2);var q=p.getCommonAncestor();return q.getAscendant('a',true);}catch(r){return null;}},fakeAnchor:b.opera||b.webkit,synAnchorSelector:c,emptyAnchorFix:c&&b.version<8,tryRestoreFakeAnchor:function(m,n){if(n&&n.data('cke-real-element-type')&&n.data('cke-real-element-type')=='anchor'){var o=m.restoreRealElement(n);if(o.data('cke-saved-name'))return o;}}};a.unlinkCommand=function(){};a.unlinkCommand.prototype={exec:function(m){var n=m.getSelection(),o=n.createBookmarks(),p=n.getRanges(),q,r;for(var s=0;s<p.length;s++){q=p[s].getCommonAncestor(true);r=q.getAscendant('a',true);if(!r)continue;p[s].selectNodeContents(r);}n.selectRanges(p);m.document.$.execCommand('unlink',false,null);n.selectBookmarks(o);},startDisabled:true};a.removeAnchorCommand=function(){};a.removeAnchorCommand.prototype={exec:function(m){var n=m.getSelection(),o=n.createBookmarks(),p;
-if(n&&(p=n.getSelectedElement())&&(j.link.fakeAnchor&&!p.getChildCount()?j.link.tryRestoreFakeAnchor(m,p):p.is('a')))p.remove(1);else if(p=j.link.getSelectedLink(m))if(p.hasAttribute('href')){p.removeAttributes({name:1,'data-cke-saved-name':1});p.removeClass('cke_anchor');}else p.remove(1);n.selectBookmarks(o);}};(function(){function m(p,q,r,s,t,u,v){var w=p.config,x=t.split(';'),y=[],z={};for(var A=0;A<x.length;A++){var B=x[A];if(B){B=B.split('/');var C={},D=x[A]=B[0];C[r]=y[A]=B[1]||D;z[D]=new a.style(v,C);z[D]._.definition.name=D;}else x.splice(A--,1);}p.ui.addRichCombo(q,{label:s.label,title:s.panelTitle,className:'cke_'+(r=='size'?'fontSize':'font'),panel:{css:p.skin.editor.css.concat(w.contentsCss),multiSelect:false,attributes:{'aria-label':s.panelTitle}},init:function(){this.startGroup(s.panelTitle);for(var E=0;E<x.length;E++){var F=x[E];this.add(F,z[F].buildPreview(),F);}},onClick:function(E){p.focus();p.fire('saveSnapshot');var F=z[E];if(this.getValue()==E)F.remove(p.document);else{var G=p.getSelection(),H=parseFloat(z[E]._.definition.styles['font-size']);for(var I in z)z[I].remove(p.document);F.apply(p.document);}p.fire('saveSnapshot');},onRender:function(){p.on('selectionChange',function(E){var F=this.getValue(),G=E.data.path,H=G.elements;for(var I=0,J;I<H.length;I++){J=H[I];for(var K in z){if(z[K].checkElementRemovable(J,true)){if(K!=F)this.setValue(K);return;}}}this.setValue('',u);},this);}});};j.add('ljfont',{requires:['richcombo','styles'],init:function(p){var q=p.config;m(p,'ljFontSize','size',p.lang.fontSize,q.fontSize_sizes,q.fontSize_defaultLabel,q.fontSize_style);}});i.font_style={element:'span',styles:{'font-family':'#(family)'},overrides:[{element:'font',attributes:{face:null}}]};var n={tiny:'0.7em',small:'0.9em',normal:'1.0em',large:'1.4em',huge:'1.8em'};i.fontSize_sizes='';for(var o in n)i.fontSize_sizes+=Site.ml_text['talk.font.'+o]+'/'+n[o]+';';i.fontSize_defaultLabel=Site.ml_text['talk.font.normal'];i.fontSize_style={element:'span',styles:{'font-size':'#(size)'},overrides:[{element:'font',attributes:{size:null}}]};})();(function(m){'use strict';var n={LJCut:{tag:'lj-cut',widget:'cut'},LJSpoiler:{tag:'lj-spoiler',widget:'spoiler'}};j.add('ljcut',{init:function(o){var p,q,r=null;function s(y){var z=y;while(!z.getParent().is('body'))z=z.getParent();if(z!==y)y.breakParent(z);};function t(){var y=jQuery(o.document.getBody().$),z=false;y.find('ul, ol, li').each(function(){if(m(this).text().length===0){m(this).remove();z=true;}});};function u(y,z){var A=new d.selection(o.document),B=false,C=n[y].tag,D=new h('iframe',o.document),E=new h('br',o.document);
-D.setAttributes({'lj-cmd':y,'lj-class':C+' '+C+'-open','class':C+'-wrap',frameBorder:0,allowTransparency:'true'});if(typeof z!=='undefined')D.setAttribute('text',z);var F=D.clone();F.setAttribute('lj-class',C+' '+C+'-close');if(q.cloneContents().getChildCount()===0)B=true;q.insertNode(D);q.collapse();q.insertNode(F);s(D);s(F);if(B){E.clone().insertAfter(D);E.clone().insertBefore(F);}var G=new d.range(o.document);G.setStartAfter(D);G.setEndBefore(F);A.selectRanges([G]);o.focus();t();};function v(y,z){if(r&&r.getAttribute('lj-cmd')===y)r.setAttribute('text',z);else{u(y,z===Site.page.rtedata[y+'_PromptText']?undefined:z);o.updateFrames();}};function w(y,z){o.addCommand(y,{exec:function(){var A=new d.selection(o.document);p=A&&A.getSelectedElement();q=A.getRanges()[0];var B={defaultText:r?r.getAttribute('text'):'',editMode:r?true:false};if(r&&r.getAttribute('lj-cmd')!==y)B=null;o.rteButton(y,z,B);},editorFocus:false});o.ui.addButton(y,{label:a.CKLang[y+'_Title'],command:y});};LiveJournal.register_hook('cut_response',function(y){v('LJCut',y);});LiveJournal.register_hook('spoiler_response',function(y){v('LJSpoiler',y);});o.on('selectionChange',function(y){var z=y.data.element;if(z&&z.is('iframe')&&...
 (truncated)
Tags: atyurin, js, livejournal, spacevillain
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