Alexander Nazarov (nfokz) wrote in changelog,
Alexander Nazarov
nfokz
changelog

[livejournal] r22651: LJSUP-12121: Update form toolbar to hand...

Committer: anazarov
LJSUP-12121: Update form toolbar to handle custom buttons.
U   trunk/htdocs/js/ck/ckeditor.js
Modified: trunk/htdocs/js/ck/ckeditor.js
===================================================================
--- trunk/htdocs/js/ck/ckeditor.js	2012-08-15 09:05:36 UTC (rev 22650)
+++ trunk/htdocs/js/ck/ckeditor.js	2012-08-15 09:11:42 UTC (rev 22651)
@@ -126,14 +126,14 @@
 function r(t){var u,v,w,x,y=document.createElement('lj-note'),z=typeof document.body.style.opacity!='string',A=(function(){var D=60,E=100,F=E*D/1000,G=[],H,I=document.getElementById('draft-container')||document.body;function J(){var K=G.shift(),L=(H?K.time/E:-(K.time/E-1)).toFixed(1);if(!G.length)L=H?1:0;if(z)y.style.filter=L>=1?null:'progid:DXImageTransform.Microsoft.Alpha(opacity='+L*100+')';else y.style.opacity=L;if(L==0&&y&&y.parentNode)y.parentNode.removeChild(y);};return function(K){H=K;if(H&&y.parentNode){if(z)y.style.filter=null;else y.style.opacity=1;}else for(var L=1;L<=F;L++){var M=Math.floor(1000/D)*L;G.push({time:M,timer:setTimeout(J,M)});}I.appendChild(y);y.style.marginTop=-y.offsetHeight/2+'px';y.style.marginLeft=-y.offsetWidth/2+'px';};})();y.className='note-popup';y.onmouseout=function(){if(!w||!w.cmd)a.note.hide();};y.onmouseover=function(){if(u&&!v){v=1;u=clearTimeout(u);}};if(z)y.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity=0)';else y.style.opacity=0;function B(){var D=this.getAttribute('lj-cmd');if(w.hasOwnProperty(D)){p[D].node=w[D].node;var E=new d.selection(t.document);E.selectElement(p[D].node);t.execFromEditor=true;t.execCommand(D);a.note.hide(true);}return false;};function C(){if(!window.switchedRteOn)a.note.hide(true);if(v){w=x;x=null;var D='';for(var E in w){if(w.hasOwnProperty(E))D+='<div class="noteItem">'+w[E].content+'</div>';}y.innerHTML=decodeURIComponent(D);var F=y.getElementsByTagName('a');for(var G=0,H=F.length;G<H;G++){var I=F[G];if(p.hasOwnProperty(I.getAttribute('lj-cmd')))I.onclick=B;}}else w=null;A(v);u=null;};a.note={show:function(D,E){if(!E&&D==x||!window.switchedRteOn)return;if(u)u=clearTimeout(u);v=1;x=D;E===true?C():u=setTimeout(C,1000);},hide:function(D){if(v){v=0;if(u)u=clearTimeout(u);if(y.parentNode)D===true?C():u=setTimeout(C,500);}}};};var 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['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};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'];j.add('livejournal',{init:function(t){t.rteButton=n;
 function u(B){var C=B.data.element||B.data.getTarget();if(C.type!=1)C=C.getParent();while(C){var D=C.getAttribute('lj-cmd');if(p.hasOwnProperty(D)){var E=t.getCommand(D);if(E.state==1){var F=new d.selection(t.document);p[D].node=C.is('body')?new h.get(C.getWindow().$.frameElement):C;F.selectElement(p[D].node);B.data.dialog='';t.execFromEditor=true;t.execCommand(D,true);break;}}C=C.getParent();}};function v(B){var C=this;if(C.$!=t.document.$){C.$.className=(C.frame.getAttribute('lj-class')||'')+' lj-selected';if(C.getAttribute('lj-cmd')=='LJPollLink')C.frame.setStyle('height',C.getDocument().$.body.scrollHeight+'px');new d.selection(t.document).selectElement(C.frame);}B.data.getKey()==1&&B.data.preventDefault();};function w(B){if(B.data.getKey()==46){var C=new d.selection(t.document).getRanges(),D=C.length;while(D--)C[D].deleteContents();}};function x(){var E=this;var B=E.$.contentWindow,C=B.document,D=new h.get(C.body);if(D.on){D.on('dblclick',u);D.on('click',v);D.on('keyup',w);if(E.getAttribute('lj-cmd')=='LJPollLink'&&E.hasAttribute('style'))C.body.className='lj-poll lj-poll-open';}C=new h.get(C);C.frame=D.frame=E;};function y(){var B=t.document.getElementsByTag('iframe'),C=B.count(),D,E,F,G,H;t.execFromEditor=false;while(C--){D=B.getItem(C),E=D.getAttribute('lj-cmd'),F=D.$.contentWindow,G=F.document,H=D.getAttribute('lj-style')||'';D.removeListener('load',x);D.on('load',x);G.open();G.write('<!DOCTYPE html><html style="'+H+'">'+'<head><link rel="stylesheet" href="'+a.styleText+'" /></head>'+'<body scroll="no" class="'+(D.getAttribute('lj-class')||'')+'" style="'+H+'" '+(E?'lj-cmd="'+E+'"':'')+'>'+decodeURIComponent(D.getAttribute('lj-content')||'')+'</body>'+'</html>');G.close();}};function z(B){if(t.onSwitch===true){delete t.onSwitch;return;}var C,D=B.name=='click',E=B.name=='selectionChange'||D,F=B.data.element||B.data.getTarget(),G,H;if(D&&(B.data.getKey()==1||B.data.$.button==0))B.data.preventDefault();if(F.type!=1)F=F.getParent();G=F;if(E){var I=t.document.getElementsByTag('iframe'),J,K;if(D&&G.is('iframe')){K=G.$.contentWindow.document.body;K.className=(G.getAttribute('lj-class')||'')+' lj-selected';if(G.getAttribute('lj-cmd')=='LJPollLink')G.setStyle('height',K.scrollHeight+'px');}for(var L=0,M=I.count();L<M;L++){J=I.getItem(L);if(J.$!=G.$){K=J.$.contentWindow.document.body;K.className=J.getAttribute('lj-class')||'';if(J.getAttribute('lj-cmd')=='LJPollLink'&&K.className.indexOf('lj-poll')!=-1)J.removeAttribute('style');}}}do{var N=G.getAttribute('lj-cmd');
 if(!N&&G.type==1){var O=G.getParent();if(G.is('img')&&O.getParent()&&!O.getParent().hasAttribute('lj:user')){N='LJImage';G.setAttribute('lj-cmd',N);}else if(G.is('a')&&!O.hasAttribute('lj:user')){N='LJLink2';G.setAttribute('lj-cmd',N);}}if(N&&p.hasOwnProperty(N)){if(E){p[N].node=G;t.getCommand(N).setState(1);}(C||(C={}))[N]={content:p[N].html,node:G};}}while(G=G.getParent());if(E)for(H in p){if(p.hasOwnProperty(H)&&(!C||!C.hasOwnProperty(H))){delete p[H].node;t.getCommand(H).setState(2);}}C?a.note.show(C):a.note.hide();};(function(){function B(H){return H.slice(-2)=='/>'?H:H.slice(0,-1)+'/>';};function C(H){var I=new Poll(H),J="<div class='lj-poll-inner lj-rtebox-inner'>"+I.outputHTML()+'</div>';return '<iframe class="lj-poll-wrap lj-rtebox" lj-class="lj-poll" frameborder="0" lj-cmd="LJPollLink" allowTransparency="true" lj-data="'+I.outputLJtags()+'" lj-content="'+J+'"></iframe>';};function D(H,I){var J="<div class='lj-poll-inner lj-rtebox-inner'>Poll id: "+I+'</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(H)+'" lj-content="'+J+'" data-disabledPoll="true"></iframe>';};function E(H,I,J){var K="<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(J)+'"'+I+'lj-content="'+K+'"></iframe>';};function F(H,I,J,K){return I+J.replace(/\n/g,'')+K;};function G(H,I,J,K){var L=I||J||m.LJRepost_Value,M=K.replace(/"/g,'&quot;');K=M+('<br /><input type="button" value="'+L+'" />').replace(/"/g,'&quot;');return '<iframe class="lj-repost-wrap" lj-class="lj-repost" frameborder="0" allowTransparency="true" lj-text="'+M+'" lj-button="'+L+'" lj-content="'+K+'"></iframe>';};t.dataProcessor.toHtml=function(H,I){H=H.replace(/<lj [^>]*?>/gi,B).replace(/<lj-map [^>]*?>/gi,B).replace(/<lj-template[^>]*?>/gi,B).replace(/(<lj-cut[^>]*?)\/>/gi,'$1>').replace(/<((?!br)[^\s>]+)([^>]*?)\/>/gi,'<$1$2></$1>').replace(/<lj-poll.*?>[\s\S]*?<\/lj-poll>/gi,C).replace(/<lj-poll-([0-9]+)>/gi,D).replace(/<lj-repost\s*(?:button\s*=\s*(?:"([^"]*?)")|(?:"([^']*?)"))?.*?>([\s\S]*?)<\/lj-repost>/gi,G).replace(/<lj-embed(.*?)>([\s\S]*?)<\/lj-embed>/gi,E);if(!$('event_format').checked){H=H.replace(/(<lj-raw.*?>)([\s\S]*?)(<\/lj-raw>)/gi,F);if(!window.switchedRteOn)H=H.replace(/\n/g,'<br />');}H=a.htmlDataProcessor.prototype.toHtml.call(this,H,I);
-if(c)H='<xml:namespace ns="livejournal" prefix="lj" />'+H;return H;};})();t.dataProcessor.toDataFormat=function(B,C){B=a.htmlDataProcessor.prototype.toDataFormat.call(this,B,C);if(!$('event_format').checked)B=B.replace(/<br\s*\/>/gi,'\n');return B.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(!a.note)r(t);if(c){t.document.getBody().on('dragend',y);t.document.getBody().on('paste',function(){setTimeout(y,0);});}t.document.on('click',z);t.document.on('mouseout',a.note.hide);t.document.on('mouseover',z);t.document.getBody().on('keyup',w);y();});(function(){var B='LJFont',C=t.config,D=false,E={},F='normal',G=F,H=C.fontSize_sizes,I=C.fontSize_style,J='b-fontsize-select-item-active',K,L,M,N,O=jQuery();H=H.split(';');for(K=0;K<H.length;K++){L=H[K];if(L){L=L.split('/');M={};N=H[K]=L[0].toLowerCase();M.size=L[1]||N;E[N]=new a.style(I,M);E[N]._.definition.name=N;}else H.splice(K--,1);}function P(Q){G=Q;O.removeClass(J).filter('.b-fontsize-select-item-'+G).addClass(J);};t.addCommand(B,{exec:function(Q){Q.rteButton(B,'font');if(!D){O=jQuery('.b-fontsize-select-item');LiveJournal.register_hook('font_response',function(S){Q.focus();Q.fire('saveSnapshot');var T=E[S],U,V,W;if(G===S)T.remove(Q.document);else{V=Q.getSelection();W=parseFloat(T._.definition.styles['font-size']);for(U in E)E[U].remove(Q.document);T.apply(Q.document);}Q.fire('saveSnapshot');});D=true;var R=Q.getCommand(B);R.setState(1);P(G);}}});t.ui.addButton(B,{label:m[B]||'BUTTON',command:B});t.on('selectionChange',function(Q){var R=Q.data.path,S=R.elements,T=t.getCommand(B),U,V,W;for(U=0;U<S.length;U++){V=S[U];for(W in E){if(E[W].checkElementRemovable(V,true)){if(W!==G){P(W);T.setState(1);}return;}}}P(F);T.setState(2);});})();(function(){var B=top.Site.siteroot+'/tools/endpoints/ljuser.bml',C='LJUserLink';function D(F,G,H){if(F.error){LiveJournal.run_hook('incorrect_user');return;}if(F.success){F.ljuser=F.ljuser.replace('<span class="useralias-value">*</span>','');q[G]=F.ljuser;var I=new h.createFromHtml(F.ljuser);I.setAttribute('lj-cmd','LJUserLink');if(H)H.$.parentNode.replaceChild(I.$,H.$);else t.insertElement(I);}};var E=false;t.addCommand('LJUserLink',{exec:function(F){var G='',H=new d.selection(F.document),I=p.LJUserLink.node,J;function K(M){parent.HTTPReq.getJSON({data:parent.HTTPReq.formEncoded({username:M}),method:'POST',url:B,onData:function(N){D(N,M,p.LJUserLink.node);
+if(c)H='<xml:namespace ns="livejournal" prefix="lj" />'+H;return H;};})();t.dataProcessor.toDataFormat=function(B,C){B=a.htmlDataProcessor.prototype.toDataFormat.call(this,B,C);if(!$('event_format').checked)B=B.replace(/<br\s*\/>/gi,'\n');return B.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(!a.note)r(t);if(c){t.document.getBody().on('dragend',y);t.document.getBody().on('paste',function(){setTimeout(y,0);});}t.document.on('click',z);t.document.on('mouseout',a.note.hide);t.document.on('mouseover',z);t.document.getBody().on('keyup',w);y();});(function(){var B='LJFont',C=t.config,D=false,E={},F='normal',G=F,H=C.fontSize_sizes,I=C.fontSize_style,J='b-fontsize-select-item-active',K,L,M,N,O=jQuery();H=H.split(';');for(K=0;K<H.length;K++){L=H[K];if(L){L=L.split('/');M={};N=H[K]=L[0].toLowerCase();M.size=L[1]||N;E[N]=new a.style(I,M);E[N]._.definition.name=N;}else H.splice(K--,1);}function P(Q){G=Q;O.removeClass(J).filter('.b-fontsize-select-item-'+G).addClass(J);};t.addCommand(B,{exec:function(Q){Q.rteButton(B,'font');if(!D){O=jQuery('.b-fontsize-select-item');LiveJournal.register_hook('font_response',function(S){Q.focus();Q.fire('saveSnapshot');var T=E[S],U,V,W;if(G===S)T.remove(Q.document);else{V=Q.getSelection();W=parseFloat(T._.definition.styles['font-size']);for(U in E)E[U].remove(Q.document);T.apply(Q.document);}Q.fire('saveSnapshot');});D=true;var R=Q.getCommand(B);R.setState(1);P(G);}}});t.ui.addButton(B,{label:m[B],command:B});t.on('selectionChange',function(Q){var R=Q.data.path,S=R.elements,T=t.getCommand(B),U,V,W;for(U=0;U<S.length;U++){V=S[U];for(W in E){if(E[W].checkElementRemovable(V,true)){if(W!==G){P(W);T.setState(1);}return;}}}P(F);T.setState(2);});})();(function(){var B=top.Site.siteroot+'/tools/endpoints/ljuser.bml',C='LJUserLink';function D(F,G,H){if(F.error){LiveJournal.run_hook('incorrect_user');return;}if(F.success){F.ljuser=F.ljuser.replace('<span class="useralias-value">*</span>','');q[G]=F.ljuser;var I=new h.createFromHtml(F.ljuser);I.setAttribute('lj-cmd','LJUserLink');if(H)H.$.parentNode.replaceChild(I.$,H.$);else t.insertElement(I);}};var E=false;t.addCommand('LJUserLink',{exec:function(F){var G='',H=new d.selection(F.document),I=p.LJUserLink.node,J;function K(M){parent.HTTPReq.getJSON({data:parent.HTTPReq.formEncoded({username:M}),method:'POST',url:B,onData:function(N){D(N,M,p.LJUserLink.node);
 }});};if(!E){var L=I;LiveJournal.register_hook('user_response',function(M){K(M);});E=true;}if(I){a.note&&a.note.hide(true);J=p.LJUserLink.node.getElementsByTag('b').getItem(0).getText();n(C,'user',{user:J});return;}else if(H.getType()==2)G=H.getSelectedText();if(G==''){n(C,'user');return;}if(!G||J==G)return;K(G,I);}});t.ui.addButton('LJUserLink',{label:m.LJUser,command:'LJUserLink'});})();(function(){var B='LJImage',C=null;LiveJournal.register_hook('editpic_response',function(D){var E=C,F=E&&E.getParent();if(!E)return;if(D.url){E.setAttribute('src',D.url);E.setAttribute('data-cke-saved-src',D.url);}else{if(F&&F.getName()==='a')F.remove();else E.remove();return;}if(D.width)E.setAttribute('width',D.width);else E.removeAttribute('width');if(D.height)E.setAttribute('height',D.height);else E.removeAttribute('height');if(D.title)E.setAttribute('title',D.title);else E.removeAttribute('title');if(D.border)E.setStyle('border-width',D.border+'px');else{E.removeStyle('border-width');E.removeStyle('border-style');}if(D.vspace)E.setStyles({'margin-top':D.vspace+'px','margin-bottom':D.vspace+'px'});else{E.removeStyle('margin-top');E.removeStyle('margin-bottom');}if(D.hspace)E.setStyles({'margin-left':D.hspace+'px','margin-right':D.hspace+'px'});else{E.removeStyle('margin-left');E.removeStyle('margin-right');}var F=E&&E.getParent();if(D.link){D.link=D.link.replace(/^[\s\t]*(?:http:\/\/)?/,'http://');if(F&&F.getName()==='a'){F.setAttribute('href',D.link);F.setAttribute('data-cke-saved-href',D.link);if(D.blank)F.setAttribute('target','_blank');else F.removeAttribute('target');}else{var G=new h('a',t.document);G.setAttribute('href',D.link);if(D.blank)G.setAttribute('target','_blank');E.insertBeforeMe(G);G.append(E);t.getSelection()&&t.getSelection().selectElement(G);}}else if(F.getName()==='a'){F.insertBeforeMe(E);F.remove();}if(D.aligment&&D.aligment!=='none')E.setStyle('float',D.aligment);else E.removeStyle('float');C=null;});t.addCommand(B,{exec:function(D,E){var F=D.getSelection();F=F?F.getSelectedElement():null;C=F;if(F){var G=F&&F.getParent(),H=G.getName()==='a',I=H&&G,J=H&&G.getAttribute('href'),K={};if('naturalWidth' in F.$){K.width=F.$.naturalWidth;K.height=F.$.naturalHeight;}else{var L=new Image();L.src=F.$.src;K={width:L.width,height:L.height};}D.rteButton(B,'editpic',{picData:{url:F.getAttribute('src'),title:F.getAttribute('title'),width:F.getAttribute('width')||F.$.width,height:F.getAttribute('height')||F.$.height,defaultWidth:K.width,defaultHeight:K.height,link:J||'',blank:H?!!I.getAttribute('target'):true,border:parseInt(F.getStyle('border-width'),10),vspace:parseInt(F.getStyle('margin-top'),10),hspace:parseInt(F.getStyle('margin-left'),10),aligment:F.getStyle('float')||'none'}});
-}else jQuery('.b-updatepage-event-section').editor('handleImageUpload','upload');},editorFocus:false});t.ui.addButton(B,{label:m.LJImage_Title,command:B});})();(function(){var B='LJEmbedLink',C='video';function D(E){var F=new h('iframe',t.document);F.setAttribute('lj-data',encodeURIComponent(E));F.setAttribute('lj-content',encodeURIComponent("<div class='lj-embed-inner lj-rtebox-inner'>Embed video</div>"));F.setAttribute('lj-class','lj-embed');F.setAttribute('lj-cmd',B);F.setAttribute('class','lj-embed-wrap lj-rtebox');F.setAttribute('frameBorder',0);F.setAttribute('allowTransparency','true');t.insertElement(F);y();};LiveJournal.register_hook(C+'_response',function(E){D(E);});t.addCommand(B,{exec:function(){var E=p[B].node;if(E)n(B,C,{defaultText:E&&decodeURIComponent(E.getAttribute('lj-data')),editMode:true});else n(B,C);}});t.ui.addButton(B,{label:m.LJEmbed,command:B});})();function A(B,C,D){var E,F=p[C].node;if(F){if(E=D.skip||prompt(D.title,F.getAttribute('text')||D.text))if(E==D.text)F.removeAttribute('text');else F.setAttribute('text',E);}else{if(E=D.skip||prompt(D.title,D.text)){t.focus();var G=new d.selection(t.document),H=G.getRanges(),I=new h('iframe',t.document),J=I.clone();I.setAttribute('lj-cmd',C);I.setAttribute('lj-class',B+' '+B+'-open');I.setAttribute('class',B+'-wrap');I.setAttribute('frameBorder',0);I.setAttribute('allowTransparency','true');if(E!=D.text)I.setAttribute('text',E);J.setAttribute('lj-class',B+' '+B+'-close');J.setAttribute('class',B+'-wrap');J.setAttribute('frameBorder',0);J.setAttribute('allowTransparency','true');var K=H[0];G.lock();var L=new h('br',t.document),M=L.clone(),N=L.clone(),O=new d.documentFragment(t.document);O.append(L.clone());O.append(I);O.append(M);if(K.collapsed===false)for(var P=0,Q=H.length;P<Q;P++){if(G.getSelectedElement())H[P].enlarge(1);O.append(H[P].extractContents());}O.append(N);t.insertElement(J);L.clone().insertAfter(J);J.insertBeforeMe(O);K.setStart(M,0);K.setEnd(N,0);G.unlock();G.selectRanges(H);t.fire('updateSnapshot');y();}a.note&&a.note.hide(true);}};(function(){var B='LJMap',C='map';LiveJournal.register_hook('map_response',function(D){var E=new h('iframe',t.document),F=800,G=600,H='',I='';if(!isNaN(F)){H+='width:'+F+'px;';I+='width:'+(F-2)+'px;';}if(!isNaN(G)){H+='height:'+G+'px;';I+='height:'+(G-2)+'px;';}var J=p[B].node;if(J)J.setAttributes({'lj-url':D});else{E.setAttributes({'lj-url':D,'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:H,'lj-style':I});
+}else jQuery('.b-updatepage-event-section').editor('handleImageUpload','upload');},editorFocus:false});t.ui.addButton(B,{label:m.LJImage_Title,command:B});})();(function(){var B='LJEmbedLink',C='video';function D(E){var F=new h('iframe',t.document);F.setAttribute('lj-data',encodeURIComponent(E));F.setAttribute('lj-content',encodeURIComponent("<div class='lj-embed-inner lj-rtebox-inner'>Embed video</div>"));F.setAttribute('lj-class','lj-embed');F.setAttribute('lj-cmd',B);F.setAttribute('class','lj-embed-wrap lj-rtebox');F.setAttribute('frameBorder',0);F.setAttribute('allowTransparency','true');t.insertElement(F);y();};LiveJournal.register_hook(C+'_response',function(E){D(E);});t.addCommand(B,{exec:function(){var E=p[B].node;if(E)n(B,C,{defaultText:E&&decodeURIComponent(E.getAttribute('lj-data')),editMode:true});else n(B,C);}});t.ui.addButton(B,{label:m.LJEmbed,command:B});})();function A(B,C,D){var E,F=p[C].node;if(F){if(E=D.skip||prompt(D.title,F.getAttribute('text')||D.text))if(E==D.text)F.removeAttribute('text');else F.setAttribute('text',E);}else{if(E=D.skip||prompt(D.title,D.text)){t.focus();var G=new d.selection(t.document),H=G.getRanges(),I=new h('iframe',t.document),J=I.clone();I.setAttribute('lj-cmd',C);I.setAttribute('lj-class',B+' '+B+'-open');I.setAttribute('class',B+'-wrap');I.setAttribute('frameBorder',0);I.setAttribute('allowTransparency','true');if(E!=D.text)I.setAttribute('text',E);J.setAttribute('lj-class',B+' '+B+'-close');J.setAttribute('class',B+'-wrap');J.setAttribute('frameBorder',0);J.setAttribute('allowTransparency','true');var K=H[0];G.lock();var L=new h('br',t.document),M=L.clone(),N=L.clone(),O=new d.documentFragment(t.document);O.append(L.clone());O.append(I);O.append(M);if(K.collapsed===false)for(var P=0,Q=H.length;P<Q;P++){if(G.getSelectedElement())H[P].enlarge(1);O.append(H[P].extractContents());}O.append(N);t.insertElement(J);L.clone().insertAfter(J);J.insertBeforeMe(O);K.setStart(M,0);K.setEnd(N,0);G.unlock();G.selectRanges(H);t.fire('updateSnapshot');y();}a.note&&a.note.hide(true);}};(function(){var B='LJMap',C='map';LiveJournal.register_hook('map_response',function(D){var E=new h('iframe',t.document),F=425,G=350,H='',I='';if(!isNaN(F)){H+='width:'+F+'px;';I+='width:'+(F-2)+'px;';}if(!isNaN(G)){H+='height:'+G+'px;';I+='height:'+(G-2)+'px;';}var J=p[B].node;if(J)J.setAttributes({'lj-url':D});else{E.setAttributes({'lj-url':D,'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:H,'lj-style':I});
 t.insertElement(E);}y();});t.addCommand(B,{exec:function(){var D=p[B].node;n(B,C,{defaultText:D?D.getAttribute('lj-url'):'',editMode:D?true:false});},editorFocus:false});t.ui.addButton(B,{label:m.LJMap_Title,command:B});})();(function(){var B='LJCut',C='cut';LiveJournal.register_hook('cut_response',function(D){A('lj-cut',B,{title:m.LJCut_PromptTitle,text:m.LJCut_PromptText,skip:D});});t.addCommand('LJCut',{exec:function(){var D=p[B].node;n(B,C,{defaultText:D?D.getAttribute('text'):'',editMode:D?true:false});},editorFocus:false});t.ui.addButton(B,{label:m.LJCut_Title,command:B});})();(function(){var B='LJSpoiler',C='spoiler';LiveJournal.register_hook('spoiler_response',function(D){A('lj-spoiler',B,{title:m.LJCut_PromptTitle,text:m.LJCut_PromptText,skip:D});});t.addCommand(B,{exec:function(){var D=p[B].node;n(B,C,{defaultText:D?D.getAttribute('text'):'',editMode:D?true:false});},editorFocus:false});t.ui.addButton(B,{label:m.LJSpoiler_Title,command:B});})();(function(){function B(I,J){J=J===undefined||J;var K,L=p.LJLike.node;if(L){var M=I.getAttribute('lj-style');K=M?M.replace(/text-align:\s*(left|right|center)/i,'$1'):'left';}else if(J)K=I.getComputedStyle('text-align');else{while(!I.hasAttribute||!(I.hasAttribute('align')||I.getStyle('text-align'))){var N=I.getParent();if(!N)break;I=N;}K=I.getStyle('text-align')||I.getAttribute('align')||'';}K&&(K=K.replace(/-moz-|-webkit-|start|auto/i,''));!K&&J&&(K=I.getComputedStyle('direction')=='rtl'?'right':'left');return K;};function C(I){if(I.editor.readOnly)return;var J=I.editor.getCommand(this.name),K=I.data.element;if((K.type==1&&K.hasAttribute('lj-cmd')&&K.getAttribute('lj-cmd'))=='LJLike')J.state=B(K,t.config.useComputedState)==this.value?1:2;else if(!K||K.type!=1||K.getName()=='body'||K.getName()=='iframe')J.state=2;else J.state=B(K,t.config.useComputedState)==this.value?1:2;J.fire('state');};function D(I,J,K){var M=this;M.name=J;M.value=K;var L=I.config.justifyClasses;if(L){switch(K){case 'left':M.cssClassName=L[0];break;case 'center':M.cssClassName=L[1];break;case 'right':M.cssClassName=L[2];break;}M.cssClassRegex=new RegExp('(?:^|\\s+)(?:'+L.join('|')+')(?=$|\\s)');}};function E(I){var J=I.editor,K=new d.range(J.document);K.setStartBefore(I.data.node);K.setEndAfter(I.data.node);var L=new d.walker(K),M;while(M=L.next()){if(M.type==1){var N='text-align',O=J.config.justifyClasses;if(!M.equals(I.data.node)&&M.getDirection()){K.setStartAfter(M);L=new d.walker(K);continue;}if(O)if(M.hasClass(O[0])){M.removeClass(O[0]);
-M.addClass(O[2]);}else if(M.hasClass(O[2])){M.removeClass(O[2]);M.addClass(O[0]);}switch(M.getStyle(N)){case 'left':M.setStyle(N,'right');break;case 'right':M.setStyle(N,'left');break;}}}};D.prototype={exec:function(I){var W=this;var J=I.getSelection(),K=I.config.enterMode;if(!J)return;var L=J.createBookmarks();if(p.LJLike.node)p.LJLike.node.setAttribute('lj-style','text-align: '+W.value);else{var M=J.getRanges(true),N=W.cssClassName,O,P,Q=I.config.useComputedState;Q=Q===undefined||Q;for(var R=M.length-1;R>=0;R--){var S=M[R],T=S.getEnclosedNode();if(T&&T.is('iframe'))return;O=S.createIterator();O.enlargeBr=K!=2;while(P=O.getNextParagraph(K==1?'p':'div')){P.removeAttribute('align');P.removeStyle('text-align');var U=N&&(P.$.className=e.ltrim(P.$.className.replace(W.cssClassRegex,''))),V=W.state==2&&(!Q||B(P,true)!=W.value);if(N){if(V)P.addClass(N);else if(!U)P.removeAttribute('class');}else if(V)P.setStyle('text-align',W.value);}}}I.focus();I.forceNextSelectionCheck();J.selectBookmarks(L);}};var F=new D(t,'LJJustifyLeft','left'),G=new D(t,'LJJustifyCenter','center'),H=new D(t,'LJJustifyRight','right');t.addCommand('LJJustifyLeft',F);t.addCommand('LJJustifyCenter',G);t.addCommand('LJJustifyRight',H);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(C,F));t.on('selectionChange',e.bind(C,H));t.on('selectionChange',e.bind(C,G));t.on('dirChanged',E);})();(function(){var B='LJPollLink';LiveJournal.register_hook('poll_response',function(C){var D=new Poll(C),E="<div class='lj-poll-inner lj-rtebox-inner'>"+D.outputHTML()+'</div>',F=D.outputLJtags(),G=p[B].node;if(G){G.setAttribute('lj-content',E);G.setAttribute('lj-data',F);G.removeAttribute('style');}else{G=new h('iframe',t.document);G.setAttribute('lj-content',E);G.setAttribute('lj-cmd','LJPollLink');G.setAttribute('lj-data',F);G.setAttribute('lj-class','lj-poll lj-rtebox');G.setAttribute('class','lj-poll-wrap');G.setAttribute('frameBorder',0);G.setAttribute('allowTransparency','true');t.insertElement(G);}y();});t.addCommand(B,{exec:function(C){var D=p.LJPollLink.node;if(D)n(B,'poll',{ljData:decodeURIComponent(D.getAttribute('lj-data')),editMode:true,disabled:D&&(D.getAttribute('data-disabledPoll')?true:false)});else n(B,'poll');},editorFocus:false});t.ui.addButton(B,{label:m.LJPoll_Title,command:B});
-})();(function(){var B='LJLike',C='like';o.defaultButtons=[];for(var D=0;D<o.length;D++){btn=o[D];o[btn.id]=o[btn.abbr]=btn;o.defaultButtons.push(btn.id);}LiveJournal.register_hook('like_response',function(E){var F=[],G=[],H=typeof E==='string';for(var I=0,J;I<o.length;I++){J=o[I];if(H&&J.checked||E.indexOf(J.id)!=-1){F.push(J.id);G.push(J.html);}}var K=p[B].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(B,{exec:function(E){var F=p[B].node;if(F)n(B,C,{buttons:F.getAttribute('buttons'),editMode:true});else n(B,C);},editorFocus:false});t.ui.addButton(B,{label:m.LJLike_Title,command:B});})();},afterInit:function(t){var u=t.dataProcessor;function v(w,x,y,z){z=z||'text';var A=new a.htmlParser.element('iframe');A.attributes['lj-class']=x+' '+x+'-open';A.attributes['class']=x+'-wrap';A.attributes['lj-cmd']=y;A.attributes.frameBorder=0;A.attributes.allowTransparency='true';if(w.attributes.hasOwnProperty(z))A.attributes.text=w.attributes[z];w.children.unshift(A);var B=new a.htmlParser.element('iframe');B.attributes['lj-class']=x+' '+x+'-close';B.attributes['class']=x+'-wrap';B.attributes.frameBorder=0;B.attributes.allowTransparency='true';w.children.push(B);delete w.name;};u.dataFilter.addRules({elements:{'lj-like':function(w){var x=[],y=new a.htmlParser.element('iframe');y.attributes['lj-class']='lj-like';y.attributes['class']='lj-like-wrap lj-rtebox';if(w.attributes.hasOwnProperty('style'))y.attributes['lj-style']=w.attributes.style;y.attributes['lj-cmd']='LJLike';y.attributes['lj-content']='<div class="lj-rtebox-inner lj-like-inner"><span class="lj-like-wrapper">';y.attributes.frameBorder=0;y.attributes.allowTransparency='true';var z=w.attributes.buttons&&w.attributes.buttons.split(',')||o.defaultButtons,A=w.attributes.buttons?true:false,B=z.length;for(var C=0;C<B;C++){var D=z[C].replace(/^\s*([a-z]{2,})\s*$/i,'$1'),E=o[D];if(E&&(A||E.checked)){y.attributes['lj-content']+=encodeURIComponent(E.html);x.push(D);}}if(!w.attributes.buttons)y.attributes.defaults=true;
-y.attributes['lj-content']+='</span></div>';y.attributes.buttons=x.join(',');return y;},lj:(function(){function w(x){var y=t.document.getElementsByTag('lj');for(var z=0,A=y.count();z<A;z++){var B=y.getItem(z);if(B){var C=B.getAttribute('user'),D=B.getAttribute('title');if(x==(D?C+':'+D:C)){var E=new h.createFromHtml(q[x],t.document);E.setAttribute('lj-cmd','LJUserLink');B.insertBeforeMe(E);B.remove();}}}t.removeListener('dataReady',w);};return function(x){var y=x.attributes.user;if(!y||!y.length)return;var z=x.attributes.title,A=z?y+':'+z:y;if(q.hasOwnProperty(A)){var B=new a.htmlParser.fragment.fromHtml(q[A]).children[0];B.attributes['lj-cmd']='LJUserLink';return B;}else{var C={username:y};if(z)C.usertitle=z;HTTPReq.getJSON({data:HTTPReq.formEncoded(C),method:'POST',url:Site.siteroot+'/tools/endpoints/ljuser.bml',onError:function(D){alert(D+' "'+y+'"');},onData:function(D){if(D.error)return alert(D.error+' "'+y+'"');if(!D.success)return;q[A]=D.ljuser;D.ljuser=D.ljuser.replace('<span class="useralias-value">*</span>','');if(t.document)w(A);else t.on('dataReady',function(){w(A);});}});}};})(),'lj-map':function(w){var x=new a.htmlParser.element('iframe'),y='',z='',A=Number(w.attributes.width),B=Number(w.attributes.height);if(!isNaN(A)){y+='width:'+A+'px;';z+='width:'+(A-2)+'px;';}if(!isNaN(B)){y+='height:'+B+'px;';z+='height:'+(B-2)+'px;';}if(y.length){x.attributes.style=y;x.attributes['lj-style']=z;}x.attributes['lj-url']=w.attributes.url?encodeURIComponent(w.attributes.url):'';x.attributes['lj-class']='lj-map';x.attributes['class']='lj-map-wrap lj-rtebox';x.attributes['lj-content']='<div class="lj-map-inner lj-rtebox-inner"><p class="lj-map">map</p></div>';x.attributes.frameBorder=0;x.attributes.allowTransparency='true';return x;},'lj-raw':function(w){w.name='lj:raw';},'lj-wishlist':function(w){w.name='lj:wishlist';},'lj-template':function(w){var x=new a.htmlParser.element('iframe');x.attributes['lj-class']='lj-template';x.attributes['class']='lj-template-wrap';x.attributes.frameBorder=0;x.attributes.allowTransparency='true';x.attributes['lj-attributes']=encodeURIComponent(LiveJournal.JSON.stringify(w.attributes));return x;},'lj-cut':function(w){v(w,'lj-cut','LJCut');},'lj-spoiler':function(w){v(w,'lj-spoiler','LJSpoiler','title');},iframe:function(w){if(w.attributes['lj-class']&&w.attributes['lj-class'].indexOf('lj-')+1==1)return w;var x=new a.htmlParser.element('iframe'),y='',z='',A=Number(w.attributes.width),B=Number(w.attributes.height);if(!isNaN(A)){y+='width:'+A+'px;';
-z+='width:'+(A-2)+'px;';}if(!isNaN(B)){y+='height:'+B+'px;';z+='height:'+(B-2)+'px;';}if(y.length){x.attributes.style=y;x.attributes['lj-style']=z;}x.attributes['lj-url']=w.attributes.src?encodeURIComponent(w.attributes.src):'';x.attributes['lj-class']='lj-iframe';x.attributes['class']='lj-iframe-wrap lj-rtebox';x.attributes['lj-content']='<div class="lj-rtebox-inner"><p class="lj-iframe">iframe</p></div>';x.attributes.frameBorder=0;x.attributes.allowTransparency='true';return x;},a:function(w){if(w.parent.attributes&&!w.parent.attributes['lj:user'])w.attributes['lj-cmd']='LJLink2';},img:function(w){var x=w.parent&&w.parent.parent;if(!x||!x.attributes||!x.attributes['lj:user'])w.attributes['lj-cmd']='LJImage';},div:function(w){if(w.attributes['class']=='lj-cut')v(w,'lj-cut','LJCut');}}},5);u.htmlFilter.addRules({elements:{iframe:function(w){var x=w,y=false,z='text',A=/lj-[a-z]+/i.exec(w.attributes['lj-class']);if(A)A=A[0];else return w;switch(A){case 'lj-like':x=new a.htmlParser.element('lj-like');if(w.attributes.defaults!='true')x.attributes.buttons=w.attributes.buttons;if(w.attributes.hasOwnProperty('lj-style'))x.attributes.style=w.attributes['lj-style'];x.isEmpty=true;x.isOptionalClose=true;break;case 'lj-embed':x=new a.htmlParser.element('lj-embed');x.attributes.id=w.attributes.id;if(w.attributes.hasOwnProperty('source_user'))x.attributes.source_user=w.attributes.source_user;x.children=new a.htmlParser.fragment.fromHtml(decodeURIComponent(w.attributes['lj-data'])).children;x.isOptionalClose=true;break;case 'lj-map':x=new a.htmlParser.element('lj-map');x.attributes.url=decodeURIComponent(w.attributes['lj-url']);w.attributes.style&&(w.attributes.style+';').replace(/([a-z-]+):(.*?);/gi,function(F,G,H){x.attributes[G.toLowerCase()]=parseInt(H);});x.isOptionalClose=x.isEmpty=true;break;case 'lj-iframe':x=new a.htmlParser.element('iframe');x.attributes.src=decodeURIComponent(w.attributes['lj-url']);w.attributes.style&&(w.attributes.style+';').replace(/([a-z-]+):(.*?);/gi,function(F,G,H){x.attributes[G.toLowerCase()]=parseInt(H);});x.attributes.frameBorder=0;break;case 'lj-poll':x=new a.htmlParser.fragment.fromHtml(decodeURIComponent(w.attributes['lj-data'])).children[0];break;case 'lj-repost':x=new a.htmlParser.element('lj-repost');x.attributes.button=w.attributes['lj-button'];x.children=new a.htmlParser.fragment.fromHtml(w.attributes['lj-text']).children;break;case 'lj-template':x=new a.htmlParser.element('lj-template');x.attributes=LiveJournal.JSON.parse(encodeURIComponent(w.attributes['lj-attributes']));
+M.addClass(O[2]);}else if(M.hasClass(O[2])){M.removeClass(O[2]);M.addClass(O[0]);}switch(M.getStyle(N)){case 'left':M.setStyle(N,'right');break;case 'right':M.setStyle(N,'left');break;}}}};D.prototype={exec:function(I){var W=this;var J=I.getSelection(),K=I.config.enterMode;if(!J)return;var L=J.createBookmarks();if(p.LJLike.node)p.LJLike.node.setAttribute('lj-style','text-align: '+W.value);else{var M=J.getRanges(true),N=W.cssClassName,O,P,Q=I.config.useComputedState;Q=Q===undefined||Q;for(var R=M.length-1;R>=0;R--){var S=M[R],T=S.getEnclosedNode();if(T&&T.is('iframe'))return;O=S.createIterator();O.enlargeBr=K!=2;while(P=O.getNextParagraph(K==1?'p':'div')){P.removeAttribute('align');P.removeStyle('text-align');var U=N&&(P.$.className=e.ltrim(P.$.className.replace(W.cssClassRegex,''))),V=W.state==2&&(!Q||B(P,true)!=W.value);if(N){if(V)P.addClass(N);else if(!U)P.removeAttribute('class');}else if(V)P.setStyle('text-align',W.value);}}}I.focus();I.forceNextSelectionCheck();J.selectBookmarks(L);}};var F=new D(t,'LJJustifyLeft','left'),G=new D(t,'LJJustifyCenter','center'),H=new D(t,'LJJustifyRight','right');t.addCommand('LJJustifyLeft',F);t.addCommand('LJJustifyCenter',G);t.addCommand('LJJustifyRight',H);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(C,F));t.on('selectionChange',e.bind(C,H));t.on('selectionChange',e.bind(C,G));t.on('dirChanged',E);})();(function(){var B='LJPollLink';if(!LJ.pageVar('remoteUser',true))return;LiveJournal.register_hook('poll_response',function(C){var D=new Poll(C),E="<div class='lj-poll-inner lj-rtebox-inner'>"+D.outputHTML()+'</div>',F=D.outputLJtags(),G=p[B].node;if(G){G.setAttribute('lj-content',E);G.setAttribute('lj-data',F);G.removeAttribute('style');}else{G=new h('iframe',t.document);G.setAttribute('lj-content',E);G.setAttribute('lj-cmd','LJPollLink');G.setAttribute('lj-data',F);G.setAttribute('lj-class','lj-poll lj-rtebox');G.setAttribute('class','lj-poll-wrap');G.setAttribute('frameBorder',0);G.setAttribute('allowTransparency','true');t.insertElement(G);}y();});t.addCommand(B,{exec:function(C){var D=p.LJPollLink.node;if(D)n(B,'poll',{ljData:decodeURIComponent(D.getAttribute('lj-data')),editMode:true,disabled:D&&(D.getAttribute('data-disabledPoll')?true:false)});else n(B,'poll');},editorFocus:false});
+t.ui.addButton(B,{label:m.LJPoll_Title,command:B});})();(function(){var B='LJLike',C='like';o.defaultButtons=[];for(var D=0;D<o.length;D++){btn=o[D];o[btn.id]=o[btn.abbr]=btn;o.defaultButtons.push(btn.id);}LiveJournal.register_hook('like_response',function(E){var F=[],G=[],H=typeof E==='string';for(var I=0,J;I<o.length;I++){J=o[I];if(H&&J.checked||E.indexOf(J.id)!=-1){F.push(J.id);G.push(J.html);}}var K=p[B].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(B,{exec:function(E){var F=p[B].node;if(F)n(B,C,{buttons:F.getAttribute('buttons'),editMode:true});else n(B,C);},editorFocus:false});t.ui.addButton(B,{label:m.LJLike_Title,command:B});})();},afterInit:function(t){var u=t.dataProcessor;function v(w,x,y,z){z=z||'text';var A=new a.htmlParser.element('iframe');A.attributes['lj-class']=x+' '+x+'-open';A.attributes['class']=x+'-wrap';A.attributes['lj-cmd']=y;A.attributes.frameBorder=0;A.attributes.allowTransparency='true';if(w.attributes.hasOwnProperty(z))A.attributes.text=w.attributes[z];w.children.unshift(A);var B=new a.htmlParser.element('iframe');B.attributes['lj-class']=x+' '+x+'-close';B.attributes['class']=x+'-wrap';B.attributes.frameBorder=0;B.attributes.allowTransparency='true';w.children.push(B);delete w.name;};u.dataFilter.addRules({elements:{'lj-like':function(w){var x=[],y=new a.htmlParser.element('iframe');y.attributes['lj-class']='lj-like';y.attributes['class']='lj-like-wrap lj-rtebox';if(w.attributes.hasOwnProperty('style'))y.attributes['lj-style']=w.attributes.style;y.attributes['lj-cmd']='LJLike';y.attributes['lj-content']='<div class="lj-rtebox-inner lj-like-inner"><span class="lj-like-wrapper">';y.attributes.frameBorder=0;y.attributes.allowTransparency='true';var z=w.attributes.buttons&&w.attributes.buttons.split(',')||o.defaultButtons,A=w.attributes.buttons?true:false,B=z.length;for(var C=0;C<B;C++){var D=z[C].replace(/^\s*([a-z]{2,})\s*$/i,'$1'),E=o[D];if(E&&(A||E.checked)){y.attributes['lj-content']+=encodeURIComponent(E.html);
+x.push(D);}}if(!w.attributes.buttons)y.attributes.defaults=true;y.attributes['lj-content']+='</span></div>';y.attributes.buttons=x.join(',');return y;},lj:(function(){function w(x){var y=t.document.getElementsByTag('lj');for(var z=0,A=y.count();z<A;z++){var B=y.getItem(z);if(B){var C=B.getAttribute('user'),D=B.getAttribute('title');if(x==(D?C+':'+D:C)){var E=new h.createFromHtml(q[x],t.document);E.setAttribute('lj-cmd','LJUserLink');B.insertBeforeMe(E);B.remove();}}}t.removeListener('dataReady',w);};return function(x){var y=x.attributes.user;if(!y||!y.length)return;var z=x.attributes.title,A=z?y+':'+z:y;if(q.hasOwnProperty(A)){var B=new a.htmlParser.fragment.fromHtml(q[A]).children[0];B.attributes['lj-cmd']='LJUserLink';return B;}else{var C={username:y};if(z)C.usertitle=z;HTTPReq.getJSON({data:HTTPReq.formEncoded(C),method:'POST',url:Site.siteroot+'/tools/endpoints/ljuser.bml',onError:function(D){alert(D+' "'+y+'"');},onData:function(D){if(D.error)return alert(D.error+' "'+y+'"');if(!D.success)return;q[A]=D.ljuser;D.ljuser=D.ljuser.replace('<span class="useralias-value">*</span>','');if(t.document)w(A);else t.on('dataReady',function(){w(A);});}});}};})(),'lj-map':function(w){var x=new a.htmlParser.element('iframe'),y='',z='',A=Number(w.attributes.width),B=Number(w.attributes.height);if(!isNaN(A)){y+='width:'+A+'px;';z+='width:'+(A-2)+'px;';}if(!isNaN(B)){y+='height:'+B+'px;';z+='height:'+(B-2)+'px;';}if(y.length){x.attributes.style=y;x.attributes['lj-style']=z;}x.attributes['lj-url']=w.attributes.url?encodeURIComponent(w.attributes.url):'';x.attributes['lj-class']='lj-map';x.attributes['class']='lj-map-wrap lj-rtebox';x.attributes['lj-content']='<div class="lj-map-inner lj-rtebox-inner"><p class="lj-map">map</p></div>';x.attributes.frameBorder=0;x.attributes.allowTransparency='true';return x;},'lj-raw':function(w){w.name='lj:raw';},'lj-wishlist':function(w){w.name='lj:wishlist';},'lj-template':function(w){var x=new a.htmlParser.element('iframe');x.attributes['lj-class']='lj-template';x.attributes['class']='lj-template-wrap';x.attributes.frameBorder=0;x.attributes.allowTransparency='true';x.attributes['lj-attributes']=encodeURIComponent(LiveJournal.JSON.stringify(w.attributes));return x;},'lj-cut':function(w){v(w,'lj-cut','LJCut');},'lj-spoiler':function(w){v(w,'lj-spoiler','LJSpoiler','title');},iframe:function(w){if(w.attributes['lj-class']&&w.attributes['lj-class'].indexOf('lj-')+1==1)return w;var x=new a.htmlParser.element('iframe'),y='',z='',A=Number(w.attributes.width),B=Number(w.attributes.height);
+if(!isNaN(A)){y+='width:'+A+'px;';z+='width:'+(A-2)+'px;';}if(!isNaN(B)){y+='height:'+B+'px;';z+='height:'+(B-2)+'px;';}if(y.length){x.attributes.style=y;x.attributes['lj-style']=z;}x.attributes['lj-url']=w.attributes.src?encodeURIComponent(w.attributes.src):'';x.attributes['lj-class']='lj-iframe';x.attributes['class']='lj-iframe-wrap lj-rtebox';x.attributes['lj-content']='<div class="lj-rtebox-inner"><p class="lj-iframe">iframe</p></div>';x.attributes.frameBorder=0;x.attributes.allowTransparency='true';return x;},a:function(w){if(w.parent.attributes&&!w.parent.attributes['lj:user'])w.attributes['lj-cmd']='LJLink2';},img:function(w){var x=w.parent&&w.parent.parent;if(!x||!x.attributes||!x.attributes['lj:user'])w.attributes['lj-cmd']='LJImage';},div:function(w){if(w.attributes['class']=='lj-cut')v(w,'lj-cut','LJCut');}}},5);u.htmlFilter.addRules({elements:{iframe:function(w){var x=w,y=false,z='text',A=/lj-[a-z]+/i.exec(w.attributes['lj-class']);if(A)A=A[0];else return w;switch(A){case 'lj-like':x=new a.htmlParser.element('lj-like');if(w.attributes.defaults!='true')x.attributes.buttons=w.attributes.buttons;if(w.attributes.hasOwnProperty('lj-style'))x.attributes.style=w.attributes['lj-style'];x.isEmpty=true;x.isOptionalClose=true;break;case 'lj-embed':x=new a.htmlParser.element('lj-embed');x.attributes.id=w.attributes.id;if(w.attributes.hasOwnProperty('source_user'))x.attributes.source_user=w.attributes.source_user;x.children=new a.htmlParser.fragment.fromHtml(decodeURIComponent(w.attributes['lj-data'])).children;x.isOptionalClose=true;break;case 'lj-map':x=new a.htmlParser.element('lj-map');x.attributes.url=decodeURIComponent(w.attributes['lj-url']);w.attributes.style&&(w.attributes.style+';').replace(/([a-z-]+):(.*?);/gi,function(F,G,H){x.attributes[G.toLowerCase()]=parseInt(H);});x.isOptionalClose=x.isEmpty=true;break;case 'lj-iframe':x=new a.htmlParser.element('iframe');x.attributes.src=decodeURIComponent(w.attributes['lj-url']);w.attributes.style&&(w.attributes.style+';').replace(/([a-z-]+):(.*?);/gi,function(F,G,H){x.attributes[G.toLowerCase()]=parseInt(H);});x.attributes.frameBorder=0;break;case 'lj-poll':x=new a.htmlParser.fragment.fromHtml(decodeURIComponent(w.attributes['lj-data'])).children[0];break;case 'lj-repost':x=new a.htmlParser.element('lj-repost');x.attributes.button=w.attributes['lj-button'];x.children=new a.htmlParser.fragment.fromHtml(w.attributes['lj-text']).children;break;case 'lj-template':x=new a.htmlParser.element('lj-template');x.attributes=LiveJournal.JSON.parse(encodeURIComponent(w.attributes['lj-attributes']));
 x.isOptionalClose=x.isEmpty=true;break;case 'lj-spoiler':y=true;z='title';case 'lj-cut':if(w.attributes['lj-class'].indexOf(A+'-open')+1){var B=w.next,C=0;x=new a.htmlParser.element(A);if(w.attributes.hasOwnProperty('text'))x.attributes[z]=w.attributes.text;while(B){if(B.name=='iframe'){var D=B.attributes['lj-class'];if(D.indexOf(A+'-close')+1){if(y&&C)C--;else{x.next=B;break;}}else if(D.indexOf(A+'-open')+1)if(y)C++;else{x.next=B;break;}}B.parent.children.remove(B);x.add(B);var E=B.next;B.next=null;B=E;}}else x=false;break;default:if(!w.children.length)x=false;}return x;},span:function(w){var x=w.attributes['lj:user'];if(x){var y=new a.htmlParser.element('lj');y.attributes.user=x;try{var z=w.children[1].children[0].children[0].value;}catch(A){return false;}if(z&&z!=x)y.attributes.title=z;y.isOptionalClose=y.isEmpty=true;return y;}else if(w.attributes.style=='display: none;'||!w.children.length)return false;},div:function(w){if(!w.children.length)return false;},'lj:raw':function(w){w.name='lj-raw';},'lj:wishlist':function(w){w.name='lj-wishlist';}},attributes:{'lj-cmd':function(){return false;},contenteditable:function(){return false;}}});},requires:['fakeobjects','domiterator']});})();(function(){var m=a.lang[a.lang.detect()]||{};jQuery.extend(m,LJ.pageVar('rtedata'));a.styleText=Site.statprefix+'/js/ck/contents.css?t='+Site.version;var n=[{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_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>'}],o={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>')},LJUserLink:{html:encodeURIComponent(m.LJUser_WizardNotice+'<br /><a href="#" lj-cmd="LJUserLink">'+m.LJUser_WizardNoticeLink+'</a>')},LJLink:{html:encodeURIComponent(m.LJLink_WizardNotice+'<br /><a href="#" lj-cmd="LJLink">'+m.LJLink_WizardNoticeLink+'</a>')},image:{html:encodeURIComponent(m.LJImage_WizardNotice+'<br /><a href="#" lj-cmd="image">'+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>')}},p={},q;
 function r(t){var u,v,w,x,y=document.createElement('lj-note'),z=typeof document.body.style.opacity!='string',A=(function(){var D=60,E=100,F=E*D/1000,G=[],H,I=document.getElementById('draft-container')||document.body;function J(){var K=G.shift(),L=(H?K.time/E:-(K.time/E-1)).toFixed(1);if(!G.length)L=H?1:0;if(z)y.style.filter=L>=1?null:'progid:DXImageTransform.Microsoft.Alpha(opacity='+L*100+')';else y.style.opacity=L;if(L==0&&y&&y.parentNode)y.parentNode.removeChild(y);};return function(K){H=K;if(H&&y.parentNode){if(z)y.style.filter=null;else y.style.opacity=1;}else for(var L=1;L<=F;L++){var M=Math.floor(1000/D)*L;G.push({time:M,timer:setTimeout(J,M)});}I.appendChild(y);y.style.marginTop=-y.offsetHeight/2+'px';y.style.marginLeft=-y.offsetWidth/2+'px';};})();y.className='note-popup';y.onmouseout=function(){if(!w||!w.cmd)a.note.hide();};y.onmouseover=function(){if(u&&!v){v=1;u=clearTimeout(u);}};if(z)y.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity=0)';else y.style.opacity=0;function B(){var D=this.getAttribute('lj-cmd');if(w.hasOwnProperty(D)){o[D].node=w[D].node;var E=new d.selection(t.document);E.selectElement(o[D].node);q=true;t.execCommand(D);a.note.hide(true);}return false;};function C(){if(!window.switchedRteOn)a.note.hide(true);if(v){w=x;x=null;var D='';for(var E in w){if(w.hasOwnProperty(E))D+='<div class="noteItem">'+w[E].content+'</div>';}y.innerHTML=decodeURIComponent(D);var F=y.getElementsByTagName('a');for(var G=0,H=F.length;G<H;G++){var I=F[G];if(o.hasOwnProperty(I.getAttribute('lj-cmd')))I.onclick=B;}}else w=null;A(v);u=null;};a.note={show:function(D,E){if(!E&&D==x||!window.switchedRteOn)return;if(u)u=clearTimeout(u);v=1;x=D;E===true?C():u=setTimeout(C,1000);},hide:function(D){if(v){v=0;if(u)u=clearTimeout(u);if(y.parentNode)D===true?C():u=setTimeout(C,500);}}};};var 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['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};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'];j.add('livejournal_old',{init:function(t){function u(B){var C=B.data.element||B.data.getTarget();
 if(C.type!=1)C=C.getParent();while(C){var D=C.getAttribute('lj-cmd');if(o.hasOwnProperty(D)){var E=t.getCommand(D);if(E.state==1){var F=new d.selection(t.document);o[D].node=C.is('body')?new h.get(C.getWindow().$.frameElement):C;F.selectElement(o[D].node);B.data.dialog='';q=true;E.exec();break;}}C=C.getParent();}};function v(B){var C=this;if(C.$!=t.document.$){C.$.className=(C.frame.getAttribute('lj-class')||'')+' lj-selected';if(C.getAttribute('lj-cmd')=='LJPollLink')C.frame.setStyle('height',C.getDocument().$.body.scrollHeight+'px');new d.selection(t.document).selectElement(C.frame);}B.data.getKey()==1&&B.data.preventDefault();};function w(B){if(B.data.getKey()==46){var C=new d.selection(t.document).getRanges(),D=C.length;while(D--)C[D].deleteContents();}};function x(){var E=this;var B=E.$.contentWindow,C=B.document,D=new h.get(C.body);if(D.on){D.on('dblclick',u);D.on('click',v);D.on('keyup',w);if(E.getAttribute('lj-cmd')=='LJPollLink'&&E.hasAttribute('style'))C.body.className='lj-poll lj-poll-open';}C=new h.get(C);C.frame=D.frame=E;};function y(){var B=t.document.getElementsByTag('iframe'),C=B.count(),D,E,F,G,H;q=false;while(C--){D=B.getItem(C),E=D.getAttribute('lj-cmd'),F=D.$.contentWindow,G=F.document,H=D.getAttribute('lj-style')||'';D.removeListener('load',x);D.on('load',x);G.open();G.write('<!DOCTYPE html><html style="'+H+'">'+'<head><link rel="stylesheet" href="'+a.styleText+'" /></head>'+'<body scroll="no" class="'+(D.getAttribute('lj-class')||'')+'" style="'+H+'" '+(E?'lj-cmd="'+E+'"':'')+'>'+decodeURIComponent(D.getAttribute('lj-content')||'')+'</body>'+'</html>');G.close();}};function z(B){if(t.onSwitch===true){delete t.onSwitch;return;}var C,D=B.name=='click',E=B.name=='selectionChange'||D,F=B.data.element||B.data.getTarget(),G,H;if(D&&(B.data.getKey()==1||B.data.$.button==0))B.data.preventDefault();if(F.type!=1)F=F.getParent();G=F;if(E){var I=t.document.getElementsByTag('iframe'),J,K;if(D&&G.is('iframe')){K=G.$.contentWindow.document.body;K.className=(G.getAttribute('lj-class')||'')+' lj-selected';if(G.getAttribute('lj-cmd')=='LJPollLink')G.setStyle('height',K.scrollHeight+'px');}for(var L=0,M=I.count();L<M;L++){J=I.getItem(L);if(J.$!=G.$){K=J.$.contentWindow.document.body;K.className=J.getAttribute('lj-class')||'';if(J.getAttribute('lj-cmd')=='LJPollLink'&&K.className=='lj-poll')J.removeAttribute('style');}}}do{var N=G.getAttribute('lj-cmd');if(!N&&G.type==1){var O=G.getParent();if(G.is('img')&&O.getParent()&&!O.getParent().hasAttribute('lj:user')){N='image';
@@ -155,6 +155,6 @@
 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=m.config,o=m.lang.colorButton;function p(s,t){m.focus();m.fire('saveSnapshot');new a.style(n['colorButton_'+t+'Style'],{color:'inherit'}).remove(m.document);if(s){var u=n['colorButton_'+t+'Style'];u.childRule=t=='back'?function(v){return r(v);}:function(v){return!(v.is('a')||v.getElementsByTag('a').count())||r(v);};new a.style(u,{color:s}).apply(m.document);}m.fire('saveSnapshot');};LiveJournal.register_hook('selectedColor',function(s){p(s,'fore');});var q='LJColor';m.ui.addButton(q,{label:o.textColorTitle,command:q});m.addCommand(q,{exec:function(s){s.rteButton(q,'color');}});function r(s){return s.getAttribute('contentEditable')=='false'||s.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());m.on('selectionChange',function(A){if(m.readOnly)return;var B=m.getCommand('unlink'),C=A.data.path.lastElement&&A.data.path.lastElement.getAscendant('a',true);if(C&&C.getName()=='a'&&C.getAttribute('href')&&C.getChildCount())B.setState(2);else B.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(A,B){var C=B&&(B.data('cke-saved-href')||B.getAttribute('href'))||'',D,E,F,G,H={};if(D=C.match(n))if(emailProtection=='encode')C=C.replace(u,function(Z,aa,ab){return 'mailto:'+String.fromCharCode.apply(String,aa.split(','))+(ab&&unescapeSingleQuote(ab));});else if(emailProtection)C.replace(v,function(Z,aa,ab){if(aa==compiledProtectionFunction.name){H.type='email';var ac=H.email={},ad=/[^,\s]+/g,ae=/(^')|('$)/g,af=ab.match(ad),ag=af.length,ah,ai;for(var aj=0;aj<ag;aj++){ai=decodeURIComponent(unescapeSingleQuote(af[aj].replace(ae,'')));ah=compiledProtectionFunction.params[aj].toLowerCase();
 ac[ah]=ai;}ac.address=[ac.name,ac.domain].join('@');}});if(!H.type)if(F=C.match(r)){H.type='anchor';H.anchor={};H.anchor.name=H.anchor.id=F[1];}else if(E=C.match(o)){var I=C.match(p),J=C.match(q);H.type='email';var K=H.email={};K.address=E[1];I&&(K.subject=decodeURIComponent(I[1]));J&&(K.body=decodeURIComponent(J[1]));}else if(C&&(G=C.match(s))){H.type='url';H.url={};H.url.protocol=G[1];H.url.url=G[2];}else H.type='url';if(B){var L=B.getAttribute('target');H.target={};H.adv={};if(!L){var M=B.data('cke-pa-onclick')||B.getAttribute('onclick'),N=M&&M.match(w);if(N){H.target.type='popup';H.target.name=N[1];var O;while(O=x.exec(N[2])){if((O[2]=='yes'||O[2]=='1')&&!(O[1] in {height:1,width:1,top:1,left:1}))H.target[O[1]]=true;else if(isFinite(O[2]))H.target[O[1]]=O[2];}}}else{var P=L.match(t);if(P)H.target.type=H.target.name=L;else{H.target.type='frame';H.target.name=L;}}var Q=this,R=function(Z,aa){var ab=B.getAttribute(aa);if(ab!==null)H.adv[Z]=ab||'';};R('advId','id');R('advLangDir','dir');R('advAccessKey','accessKey');H.adv.advName=B.data('cke-saved-name')||B.getAttribute('name')||'';R('advLangCode','lang');R('advTabIndex','tabindex');R('advTitle','title');R('advContentType','type');j.link.synAnchorSelector?H.adv.advCSSClasses=getLinkClass(B):R('advCSSClasses','class');R('advCharset','charset');R('advStyles','style');R('advRel','rel');}var S=H.anchors=[],T;if(j.link.emptyAnchorFix){var U=A.document.getElementsByTag('a');for(i=0,count=U.count();i<count;i++){T=U.getItem(i);if(T.data('cke-saved-name')||T.hasAttribute('name'))S.push({name:T.data('cke-saved-name')||T.getAttribute('name'),id:T.getAttribute('id')});}}else{var V=new d.nodeList(A.document.$.anchors);for(var W=0,X=V.count();W<X;W++){T=V.getItem(W);S[W]={name:T.getAttribute('name'),id:T.getAttribute('id')};}}if(j.link.fakeAnchor){var Y=A.document.getElementsByTag('img');for(W=0,X=Y.count();W<X;W++){if(T=j.link.tryRestoreFakeAnchor(A,Y.getItem(W)))S.push({name:T.getAttribute('name'),id:T.getAttribute('id')});}}this.selectedElement=B;return H;};LiveJournal.register_hook('link_response',function(A){var J=this;if(A.length===0){m.execCommand('unlink');delete J.selectedElement;return;}if(A.indexOf('http://')===-1)A='http://'+A;var B={};B['data-cke-saved-href']=A;B.href=A;if(!J.selectedElement){var C=m.getSelection(),D=C.getRanges(true);if(D.length==1&&D[0].collapsed){var E=new d.text(B['data-cke-saved-href'],m.document);D[0].insertNode(E);D[0].selectNodeContents(E);C.selectRanges(D);}var F=new a.style({element:'a',attributes:B});
 F.type=2;F.apply(m.document);}else{var G=J.selectedElement,H=G.data('cke-saved-href'),I=G.getHtml();G.setAttributes(B);delete J.selectedElement;}});LiveJournal.register_hook('link_hide',function(A){if(this.selectedElement)delete this.selectedElement;});var z='LJLink2';m.addCommand(z,{exec:function(A){var B=A.getSelection(),C=null;if((C=j.link.getSelectedLink(A))&&C.hasAttribute('href'))B.selectElement(C);else C=null;var D='';if(C){var E=y(A,C).url;D=(E.protocol||'http://')+E.url;}A.rteButton(z,'link',{defaultText:D,hasSelectedText:C?true:false,editMode:C?true:false});},editorFocus:false});m.ui.addButton(z,{label:m.lang.link.toolbar,command:z});},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.d...
 (truncated)
Tags: anazarov, js, livejournal, nfokz
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