spacevillain (spacevillain) wrote in changelog,
spacevillain
spacevillain
changelog

[livejournal] r23500: LJSUP-14675: Convert highlighted usernam...

Committer: atyurin
LJSUP-14675: Convert highlighted username to lj-user when clicking lj-user button in update.bml
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-12-21 14:50:28 UTC (rev 23499)
+++ trunk/htdocs/js/ck/ckeditor.js	2012-12-21 14:59:35 UTC (rev 23500)
@@ -137,7 +137,7 @@
 y.selectNodeContents(s.document.getBody());y.collapse(true);t.selectRanges([y]);}},100);};a.editor.prototype.isFocusAt=function(r){var s=this.getSelection(),t=s.getRanges()[0],u=this.document.getBody();if(r==='end'&&t.checkEndOfBlock())if(u.equals(t.endContainer)||u.getLast().equals(t.endContainer))return true;if(r==='start')throw new Error('Not implemented');return false;};a.editor.prototype.isSelectionCollapsed=function(){var r=this.getSelection(),s=r&&r.getRanges()[0];if(s)return!!s.collapsed;return false;};var m=a.lang[a.lang.detect()]||{};jQuery.extend(m,LJ.pageVar('rtedata'));window.CKLang=a.CKLang=m;if(Site.page.ljpost)a.styleText=Site.statprefix+'/js/ck/contents_new.css?t='+Site.version;else a.styleText=Site.statprefix+'/js/ck/contents.css?t='+Site.version;function n(r,s,t){t=t||{};t&&jQuery.extend(t,{fromDoubleClick:this.execFromEditor});LiveJournal.run_hook('rteButton',s,jQuery('.cke_button_'+r),t);this.execFromEditor=false;};var o=[{label:m.LJLike_button_repost,id:'repost',abbr:'rp',checked:true,html:'<span class="lj-like-item rp">'+m.LJLike_button_repost+'</span>',htmlOpt:'<li class="like-rp"><input type="checkbox" id="like-rp" /><label for="like-rp">'+m.LJLike_button_repost+'</label></li>'},{label:m.LJLike_button_facebook,id:'facebook',abbr:'fb',checked:true,html:'<span class="lj-like-item fb">'+m.LJLike_button_facebook+'</span>',htmlOpt:'<li class="like-fb"><input type="checkbox" id="like-fb" /><label for="like-fb">'+m.LJLike_button_facebook+'</label></li>'},{label:m.LJLike_button_twitter,id:'twitter',abbr:'tw',checked:true,html:'<span class="lj-like-item tw">'+m.LJLike_button_twitter+'</span>',htmlOpt:'<li class="like-tw"><input type="checkbox" id="like-tw" /><label for="like-tw">'+m.LJLike_button_twitter+'</label></li>'},{label:m.LJLike_button_google,id:'google',abbr:'go',checked:true,html:'<span class="lj-like-item go">'+m.LJLike_button_google+'</span>',htmlOpt:'<li class="like-go"><input type="checkbox" id="like-go" /><label for="like-go">'+m.LJLike_button_google+'</label></li>'},{label:m.LJLike_button_vkontakte,id:'vkontakte',abbr:'vk',checked:Site.remote_is_sup?true:false,html:'<span class="lj-like-item vk">'+m.LJLike_button_vkontakte+'</span>',htmlOpt:Site.remote_is_sup?'<li class="like-vk"><input type="checkbox" id="like-vk" /><label for="like-vk">'+m.LJLike_button_vkontakte+'</label></li>':''},{label:m.LJLike_button_surfingbird,id:'surfingbird',abbr:'sb',checked:Site.remote_is_sup?true:false,html:'<span class="lj-like-item sb">'+m.LJLike_button_surfingbird+'</span>',htmlOpt:Site.remote_is_sup?'<li class="like-sb"><input type="checkbox" id="like-sb" /><label for="like-sb">'+m.LJLike_button_surfingbird+'</label></li>':''},{label:m.LJLike_button_tumblr,id:'tumblr',abbr:'tb',checked:true,html:'<span class="lj-like-item tb">'+m.LJLike_button_tumblr+'</span>',htmlOpt:'<li class="like-tb"><input type="checkbox" id="like-tb" /><label for="like-tb">'+m.LJLike_button_tumblr+'</label></li>'},{label:m.LJLike_button_give,id:'livejournal',abbr:'lj',checked:false,html:'<span class="lj-like-item lj">'+m.LJLike_button_give+'</span>',htmlOpt:'<li class="like-lj"><input type="checkbox" id="like-lj" /><label for="like-lj">'+m.LJLike_button_give+'</label></li>'}],p={LJPollLink:{html:encodeURIComponent(m.Poll_PollWizardNotice+'<br /><a href="#" lj-cmd="LJPollLink">'+m.Poll_PollWizardNoticeLink+'</a>')},LJLike:{html:encodeURIComponent(m.LJLike_WizardNotice+'<br /><a href="#" lj-cmd="LJLike">'+m.LJLike_WizardNoticeLink+'</a>')},LJLink2:{html:encodeURIComponent(m.LJLink_WizardNotice+'<br /><a href="#" lj-cmd="LJLink2">'+m.LJLink_WizardNoticeLink+'</a>')},LJImage:{html:encodeURIComponent(m.LJImage_WizardNotice+'<br /><a href="#" lj-cmd="LJImage">'+m.LJImage_WizardNoticeLink+'</a>')},LJCut:{html:encodeURIComponent(m.LJCut_WizardNotice+'<br /><a href="#" lj-cmd="LJCut">'+m.LJCut_WizardNoticeLink+'</a>')},LJSpoiler:{html:encodeURIComponent(m.LJSpoiler_WizardNotice+'<br /><a href="#" lj-cmd="LJSpoiler">'+m.LJSpoiler_WizardNoticeLink+'</a>')},LJEmbedLink:{},LJMap:{}},q=f;
 q.$block['lj-template']=1;q.$block['lj-raw']=1;q.$block['lj-cut']=1;q.$block['lj-spoiler']=1;q.$block['lj-poll']=1;q.$block['lj-repost']=1;q.$block['lj-pq']=1;q.$block['lj-pi']=1;q.$nonEditable['lj-template']=1;q.$empty['lj-random']=1;q['lj-template']={};q['lj-map']={};q['lj-repost']={};q['lj-raw']=q.div;q['lj-poll']={'lj-pq':1};q['lj-pq']={'#':1,'lj-pi':1};q['lj-pi']={'#':1};['a','b','em','i','img','strong','u','lj-user'].forEach(function(r){q['lj-pq'][r]=1;q['lj-pi'][r]=1;});q.$block.iframe=q.$inline.iframe;delete q.$inline.iframe;e.extend(q['lj-cut']={},q.$block);e.extend(q['lj-spoiler']={},q.$block);e.extend(q['lj-cut'],q.$inline);e.extend(q['lj-spoiler'],q.$inline);e.extend(q.div,q.$block);e.extend(q.$body,q.$block);delete q['lj-cut']['lj-cut'];f.p.iframe=1;f['lj-cut'].iframe=1;f['lj-spoiler'].iframe=1;j.add('livejournal',{init:function(r){r.rteButton=n;r.ljTagsData=p;function s(z){var A=z.data.element||z.data.getTarget();if(A.type!=1)A=A.getParent();while(A){var B=A.getAttribute('lj-cmd');if(p.hasOwnProperty(B)){var C=r.getCommand(B);if(C.state==1){var D=new d.selection(r.document);p[B].node=A.is('body')?new h.get(A.getWindow().$.frameElement):A;D.selectElement(p[B].node);z.data.dialog='';r.execFromEditor=true;r.execCommand(B,true);break;}}A=A.getParent();}};function t(z){var A=this;if(A.$!=r.document.$){A.$.className=(A.frame.getAttribute('lj-class')||'')+' lj-selected';if(A.getAttribute('lj-cmd')=='LJPollLink')A.frame.setStyle('height',A.getDocument().$.body.scrollHeight+'px');r.focus();new d.selection(r.document).selectElement(A.frame);}z.data.getKey()==1&&z.data.preventDefault();};function u(z){if(z.data.getKey()==46){var A=new d.selection(r.document).getRanges(),B=A.length;while(B--)A[B].deleteContents();}};function v(){var C=this;var z=C.$.contentWindow,A=z.document,B=new h.get(A.body);LiveJournal.run_hook('rte_frame_load',C,B);if(B.on&&!Site.page.disabled_input){B.on('dblclick',s);B.on('click',t);B.on('keyup',u);if(C.getAttribute('lj-cmd')=='LJPollLink'&&C.hasAttribute('style'))A.body.className='lj-poll lj-poll-open';}A=new h.get(A);A.frame=B.frame=C;};function w(){var z=r.document.getElementsByTag('iframe'),A=z.count(),B,C,D,E,F;r.execFromEditor=false;while(A--){B=z.getItem(A),C=B.getAttribute('lj-cmd'),D=B.$.contentWindow,E=D.document,F=B.getAttribute('lj-style')||'';if(B.getAttribute('data-update')==='false')continue;if(E&&E.body&&E.body.getAttribute('data-loaded'))continue;B.removeListener('load',v);B.on('load',v);E.open();E.write('<!DOCTYPE html><html style="width: 99%; height: 99%; overflow: hidden;"><head><link rel="stylesheet" href="'+a.styleText+'" /></head>'+'<body data-loaded="true" scroll="no" class="'+(B.getAttribute('lj-class')||'')+'" style="'+F+'" '+(C?'lj-cmd="'+C+'"':'')+'>'+decodeURIComponent(B.getAttribute('lj-content')||'')+'</body>'+'</html>');
 E.close();}};r.updateFrames=w;r.on('dataReady',function(){setTimeout(w,100);});function x(z){r.fire('updateSnapshot');if(r.onSwitch===true){delete r.onSwitch;return;}var A,B=z.name=='click',C=z.name=='selectionChange'||B,D=z.data.element||z.data.getTarget(),E,F;if(B&&(z.data.getKey()===1||z.data.$.button===0))z.data.preventDefault();if(D.type!=1)D=D.getParent();E=D;if(C){var G=r.document.getElementsByTag('iframe'),H,I;if(B&&E.is('iframe')){I=E.$.contentWindow.document.body;I.className=(E.getAttribute('lj-class')||'')+' lj-selected';if(E.getAttribute('lj-cmd')=='LJPollLink')E.setStyle('height',I.scrollHeight+'px');}for(var J=0,K=G.count();J<K;J++){H=G.getItem(J);if(H.$!=E.$){I=H.$.contentWindow.document.body;I.className=H.getAttribute('lj-class')||'';if(H.getAttribute('lj-cmd')=='LJPollLink'&&I.className.indexOf('lj-poll')!=-1)H.removeAttribute('style');}}}do{var L=E.getAttribute('lj-cmd');if(!L&&E.type==1){var M=E.getParent();if(E.is('img')&&!E.hasAttribute('data-user')&&M.getParent()&&!M.getParent().hasAttribute('data-user')){L='LJImage';E.setAttribute('lj-cmd',L);}else if(E.is('a')&&!E.hasAttribute('data-user')&&!M.hasAttribute('lj:user')){L='LJLink2';E.setAttribute('lj-cmd',L);}}if(L&&p.hasOwnProperty(L)){if(C){p[L].node=E;r.getCommand(L).setState(1);}(A||(A={}))[L]={content:p[L].html,node:E};}}while(E=E.getParent());var N;if(C)for(F in p){if(p.hasOwnProperty(F)&&(!A||!A.hasOwnProperty(F))){delete p[F].node;N=r.getCommand(F);if(N)N.setState(2);}}r.fire('updateSnapshot');};var y=(function(){var z='@focus@',A='<input type="hidden" id="__focus"/>';function B(D,E){return D.replace(/<(.|\n)*?>/g,function(F){var G=F;if(G.indexOf(E)!==-1){G=G.replace(E,'');return G+E;}else return F;});};function C(D,E,F){return[D.slice(0,E),F,D.slice(E)].join('');};r.on('contentDom',function(D){var E=D.editor.document.getById('__focus');if(E){this._domBuilt=true;setTimeout(function(){D.editor.focus();var F=D.editor.getSelection();if(F){var G=new d.range(D.editor.document);G.setEndAfter(E);F.selectRanges([G]);}E.remove();r.fire('updateSnapshot');},this._domBuilt?0:100);}});return function(D){var E=Site.page.__htmlLast;if(typeof E==='number'){if(D.length>0)D=B(C(D,E,z),z).replace(z,A);else D=A;delete Site.page.__htmlLast;}return D;};})();(function(){function z(F){return F.slice(-2)=='/>'?F:F.slice(0,-1)+'/>';};function A(F){var G=new Poll(F),H="<div class='lj-poll-inner lj-rtebox-inner'>"+G.outputHTML()+'</div>';return '<iframe class="lj-poll-wrap lj-rtebox" lj-class="lj-poll" frameborder="0" lj-cmd="LJPollLink" allowTransparency="true" lj-data="'+G.outputLJtags()+'" lj-content="'+H+'"></iframe>';
-};function B(F,G){var H="<div class='lj-poll-inner lj-rtebox-inner'>Poll id: "+G+'</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(F)+'" lj-content="'+H+'" data-disabledPoll="true"></iframe>';};function C(F,G,H){var I="<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(H)+'"'+G+'lj-content="'+I+'"></iframe>';};function D(F,G,H,I){return G+H.replace(/\n/g,'')+I;};function E(F,G,H,I){var J=G||H||m.LJRepost_Value,K=I.replace(/"/g,'&quot;');I=K+('<br /><input type="button" value="'+J+'" />').replace(/"/g,'&quot;');return '<iframe class="lj-repost-wrap" lj-class="lj-repost" frameborder="0" allowTransparency="true" lj-text="'+K+'" lj-button="'+J+'" lj-content="'+I+'"></iframe>';};r.dataProcessor.toHtml=function(F,G){F=y(F);F=F.replace(/<lj [^>]*?>/gi,z).replace(/<lj-map [^>]*?>/gi,z).replace(/<lj-template[^>]*?>/gi,z).replace(/(<lj-cut[^>]*?)\/>/gi,'$1>').replace(/<((?!br)[^\s>]+)([^>]*?)\/>/gi,'<$1$2></$1>').replace(/<lj-poll.*?>[\s\S]*?<\/lj-poll>/gi,A).replace(/<lj-poll-([0-9]+)>/gi,B).replace(/<lj-repost\s*(?:button\s*=\s*(?:"([^"]*?)")|(?:"([^']*?)"))?.*?>([\s\S]*?)<\/lj-repost>/gi,E).replace(/<lj-embed(.*?)>([\s\S]*?)<\/lj-embed>/gi,C).replace(/(<lj-raw.*?>)([\s\S]*?)(<\/lj-raw>)/gi,D).replace(/\n/g,'<br/>');F=F.replace(/>\s+<tr/ig,'><tr').replace(/>\s+<\/tr/ig,'></tr').replace(/>\s+<td/ig,'><td').replace(/>\s+<\/td/ig,'></td').replace(/<\/tr>\s+<\/table>/ig,'</tr></table>').replace(/<tr>\n/ig,'<tr>').replace(/\n<\/tr>/ig,'</tr>').replace(/<td>\n/ig,'<td>').replace(/\n<\/td>/ig,'</td>');F=a.htmlDataProcessor.prototype.toHtml.call(this,F,G);if(c)F='<xml:namespace ns="livejournal" prefix="lj" />'+F;return F;};r.dataProcessor.toDataFormat=function(F,G){F=a.htmlDataProcessor.prototype.toDataFormat.call(this,F,G);F=F.replace(/<br\s*\/>/gi,'\n').replace(/\>&nbsp;\n/ig,'>\n').replace(/[^ ]&nbsp\;</ig,' <').replace(/\>&nbsp\;[^ ]/ig,'> ').replace(/\t/g,' ');return F;};})();r.dataProcessor.writer.indentationChars='';r.dataProcessor.writer.lineBreakChars='';r.on('selectionChange',x);r.on('doubleclick',s);r.on('afterCommandExec',w);r.on('dialogHide',w);(function(){var z=/<br\s*\/?>$/i;r.on('paste',function(A){A.data.html=A.data.html.replace(z,'');});})();r.on('paste',function(){setTimeout(function(){w();
+};function B(F,G){var H="<div class='lj-poll-inner lj-rtebox-inner'>Poll id: "+G+'</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(F)+'" lj-content="'+H+'" data-disabledPoll="true"></iframe>';};function C(F,G,H){var I="<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(H)+'"'+G+'lj-content="'+I+'"></iframe>';};function D(F,G,H,I){return G+H.replace(/\n/g,'')+I;};function E(F,G,H,I){var J=G||H||m.LJRepost_Value,K=I.replace(/"/g,'&quot;');I=K+('<br /><input type="button" value="'+J+'" />').replace(/"/g,'&quot;');return '<iframe class="lj-repost-wrap" lj-class="lj-repost" frameborder="0" allowTransparency="true" lj-text="'+K+'" lj-button="'+J+'" lj-content="'+I+'"></iframe>';};r.dataProcessor.toHtml=function(F,G){F=y(F);F=F.replace(/<lj [^>]*?>/gi,z).replace(/<lj-map [^>]*?>/gi,z).replace(/<lj-template[^>]*?>/gi,z).replace(/(<lj-cut[^>]*?)\/>/gi,'$1>').replace(/<((?!br)[^\s>]+)([^>]*?)\/>/gi,'<$1$2></$1>').replace(/<lj-poll.*?>[\s\S]*?<\/lj-poll>/gi,A).replace(/<lj-poll-([0-9]+)>/gi,B).replace(/<lj-repost\s*(?:button\s*=\s*(?:"([^"]*?)")|(?:"([^']*?)"))?.*?>([\s\S]*?)<\/lj-repost>/gi,E).replace(/<lj-embed(.*?)>([\s\S]*?)<\/lj-embed>/gi,C).replace(/(<lj-raw.*?>)([\s\S]*?)(<\/lj-raw>)/gi,D).replace(/\n/g,'<br/>');F=F.replace(/>\s+<tr/ig,'><tr').replace(/>\s+<\/tr/ig,'></tr').replace(/>\s+<td/ig,'><td').replace(/>\s+<\/td/ig,'></td').replace(/<\/tr>\s+<\/table>/ig,'</tr></table>').replace(/<tr>\n/ig,'<tr>').replace(/\n<\/tr>/ig,'</tr>').replace(/<td>\n/ig,'<td>').replace(/\n<\/td>/ig,'</td>');F=a.htmlDataProcessor.prototype.toHtml.call(this,F,G);if(c)F='<xml:namespace ns="livejournal" prefix="lj" />'+F;return F;};r.dataProcessor.toDataFormat=function(F,G){F=a.htmlDataProcessor.prototype.toDataFormat.call(this,F,G);F=F.replace(/<br\s*\/>/gi,'\n').replace(/&nbsp;</ig,' <').replace(/\>&nbsp;/ig,'> ').replace(/\>&nbsp;\n/ig,'>\n').replace(/\t/g,' ');return F;};})();r.dataProcessor.writer.indentationChars='';r.dataProcessor.writer.lineBreakChars='';r.on('selectionChange',x);r.on('doubleclick',s);r.on('afterCommandExec',w);r.on('dialogHide',w);(function(){var z=/<br\s*\/?>$/i;r.on('paste',function(A){A.data.html=A.data.html.replace(z,'');});})();r.on('paste',function(){setTimeout(function(){w();
 },0);});r.on('dataReady',function(){if(c){r.document.getBody().on('dragend',w);r.document.getBody().on('paste',function(){setTimeout(w,0);});}if(!Site.page.disabled_input){r.document.on('click',x);r.document.on('mouseover',x);r.document.getBody().on('keyup',u);w();}});(function(){var z='LJImage',A=null;LiveJournal.register_hook('editpic_response',function(B){var C=A,D=C&&C.getParent();if(!C)return;if(B.url){C.setAttribute('src',B.url);C.setAttribute('data-cke-saved-src',B.url);}else{if(D&&D.getName()==='a')D.remove();else C.remove();return;}if(B.width)C.setAttribute('width',B.width);else C.removeAttribute('width');if(B.height)C.setAttribute('height',B.height);else C.removeAttribute('height');if(B.title)C.setAttribute('title',B.title);else C.removeAttribute('title');if(B.border)C.setStyle('border-width',B.border+'px');else{C.removeStyle('border-width');C.removeStyle('border-style');}if(B.vspace)C.setStyles({'margin-top':B.vspace+'px','margin-bottom':B.vspace+'px'});else{C.removeStyle('margin-top');C.removeStyle('margin-bottom');}if(B.hspace)C.setStyles({'margin-left':B.hspace+'px','margin-right':B.hspace+'px'});else{C.removeStyle('margin-left');C.removeStyle('margin-right');}var D=C&&C.getParent();if(B.link){B.link=B.link.replace(/^[\s\t]*(?:http:\/\/)?/,'http://');if(D&&D.getName()==='a'){D.setAttribute('href',B.link);D.setAttribute('data-cke-saved-href',B.link);if(B.blank)D.setAttribute('target','_blank');else D.removeAttribute('target');}else{var E=new h('a',r.document);E.setAttribute('href',B.link);if(B.blank)E.setAttribute('target','_blank');C.insertBeforeMe(E);E.append(C);r.getSelection()&&r.getSelection().selectElement(E);}}else if(D.getName()==='a'){D.insertBeforeMe(C);D.remove();}if(B.aligment&&B.aligment!=='none')C.setStyle('float',B.aligment);else C.removeStyle('float');A=null;});r.addCommand(z,{exec:function(B,C){var D=B.getSelection();D=D?D.getSelectedElement():null;A=D;if(D&&D.is('img')){var E=D&&D.getParent(),F=E.getName()==='a',G=F&&E,H=F&&E.getAttribute('href'),I={};if('naturalWidth' in D.$){I.width=D.$.naturalWidth;I.height=D.$.naturalHeight;}else{var J=new Image();J.src=D.$.src;I={width:J.width,height:J.height};}B.rteButton(z,'editpic',{picData:{url:D.getAttribute('src'),title:D.getAttribute('title'),width:D.getAttribute('width')||D.$.width,height:D.getAttribute('height')||D.$.height,defaultWidth:I.width,defaultHeight:I.height,link:H||'',blank:F?!!G.getAttribute('target'):true,border:parseInt(D.getStyle('border-width'),10),vspace:parseInt(D.getStyle('margin-top'),10),hspace:parseInt(D.getStyle('margin-left'),10),aligment:D.getStyle('float')||'none'}});
 }else jQuery('.b-updatepage-event-section').editor('handleImageUpload','upload');},editorFocus:false});r.ui.addButton(z,{label:m.LJImage_Title,command:z});})();(function(){var z='LJMap',A='map';LiveJournal.register_hook('map_response',function(B){var C=new h('iframe',r.document),D=425,E=350,F='',G='';if(!isNaN(D)){F+='width:'+D+'px;';G+='width:'+(D-2)+'px;';}if(!isNaN(E)){F+='height:'+E+'px;';G+='height:'+(E-2)+'px;';}var H=p[z].node;if(H)H.setAttributes({'lj-url':B});else{C.setAttributes({'lj-url':B,'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:F,'lj-style':G});r.insertElement(C);}w();});r.addCommand(z,{exec:function(){var B=p[z].node;r.rteButton(z,A,{defaultText:B?B.getAttribute('lj-url'):'',editMode:B?true:false});},editorFocus:false});r.ui.addButton(z,{label:m.LJMap_Title,command:z});})();(function(){function z(G,H){H=H===undefined||H;var I,J=p.LJLike.node;if(J){var K=G.getAttribute('lj-style');I=K?K.replace(/text-align:\s*(left|right|center)/i,'$1'):'left';}else if(H)I=G.getComputedStyle('text-align');else{while(!G.hasAttribute||!(G.hasAttribute('align')||G.getStyle('text-align'))){var L=G.getParent();if(!L)break;G=L;}I=G.getStyle('text-align')||G.getAttribute('align')||'';}I&&(I=I.replace(/-moz-|-webkit-|start|auto/i,''));!I&&H&&(I=G.getComputedStyle('direction')=='rtl'?'right':'left');return I;};function A(G){if(G.editor.readOnly)return;var H=G.editor.getCommand(this.name),I=G.data.element;if((I.type==1&&I.hasAttribute('lj-cmd')&&I.getAttribute('lj-cmd'))=='LJLike')H.state=z(I,r.config.useComputedState)==this.value?1:2;else if(!I||I.type!=1||I.getName()=='body'||I.getName()=='iframe')H.state=2;else H.state=z(I,r.config.useComputedState)==this.value?1:2;H.fire('state');};function B(G,H,I){var K=this;K.name=H;K.value=I;var J=G.config.justifyClasses;if(J){switch(I){case 'left':K.cssClassName=J[0];break;case 'center':K.cssClassName=J[1];break;case 'right':K.cssClassName=J[2];break;}K.cssClassRegex=new RegExp('(?:^|\\s+)(?:'+J.join('|')+')(?=$|\\s)');}};function C(G){var H=G.editor,I=new d.range(H.document);I.setStartBefore(G.data.node);I.setEndAfter(G.data.node);var J=new d.walker(I),K;while(K=J.next()){if(K.type==1){var L='text-align',M=H.config.justifyClasses;if(!K.equals(G.data.node)&&K.getDirection()){I.setStartAfter(K);J=new d.walker(I);continue;}if(M)if(K.hasClass(M[0])){K.removeClass(M[0]);K.addClass(M[2]);
 }else if(K.hasClass(M[2])){K.removeClass(M[2]);K.addClass(M[0]);}switch(K.getStyle(L)){case 'left':K.setStyle(L,'right');break;case 'right':K.setStyle(L,'left');break;}}}};B.prototype={exec:function(G){var U=this;var H=G.getSelection(),I=G.config.enterMode;if(!H)return;var J=H.createBookmarks();if(p.LJLike.node)p.LJLike.node.setAttribute('lj-style','text-align: '+U.value);else{var K=H.getRanges(true),L=U.cssClassName,M,N,O=G.config.useComputedState;O=O===undefined||O;for(var P=K.length-1;P>=0;P--){var Q=K[P],R=Q.getEnclosedNode();if(R&&R.type===1&&R.is('iframe'))return;M=Q.createIterator();M.enlargeBr=I!=2;while(N=M.getNextParagraph(I==1?'p':'div')){N.removeAttribute('align');N.removeStyle('text-align');var S=L&&(N.$.className=e.ltrim(N.$.className.replace(U.cssClassRegex,''))),T=U.state==2&&(!O||z(N,true)!=U.value);if(L){if(T)N.addClass(L);else if(!S)N.removeAttribute('class');}else if(T)N.setStyle('text-align',U.value);}}}G.focus();G.forceNextSelectionCheck();H.selectBookmarks(J);}};var D=new B(r,'LJJustifyLeft','left'),E=new B(r,'LJJustifyCenter','center'),F=new B(r,'LJJustifyRight','right');r.addCommand('LJJustifyLeft',D);r.addCommand('LJJustifyCenter',E);r.addCommand('LJJustifyRight',F);r.ui.addButton('LJJustifyLeft',{label:r.lang.justify.left,command:'LJJustifyLeft'});r.ui.addButton('LJJustifyCenter',{label:r.lang.justify.center,command:'LJJustifyCenter'});r.ui.addButton('LJJustifyRight',{label:r.lang.justify.right,command:'LJJustifyRight'});r.on('selectionChange',e.bind(A,D));r.on('selectionChange',e.bind(A,F));r.on('selectionChange',e.bind(A,E));r.on('dirChanged',C);})();(function(){var z='LJPollLink';if(!LJ.pageVar('remoteUser',true))return;LiveJournal.register_hook('poll_response',function(A){var B=new Poll(A),C="<div class='lj-poll-inner lj-rtebox-inner'>"+B.outputHTML()+'</div>',D=B.outputLJtags(),E=p[z].node;if(E){E.setAttribute('lj-content',C);E.setAttribute('lj-data',D);E.removeAttribute('style');}else{E=new h('iframe',r.document);E.setAttribute('lj-content',C);E.setAttribute('lj-cmd','LJPollLink');E.setAttribute('lj-data',D);E.setAttribute('lj-class','lj-poll lj-rtebox');E.setAttribute('class','lj-poll-wrap');E.setAttribute('frameBorder',0);E.setAttribute('allowTransparency','true');r.insertElement(E);}w();});r.addCommand(z,{exec:function(A){var B=p.LJPollLink.node;if(B)A.rteButton(z,'poll',{ljData:decodeURIComponent(B.getAttribute('lj-data')),editMode:true,disabled:B&&(B.getAttribute('data-disabledPoll')?true:false)});else A.rteButton(z,'poll');
@@ -155,9 +155,9 @@
 for(var al=0;al<ai;al++){ak=decodeURIComponent(unescapeSingleQuote(ah[al].replace(ag,'')));aj=compiledProtectionFunction.params[al].toLowerCase();ae[aj]=ak;}ae.address=[ae.name,ae.domain].join('@');}});if(!J.type)if(H=E.match(s)){J.type='anchor';J.anchor={};J.anchor.name=J.anchor.id=H[1];}else if(G=E.match(p)){var K=E.match(q),L=E.match(r);J.type='email';var M=J.email={};M.address=G[1];K&&(M.subject=decodeURIComponent(K[1]));L&&(M.body=decodeURIComponent(L[1]));}else if(E&&(I=E.match(t))){J.type='url';J.url={};J.url.protocol=I[1];J.url.url=I[2];}else J.type='url';if(D){var N=D.getAttribute('target');J.target={};J.adv={};if(!N){var O=D.data('cke-pa-onclick')||D.getAttribute('onclick'),P=O&&O.match(x);if(P){J.target.type='popup';J.target.name=P[1];var Q;while(Q=y.exec(P[2])){if((Q[2]=='yes'||Q[2]=='1')&&!(Q[1] in {height:1,width:1,top:1,left:1}))J.target[Q[1]]=true;else if(isFinite(Q[2]))J.target[Q[1]]=Q[2];}}}else{var R=N.match(u);if(R)J.target.type=J.target.name=N;else{J.target.type='frame';J.target.name=N;}}var S=this,T=function(ab,ac){var ad=D.getAttribute(ac);if(ad!==null)J.adv[ab]=ad||'';};T('advId','id');T('advLangDir','dir');T('advAccessKey','accessKey');J.adv.advName=D.data('cke-saved-name')||D.getAttribute('name')||'';T('advLangCode','lang');T('advTabIndex','tabindex');T('advTitle','title');T('advContentType','type');j.link.synAnchorSelector?J.adv.advCSSClasses=getLinkClass(D):T('advCSSClasses','class');T('advCharset','charset');T('advStyles','style');T('advRel','rel');}var U=J.anchors=[],V;if(j.link.emptyAnchorFix){var W=C.document.getElementsByTag('a');for(i=0,count=W.count();i<count;i++){V=W.getItem(i);if(V.data('cke-saved-name')||V.hasAttribute('name'))U.push({name:V.data('cke-saved-name')||V.getAttribute('name'),id:V.getAttribute('id')});}}else{var X=new d.nodeList(C.document.$.anchors);for(var Y=0,Z=X.count();Y<Z;Y++){V=X.getItem(Y);U[Y]={name:V.getAttribute('name'),id:V.getAttribute('id')};}}if(j.link.fakeAnchor){var aa=C.document.getElementsByTag('img');for(Y=0,Z=aa.count();Y<Z;Y++){if(V=j.link.tryRestoreFakeAnchor(C,aa.getItem(Y)))U.push({name:V.getAttribute('name'),id:V.getAttribute('id')});}}this.selectedElement=D;return J;};LiveJournal.register_hook('link_response',function(C){var L=this;var D=C.url,E=C.target||'';if(D.length===0){m.execCommand('unlink');delete L.selectedElement;return;}if(!D.match(/^[a-z+]+:(\/\/)?/))D='http://'+D;var F={};F['data-cke-saved-href']=D;F.href=D;if(E)F.target=E;if(!L.selectedElement){var G=new h('a'),H=m.getSelection();
 G.setAttributes({'data-cke-saved-href':D,href:D});if(E)G.setAttribute('target',E);G.setText(A||D);m.insertElement(G);}else{var I=L.selectedElement,J=I.data('cke-saved-href'),K=I.getHtml();if(!F[E])I.removeAttribute('target');I.setAttributes(F);delete L.selectedElement;}});var A;LiveJournal.register_hook('link_hide',function(C){if(this.selectedElement)delete this.selectedElement;A='';});var B='LJLink2';m.addCommand(B,{exec:function(C){var D=C.getSelection(),E={},F=null;A=D.getSelectedText();if((F=j.link.getSelectedLink(C))&&F.hasAttribute('href'))D.selectElement(F);else F=null;var G='';if(F){var H=z(C,F).url;G=(H.protocol||'http://')+H.url;}E.defaultText=G;E.hasSelectedText=!!F;E.editMode=!!F;if(F)E.hasTarget=F.hasAttribute('target')?true:false;C.rteButton(B,'link',E);},editorFocus:false});m.ui.addButton(B,{label:m.lang.link.toolbar,command:B});},afterInit:function(m){var n=m.dataProcessor,o=n&&n.dataFilter,p=n&&n.htmlFilter,q=m._.elementsPath&&m._.elementsPath.filters;if(o)o.addRules({elements:{a:function(r){var s=r.attributes;if(!s.name)return null;var t=!r.children.length;if(j.link.synAnchorSelector){var u=t?'cke_anchor_empty':'cke_anchor',v=s['class'];if(s.name&&(!v||v.indexOf(u)<0))s['class']=(v||'')+' '+u;if(t&&j.link.emptyAnchorFix){s.contenteditable='false';s['data-cke-editable']=1;}}else if(j.link.fakeAnchor&&t)return m.createFakeParserElement(r,'cke_anchor','anchor');return null;}}});if(j.link.emptyAnchorFix&&p)p.addRules({elements:{a:function(r){delete r.attributes.contenteditable;}}});if(q)q.push(function(r,s){if(s=='a')if(j.link.tryRestoreFakeAnchor(m,r)||r.getAttribute('name')&&(!r.getAttribute('href')||!r.getChildCount()))return 'anchor';});},requires:['fakeobjects']});j.link={getSelectedLink:function(m){try{var n=m.getSelection();if(n.getType()==3){var o=n.getSelectedElement();if(o.is('a'))return o;}var p=n.getRanges(true)[0];p.shrink(2);var q=p.getCommonAncestor();return q.getAscendant('a',true);}catch(r){return null;}},fakeAnchor:b.opera||b.webkit,synAnchorSelector:c,emptyAnchorFix:c&&b.version<8,tryRestoreFakeAnchor:function(m,n){if(n&&n.data('cke-real-element-type')&&n.data('cke-real-element-type')=='anchor'){var o=m.restoreRealElement(n);if(o.data('cke-saved-name'))return o;}}};a.unlinkCommand=function(){};a.unlinkCommand.prototype={exec:function(m){var n=m.getSelection(),o=n.createBookmarks(),p=n.getRanges(),q,r;for(var s=0;s<p.length;s++){q=p[s].getCommonAncestor(true);r=q.getAscendant('a',true);if(!r)continue;p[s].selectNodeContents(r);
 }n.selectRanges(p);m.document.$.execCommand('unlink',false,null);n.selectBookmarks(o);},startDisabled:true};a.removeAnchorCommand=function(){};a.removeAnchorCommand.prototype={exec:function(m){var n=m.getSelection(),o=n.createBookmarks(),p;if(n&&(p=n.getSelectedElement())&&(j.link.fakeAnchor&&!p.getChildCount()?j.link.tryRestoreFakeAnchor(m,p):p.is('a')))p.remove(1);else if(p=j.link.getSelectedLink(m))if(p.hasAttribute('href')){p.removeAttributes({name:1,'data-cke-saved-name':1});p.removeClass('cke_anchor');}else p.remove(1);n.selectBookmarks(o);}};(function(m){'use strict';j.add('ljfont',{init:function(p){var q='LJFont',r=p.config,s=false,t={},u='normal',v=r.LJFontDefault,w=r.LJFontSize,x=r.LJFontStyle,y='b-fontsize-select-item-active',z,A=m();for(z in w){t[z]=new a.style(x,{size:w[z]});t[z]._.definition.name=z;}function B(C){v=C;A.removeClass(y).filter('.b-fontsize-select-item-'+v).addClass(y);};p.addCommand(q,{exec:function(C){C.rteButton(q,'font');if(!s){A=m('.b-fontsize-select-item');LiveJournal.register_hook('font_response',function(E){C.focus();C.fire('saveSnapshot');var F=t[E],G,H,I;if(v===E)F.remove(C.document);else{H=C.getSelection();I=parseFloat(F._.definition.styles['font-size']);for(G in t)t[G].remove(C.document);F.apply(C.document);}C.fire('saveSnapshot');});s=true;var D=C.getCommand(q);D.setState(1);B(v);}},editorFocus:false});p.ui.addButton(q,{label:a.CKLang[q],command:q});p.on('selectionChange',function(C){var D=C.data.path,E=D.elements,F=p.getCommand(q),G,H,I;for(G=0;G<E.length;G++){H=E[G];for(I in t){if(t[I].checkElementRemovable(H,true)){if(I!==v){B(I);F.setState(1);}return;}}}B(u);F.setState(2);});},requires:['styles']});i.font_style={element:'span',styles:{'font-family':'#(family)'},overrides:[{element:'font',attributes:{face:null}}]};var n={tiny:'0.7em',small:'0.9em',normal:'1.0em',large:'1.4em',huge:'1.8em'};i.fontSize_sizes='';for(var o in n)i.fontSize_sizes+=Site.ml_text['talk.font.'+o]+'/'+n[o]+';';i.fontSize_defaultLabel=Site.ml_text['talk.font.normal'];i.fontSize_style={element:'span',styles:{'font-size':'#(size)'},overrides:[{element:'font',attributes:{size:null}}]};})(jQuery);(function(m){'use strict';var n={LJCut:{tag:'lj-cut',widget:'cut'},LJSpoiler:{tag:'lj-spoiler',widget:'spoiler'}};j.add('ljcut',{init:function(o){var p,q,r=null;function s(y){var z=y;while(!z.getParent().is('body'))z=z.getParent();if(z!==y)y.breakParent(z);};function t(){var y=jQuery(o.document.getBody().$),z=false;y.find('ul, ol, li').each(function(){if(m(this).text().length===0){m(this).remove();
-z=true;}});};function u(y,z){var A=new d.selection(o.document),B=false,C=n[y].tag,D=new h('iframe',o.document),E=new h('br',o.document);D.setAttributes({'lj-cmd':y,'lj-class':C+' '+C+'-open','class':C+'-wrap',frameBorder:0,allowTransparency:'true'});if(typeof z!=='undefined')D.setAttribute('text',z);var F=D.clone();F.setAttribute('lj-class',C+' '+C+'-close');if(q.cloneContents().getChildCount()===0)B=true;q.insertNode(D);q.collapse();q.insertNode(F);s(D);s(F);if(B){E.clone().insertAfter(D);E.clone().insertBefore(F);}var G=new d.range(o.document);G.setStartAfter(D);G.setEndBefore(F);A.selectRanges([G]);o.focus();t();};function v(y,z){if(r&&r.getAttribute('lj-cmd')===y)r.setAttribute('text',z);else{u(y,z===Site.page.rtedata[y+'_PromptText']?undefined:z);o.updateFrames();}};function w(y,z){o.addCommand(y,{exec:function(){var A=new d.selection(o.document);p=A&&A.getSelectedElement();q=A.getRanges()[0];var B={defaultText:r?r.getAttribute('text'):'',editMode:r?true:false};if(r&&r.getAttribute('lj-cmd')!==y)B=null;o.rteButton(y,z,B);},editorFocus:false});o.ui.addButton(y,{label:a.CKLang[y+'_Title'],command:y});};LiveJournal.register_hook('cut_response',function(y){v('LJCut',y);});LiveJournal.register_hook('spoiler_response',function(y){v('LJSpoiler',y);});o.on('selectionChange',function(y){var z=y.data.element;if(z&&z.is('iframe')&&n[z.getAttribute('lj-cmd')])r=z;else r=null;});o.on('contentDom',function(){o.updateFrames();});for(var x in n)w(x,n[x].widget);},afterInit:function(o){function p(q,r,s){var t=n[r].tag;s=s||'text';var u=new a.htmlParser.element('iframe');u.attributes['lj-class']=t+' '+t+'-open';u.attributes['class']=t+'-wrap';u.attributes['lj-cmd']=r;u.attributes.frameBorder=0;u.attributes.allowTransparency='true';if(q.attributes.hasOwnProperty(s))u.attributes.text=q.attributes[s];q.children.unshift(u);var v=new a.htmlParser.element('iframe');v.attributes['lj-class']=t+' '+t+'-close';v.attributes['class']=t+'-wrap';v.attributes.frameBorder=0;v.attributes.allowTransparency='true';q.children.push(v);delete q.name;};o.dataProcessor.dataFilter.addRules({elements:{'lj-cut':function(q){p(q,'LJCut');},'lj-spoiler':function(q){p(q,'LJSpoiler','title');}}});}});})(jQuery);(function(m){'use strict';var n='LJUser2',o='user',p={},q={},r='/img/userinfo-disabled.gif';j.add('ljuser2',{init:function(s){var t=null,u=new Image();u.src='/img/preloader/preloader-blue-white-xl.gif';s.on('selectionChange',function(y){var z=y.data.element;s.getCommand(n).setState(z.hasAttribute('data-user')?1:2);
-t=z.hasAttribute('data-user')?z:null;});function v(y){var z={};if(!y)return null;if(y.is('img')){z.head=y;z.link=y.getNextSourceNode(true,1);}else{z.link=y;z.head=y.getPreviousSourceNode(true,1);}return z;};function w(y){if(!y)return;var z=new d.range(s.document),A=v(y),B=A.head,C=A.link,D=s.document.getSelection();if(C&&B){z.setStartBefore(B);z.setEndAfter(C);if(D)D.selectRanges([z]);}else D.selectElement(y);return C||y;};s.on('contentDom',function(){this.document.on('keydown',function(y){var z=s.document.getSelection(),A=z&&z.getRanges()[0];if(A.collapsed&&y.data.getKey()===8){var B=A.getTouchedEndNode();if(B.type===3)B=B.getParent();if(B.hasAttribute('data-user')){y.data.preventDefault();w(B);}}});this.document.on('click',function(y){var z=y.data.getTarget();if(z&&z.hasAttribute('data-user'))w(z);});});function x(y,z){var A=new h('img'),B=new h('a');A.setAttributes({src:u.src,width:'16',height:'16','data-user':y.journal,'data-title':z});A.setStyle('cursor','default');var C=new Image();C.onload=function(){p[y.journal]=y.userhead_url;A.setAttribute('src',C.src);s.fire('updateSnapshot');};C.src=y.userhead_url;B.setAttributes({href:'#','data-cke-saved-href':'#','data-user':y.journal,'data-title':z,seen:true});B.setStyles({color:'blue',fontWeight:'bold'});B.setText(z||y.journal);s.insertElement(A);s.insertElement(B);s.fire('updateSnapshot');};LiveJournal.register_hook('user_response',function(y,z){if(y&&y.hasOwnProperty('ljuser'))x(y.ljuser,z);});s.addCommand(n,{exec:function(y){if(t){var z=t.getAttribute('data-user'),A=t.getAttribute('data-title');y.rteButton(n,o,{user:z,title:A,fromRte:true});}else y.rteButton(n,o);}});s.ui.addButton(n,{label:n,command:n});s.dataProcessor.htmlFilter.addRules({elements:{img:function(y){if(y.attributes['data-user'])return false;return y;},a:function(y){var z=y;if(y.attributes['data-user']){z=new a.htmlParser.element('lj');z.isEmpty=true;z.isOptionalClose=true;if(y.attributes.hasOwnProperty('data-user'))z.attributes.user=y.attributes['data-user'];if(y.attributes['data-title'])z.attributes.title=y.attributes['data-title'];return z;}else return y;}}});s.on('doubleclick',function(y){var z=y.data.element;if(z&&z.hasAttribute('data-user')){w(z);s.execFromEditor=true;s.execCommand(n);}});s.on('contentDom',function(){var y=m(a.instances.ck.document.$);y.find('a[data-user]').each(function(z,A){if(A.seen)return;var B=A.getAttribute('data-user'),C=m('<img/>',{style:'cursor: default; width: 16px; height: 16px;','data-user':B,'data-title':A.getAttribute('data-title'),src:q[B]&&r||p[B]||u.src}).insertBefore(m(A));
-if(q[B])m(A).addClass('lj-user-undefined');if(!p[B]&&!q[B])LJ.Api.call('ljuser.get',{user:B,raw:1},function(D){if(D.error){m(A).addClass('lj-user-undefined');C.attr('src',r);q[B]=true;return;}p[B]=D.ljuser.userhead_url;C.attr('src',D.ljuser.userhead_url);A.seen=true;});});});s.dataProcessor.dataFilter.addRules({elements:{lj:function(y){var z=y.attributes.user,A=new a.htmlParser.element('a');A.add(new a.htmlParser.text(y.attributes.title||z));A.attributes.href='#';A.attributes['data-cke-saved-href']='#';A.attributes.style='font-weight: bold; color: #00C;';A.attributes['data-user']=z;A.attributes['data-title']=y.attributes.title||'';return A;}}});}});})(jQuery);(function(m){'use strict';var n={minHeight:400,maxHeight:0},o=null,p=false,q=['contentDom','selectionChange','insertElement'],r,s,t;function u(){var x,y;if(!r)return;x=o.document.getBody().$.clientHeight+30,y=Math.max(n.minHeight,x);if(y>n.maxHeight&&n.maxHeight!==0)y=n.maxHeight;o.resize('',y,true);};function v(){if(r||!p)return;r=true;q.forEach(function(x){o.on(x,u);});o.document.on('keyup',u);s=o.document.getBody().getStyle('overflow-y')||'visible';o.document.getBody().setStyle('overflow-y','hidden');t=o.window.getViewPaneSize().height;u();};function w(){if(!r)return;r=false;q.forEach(function(x){o.removeListener(x,u);});o.document.removeListener('keyup',u);o.resize('',t,true);o.document.getBody().setStyle('overflow-y',s);};j.add('ljautogrow',{init:function(x){o=x;o.on('instanceReady',function(){o.on('contentDom',function(){if(p)return;p=true;v();});});}});a.editor.prototype.autogrow={enable:v,disable:w,resize:u,config:function(x,y){if(typeof y==='undefined')return n[x];else{n[x]=y;u();}}};})(jQuery);(function(){'use strict';var m=(function(){var n={};return function(o,p){var q=LiveJournal.parseMedia(o);if(!q){p(null);return;}switch(q.site){case 'youtube':var r='http://img.youtube.com/vi/'+q.id+'/0.jpg';p(r);break;case 'vimeo':var s=n['vimeo_'+q.id];if(s){p(s);return;}jQuery.ajax({url:'http://vimeo.com/api/v2/video/'+q.id+'.json',dataType:'jsonp'}).done(function(t){if(t&&t[0]){var u=t[0].thumbnail_large;if(u){n['vimeo_'+q.id]=u;p(u);}}else console.error('Data error',t);});break;}};})();j.add('ljembed',{init:function(n){var o='LJEmbedLink',p='video',q=null;n.on('selectionChange',function(s){var t=s.data.element;if(t.is('iframe'))q=t;else q=null;});LiveJournal.register_hook('rte_frame_load',function(s,t){m(decodeURIComponent(s.$.getAttribute('lj-url')),function(u){if(u)jQuery(t.$).find('.lj-rtebox-inner').css('background-size','cover').css('background-image','url('+u+')').empty();
-});});function r(s){var t=new h('iframe',n.document),u=LiveJournal.parseMedia(s),v={width:560,height:315};if(u&&u.embed){var w=h.createFromHtml(u.embed);t.setAttribute('lj-url',w.getAttribute('src'));t.setAttribute('data-link',u.link||s);t.setAttribute('lj-class','lj-iframe');t.setAttribute('class','lj-iframe-wrap lj-rtebox');t.setAttribute('style',String.prototype.supplant.call('width: {width}px; height: {height}px;',v));t.setAttribute('lj-style','width: 99%; height: 99%;');t.setAttribute('allowfullscreen','true');t.setAttribute('lj-content',encodeURIComponent("<div class='lj-embed-inner lj-rtebox-inner'>Embed media</div>"));}else{t.setAttribute('lj-class','lj-embed');t.setAttribute('class','lj-embed-wrap lj-rtebox');t.setAttribute('lj-content',encodeURIComponent("<div class='lj-embed-inner lj-rtebox-inner'>Embed</div>"));}t.setAttribute('lj-data',encodeURIComponent(s));t.setAttribute('frameBorder',0);t.setAttribute('allowTransparency','true');t.setAttribute('lj-cmd',o);n.insertElement(t);n.updateFrames();};LiveJournal.register_hook(p+'_response',function(s){r(s);});n.addCommand(o,{exec:function(s){var t=s.ljTagsData[o].node||q;if(t)s.rteButton(o,p,{defaultText:t&&decodeURIComponent(t.getAttribute('data-link')||t.getAttribute('lj-url')||t.getAttribute('lj-data')),editMode:true});else s.rteButton(o,p);}});n.ui.addButton(o,{label:a.CKLang.LJEmbed,command:o});}});})();a.editorConfig=function(m){'use strict';var n=jQuery.browser.msie,o,p;if(Site.page.ljpost){o={livejournal:'plugins/livejournal/plugin.js',ljcolor:'plugins/lj/ljcolor/plugin.js',ljlink:'plugins/lj/ljlink/plugin.js',ljfont:'plugins/lj/ljfont/plugin.js',ljcut:'plugins/lj/ljcut/plugin.js',ljuser2:'plugins/lj/ljuser/plugin.js',ljembed:'plugins/lj/ljembed/plugin.js',ljautogrow:'plugins/lj/ljautogrow/plugin.js',clipboard:'_source/plugins/clipboard/plugin.js',selection:'_source/plugins/selection/plugin.js'};if(n)o.ljspell='plugins/ljspell/plugin.js';}else o={livejournal_old:'plugins/livejournal_old/plugin.js'};for(p in o)j.addExternal(p,o[p]);var q=['ajax','basicstyles','bidi','blockquote','button','colorbutton','colordialog','enterkey','entities','format','htmldataprocessor','keystrokes','list','liststyle','pastefromword','specialchar','tab','table','toolbar','undo','wysiwygarea','onchange'];if(!Site.page.ljpost)q.push('dialog','image','link','font');m.extraPlugins=Object.keys(o).join(',');if(Site.is_dev_server){console.warn('Development server, loading plugins as external files');for(p in o){delete j.registered[p];
-j.addExternal(p,o[p]);}}m.plugins=q.join(',');m.language='ru';m.autoParagraph=false;m.autoUpdateElement=false;m.docType='<!DOCTYPE html>';if(Site.page.ljpost){m.contentsCss=Site.statprefix+'/js/ck/contents_new.css?t='+Site.version;m.styleText=Site.statprefix+'/js/ck/contents_new.css?t='+Site.version;m.bodyClass='lj-main-body';}else{m.contentsCss='/js/ck/contents.css?t='+Site.version;m.styleText=Site.statprefix+'/js/ck/contents.css?t='+Site.version;}m.contentsLangDirection='ltr';m.fillEmptyBlocks=false;m.tabIndex=41;m.tabSpaces=2;m.startupShowBorders=false;m.toolbarCanCollapse=false;m.disableNativeSpellChecker=n?true:false;var r=[];function s(t,u){return t?u:undefined;};if(Site.page.ljpost)r=['Bold','Italic','Underline','Strike','LJFont','LJColor','-','LJLink2','LJUser2','-','LJImage',s(Site.media_embed_enabled,'LJEmbedLink'),'LJCut','LJSpoiler','LJMap','LJLike','LJPollLink','NumberedList','BulletedList','LJJustifyLeft','LJJustifyCenter','LJJustifyRight','LJSpell','Undo','Redo'];else r=['Bold','Italic','Underline','Strike','TextColor','FontSize','-','LJLink','LJUserLink','image',s(Site.media_embed_enabled,'LJEmbedLink'),'LJPollLink','LJCutLink','LJCut','LJLike','LJSpoiler','-','UnorderedList','OrderedList','NumberedList','BulletedList','-','LJJustifyLeft','LJJustifyCenter','LJJustifyRight','-','Undo','Redo'];m.toolbar_Full=[r.filter(function(t){return t;})];m.enterMode=2;m.shiftEnterMode=1;m.keystrokes=[[2228224+121,'contextMenu'],[1114112+90,'undo'],[1114112+89,'redo'],[1114112+2228224+90,'redo'],[1114112+76,'LJLink2'],[1114112+66,'bold'],[1114112+73,'italic'],[1114112+85,'underline']];m.colorButton_colors='000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF';m.fontSize_sizes='smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large';m.disableObjectResizing=true;m.format_tags='p;h1;h2;h3;h4;h5;h6;pre;address';m.removeFormatTags='b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var';m.removeFormatAttributes='class,style,lang,width,height,align,hspace,valign';m.coreStyles_bold={element:'b',overrides:'strong'};m.coreStyles_italic={element:'i',overrides:'em'};m.indentClasses=[];m.indentOffset=0;m.pasteFromWordRemoveFontStyles=false;m.pasteFromWordRemoveStyles=false;if(!Site.page.ljpost)m.protectedSource.push(/<lj-poll-\d+\s*\/?>/gi);
-m.LJFontDefault='normal';m.LJFontStyle={element:'span',styles:{'font-size':'#(size)'},overrides:[{element:'font',attributes:{size:null}}]};m.LJFontSize={tiny:'0.7em',small:'0.9em',normal:'1.0em',large:'1.4em',huge:'1.8em'};m.protectedSource.push(/<lj-replace name="first_post"\s*\/?>/gi);};if(!Site.is_dev_server)a.editorConfig(i);})();
+z=true;}});};function u(y,z){var A=new d.selection(o.document),B=false,C=n[y].tag,D=new h('iframe',o.document),E=new h('br',o.document);D.setAttributes({'lj-cmd':y,'lj-class':C+' '+C+'-open','class':C+'-wrap',frameBorder:0,allowTransparency:'true'});if(typeof z!=='undefined')D.setAttribute('text',z);var F=D.clone();F.setAttribute('lj-class',C+' '+C+'-close');if(q.cloneContents().getChildCount()===0)B=true;q.insertNode(D);q.collapse();q.insertNode(F);s(D);s(F);if(B){E.clone().insertAfter(D);E.clone().insertBefore(F);}var G=new d.range(o.document);G.setStartAfter(D);G.setEndBefore(F);A.selectRanges([G]);o.focus();t();};function v(y,z){if(r&&r.getAttribute('lj-cmd')===y)r.setAttribute('text',z);else{u(y,z===Site.page.rtedata[y+'_PromptText']?undefined:z);o.updateFrames();}};function w(y,z){o.addCommand(y,{exec:function(){var A=new d.selection(o.document);p=A&&A.getSelectedElement();q=A.getRanges()[0];var B={defaultText:r?r.getAttribute('text'):'',editMode:r?true:false};if(r&&r.getAttribute('lj-cmd')!==y)B=null;o.rteButton(y,z,B);},editorFocus:false});o.ui.addButton(y,{label:a.CKLang[y+'_Title'],command:y});};LiveJournal.register_hook('cut_response',function(y){v('LJCut',y);});LiveJournal.register_hook('spoiler_response',function(y){v('LJSpoiler',y);});o.on('selectionChange',function(y){var z=y.data.element;if(z&&z.is('iframe')&&n[z.getAttribute('lj-cmd')])r=z;else r=null;});o.on('contentDom',function(){o.updateFrames();});for(var x in n)w(x,n[x].widget);},afterInit:function(o){function p(q,r,s){var t=n[r].tag;s=s||'text';var u=new a.htmlParser.element('iframe');u.attributes['lj-class']=t+' '+t+'-open';u.attributes['class']=t+'-wrap';u.attributes['lj-cmd']=r;u.attributes.frameBorder=0;u.attributes.allowTransparency='true';if(q.attributes.hasOwnProperty(s))u.attributes.text=q.attributes[s];q.children.unshift(u);var v=new a.htmlParser.element('iframe');v.attributes['lj-class']=t+' '+t+'-close';v.attributes['class']=t+'-wrap';v.attributes.frameBorder=0;v.attributes.allowTransparency='true';q.children.push(v);delete q.name;};o.dataProcessor.dataFilter.addRules({elements:{'lj-cut':function(q){p(q,'LJCut');},'lj-spoiler':function(q){p(q,'LJSpoiler','title');}}});}});})(jQuery);(function(m){'use strict';var n='LJUser2',o='user',p={},q={},r='/img/userinfo-disabled.gif';j.add('ljuser2',{init:function(s){var t=null,u=new Image();u.src='/img/preloader/preloader-blue-white-xl.gif';s.on('selectionChange',function(z){var A=z.data.element;s.getCommand(n).setState(A.hasAttribute('data-user')?1:2);
+t=A.hasAttribute('data-user')?A:null;});function v(z){var A={};if(!z)return null;if(z.is('img')){A.head=z;A.link=z.getNextSourceNode(true,1);}else{A.link=z;A.head=z.getPreviousSourceNode(true,1);}return A;};function w(z){if(!z)return;var A=new d.range(s.document),B=v(z),C=B.head,D=B.link,E=s.document.getSelection();if(D&&C){A.setStartBefore(C);A.setEndAfter(D);if(E)E.selectRanges([A]);}else E.selectElement(z);return D||z;};s.on('contentDom',function(){this.document.on('keydown',function(z){var A=s.document.getSelection(),B=A&&A.getRanges()[0];if(B.collapsed&&z.data.getKey()===8){var C=B.getTouchedEndNode();if(C.type===3)C=C.getParent();if(C.hasAttribute('data-user')){z.data.preventDefault();w(C);}}});this.document.on('click',function(z){var A=z.data.getTarget();if(A&&A.hasAttribute('data-user'))w(A);});});function x(z,A){var B=new h('img'),C=new h('a');B.setAttributes({src:u.src,width:'16',height:'16','data-user':z.journal,'data-title':A});B.setStyle('cursor','default');var D=new Image();D.onload=function(){p[z.journal]=z.userhead_url;B.setAttribute('src',D.src);s.fire('updateSnapshot');};D.src=z.userhead_url;C.setAttributes({href:'#','data-cke-saved-href':'#','data-user':z.journal,'data-title':A});C.$.seen=true;C.setStyles({color:'blue',fontWeight:'bold'});C.setText(A||z.journal);s.insertElement(B);s.insertElement(C);s.fire('updateSnapshot');};LiveJournal.register_hook('user_response',function(z,A){if(z&&z.hasOwnProperty('ljuser'))x(z.ljuser,A);});s.addCommand(n,{exec:function(z){if(t){var A=t.getAttribute('data-user'),B=t.getAttribute('data-title');z.rteButton(n,o,{user:A,title:B,fromRte:true});}else{var C=z.getSelection(),D=C&&C.getSelectedText();if(D&&typeof D==='string'){z.insertHtml('<lj user="'+D+'" />');y();}else z.rteButton(n,o);}}});s.ui.addButton(n,{label:n,command:n});s.dataProcessor.htmlFilter.addRules({elements:{img:function(z){if(z.attributes['data-user'])return false;return z;},a:function(z){var A=z;if(z.attributes['data-user']){A=new a.htmlParser.element('lj');A.isEmpty=true;A.isOptionalClose=true;if(z.attributes.hasOwnProperty('data-user'))A.attributes.user=z.attributes['data-user'];if(z.attributes['data-title'])A.attributes.title=z.attributes['data-title'];return A;}else return z;}}});s.on('doubleclick',function(z){var A=z.data.element;if(A&&A.hasAttribute('data-user')){w(A);s.execFromEditor=true;s.execCommand(n);}});function y(){var z=m(a.instances.ck.document.$);z.find('a[data-user]').each(function(A,B){if(B.seen)return;var C=B.getAttribute('data-user'),D=m('<img/>',{style:'cursor: default; width: 16px; height: 16px;','data-user':C,'data-title':B.getAttribute('data-title'),src:q[C]&&r||p[C]||u.src}).insertBefore(m(B));
+if(q[C])m(B).addClass('lj-user-undefined');if(!p[C]&&!q[C])LJ.Api.call('ljuser.get',{user:C,raw:1},function(E){if(E.error){m(B).addClass('lj-user-undefined');D.attr('src',r);q[C]=true;return;}p[C]=E.ljuser.userhead_url;D.attr('src',E.ljuser.userhead_url);});B.seen=true;});};s.on('contentDom',y);s.dataProcessor.dataFilter.addRules({elements:{lj:function(z){var A=z.attributes.user,B=new a.htmlParser.element('a');B.add(new a.htmlParser.text(z.attributes.title||A));B.attributes.href='#';B.attributes['data-cke-saved-href']='#';B.attributes.style='font-weight: bold; color: #00C;';B.attributes['data-user']=A;B.attributes['data-title']=z.attributes.title||'';return B;}}});}});})(jQuery);(function(m){'use strict';var n={minHeight:400,maxHeight:0},o=null,p=false,q=['contentDom','selectionChange','insertElement'],r,s,t;function u(){var x,y;if(!r)return;x=o.document.getBody().$.clientHeight+30,y=Math.max(n.minHeight,x);if(y>n.maxHeight&&n.maxHeight!==0)y=n.maxHeight;o.resize('',y,true);};function v(){if(r||!p)return;r=true;q.forEach(function(x){o.on(x,u);});o.document.on('keyup',u);s=o.document.getBody().getStyle('overflow-y')||'visible';o.document.getBody().setStyle('overflow-y','hidden');t=o.window.getViewPaneSize().height;u();};function w(){if(!r)return;r=false;q.forEach(function(x){o.removeListener(x,u);});o.document.removeListener('keyup',u);o.resize('',t,true);o.document.getBody().setStyle('overflow-y',s);};j.add('ljautogrow',{init:function(x){o=x;o.on('instanceReady',function(){o.on('contentDom',function(){if(p)return;p=true;v();});});}});a.editor.prototype.autogrow={enable:v,disable:w,resize:u,config:function(x,y){if(typeof y==='undefined')return n[x];else{n[x]=y;u();}}};})(jQuery);(function(){'use strict';var m=(function(){var n={};return function(o,p){var q=LiveJournal.parseMedia(o);if(!q){p(null);return;}switch(q.site){case 'youtube':var r='http://img.youtube.com/vi/'+q.id+'/0.jpg';p(r);break;case 'vimeo':var s=n['vimeo_'+q.id];if(s){p(s);return;}jQuery.ajax({url:'http://vimeo.com/api/v2/video/'+q.id+'.json',dataType:'jsonp'}).done(function(t){if(t&&t[0]){var u=t[0].thumbnail_large;if(u){n['vimeo_'+q.id]=u;p(u);}}else console.error('Data error',t);});break;}};})();j.add('ljembed',{init:function(n){var o='LJEmbedLink',p='video',q=null;n.on('selectionChange',function(s){var t=s.data.element;if(t.is('iframe'))q=t;else q=null;});LiveJournal.register_hook('rte_frame_load',function(s,t){m(decodeURIComponent(s.$.getAttribute('lj-url')),function(u){if(u)jQuery(t.$).find('.lj-rtebox-inner').css('background-size','cover').css('background-image','url('+u+')').empty();
+});});function r(s){var t=new h('iframe',n.document),u=LiveJournal.parseMedia(s),v={width:560,height:315};if(u&&u.embed){var w=h.createFromHtml(u.embed);t.setAttribute('lj-url',w.getAttribute('src'));t.setAttribute('data-link',u.link||s);t.setAttribute('lj-class','lj-iframe');t.setAttribute('class','lj-iframe-wrap lj-rtebox');t.setAttribute('style',String.prototype.supplant.call('width: {width}px; height: {height}px;',v));t.setAttribute('lj-style','width: 99%; height: 99%;');t.setAttribute('allowfullscreen','true');t.setAttribute('lj-content',encodeURIComponent("<div class='lj-embed-inner lj-rtebox-inner'>Embed media</div>"));}else{t.setAttribute('lj-class','lj-embed');t.setAttribute('class','lj-embed-wrap lj-rtebox');t.setAttribute('lj-content',encodeURIComponent("<div class='lj-embed-inner lj-rtebox-inner'>Embed</div>"));}t.setAttribute('lj-data',encodeURIComponent(s));t.setAttribute('frameBorder',0);t.setAttribute('allowTransparency','true');t.setAttribute('lj-cmd',o);n.insertElement(t);n.updateFrames();};LiveJournal.register_hook(p+'_response',function(s){r(s);});n.addCommand(o,{exec:function(s){var t=s.ljTagsData[o].node||q;if(t)s.rteButton(o,p,{defaultText:t&&decodeURIComponent(t.getAttribute('data-link')||t.getAttribute('lj-url')||t.getAttribute('lj-data')),editMode:true});else s.rteButton(o,p);}});n.ui.addButton(o,{label:a.CKLang.LJEmbed,command:o});}});})();a.editorConfig=function(m){'use strict';var n=jQuery.browser.msie,o,p;if(Site.page.ljpost){o={livejournal:'plugins/livejournal/plugin.js',ljcolor:'plugins/lj/ljcolor/plugin.js',ljlink:'plugins/lj/ljlink/plugin.js',ljfont:'plugins/lj/ljfont/plugin.js',ljcut:'plugins/lj/ljcut/plugin.js',ljuser2:'plugins/lj/ljuser/plugin.js',ljembed:'plugins/lj/ljembed/plugin.js',ljautogrow:'plugins/lj/ljautogrow/plugin.js'};if(n)o.ljspell='plugins/ljspell/plugin.js';}else o={livejournal_old:'plugins/livejournal_old/plugin.js'};for(p in o)j.addExternal(p,o[p]);var q=['ajax','basicstyles','bidi','blockquote','button','colorbutton','colordialog','enterkey','entities','format','htmldataprocessor','keystrokes','list','liststyle','pastefromword','specialchar','tab','table','toolbar','undo','wysiwygarea','onchange'];if(!Site.page.ljpost)q.push('dialog','image','link','font');m.extraPlugins=Object.keys(o).join(',');if(Site.is_dev_server){console.warn('Development server, loading plugins as external files');for(p in o){delete j.registered[p];j.addExternal(p,o[p]);}}m.plugins=q.join(',');m.language='ru';m.autoParagraph=false;
+m.autoUpdateElement=false;m.docType='<!DOCTYPE html>';if(Site.page.ljpost){m.contentsCss=Site.statprefix+'/js/ck/contents_new.css?t='+Site.version;m.styleText=Site.statprefix+'/js/ck/contents_new.css?t='+Site.version;m.bodyClass='lj-main-body';}else{m.contentsCss='/js/ck/contents.css?t='+Site.version;m.styleText=Site.statprefix+'/js/ck/contents.css?t='+Site.version;}m.contentsLangDirection='ltr';m.fillEmptyBlocks=false;m.tabIndex=41;m.tabSpaces=2;m.startupShowBorders=false;m.toolbarCanCollapse=false;m.disableNativeSpellChecker=n?true:false;var r=[];function s(t,u){return t?u:undefined;};if(Site.page.ljpost)r=['Bold','Italic','Underline','Strike','LJFont','LJColor','-','LJLink2','LJUser2','-','LJImage',s(Site.media_embed_enabled,'LJEmbedLink'),'LJCut','LJSpoiler','LJMap','LJLike','LJPollLink','NumberedList','BulletedList','LJJustifyLeft','LJJustifyCenter','LJJustifyRight','LJSpell','Undo','Redo'];else r=['Bold','Italic','Underline','Strike','TextColor','FontSize','-','LJLink','LJUserLink','image',s(Site.media_embed_enabled,'LJEmbedLink'),'LJPollLink','LJCutLink','LJCut','LJLike','LJSpoiler','-','UnorderedList','OrderedList','NumberedList','BulletedList','-','LJJustifyLeft','LJJustifyCenter','LJJustifyRight','-','Undo','Redo'];m.toolbar_Full=[r.filter(function(t){return t;})];m.enterMode=2;m.shiftEnterMode=1;m.keystrokes=[[2228224+121,'contextMenu'],[1114112+90,'undo'],[1114112+89,'redo'],[1114112+2228224+90,'redo'],[1114112+76,'LJLink2'],[1114112+66,'bold'],[1114112+73,'italic'],[1114112+85,'underline']];m.colorButton_colors='000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF';m.fontSize_sizes='smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large';m.disableObjectResizing=true;m.format_tags='p;h1;h2;h3;h4;h5;h6;pre;address';m.removeFormatTags='b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var';m.removeFormatAttributes='class,style,lang,width,height,align,hspace,valign';m.coreStyles_bold={element:'b',overrides:'strong'};m.coreStyles_italic={element:'i',overrides:'em'};m.indentClasses=[];m.indentOffset=0;m.pasteFromWordRemoveFontStyles=false;m.pasteFromWordRemoveStyles=false;if(!Site.page.ljpost)m.protectedSource.push(/<lj-poll-\d+\s*\/?>/gi);m.LJFontDefault='normal';m.LJFontStyle={element:'span',styles:{'font-size':'#(size)'},overrides:[{element:'font',attributes:{size:null}}]};
+m.LJFontSize={tiny:'0.7em',small:'0.9em',normal:'1.0em',large:'1.4em',huge:'1.8em'};m.protectedSource.push(/<lj-replace name="first_post"\s*\/?>/gi);};if(!Site.is_dev_server)a.editorConfig(i);})();

Modified: trunk/htdocs/js/ck/plugins/livejournal/plugin.js
===================================================================
--- trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2012-12-21 14:50:28 UTC (rev 23499)
+++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2012-12-21 14:59:35 UTC (rev 23500)
@@ -665,10 +665,13 @@
 				editor.dataProcessor.toDataFormat = function(html, fixForBody) {
 					html = CKEDITOR.htmlDataProcessor.prototype.toDataFormat.call(this, html, fixForBody);
 					html = html
-						.replace(/<br\s*\/>/gi, '\n')
-						.replace(/\>&nbsp;\n/ig, '>\n')
-						.replace(/[^ ]&nbsp\;</ig, ' <')
-						.replace(/\>&nbsp\;[^ ]/ig, '> ')
+						.replace(/<br\s*\/>/gi     , '\n' )
+
+						.replace(/&nbsp;</ig       , ' <' )
+						.replace(/\>&nbsp;/ig      , '> ' )
+
+						.replace(/\>&nbsp;\n/ig    , '>\n')
+
 						.replace(/\t/g, ' ');
 
 					return html;

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