spacevillain (spacevillain) wrote in changelog,
spacevillain
spacevillain
changelog

[livejournal] r22448: LJSV-2325: RTE: Undo (ctrl-z) eats highl...

Committer: atyurin
LJSV-2325: RTE: Undo (ctrl-z) eats highlighted text after using lj-cut
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-07-16 08:49:22 UTC (rev 22447)
+++ trunk/htdocs/js/ck/ckeditor.js	2012-07-16 08:50:27 UTC (rev 22448)
@@ -127,7 +127,7 @@
 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';
 G.setAttribute('lj-cmd',N);}else if(G.is('a')&&!O.hasAttribute('lj:user')){N='LJLink2';G.setAttribute('lj-cmd',N);}}if(N&&o.hasOwnProperty(N)){if(E){o[N].node=G;t.getCommand(N).setState(1);}(C||(C={}))[N]={content:o[N].html,node:G};}}while(G=G.getParent());if(E)for(H in o){if(o.hasOwnProperty(H)&&(!C||!C.hasOwnProperty(H))){delete o[H].node;t.getCommand(H).setState(2);}}C?a.note.show(C):a.note.hide();};(function(){function B(G){return G.slice(-2)=='/>'?G:G.slice(0,-1)+'/>';};function C(G){var H=new Poll(G);return '<iframe class="lj-poll-wrap" lj-class="lj-poll" frameborder="0" lj-cmd="LJPollLink" allowTransparency="true" lj-data="'+H.outputLJtags()+'" lj-content="'+H.outputHTML()+'"></iframe>';};function D(G,H,I){return '<iframe class="lj-embed-wrap" lj-class="lj-embed" frameborder="0" allowTransparency="true" lj-data="'+encodeURIComponent(I)+'"'+H+'></iframe>';};function E(G,H,I,J){return H+I.replace(/\n/g,'')+J;};function F(G,H,I,J){var K=H||I||m.LJRepost_Value,L=J.replace(/"/g,'&quot;');J=L+('<br /><input type="button" value="'+K+'" />').replace(/"/g,'&quot;');return '<iframe class="lj-repost-wrap" lj-class="lj-repost" frameborder="0" allowTransparency="true" lj-text="'+L+'" lj-button="'+K+'" lj-content="'+J+'"></iframe>';};t.dataProcessor.toHtml=function(G,H){G=G.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-repost\s*(?:button\s*=\s*(?:"([^"]*?)")|(?:"([^']*?)"))?.*?>([\s\S]*?)<\/lj-repost>/gi,F).replace(/<lj-embed(.*?)>([\s\S]*?)<\/lj-embed>/gi,D);if(!$('event_format').checked){G=G.replace(/(<lj-raw.*?>)([\s\S]*?)(<\/lj-raw>)/gi,E);if(!window.switchedRteOn)G=G.replace(/\n/g,'<br />');}G=a.htmlDataProcessor.prototype.toHtml.call(this,G,H);if(c)G='<xml:namespace ns="livejournal" prefix="lj" />'+G;return G;};})();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=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>','');p[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=o.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,o.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=o.LJUserLink.node.getElementsByTag('b').getItem(0).getText();LiveJournal.run_hook('rteButton','user',jQuery('.cke_button_'+C),{user:J});return;}else if(H.getType()==2)G=H.getSelectedText();if(G==''){LiveJournal.run_hook('rteButton','user',jQuery('.cke_button_'+C));return;}if(!G||J==G)return;K(G,I);}});t.ui.addButton('LJUserLink',{label:m.LJUser,command:'LJUserLink'});})();if(window.ljphotoEnabled&&window.ljphotoMigrationStatus===LJ.getConst('LJPHOTO_MIGRATION_NONE'))t.ui.addButton('image',{label:m.LJImage_Title,command:'image'});else{t.addCommand('LJImage',{exec:function(){if(typeof InOb!=='undefined')InOb.handleInsertImageBeta('upload');else jQuery('.b-updatepage-event-section').editor('handleImageUpload','upload');},editorFocus:false});t.ui.addButton('image',{label:m.LJImage_Title,command:'LJImage'});}(function(){function B(C){if(C&&C.length&&window.switchedRteOn){var D=new h('iframe',t.document);D.setAttribute('lj-data',encodeURIComponent(C));D.setAttribute('lj-class','lj-embed');D.setAttribute('class','lj-embed-wrap');D.setAttribute('frameBorder',0);D.setAttribute('allowTransparency','true');t.insertElement(D);y();}};t.addCommand('LJEmbedLink',{exec:function(){top.LJ_IPPU.textPrompt(m.LJEmbedPromptTitle,m.LJEmbedPrompt,B,{width:'350px'});}});t.ui.addButton('LJEmbedLink',{label:m.LJEmbed,command:'LJEmbedLink'});})();function A(B,C,D){var E,F=o[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++)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);y();}a.note&&a.note.hide(true);}};LiveJournal.register_hook('cut_response',function(B){A('lj-cut','LJCut',{title:m.LJCut_PromptTitle,text:m.LJCut_PromptText,skip:B});});t.addCommand('LJCut',{exec:function(){var B='LJCut',C=o[B].node;LiveJournal.run_hook('rteButton','cut',jQuery('.cke_button_'+B),{defaultText:C?C.getAttribute('text'):'',editMode:C?true:false});},editorFocus:false});t.ui.addButton('LJCut',{label:m.LJCut_Title,command:'LJCut'});LiveJournal.register_hook('spoiler_response',function(B){A('lj-spoiler','LJSpoiler',{title:m.LJCut_PromptTitle,text:m.LJCut_PromptText,skip:B});});t.addCommand('LJSpoiler',{exec:function(){var B='LJSpoiler',C=o[B].node;LiveJournal.run_hook('rteButton','spoiler',jQuery('.cke_button_'+B),{defaultText:C?C.getAttribute('text'):'',editMode:C?true:false});},editorFocus:false});t.ui.addButton('LJSpoiler',{label:m.LJSpoiler_Title,command:'LJSpoiler'});(function(){function B(I,J){J=J===undefined||J;var K,L=o.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;
+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++)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);}};LiveJournal.register_hook('cut_response',function(B){A('lj-cut','LJCut',{title:m.LJCut_PromptTitle,text:m.LJCut_PromptText,skip:B});});t.addCommand('LJCut',{exec:function(){var B='LJCut',C=o[B].node;LiveJournal.run_hook('rteButton','cut',jQuery('.cke_button_'+B),{defaultText:C?C.getAttribute('text'):'',editMode:C?true:false});},editorFocus:false});t.ui.addButton('LJCut',{label:m.LJCut_Title,command:'LJCut'});LiveJournal.register_hook('spoiler_response',function(B){A('lj-spoiler','LJSpoiler',{title:m.LJCut_PromptTitle,text:m.LJCut_PromptText,skip:B});});t.addCommand('LJSpoiler',{exec:function(){var B='LJSpoiler',C=o[B].node;LiveJournal.run_hook('rteButton','spoiler',jQuery('.cke_button_'+B),{defaultText:C?C.getAttribute('text'):'',editMode:C?true:false});},editorFocus:false});t.ui.addButton('LJSpoiler',{label:m.LJSpoiler_Title,command:'LJSpoiler'});(function(){function B(I,J){J=J===undefined||J;var K,L=o.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(o.LJLike.node)o.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(){LiveJournal.register_hook('poll_response',function(B){var C=new Poll(B),D=C.outputHTML(),E=C.outputLJtags(),F=o.LJPollLink.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');F.setAttribute('class','lj-poll-wrap');F.setAttribute('frameBorder',0);F.setAttribute('allowTransparency','true');t.insertElement(F);}y();});t.addCommand('LJPollLink',{exec:function(B){var C='LJPollLink';if(o.LJPollLink.node)LiveJournal.run_hook('rteButton','poll',jQuery('.cke_button_'+C),{ljData:decodeURIComponent(o.LJPollLink.node.getAttribute('lj-data')),editMode:true});else LiveJournal.run_hook('rteButton','poll',jQuery('.cke_button_'+C));},editorFocus:false});t.ui.addButton('LJPollLink',{label:m.LJPoll_Title,command:'LJPollLink'});})();(function(){n.defaultButtons=[];for(var B=0;B<n.length;B++){button=n[B];n[button.id]=n[button.abbr]=button;n.defaultButtons.push(button.id);}LiveJournal.register_hook('like_response',function(C){var D=[],E=[],F=typeof C==='string';for(var G=0;G<n.length;G++){button=n[G];if(F&&button.checked||C.indexOf(button.id)!=-1){D.push(button.id);E.push(button.html);}}var H=o.LJLike.node;if(H){H.setAttribute('buttons',D.join(','));H.setAttribute('lj-content',encodeURIComponent('<span class="lj-like-wrapper">'+E.join('')+'</span>'));H.removeAttribute('defaults');}else{H=new h('iframe',t.document);H.setAttribute('lj-class','lj-like');H.setAttribute('class','lj-like-wrap');H.setAttribute('buttons',D.join(','));H.setAttribute('lj-content',encodeURIComponent('<span class="lj-like-wrapper">'+E.join('')+'</span>'));H.setAttribute('lj-cmd','LJLike');H.setAttribute('frameBorder',0);H.setAttribute('allowTransparency','true');H.setAttribute('defaults',F);t.insertElement(H);}y();});t.addCommand('LJLike',{exec:function(C){var D='LJLike';if(o.LJLike.node)LiveJournal.run_hook('rteButton','like',jQuery('.cke_button_'+D),{buttons:o.LJLike.node.getAttribute('buttons')});else LiveJournal.run_hook('rteButton','like',jQuery('.cke_button_'+D));},editorFocus:false});t.ui.addButton('LJLike',{label:m.LJLike_Title,command:'LJLike'});})();},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';if(w.attributes.hasOwnProperty('style'))y.attributes['lj-style']=w.attributes.style;y.attributes['lj-cmd']='LJLike';y.attributes['lj-content']='<span class="lj-like-wrapper">';y.attributes.frameBorder=0;y.attributes.allowTransparency='true';var z=w.attributes.buttons&&w.attributes.buttons.split(',')||n.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=n[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>';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(p[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(p.hasOwnProperty(A)){var B=new a.htmlParser.fragment.fromHtml(p[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;p[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';x.attributes['lj-content']='<p class="lj-map">map</p>';x.attributes.frameBorder=0;x.attributes.allowTransparency='true';
@@ -137,7 +137,7 @@
 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';
 G.setAttribute('lj-cmd',N);}else if(G.is('a')&&!O.hasAttribute('lj:user')){N='LJLink';G.setAttribute('lj-cmd',N);}}if(N&&o.hasOwnProperty(N)){if(E){o[N].node=G;t.getCommand(N).setState(1);}(C||(C={}))[N]={content:o[N].html,node:G};}}while(G=G.getParent());if(E)for(H in o){if(o.hasOwnProperty(H)&&(!C||!C.hasOwnProperty(H))){delete o[H].node;t.getCommand(H).setState(2);}}C?a.note.show(C):a.note.hide();};(function(){function B(G){return G.slice(-2)=='/>'?G:G.slice(0,-1)+'/>';};function C(G){var H=new Poll(G);return '<iframe class="lj-poll-wrap" lj-class="lj-poll" frameborder="0" lj-cmd="LJPollLink" allowTransparency="true" lj-data="'+H.outputLJtags()+'" lj-content="'+H.outputHTML()+'"></iframe>';};function D(G,H,I){return '<iframe class="lj-embed-wrap" lj-class="lj-embed" frameborder="0" allowTransparency="true" lj-data="'+encodeURIComponent(I)+'"'+H+'></iframe>';};function E(G,H,I,J){return H+I.replace(/\n/g,'')+J;};function F(G,H,I,J){var K=H||I||m.LJRepost_Value,L=J.replace(/"/g,'&quot;');J=L+('<br /><input type="button" value="'+K+'" />').replace(/"/g,'&quot;');return '<iframe class="lj-repost-wrap" lj-class="lj-repost" frameborder="0" allowTransparency="true" lj-text="'+L+'" lj-button="'+K+'" lj-content="'+J+'"></iframe>';};t.dataProcessor.toHtml=function(G,H){G=G.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-repost\s*(?:button\s*=\s*(?:"([^"]*?)")|(?:"([^']*?)"))?.*?>([\s\S]*?)<\/lj-repost>/gi,F).replace(/<lj-embed(.*?)>([\s\S]*?)<\/lj-embed>/gi,D);if(!$('event_format').checked){G=G.replace(/(<lj-raw.*?>)([\s\S]*?)(<\/lj-raw>)/gi,E);if(!window.switchedRteOn)G=G.replace(/\n/g,'<br />');}G=a.htmlDataProcessor.prototype.toHtml.call(this,G,H);if(c)G='<xml:namespace ns="livejournal" prefix="lj" />'+G;return G;};})();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=top.Site.siteroot+'/tools/endpoints/ljuser.bml';function C(D,E,F){if(D.error){alert(D.error);return;}if(D.success){D.ljuser=D.ljuser.replace('<span class="useralias-value">*</span>','');p[E]=D.ljuser;var G=new h.createFromHtml(D.ljuser);G.setAttribute('lj-cmd','LJUserLink');if(F)F.$.parentNode.replaceChild(G.$,F.$);else t.insertElement(G);}};t.addCommand('LJUserLink',{exec:function(D){var E='',F=new d.selection(D.document),G=o.LJUserLink.node,H;if(G){a.note&&a.note.hide(true);H=o.LJUserLink.node.getElementsByTag('b').getItem(0).getText();E=prompt(m.UserPrompt,H);}else if(F.getType()==2)E=F.getSelectedText();if(E=='')E=prompt(m.UserPrompt,E);if(!E||H==E)return;parent.HTTPReq.getJSON({data:parent.HTTPReq.formEncoded({username:E}),method:'POST',url:B,onData:function(I){C(I,E,G);}});}});t.ui.addButton('LJUserLink',{label:m.LJUser,command:'LJUserLink'});})();if(window.ljphotoEnabled&&window.ljphotoMigrationStatus===LJ.getConst('LJPHOTO_MIGRATION_NONE'))t.ui.addButton('image',{label:m.LJImage_Title,command:'image'});else{t.addCommand('LJImage',{exec:function(){if(typeof InOb!=='undefined')InOb.handleInsertImageBeta('upload');else jQuery('.b-updatepage-event-section').editor('handleImageUpload','upload');},editorFocus:false});t.ui.addButton('image',{label:m.LJImage_Title,command:'LJImage'});}t.addCommand('LJLink',{exec:function(B){!q&&this.state==1?B.execCommand('unlink'):B.openDialog('link');a.note&&a.note.hide(true);},editorFocus:false});t.ui.addButton('LJLink',{label:t.lang.link.toolbar,command:'LJLink'});(function(){function B(C){if(C&&C.length&&window.switchedRteOn){var D=new h('iframe',t.document);D.setAttribute('lj-data',encodeURIComponent(C));D.setAttribute('lj-class','lj-embed');D.setAttribute('class','lj-embed-wrap');D.setAttribute('frameBorder',0);D.setAttribute('allowTransparency','true');t.insertElement(D);y();}};t.addCommand('LJEmbedLink',{exec:function(){top.LJ_IPPU.textPrompt(m.LJEmbedPromptTitle,m.LJEmbedPrompt,B,{width:'350px'});}});t.ui.addButton('LJEmbedLink',{label:m.LJEmbed,command:'LJEmbedLink'});})();function A(B,C,D){var E,F=o[C].node;if(F){if(E=prompt(D.title,F.getAttribute('text')||D.text))if(E==D.text)F.removeAttribute('text');else F.setAttribute('text',E);}else{if(E=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++)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);}a.note&&a.note.hide(true);}};t.addCommand('LJCut',{exec:function(){A('lj-cut','LJCut',{title:m.LJCut_PromptTitle,text:m.LJCut_PromptText});},editorFocus:false});t.ui.addButton('LJCut',{label:m.LJCut_Title,command:'LJCut'});t.addCommand('LJSpoiler',{exec:function(){A('lj-spoiler','LJSpoiler',{title:m.LJSpoiler_PromptTitle,text:m.LJSpoiler_PromptText});},editorFocus:false});t.ui.addButton('LJSpoiler',{label:m.LJSpoiler_Title,command:'LJSpoiler'});(function(){function B(I,J){J=J===undefined||J;var K,L=o.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;
+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++)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');}a.note&&a.note.hide(true);}};t.addCommand('LJCut',{exec:function(){A('lj-cut','LJCut',{title:m.LJCut_PromptTitle,text:m.LJCut_PromptText});},editorFocus:false});t.ui.addButton('LJCut',{label:m.LJCut_Title,command:'LJCut'});t.addCommand('LJSpoiler',{exec:function(){A('lj-spoiler','LJSpoiler',{title:m.LJSpoiler_PromptTitle,text:m.LJSpoiler_PromptText});},editorFocus:false});t.ui.addButton('LJSpoiler',{label:m.LJSpoiler_Title,command:'LJSpoiler'});(function(){function B(I,J){J=J===undefined||J;var K,L=o.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(o.LJLike.node)o.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);})();if(Site.page.makepoll){a.dialog.add('LJPollDialog',function(){var B=0,C,D,E,F=function(){if(this.removeListener)this.removeListener('load',F);if(B&&C){currentPoll=new Poll(o.LJPollLink.node&&decodeURIComponent(o.LJPollLink.node.getAttribute('lj-data')),D.document,E.document,D.Questions);D.ready(currentPoll);E.ready(currentPoll);C.style.display='block';a.note&&a.note.hide(true);}else B++;},G=[new k.button({type:'button',id:'LJPoll_Ok',label:t.lang.common.ok,onClick:function(H){H.data.dialog.hide();var I=new Poll(currentPoll,D.document,E.document,D.Questions),J=I.outputHTML(),K=I.outputLJtags();if(J.length>0){var L=o.LJPollLink.node;if(L){L.setAttribute('lj-content',J);L.setAttribute('lj-data',K);L.removeAttribute('style');L.$.contentWindow.document.body.className='lj-poll';
 }else{L=new h('iframe',t.document);L.setAttribute('lj-content',J);L.setAttribute('lj-cmd','LJPollLink');L.setAttribute('lj-data',K);L.setAttribute('lj-class','lj-poll');L.setAttribute('class','lj-poll-wrap');L.setAttribute('frameBorder',0);L.setAttribute('allowTransparency','true');t.insertElement(L);}o.LJPollLink.node=null;y();}}}),a.dialog.cancelButton];b.mac&&G.reverse();return{title:m.Poll_PollWizardTitle,width:420,height:270,resizable:false,onShow:function(){if(B){currentPoll=new Poll(o.LJPollLink.node&&unescape(o.LJPollLink.node.getAttribute('data')),D.document,E.document,D.Questions);D.ready(currentPoll);E.ready(currentPoll);}},contents:[{id:'LJPoll_Setup',label:'Setup',padding:0,elements:[{type:'html',html:'<iframe src="/tools/ck_poll_setup.bml" allowTransparency="true" frameborder="0" style="width:100%; height:320px;"></iframe>',onShow:function(H){if(!C)(C=document.getElementById(H.sender.getButton('LJPoll_Ok').domId).parentNode).style.display='none';var I=this.getElement('iframe');E=I.$.contentWindow;if(E.ready)F();else I.on('load',F);}}]},{id:'LJPoll_Questions',label:'Questions',padding:0,elements:[{type:'html',html:'<iframe src="/tools/ck_poll_questions.bml" allowTransparency="true" frameborder="0" style="width:100%; height:320px;"></iframe>',onShow:function(){var H=this.getElement('iframe');D=H.$.contentWindow;if(D.ready)F();else H.on('load',F);}}]}],buttons:G};});t.addCommand('LJPollLink',new a.dialogCommand('LJPollDialog'));}else{t.addCommand('LJPollLink',{exec:function(){a.note&&a.note.show(m.Poll_AccountLevelNotice,null,null,true);}});t.getCommand('LJPollLink').setState(0);}t.ui.addButton('LJPollLink',{label:m.Poll_Title,command:'LJPollLink'});(function(){function B(){if(t.getCommand('LJLike')==2){this.$.checked?E++:E--;F.getButton('LJLike_Ok').getElement()[E==0?'addClass':'removeClass']('btn-disabled');}};var C=n.length,D='<div class="cke-dialog-likes"><ul class="cke-dialog-likes-list">',E=0,F,G;n.defaultButtons=[];for(var H=0;H<C;H++){var I=n[H];n[I.id]=n[I.abbr]=I;n.defaultButtons.push(I.id);D+=I.htmlOpt;}D+='</ul><p class="cke-dialog-likes-faq">'+Site.page.faqLink+'</p></div>';a.dialog.add('LJLikeDialog',function(){var J=[new k.button({type:'button',id:'LJLike_Ok',label:t.lang.common.ok,onClick:function(){var K=[],L='<span class="lj-like-wrapper">',M=o.LJLike.node,N=false;if(F.getButton('LJLike_Ok').getElement().hasClass('btn-disabled'))return false;for(var O=0;O<C;O++){var P=n[O],Q=document.getElementById('like-'+P.abbr),R=M&&M.getAttribute('buttons');
 if(Q&&Q.checked||R&&!P.htmlOpt&&(R.indexOf(P.abbr)+1||R.indexOf(P.id)+1)){K.push(P.id);L+=P.html;}if(Q&&n[O]&&Q.checked!=n[O].checked)N=true;}L+='</span>';if(K.length){if(M){o.LJLike.node.setAttribute('buttons',K.join(','));o.LJLike.node.setAttribute('lj-content',encodeURIComponent(L));o.LJLike.node.removeAttribute('defaults');}else{M=new h('iframe',t.document);M.setAttribute('lj-class','lj-like');M.setAttribute('class','lj-like-wrap');M.setAttribute('buttons',K.join(','));M.setAttribute('lj-content',encodeURIComponent(L));M.setAttribute('lj-cmd','LJLike');M.setAttribute('frameBorder',0);M.setAttribute('allowTransparency','true');M.setAttribute('defaults',!N);t.insertElement(M);}}else if(M)o.LJLike.node.remove();F.hide();}}),a.dialog.cancelButton];b.mac&&J.reverse();return{title:m.LJLike_name,width:145,height:Site.remote_is_sup?180:145,resizable:false,contents:[{id:'LJLike_Options',elements:[{type:'html',html:D}]}],onShow:function(){var K=t.getCommand('LJLike'),L=E=0,M=K.state==1,N=o.LJLike.node&&o.LJLike.node.getAttribute('buttons');a.note&&a.note.hide(true);for(;L<C;L++){var O=N?!!(N.indexOf(n[L].abbr)+1||N.indexOf(n[L].id)+1):n[L].checked,P=document.getElementById('like-'+n[L].abbr);if(P){if(O&&!M)E++;P.checked=O;}}if(E>0)F.getButton('LJLike_Ok').getElement().removeClass('btn-disabled');},onLoad:function(){F=this;G=F.parts.contents.getElementsByTag('input');for(var K=0;K<C;K++){var L=G.getItem(K);L&&L.on('click',B);}},buttons:J};});t.addCommand('LJLike',new a.dialogCommand('LJLikeDialog'));t.ui.addButton('LJLike',{label:m.LJLike_name,command:'LJLike'});})();},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';if(w.attributes.hasOwnProperty('style'))y.attributes['lj-style']=w.attributes.style;y.attributes['lj-cmd']='LJLike';y.attributes['lj-content']='<span class="lj-like-wrapper">';

Modified: trunk/htdocs/js/ck/plugins/livejournal/plugin.js
===================================================================
--- trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2012-07-16 08:49:22 UTC (rev 22447)
+++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2012-07-16 08:50:27 UTC (rev 22448)
@@ -751,6 +751,7 @@
 
 						selection.selectRanges(ranges);
 
+						editor.fire('updateSnapshot');
 						updateFrames();
 					}
 

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