spacevillain (spacevillain) wrote in changelog,
spacevillain
spacevillain
changelog

[livejournal] r23393: LJSUP-14409: Troubles with table embedde...

Committer: atyurin
LJSUP-14409: Troubles with table embedded into another one in new 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-11-29 11:58:56 UTC (rev 23392)
+++ trunk/htdocs/js/ck/ckeditor.js	2012-11-29 12:03:37 UTC (rev 23393)
@@ -137,7 +137,7 @@
 A.selectNodeContents(u.document.getBody());A.collapse(true);v.selectRanges([A]);}},100);};a.editor.prototype.isFocusAt=function(t){var u=this.getSelection(),v=u.getRanges()[0],w=this.document.getBody();if(t==='end'&&v.checkEndOfBlock())if(w.equals(v.endContainer)||w.getLast().equals(v.endContainer))return true;if(t==='start')throw new Error('Not implemented');return false;};a.editor.prototype.isSelectionCollapsed=function(){var t=this.getSelection(),u=t&&t.getRanges()[0];if(u)return!!u.collapsed;return false;};var m=a.lang[a.lang.detect()]||{};jQuery.extend(m,LJ.pageVar('rtedata'));window.CKLang=a.CKLang=m;if(Site.page.ljpost)a.styleText=Site.statprefix+'/js/ck/contents_new.css?t='+Site.version;else a.styleText=Site.statprefix+'/js/ck/contents.css?t='+Site.version;var n='@focus@',o='<input type="hidden" id="__focus"/>';function p(t,u,v){v=v||{};v&&jQuery.extend(v,{fromDoubleClick:this.execFromEditor});LiveJournal.run_hook('rteButton',u,jQuery('.cke_button_'+t),v);this.execFromEditor=false;};var q=[{label:m.LJLike_button_repost,id:'repost',abbr:'rp',checked:true,html:'<span class="lj-like-item rp">'+m.LJLike_button_repost+'</span>',htmlOpt:'<li class="like-rp"><input type="checkbox" id="like-rp" /><label for="like-rp">'+m.LJLike_button_repost+'</label></li>'},{label:m.LJLike_button_facebook,id:'facebook',abbr:'fb',checked:true,html:'<span class="lj-like-item fb">'+m.LJLike_button_facebook+'</span>',htmlOpt:'<li class="like-fb"><input type="checkbox" id="like-fb" /><label for="like-fb">'+m.LJLike_button_facebook+'</label></li>'},{label:m.LJLike_button_twitter,id:'twitter',abbr:'tw',checked:true,html:'<span class="lj-like-item tw">'+m.LJLike_button_twitter+'</span>',htmlOpt:'<li class="like-tw"><input type="checkbox" id="like-tw" /><label for="like-tw">'+m.LJLike_button_twitter+'</label></li>'},{label:m.LJLike_button_google,id:'google',abbr:'go',checked:true,html:'<span class="lj-like-item go">'+m.LJLike_button_google+'</span>',htmlOpt:'<li class="like-go"><input type="checkbox" id="like-go" /><label for="like-go">'+m.LJLike_button_google+'</label></li>'},{label:m.LJLike_button_vkontakte,id:'vkontakte',abbr:'vk',checked:Site.remote_is_sup?true:false,html:'<span class="lj-like-item vk">'+m.LJLike_button_vkontakte+'</span>',htmlOpt:Site.remote_is_sup?'<li class="like-vk"><input type="checkbox" id="like-vk" /><label for="like-vk">'+m.LJLike_button_vkontakte+'</label></li>':''},{label:m.LJLike_button_surfingbird,id:'surfingbird',abbr:'sb',checked:Site.remote_is_sup?true:false,html:'<span class="lj-like-item sb">'+m.LJLike_button_surfingbird+'</span>',htmlOpt:Site.remote_is_sup?'<li class="like-sb"><input type="checkbox" id="like-sb" /><label for="like-sb">'+m.LJLike_button_surfingbird+'</label></li>':''},{label:m.LJLike_button_tumblr,id:'tumblr',abbr:'tb',checked:true,html:'<span class="lj-like-item tb">'+m.LJLike_button_tumblr+'</span>',htmlOpt:'<li class="like-tb"><input type="checkbox" id="like-tb" /><label for="like-tb">'+m.LJLike_button_tumblr+'</label></li>'},{label:m.LJLike_button_give,id:'livejournal',abbr:'lj',checked:false,html:'<span class="lj-like-item lj">'+m.LJLike_button_give+'</span>',htmlOpt:'<li class="like-lj"><input type="checkbox" id="like-lj" /><label for="like-lj">'+m.LJLike_button_give+'</label></li>'}],r={LJPollLink:{html:encodeURIComponent(m.Poll_PollWizardNotice+'<br /><a href="#" lj-cmd="LJPollLink">'+m.Poll_PollWizardNoticeLink+'</a>')},LJLike:{html:encodeURIComponent(m.LJLike_WizardNotice+'<br /><a href="#" lj-cmd="LJLike">'+m.LJLike_WizardNoticeLink+'</a>')},LJLink2:{html:encodeURIComponent(m.LJLink_WizardNotice+'<br /><a href="#" lj-cmd="LJLink2">'+m.LJLink_WizardNoticeLink+'</a>')},LJImage:{html:encodeURIComponent(m.LJImage_WizardNotice+'<br /><a href="#" lj-cmd="LJImage">'+m.LJImage_WizardNoticeLink+'</a>')},LJCut:{html:encodeURIComponent(m.LJCut_WizardNotice+'<br /><a href="#" lj-cmd="LJCut">'+m.LJCut_WizardNoticeLink+'</a>')},LJSpoiler:{html:encodeURIComponent(m.LJSpoiler_WizardNotice+'<br /><a href="#" lj-cmd="LJSpoiler">'+m.LJSpoiler_WizardNoticeLink+'</a>')},LJEmbedLink:{},LJMap:{}},s=f;
 s.$block['lj-template']=1;s.$block['lj-raw']=1;s.$block['lj-cut']=1;s.$block['lj-spoiler']=1;s.$block['lj-poll']=1;s.$block['lj-repost']=1;s.$block['lj-pq']=1;s.$block['lj-pi']=1;s.$nonEditable['lj-template']=1;s.$empty['lj-random']=1;s['lj-template']={};s['lj-map']={};s['lj-repost']={};s['lj-raw']=s.div;s['lj-poll']={'lj-pq':1};s['lj-pq']={'#':1,'lj-pi':1};s['lj-pi']={'#':1};['a','b','em','i','img','strong','u','lj-user'].forEach(function(t){s['lj-pq'][t]=1;s['lj-pi'][t]=1;});s.$block.iframe=s.$inline.iframe;delete s.$inline.iframe;e.extend(s['lj-cut']={},s.$block);e.extend(s['lj-spoiler']={},s.$block);e.extend(s['lj-cut'],s.$inline);e.extend(s['lj-spoiler'],s.$inline);e.extend(s.div,s.$block);e.extend(s.$body,s.$block);delete s['lj-cut']['lj-cut'];f.p.iframe=1;f['lj-cut'].iframe=1;f['lj-spoiler'].iframe=1;j.add('livejournal',{init:function(t){t.rteButton=p;function u(A){var B=A.data.element||A.data.getTarget();if(B.type!=1)B=B.getParent();while(B){var C=B.getAttribute('lj-cmd');if(r.hasOwnProperty(C)){var D=t.getCommand(C);if(D.state==1){var E=new d.selection(t.document);r[C].node=B.is('body')?new h.get(B.getWindow().$.frameElement):B;E.selectElement(r[C].node);A.data.dialog='';t.execFromEditor=true;t.execCommand(C,true);break;}}B=B.getParent();}};function v(A){var B=this;if(B.$!=t.document.$){B.$.className=(B.frame.getAttribute('lj-class')||'')+' lj-selected';if(B.getAttribute('lj-cmd')=='LJPollLink')B.frame.setStyle('height',B.getDocument().$.body.scrollHeight+'px');t.focus();new d.selection(t.document).selectElement(B.frame);}A.data.getKey()==1&&A.data.preventDefault();};function w(A){if(A.data.getKey()==46){var B=new d.selection(t.document).getRanges(),C=B.length;while(C--)B[C].deleteContents();}};function x(){var D=this;var A=D.$.contentWindow,B=A.document,C=new h.get(B.body);if(C.on&&!Site.page.disabled_input){C.on('dblclick',u);C.on('click',v);C.on('keyup',w);if(D.getAttribute('lj-cmd')=='LJPollLink'&&D.hasAttribute('style'))B.body.className='lj-poll lj-poll-open';}B=new h.get(B);B.frame=C.frame=D;};function y(){var A=t.document.getElementsByTag('iframe'),B=A.count(),C,D,E,F,G;t.execFromEditor=false;while(B--){C=A.getItem(B),D=C.getAttribute('lj-cmd'),E=C.$.contentWindow,F=E.document,G=C.getAttribute('lj-style')||'';if(C.getAttribute('data-update')==='false')continue;if(F&&F.body&&F.body.getAttribute('data-loaded'))continue;C.removeListener('load',x);C.on('load',x);F.open();F.write('<!DOCTYPE html><html style="'+G+'">'+'<head><link rel="stylesheet" href="'+a.styleText+'" /></head>'+'<body data-loaded="true" scroll="no" class="'+(C.getAttribute('lj-class')||'')+'" style="'+G+'" '+(D?'lj-cmd="'+D+'"':'')+'>'+decodeURIComponent(C.getAttribute('lj-content')||'')+'</body>'+'</html>');
 F.close();}};t.updateFrames=y;t.on('dataReady',function(){setTimeout(y,100);});function z(A){t.fire('updateSnapshot');if(t.onSwitch===true){delete t.onSwitch;return;}var B,C=A.name=='click',D=A.name=='selectionChange'||C,E=A.data.element||A.data.getTarget(),F,G;if(C&&(A.data.getKey()===1||A.data.$.button===0))A.data.preventDefault();if(E.type!=1)E=E.getParent();F=E;if(D){var H=t.document.getElementsByTag('iframe'),I,J;if(C&&F.is('iframe')){J=F.$.contentWindow.document.body;J.className=(F.getAttribute('lj-class')||'')+' lj-selected';if(F.getAttribute('lj-cmd')=='LJPollLink')F.setStyle('height',J.scrollHeight+'px');}for(var K=0,L=H.count();K<L;K++){I=H.getItem(K);if(I.$!=F.$){J=I.$.contentWindow.document.body;J.className=I.getAttribute('lj-class')||'';if(I.getAttribute('lj-cmd')=='LJPollLink'&&J.className.indexOf('lj-poll')!=-1)I.removeAttribute('style');}}}do{var M=F.getAttribute('lj-cmd');if(!M&&F.type==1){var N=F.getParent();if(F.is('img')&&!F.hasAttribute('data-user')&&N.getParent()&&!N.getParent().hasAttribute('data-user')){M='LJImage';F.setAttribute('lj-cmd',M);}else if(F.is('a')&&!F.hasAttribute('data-user')&&!N.hasAttribute('lj:user')){M='LJLink2';F.setAttribute('lj-cmd',M);}}if(M&&r.hasOwnProperty(M)){if(D){r[M].node=F;t.getCommand(M).setState(1);}(B||(B={}))[M]={content:r[M].html,node:F};}}while(F=F.getParent());var O;if(D)for(G in r){if(r.hasOwnProperty(G)&&(!B||!B.hasOwnProperty(G))){delete r[G].node;O=t.getCommand(G);if(O)O.setState(2);}}t.fire('updateSnapshot');};(function(){function A(J){return J.slice(-2)=='/>'?J:J.slice(0,-1)+'/>';};function B(J){var K=new Poll(J),L="<div class='lj-poll-inner lj-rtebox-inner'>"+K.outputHTML()+'</div>';return '<iframe class="lj-poll-wrap lj-rtebox" lj-class="lj-poll" frameborder="0" lj-cmd="LJPollLink" allowTransparency="true" lj-data="'+K.outputLJtags()+'" lj-content="'+L+'"></iframe>';};function C(J,K){var L="<div class='lj-poll-inner lj-rtebox-inner'>Poll id: "+K+'</div>';return '<iframe class="lj-poll-wrap lj-poll-wrap-done lj-rtebox" lj-class="lj-poll" frameborder="0" lj-cmd="LJPollLink" allowTransparency="true" lj-data="'+escape(J)+'" lj-content="'+L+'" data-disabledPoll="true"></iframe>';};function D(J,K,L){var M="<div class='lj-embed-inner lj-rtebox-inner'>Embed video</div>";return '<iframe class="lj-embed-wrap lj-rtebox" lj-class="lj-embed" frameborder="0" lj-cmd="LJEmbedLink" allowTransparency="true" lj-data="'+encodeURIComponent(L)+'"'+K+'lj-content="'+M+'"></iframe>';};function E(J,K,L,M){return K+L.replace(/\n/g,'')+M;
-};function F(J,K,L,M){var N=K||L||m.LJRepost_Value,O=M.replace(/"/g,'&quot;');M=O+('<br /><input type="button" value="'+N+'" />').replace(/"/g,'&quot;');return '<iframe class="lj-repost-wrap" lj-class="lj-repost" frameborder="0" allowTransparency="true" lj-text="'+O+'" lj-button="'+N+'" lj-content="'+M+'"></iframe>';};function G(J,K){var L,M,N=0;do{if(!L)L=K.call(J,N)===false;if(!L&&(M=J.firstChild))N++;else if(M=J.nextSibling)L=false;else{M=J.parentNode;N--;L=true;}J=M;}while(N>0);};function H(J,K){return J.replace(/<(.|\n)*?>/g,function(L){var M=L;if(M.indexOf(K)!==-1){M=M.replace(K,'');return M+K;}else return L;});};function I(J,K,L){return[J.slice(0,K),L,J.slice(K)].join('');};t.on('contentDom',function(J){var K=J.editor.document.getById('__focus');if(K){this._domBuilt=true;setTimeout(function(){J.editor.focus();var L=J.editor.getSelection();if(L){var M=new d.range(J.editor.document);M.setEndAfter(K);L.selectRanges([M]);}K.remove();t.fire('updateSnapshot');},this._domBuilt?0:100);}});t.dataProcessor.toHtml=function(J,K){var L=Site.page.__htmlLast;if(typeof L==='number')if(J.length>0)J=H(I(J,L,n),n).replace(n,o);else J=o;J=J.replace(/<lj [^>]*?>/gi,A).replace(/<lj-map [^>]*?>/gi,A).replace(/<lj-template[^>]*?>/gi,A).replace(/(<lj-cut[^>]*?)\/>/gi,'$1>').replace(/<((?!br)[^\s>]+)([^>]*?)\/>/gi,'<$1$2></$1>').replace(/<lj-poll.*?>[\s\S]*?<\/lj-poll>/gi,B).replace(/<lj-poll-([0-9]+)>/gi,C).replace(/<lj-repost\s*(?:button\s*=\s*(?:"([^"]*?)")|(?:"([^']*?)"))?.*?>([\s\S]*?)<\/lj-repost>/gi,F).replace(/<lj-embed(.*?)>([\s\S]*?)<\/lj-embed>/gi,D);J=J.replace(/<table[^>]*>((.|\n)*?)<\/table>/i,function(M){var N=document.createElement('span');N.innerHTML=M;G(N,function(){var O=this;if(O.nodeType===3)if(O.parentNode.nodeName.toLowerCase()!=='td')O.nodeValue=O.nodeValue.replace(/\n/ig,'');});return N.innerHTML;});if(!$('event_format').checked){J=J.replace(/(<lj-raw.*?>)([\s\S]*?)(<\/lj-raw>)/gi,E);J=J.replace(/\n/g,'<br/>');}J=a.htmlDataProcessor.prototype.toHtml.call(this,J,K);if(c)J='<xml:namespace ns="livejournal" prefix="lj" />'+J;return J;};})();t.dataProcessor.toDataFormat=function(A,B){A=a.htmlDataProcessor.prototype.toDataFormat.call(this,A,B);if(!$('event_format').checked)A=A.replace(/<br\s*\/>/gi,'\n');return A.replace(/\t/g,' ');};t.dataProcessor.writer.indentationChars='';t.dataProcessor.writer.lineBreakChars='';t.on('selectionChange',z);t.on('doubleclick',u);t.on('afterCommandExec',y);t.on('dialogHide',y);t.on('dataReady',function(){if(c){t.document.getBody().on('dragend',y);
+};function F(J,K,L,M){var N=K||L||m.LJRepost_Value,O=M.replace(/"/g,'&quot;');M=O+('<br /><input type="button" value="'+N+'" />').replace(/"/g,'&quot;');return '<iframe class="lj-repost-wrap" lj-class="lj-repost" frameborder="0" allowTransparency="true" lj-text="'+O+'" lj-button="'+N+'" lj-content="'+M+'"></iframe>';};function G(J,K){var L,M,N=0;do{if(!L)L=K.call(J,N)===false;if(!L&&(M=J.firstChild))N++;else if(M=J.nextSibling)L=false;else{M=J.parentNode;N--;L=true;}J=M;}while(N>0);};function H(J,K){return J.replace(/<(.|\n)*?>/g,function(L){var M=L;if(M.indexOf(K)!==-1){M=M.replace(K,'');return M+K;}else return L;});};function I(J,K,L){return[J.slice(0,K),L,J.slice(K)].join('');};t.on('contentDom',function(J){var K=J.editor.document.getById('__focus');if(K){this._domBuilt=true;setTimeout(function(){J.editor.focus();var L=J.editor.getSelection();if(L){var M=new d.range(J.editor.document);M.setEndAfter(K);L.selectRanges([M]);}K.remove();t.fire('updateSnapshot');},this._domBuilt?0:100);}});t.dataProcessor.toHtml=function(J,K){var L=Site.page.__htmlLast;if(typeof L==='number')if(J.length>0)J=H(I(J,L,n),n).replace(n,o);else J=o;J=J.replace(/<lj [^>]*?>/gi,A).replace(/<lj-map [^>]*?>/gi,A).replace(/<lj-template[^>]*?>/gi,A).replace(/(<lj-cut[^>]*?)\/>/gi,'$1>').replace(/<((?!br)[^\s>]+)([^>]*?)\/>/gi,'<$1$2></$1>').replace(/<lj-poll.*?>[\s\S]*?<\/lj-poll>/gi,B).replace(/<lj-poll-([0-9]+)>/gi,C).replace(/<lj-repost\s*(?:button\s*=\s*(?:"([^"]*?)")|(?:"([^']*?)"))?.*?>([\s\S]*?)<\/lj-repost>/gi,F).replace(/<lj-embed(.*?)>([\s\S]*?)<\/lj-embed>/gi,D);J=J.replace(/>\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>');if(!$('event_format').checked){J=J.replace(/(<lj-raw.*?>)([\s\S]*?)(<\/lj-raw>)/gi,E);J=J.replace(/\n/g,'<br/>');}J=a.htmlDataProcessor.prototype.toHtml.call(this,J,K);if(c)J='<xml:namespace ns="livejournal" prefix="lj" />'+J;return J;};})();t.dataProcessor.toDataFormat=function(A,B){A=a.htmlDataProcessor.prototype.toDataFormat.call(this,A,B);if(!$('event_format').checked)A=A.replace(/<br\s*\/>/gi,'\n');return A.replace(/\t/g,' ');};t.dataProcessor.writer.indentationChars='';t.dataProcessor.writer.lineBreakChars='';t.on('selectionChange',z);t.on('doubleclick',u);t.on('afterCommandExec',y);t.on('dialogHide',y);t.on('dataReady',function(){if(c){t.document.getBody().on('dragend',y);
 t.document.getBody().on('paste',function(){setTimeout(y,0);});}if(!Site.page.disabled_input){t.document.on('click',z);t.document.on('mouseover',z);t.document.getBody().on('keyup',w);y();}});(function(){var A='LJFont',B=t.config,C=false,D={},E='normal',F=B.LJFontDefault,G=B.LJFontSize,H=B.LJFontStyle,I='b-fontsize-select-item-active',J,K,L,M,N=jQuery();for(M in G){D[M]=new a.style(H,{size:G[M]});D[M]._.definition.name=M;}function O(P){F=P;N.removeClass(I).filter('.b-fontsize-select-item-'+F).addClass(I);};t.addCommand(A,{exec:function(P){P.rteButton(A,'font');if(!C){N=jQuery('.b-fontsize-select-item');LiveJournal.register_hook('font_response',function(R){P.focus();P.fire('saveSnapshot');var S=D[R],T,U,V;if(F===R)S.remove(P.document);else{U=P.getSelection();V=parseFloat(S._.definition.styles['font-size']);for(T in D)D[T].remove(P.document);S.apply(P.document);}P.fire('saveSnapshot');});C=true;var Q=P.getCommand(A);Q.setState(1);O(F);}}});t.ui.addButton(A,{label:m[A],command:A});t.on('selectionChange',function(P){var Q=P.data.path,R=Q.elements,S=t.getCommand(A),T,U,V;for(T=0;T<R.length;T++){U=R[T];for(V in D){if(D[V].checkElementRemovable(U,true)){if(V!==F){O(V);S.setState(1);}return;}}}O(E);S.setState(2);});})();(function(){var A='LJImage',B=null;LiveJournal.register_hook('editpic_response',function(C){var D=B,E=D&&D.getParent();if(!D)return;if(C.url){D.setAttribute('src',C.url);D.setAttribute('data-cke-saved-src',C.url);}else{if(E&&E.getName()==='a')E.remove();else D.remove();return;}if(C.width)D.setAttribute('width',C.width);else D.removeAttribute('width');if(C.height)D.setAttribute('height',C.height);else D.removeAttribute('height');if(C.title)D.setAttribute('title',C.title);else D.removeAttribute('title');if(C.border)D.setStyle('border-width',C.border+'px');else{D.removeStyle('border-width');D.removeStyle('border-style');}if(C.vspace)D.setStyles({'margin-top':C.vspace+'px','margin-bottom':C.vspace+'px'});else{D.removeStyle('margin-top');D.removeStyle('margin-bottom');}if(C.hspace)D.setStyles({'margin-left':C.hspace+'px','margin-right':C.hspace+'px'});else{D.removeStyle('margin-left');D.removeStyle('margin-right');}var E=D&&D.getParent();if(C.link){C.link=C.link.replace(/^[\s\t]*(?:http:\/\/)?/,'http://');if(E&&E.getName()==='a'){E.setAttribute('href',C.link);E.setAttribute('data-cke-saved-href',C.link);if(C.blank)E.setAttribute('target','_blank');else E.removeAttribute('target');}else{var F=new h('a',t.document);F.setAttribute('href',C.link);if(C.blank)F.setAttribute('target','_blank');
 D.insertBeforeMe(F);F.append(D);t.getSelection()&&t.getSelection().selectElement(F);}}else if(E.getName()==='a'){E.insertBeforeMe(D);E.remove();}if(C.aligment&&C.aligment!=='none')D.setStyle('float',C.aligment);else D.removeStyle('float');B=null;});t.addCommand(A,{exec:function(C,D){var E=C.getSelection();E=E?E.getSelectedElement():null;B=E;if(E){var F=E&&E.getParent(),G=F.getName()==='a',H=G&&F,I=G&&F.getAttribute('href'),J={};if('naturalWidth' in E.$){J.width=E.$.naturalWidth;J.height=E.$.naturalHeight;}else{var K=new Image();K.src=E.$.src;J={width:K.width,height:K.height};}C.rteButton(A,'editpic',{picData:{url:E.getAttribute('src'),title:E.getAttribute('title'),width:E.getAttribute('width')||E.$.width,height:E.getAttribute('height')||E.$.height,defaultWidth:J.width,defaultHeight:J.height,link:I||'',blank:G?!!H.getAttribute('target'):true,border:parseInt(E.getStyle('border-width'),10),vspace:parseInt(E.getStyle('margin-top'),10),hspace:parseInt(E.getStyle('margin-left'),10),aligment:E.getStyle('float')||'none'}});}else jQuery('.b-updatepage-event-section').editor('handleImageUpload','upload');},editorFocus:false});t.ui.addButton(A,{label:m.LJImage_Title,command:A});})();(function(){var A=null;t.on('selectionChange',function(E){var F=E.data.element;if(F.is('iframe'))A=F;else A=null;});var B='LJEmbedLink',C='video';function D(E){var F=new h('iframe',t.document);if(E!==LiveJournal.getEmbed(E)){var G=h.createFromHtml(LiveJournal.getEmbed(E)),H='',I=LiveJournal.parseMediaLink(E);if(I.preview)H='style="background-image: url('+I.preview+');"';F.setAttribute('lj-url',G.getAttribute('src'));F.setAttribute('data-link',E);F.setAttribute('lj-class','lj-iframe');F.setAttribute('class','lj-iframe-wrap lj-rtebox');F.setAttribute('style','width: 490px; height:370px;');F.setAttribute('lj-style','width: 480px; height:360px;');F.setAttribute('allowfullscreen','true');F.setAttribute('lj-content',encodeURIComponent('<div '+H+" class='lj-embed-inner lj-rtebox-inner'>"+(H?'':'iframe')+'</div>'));}else{F.setAttribute('lj-class','lj-embed');F.setAttribute('class','lj-embed-wrap lj-rtebox');F.setAttribute('lj-content',encodeURIComponent('<div '+H+" class='lj-embed-inner lj-rtebox-inner'>Embed</div>"));}F.setAttribute('lj-data',encodeURIComponent(LiveJournal.getEmbed(E)));F.setAttribute('frameBorder',0);F.setAttribute('allowTransparency','true');F.setAttribute('lj-cmd',B);t.insertElement(F);y();};LiveJournal.register_hook(C+'_response',function(E){D(E);});t.addCommand(B,{exec:function(E){var F=r[B].node||A;
 if(F)E.rteButton(B,C,{defaultText:F&&decodeURIComponent(F.getAttribute('data-link')||F.getAttribute('lj-url')||F.getAttribute('lj-data')),editMode:true});else E.rteButton(B,C);}});t.ui.addButton(B,{label:m.LJEmbed,command:B});})();(function(){var A='LJMap',B='map';LiveJournal.register_hook('map_response',function(C){var D=new h('iframe',t.document),E=425,F=350,G='',H='';if(!isNaN(E)){G+='width:'+E+'px;';H+='width:'+(E-2)+'px;';}if(!isNaN(F)){G+='height:'+F+'px;';H+='height:'+(F-2)+'px;';}var I=r[A].node;if(I)I.setAttributes({'lj-url':C});else{D.setAttributes({'lj-url':C,'class':'lj-map-wrap lj-rtebox','lj-content':'<div class="lj-map-inner lj-rtebox-inner"><p class="lj-map">map</p></div>','lj-cmd':'LJMap','lj-class':'lj-map',frameborder:0,allowTransparency:'true',style:G,'lj-style':H});t.insertElement(D);}y();});t.addCommand(A,{exec:function(){var C=r[A].node;t.rteButton(A,B,{defaultText:C?C.getAttribute('lj-url'):'',editMode:C?true:false});},editorFocus:false});t.ui.addButton(A,{label:m.LJMap_Title,command:A});})();(function(){function A(H,I){I=I===undefined||I;var J,K=r.LJLike.node;if(K){var L=H.getAttribute('lj-style');J=L?L.replace(/text-align:\s*(left|right|center)/i,'$1'):'left';}else if(I)J=H.getComputedStyle('text-align');else{while(!H.hasAttribute||!(H.hasAttribute('align')||H.getStyle('text-align'))){var M=H.getParent();if(!M)break;H=M;}J=H.getStyle('text-align')||H.getAttribute('align')||'';}J&&(J=J.replace(/-moz-|-webkit-|start|auto/i,''));!J&&I&&(J=H.getComputedStyle('direction')=='rtl'?'right':'left');return J;};function B(H){if(H.editor.readOnly)return;var I=H.editor.getCommand(this.name),J=H.data.element;if((J.type==1&&J.hasAttribute('lj-cmd')&&J.getAttribute('lj-cmd'))=='LJLike')I.state=A(J,t.config.useComputedState)==this.value?1:2;else if(!J||J.type!=1||J.getName()=='body'||J.getName()=='iframe')I.state=2;else I.state=A(J,t.config.useComputedState)==this.value?1:2;I.fire('state');};function C(H,I,J){var L=this;L.name=I;L.value=J;var K=H.config.justifyClasses;if(K){switch(J){case 'left':L.cssClassName=K[0];break;case 'center':L.cssClassName=K[1];break;case 'right':L.cssClassName=K[2];break;}L.cssClassRegex=new RegExp('(?:^|\\s+)(?:'+K.join('|')+')(?=$|\\s)');}};function D(H){var I=H.editor,J=new d.range(I.document);J.setStartBefore(H.data.node);J.setEndAfter(H.data.node);var K=new d.walker(J),L;while(L=K.next()){if(L.type==1){var M='text-align',N=I.config.justifyClasses;if(!L.equals(H.data.node)&&L.getDirection()){J.setStartAfter(L);K=new d.walker(J);

Modified: trunk/htdocs/js/ck/plugins/livejournal/plugin.js
===================================================================
--- trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2012-11-29 11:58:56 UTC (rev 23392)
+++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2012-11-29 12:03:37 UTC (rev 23393)
@@ -649,22 +649,18 @@
 						.replace(/<lj-repost\s*(?:button\s*=\s*(?:"([^"]*?)")|(?:"([^']*?)"))?.*?>([\s\S]*?)<\/lj-repost>/gi, createRepost)
 						.replace(/<lj-embed(.*?)>([\s\S]*?)<\/lj-embed>/gi, createEmbed);
 
-					// https://jira.sup.com/browse/LJSUP-13714
-					html = html.replace(/<table[^>]*>((.|\n)*?)<\/table>/i, function(table) {
-						var span = document.createElement('span');
-						span.innerHTML = table;
-						
-						walk(span, function() {
-							if (this.nodeType === 3) {
-								if (this.parentNode.nodeName.toLowerCase() !== 'td') {
-									this.nodeValue = this.nodeValue.replace(/\n/ig, '');
-								}
-							}
-						});
+					// Fix tables: LJSUP-14409, LJSUP-13714
+					html = html
+						.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>');
 
-						return span.innerHTML;
-					});
-
 					if (!$('event_format').checked) {
 						html = html.replace(/(<lj-raw.*?>)([\s\S]*?)(<\/lj-raw>)/gi, createLJRaw);
 						html = html.replace(/\n/g, '<br/>');

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