spacevillain (spacevillain) wrote in changelog,
spacevillain
spacevillain
changelog

[livejournal] r23307: LJSUP-14225: incorrect work Insert img

Committer: atyurin
LJSUP-14225: incorrect work Insert img
U   trunk/htdocs/js/ck/ckeditor.js
Modified: trunk/htdocs/js/ck/ckeditor.js
===================================================================
--- trunk/htdocs/js/ck/ckeditor.js	2012-11-14 14:27:43 UTC (rev 23306)
+++ trunk/htdocs/js/ck/ckeditor.js	2012-11-14 15:43:54 UTC (rev 23307)
@@ -153,12 +153,12 @@
 });ab.forEach(function(ac){if(I.hasOwnProperty(ac)&&H.indexOf(ac)===-1)H.push(ac);});};function U(){var ab=R();ab=ab.filter(function(ac){return!G[ac];});if(ab.length>0){S(ab);return ab;}else return false;return ab.length>0?ab:false;};function V(){var ab=U();if(!ab)return;m.ajax({url:F,type:'POST',dataType:'json',data:{html:ab.join(' ')},async:false,success:function(ac){var ad=Object.keys(ac.words);if(ad.length){m.extend(I,ac.words);H=H.concat(ad);}}});};function W(ab){var ac=this,ad=null;if(!D)return;setTimeout(function(){A.save();ad=s._.definition.attributes;ad['data-word']=ab;O(ab).forEach(function(ae){C+=1;ad['data-id']=C;ae.highlight();});A.restore();},0);};function X(){V();Z();H.forEach(W);};function Y(ab){N(true).find("span[data-incorrect][data-word='"+ab+"']").each(function(){var ac=m(this);ac.replaceWith(ac.text());});};function Z(){if(C===0)return;A.save();m(z.document.getBody().$).find('span[data-incorrect]').each(function(ab,ac){var ad=m(ac);ad.replaceWith(ad.html());});A.restore();C=0;};function aa(ab){delete I[ab];H=H.filter(function(ac){return ac!==ab;});};M={init:function(){if(!B){P(D);if(D)setTimeout(X,1000);LiveJournal.register_hook('skipWord',function(ab){aa(ab);S([ab]);});B=true;}},on:function(){P(true);X();},off:function(){P(false);Z();},isEnabled:function(){return D;},toggle:function(){P(!D);},highlightWord:W,removeHighlightFromWord:Y,highlight:X,removeHighlight:Z,skipWord:aa,change:function(){if(K)clearTimeout(K);K=setTimeout(function(){if(D)X();else Z();},L);},getSuggestions:function(ab){return ab===undefined?I:I[ab]||[];},getWordRanges:O,debug:function(){LJ.console.log('--- already used words');LJ.console.log(Object.keys(G));LJ.console.log('--- words that are in the editor');LJ.console.log(R());LJ.console.log('--- new words in the editor');LJ.console.log(U());LJ.console.log('--- current incorrect words');LJ.console.log(H);}};return M;})(v,y);v.dataProcessor.htmlFilter.addRules({elements:{span:function(z){if(z.attributes['data-incorrect']||z.attributes['data-id']){delete z.name;var A=z.children[0];if(A)A.value=A.value.replace(/\&nbsp;/,' ');return z;}}}});v.on('change',a.ljspell.change);v.addCommand(x,{exec:function(z){a.ljspell.toggle();},editorFocus:false});v.ui.addButton(x,{label:CKLang.LJSpell_Title,command:x});}});})(jQuery,window);(function(){function m(o){var p=o.getStyle('overflow-y'),q=o.getDocument(),r=h.createFromHtml('<span style="margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;">'+(b.webkit?'&nbsp;':'')+'</span>',q);
 q[c?'getBody':'getDocumentElement']().append(r);var s=r.getDocumentPosition(q).y+r.$.offsetHeight;r.remove();o.setStyle('overflow-y',p);return s;};var n=function(o){if(!o.window)return;var p=o.document,q=new h(p.getWindow().$.frameElement),r=p.getBody(),s=p.getDocumentElement(),t=o.window.getViewPaneSize().height,u=p.$.compatMode=='BackCompat'?r:s,v=m(u);v+=o.config.autoGrow_bottomSpace||0;var w=o.config.autoGrow_minHeight!=undefined?o.config.autoGrow_minHeight:200,x=o.config.autoGrow_maxHeight||Infinity;v=Math.max(v,w);v=Math.min(v,x);if(v!=t){v=o.fire('autoGrow',{currentHeight:t,newHeight:v}).newHeight;o.resize(o.container.getStyle('width'),v,true);}if(u.$.scrollHeight>u.$.clientHeight&&v<x)u.setStyle('overflow-y','hidden');else u.removeStyle('overflow-y');};j.add('autogrow',{init:function(o){o.addCommand('autogrow',{exec:n,modes:{wysiwyg:1},readOnly:1,canUndo:false,editorFocus:false});var p={contentDom:1,key:1,selectionChange:1,insertElement:1};o.config.autoGrow_onStartup&&(p.instanceReady=1);for(var q in p)o.on(q,function(r){var s=o.getCommand('maximize');if(r.editor.mode=='wysiwyg'&&(!s||s.state!=1))setTimeout(function(){n(r.editor);n(r.editor);},100);});}});})();j.add('colorbutton',{requires:['panelbutton','floatpanel','styles'],init:function(m){var n=m.config,o=m.lang.colorButton,p;if(!b.hc){q('TextColor','fore',o.textColorTitle);q('BGColor','back',o.bgColorTitle);}function q(t,u,v){var w=e.getNextId()+'_colorBox';m.ui.add(t,'panelbutton',{label:v,title:v,className:'cke_button_'+t.toLowerCase(),modes:{wysiwyg:1},panel:{css:m.skin.editor.css,attributes:{role:'listbox','aria-label':o.panelTitle}},onBlock:function(x,y){y.autoSize=true;y.element.addClass('cke_colorblock');y.element.setHtml(r(x,u,w));y.element.getDocument().getBody().setStyle('overflow','hidden');k.fire('ready',this);var z=y.keys,A=m.lang.dir=='rtl';z[A?37:39]='next';z[40]='next';z[9]='next';z[A?39:37]='prev';z[38]='prev';z[2228224+9]='prev';z[32]='click';},onOpen:function(){var x=m.getSelection(),y=x&&x.getStartElement(),z=new d.elementPath(y),A;y=z.block||z.blockLimit||m.document.getBody();do A=y&&y.getComputedStyle(u=='back'?'background-color':'color')||'transparent';while(u=='back'&&A=='transparent'&&y&&(y=y.getParent()));if(!A||A=='transparent')A='#ffffff';this._.panel._.iframe.getFrameDocument().getById(w).setStyle('background-color',A);}});};function r(t,u,v){var w=[],x=n.colorButton_colors.split(','),y=x.length+(n.colorButton_enableMore?2:1),z=e.addFunction(function(F,G){if(F=='?'){var H=arguments.callee;
 function I(K){this.removeListener('ok',I);this.removeListener('cancel',I);K.name=='ok'&&H(this.getContentElement('picker','selectedColor').getValue(),G);};m.openDialog('colordialog',function(){this.on('ok',I);this.on('cancel',I);});return;}m.focus();t.hide(false);m.fire('saveSnapshot');new a.style(n['colorButton_'+G+'Style'],{color:'inherit'}).remove(m.document);if(F){var J=n['colorButton_'+G+'Style'];J.childRule=G=='back'?function(K){return s(K);}:function(K){return!(K.is('a')||K.getElementsByTag('a').count())||s(K);};new a.style(J,{color:F}).apply(m.document);}m.fire('saveSnapshot');});w.push('<a class="cke_colorauto" _cke_focus=1 hidefocus=true title="',o.auto,'" onclick="CKEDITOR.tools.callFunction(',z,",null,'",u,"');return false;\" href=\"javascript:void('",o.auto,'\')" role="option" aria-posinset="1" aria-setsize="',y,'"><table role="presentation" cellspacing=0 cellpadding=0 width="100%"><tr><td><span class="cke_colorbox" id="',v,'"></span></td><td colspan=7 align=center>',o.auto,'</td></tr></table></a><table role="presentation" cellspacing=0 cellpadding=0 width="100%">');for(var A=0;A<x.length;A++){if(A%8===0)w.push('</tr><tr>');var B=x[A].split('/'),C=B[0],D=B[1]||C;if(!B[1])C='#'+C.replace(/^(.)(.)(.)$/,'$1$1$2$2$3$3');var E=m.lang.colors[D]||D;w.push('<td><a class="cke_colorbox" _cke_focus=1 hidefocus=true title="',E,'" onclick="CKEDITOR.tools.callFunction(',z,",'",C,"','",u,"'); return false;\" href=\"javascript:void('",E,'\')" role="option" aria-posinset="',A+2,'" aria-setsize="',y,'"><span class="cke_colorbox" style="background-color:#',D,'"></span></a></td>');}if(n.colorButton_enableMore===undefined||n.colorButton_enableMore)w.push('</tr><tr><td colspan=8 align=center><a class="cke_colormore" _cke_focus=1 hidefocus=true title="',o.more,'" onclick="CKEDITOR.tools.callFunction(',z,",'?','",u,"');return false;\" href=\"javascript:void('",o.more,"')\"",' role="option" aria-posinset="',y,'" aria-setsize="',y,'">',o.more,'</a></td>');w.push('</tr></table>');return w.join('');};function s(t){return t.getAttribute('contentEditable')=='false'||t.getAttribute('data-nostyle');};}});i.colorButton_colors='000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF';i.colorButton_foreStyle={element:'span',styles:{color:'#(color)'},overrides:[{element:'font',attributes:{color:null}}]};
-i.colorButton_backStyle={element:'span',styles:{'background-color':'#(color)'}};j.colordialog={init:function(m){m.addCommand('colordialog',new a.dialogCommand('colordialog'));a.dialog.add('colordialog',this.path+'dialogs/colordialog.js');}};j.add('colordialog',j.colordialog);j.add('ljcolor',{requires:['styles'],init:function(m){var n='LJColor';m.on('selectionChange',function(t){var u=t.data.element,v=m.getCommand(n);if(u.is('span')&&u.getStyle('color'))v.setState(1);else v.setState(2);});var o=m.config,p=m.lang.colorButton;function q(t){t=t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);var u='#'+('0'+parseInt(t[1],10).toString(16)).slice(-2)+('0'+parseInt(t[2],10).toString(16)).slice(-2)+('0'+parseInt(t[3],10).toString(16)).slice(-2);return u.toUpperCase();};function r(t,u){m.focus();m.fire('saveSnapshot');new a.style(o['colorButton_'+u+'Style'],{color:'inherit'}).remove(m.document);if(t){var v=o['colorButton_'+u+'Style'];v.childRule=u=='back'?function(w){return s(w);}:function(w){return!(w.is('a')||w.getElementsByTag('a').count())||s(w);};new a.style(v,{color:t}).apply(m.document);}m.fire('saveSnapshot');};LiveJournal.register_hook('selectedColor',function(t){r(t,'fore');});m.ui.addButton(n,{label:p.textColorTitle,command:n});m.addCommand(n,{exec:function(t){var u=null,v=t.getSelection();if(v){var w=v.getRanges()[0],x=w.startContainer.getParent();if(x.is('span')){u=x.getStyle('color');if(u)u=q(u);}}t.rteButton(n,'color',{selectedColor:u});}});function s(t){return t.getAttribute('contentEditable')=='false'||t.getAttribute('data-nostyle');};}});i.colorButton_foreStyle={element:'span',styles:{color:'#(color)'},overrides:[{element:'font',attributes:{color:null}}]};j.add('ljlink',{init:function(m){m.addCommand('link',new a.dialogCommand('link'));m.addCommand('unlink',new a.unlinkCommand());if(jQuery.browser.webkit)m.on('contentDom',function(){this.document.on('keydown',function(B){if(B.data.getKey()===13){var C=m.getSelection(),D,E;if(!C)return;D=C.getRanges()[0];E=D.endContainer.getParent();var F=D.checkStartOfBlock(),G=D.checkEndOfBlock();if(E.is('a')&&D.collapsed){m.insertHtml('<span>&nbsp;</span>');setTimeout(function(){if(G)E.getNext().remove();},100);}}});});m.on('selectionChange',function(B){if(m.readOnly)return;var C=m.getCommand('unlink'),D=B.data.path.lastElement&&B.data.path.lastElement.getAscendant('a',true);if(D&&D.getName()=='a'&&D.getAttribute('href')&&D.getChildCount())C.setState(2);else C.setState(0);});var n=/^javascript:/,o=/^mailto:([^?]+)(?:\?(.+))?$/,p=/subject=([^;?:@&=$,\/]*)/,q=/body=([^;?:@&=$,\/]*)/,r=/^#(.*)$/,s=/^((?:http|https|ftp|news):\/\/)?(.*)$/,t=/^(_(?:self|top|parent|blank))$/,u=/^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/,v=/^javascript:([^(]+)\(([^)]+)\)$/,w=/\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/,x=/(?:^|,)([^=]+)=(\d+|yes|no)/gi,y=function(B,C){var D=C&&(C.data('cke-saved-href')||C.getAttribute('href'))||'',E,F,G,H,I={};
-if(E=D.match(n))if(emailProtection=='encode')D=D.replace(u,function(aa,ab,ac){return 'mailto:'+String.fromCharCode.apply(String,ab.split(','))+(ac&&unescapeSingleQuote(ac));});else if(emailProtection)D.replace(v,function(aa,ab,ac){if(ab==compiledProtectionFunction.name){I.type='email';var ad=I.email={},ae=/[^,\s]+/g,af=/(^')|('$)/g,ag=ac.match(ae),ah=ag.length,ai,aj;for(var ak=0;ak<ah;ak++){aj=decodeURIComponent(unescapeSingleQuote(ag[ak].replace(af,'')));ai=compiledProtectionFunction.params[ak].toLowerCase();ad[ai]=aj;}ad.address=[ad.name,ad.domain].join('@');}});if(!I.type)if(G=D.match(r)){I.type='anchor';I.anchor={};I.anchor.name=I.anchor.id=G[1];}else if(F=D.match(o)){var J=D.match(p),K=D.match(q);I.type='email';var L=I.email={};L.address=F[1];J&&(L.subject=decodeURIComponent(J[1]));K&&(L.body=decodeURIComponent(K[1]));}else if(D&&(H=D.match(s))){I.type='url';I.url={};I.url.protocol=H[1];I.url.url=H[2];}else I.type='url';if(C){var M=C.getAttribute('target');I.target={};I.adv={};if(!M){var N=C.data('cke-pa-onclick')||C.getAttribute('onclick'),O=N&&N.match(w);if(O){I.target.type='popup';I.target.name=O[1];var P;while(P=x.exec(O[2])){if((P[2]=='yes'||P[2]=='1')&&!(P[1] in {height:1,width:1,top:1,left:1}))I.target[P[1]]=true;else if(isFinite(P[2]))I.target[P[1]]=P[2];}}}else{var Q=M.match(t);if(Q)I.target.type=I.target.name=M;else{I.target.type='frame';I.target.name=M;}}var R=this,S=function(aa,ab){var ac=C.getAttribute(ab);if(ac!==null)I.adv[aa]=ac||'';};S('advId','id');S('advLangDir','dir');S('advAccessKey','accessKey');I.adv.advName=C.data('cke-saved-name')||C.getAttribute('name')||'';S('advLangCode','lang');S('advTabIndex','tabindex');S('advTitle','title');S('advContentType','type');j.link.synAnchorSelector?I.adv.advCSSClasses=getLinkClass(C):S('advCSSClasses','class');S('advCharset','charset');S('advStyles','style');S('advRel','rel');}var T=I.anchors=[],U;if(j.link.emptyAnchorFix){var V=B.document.getElementsByTag('a');for(i=0,count=V.count();i<count;i++){U=V.getItem(i);if(U.data('cke-saved-name')||U.hasAttribute('name'))T.push({name:U.data('cke-saved-name')||U.getAttribute('name'),id:U.getAttribute('id')});}}else{var W=new d.nodeList(B.document.$.anchors);for(var X=0,Y=W.count();X<Y;X++){U=W.getItem(X);T[X]={name:U.getAttribute('name'),id:U.getAttribute('id')};}}if(j.link.fakeAnchor){var Z=B.document.getElementsByTag('img');for(X=0,Y=Z.count();X<Y;X++){if(U=j.link.tryRestoreFakeAnchor(B,Z.getItem(X)))T.push({name:U.getAttribute('name'),id:U.getAttribute('id')});
-}}this.selectedElement=C;return I;};LiveJournal.register_hook('link_response',function(B){var K=this;var C=B.url,D=B.target||'';if(C.length===0){m.execCommand('unlink');delete K.selectedElement;return;}if(!C.match(/^[a-z+]+:(\/\/)?/))C='http://'+C;var E={};E['data-cke-saved-href']=C;E.href=C;if(D)E.target=D;if(!K.selectedElement){var F=new h('a'),G=m.getSelection();F.setAttributes({'data-cke-saved-href':C,href:C});if(D)F.setAttribute('target',D);F.setText(z||C);m.insertElement(F);}else{var H=K.selectedElement,I=H.data('cke-saved-href'),J=H.getHtml();if(!E[D])H.removeAttribute('target');H.setAttributes(E);delete K.selectedElement;}});var z;LiveJournal.register_hook('link_hide',function(B){if(this.selectedElement)delete this.selectedElement;z='';});var A='LJLink2';m.addCommand(A,{exec:function(B){var C=B.getSelection(),D={},E=null;z=C.getSelectedText();if((E=j.link.getSelectedLink(B))&&E.hasAttribute('href'))C.selectElement(E);else E=null;var F='';if(E){var G=y(B,E).url;F=(G.protocol||'http://')+G.url;}D.defaultText=F;D.hasSelectedText=!!E;D.editMode=!!E;if(E)D.hasTarget=E.hasAttribute('target')?true:false;B.rteButton(A,'link',D);},editorFocus:false});m.ui.addButton(A,{label:m.lang.link.toolbar,command:A});},afterInit:function(m){var n=m.dataProcessor,o=n&&n.dataFilter,p=n&&n.htmlFilter,q=m._.elementsPath&&m._.elementsPath.filters;if(o)o.addRules({elements:{a:function(r){var s=r.attributes;if(!s.name)return null;var t=!r.children.length;if(j.link.synAnchorSelector){var u=t?'cke_anchor_empty':'cke_anchor',v=s['class'];if(s.name&&(!v||v.indexOf(u)<0))s['class']=(v||'')+' '+u;if(t&&j.link.emptyAnchorFix){s.contenteditable='false';s['data-cke-editable']=1;}}else if(j.link.fakeAnchor&&t)return m.createFakeParserElement(r,'cke_anchor','anchor');return null;}}});if(j.link.emptyAnchorFix&&p)p.addRules({elements:{a:function(r){delete r.attributes.contenteditable;}}});if(q)q.push(function(r,s){if(s=='a')if(j.link.tryRestoreFakeAnchor(m,r)||r.getAttribute('name')&&(!r.getAttribute('href')||!r.getChildCount()))return 'anchor';});},requires:['fakeobjects']});j.link={getSelectedLink:function(m){try{var n=m.getSelection();if(n.getType()==3){var o=n.getSelectedElement();if(o.is('a'))return o;}var p=n.getRanges(true)[0];p.shrink(2);var q=p.getCommonAncestor();return q.getAscendant('a',true);}catch(r){return null;}},fakeAnchor:b.opera||b.webkit,synAnchorSelector:c,emptyAnchorFix:c&&b.version<8,tryRestoreFakeAnchor:function(m,n){if(n&&n.data('cke-real-element-type')&&n.data('cke-real-element-type')=='anchor'){var o=m.restoreRealElement(n);
-if(o.data('cke-saved-name'))return o;}}};a.unlinkCommand=function(){};a.unlinkCommand.prototype={exec:function(m){var n=m.getSelection(),o=n.createBookmarks(),p=n.getRanges(),q,r;for(var s=0;s<p.length;s++){q=p[s].getCommonAncestor(true);r=q.getAscendant('a',true);if(!r)continue;p[s].selectNodeContents(r);}n.selectRanges(p);m.document.$.execCommand('unlink',false,null);n.selectBookmarks(o);},startDisabled:true};a.removeAnchorCommand=function(){};a.removeAnchorCommand.prototype={exec:function(m){var n=m.getSelection(),o=n.createBookmarks(),p;if(n&&(p=n.getSelectedElement())&&(j.link.fakeAnchor&&!p.getChildCount()?j.link.tryRestoreFakeAnchor(m,p):p.is('a')))p.remove(1);else if(p=j.link.getSelectedLink(m))if(p.hasAttribute('href')){p.removeAttributes({name:1,'data-cke-saved-name':1});p.removeClass('cke_anchor');}else p.remove(1);n.selectBookmarks(o);}};(function(){function m(p,q,r,s,t,u,v){var w=p.config,x=t.split(';'),y=[],z={};for(var A=0;A<x.length;A++){var B=x[A];if(B){B=B.split('/');var C={},D=x[A]=B[0];C[r]=y[A]=B[1]||D;z[D]=new a.style(v,C);z[D]._.definition.name=D;}else x.splice(A--,1);}p.ui.addRichCombo(q,{label:s.label,title:s.panelTitle,className:'cke_'+(r=='size'?'fontSize':'font'),panel:{css:p.skin.editor.css.concat(w.contentsCss),multiSelect:false,attributes:{'aria-label':s.panelTitle}},init:function(){this.startGroup(s.panelTitle);for(var E=0;E<x.length;E++){var F=x[E];this.add(F,z[F].buildPreview(),F);}},onClick:function(E){p.focus();p.fire('saveSnapshot');var F=z[E];if(this.getValue()==E)F.remove(p.document);else{var G=p.getSelection(),H=parseFloat(z[E]._.definition.styles['font-size']);for(var I in z)z[I].remove(p.document);F.apply(p.document);}p.fire('saveSnapshot');},onRender:function(){p.on('selectionChange',function(E){var F=this.getValue(),G=E.data.path,H=G.elements;for(var I=0,J;I<H.length;I++){J=H[I];for(var K in z){if(z[K].checkElementRemovable(J,true)){if(K!=F)this.setValue(K);return;}}}this.setValue('',u);},this);}});};j.add('ljfont',{requires:['richcombo','styles'],init:function(p){var q=p.config;m(p,'ljFontSize','size',p.lang.fontSize,q.fontSize_sizes,q.fontSize_defaultLabel,q.fontSize_style);}});i.font_style={element:'span',styles:{'font-family':'#(family)'},overrides:[{element:'font',attributes:{face:null}}]};var n={tiny:'0.7em',small:'0.9em',normal:'1.0em',large:'1.4em',huge:'1.8em'};i.fontSize_sizes='';for(var o in n)i.fontSize_sizes+=Site.ml_text['talk.font.'+o]+'/'+n[o]+';';i.fontSize_defaultLabel=Site.ml_text['talk.font.normal'];
-i.fontSize_style={element:'span',styles:{'font-size':'#(size)'},overrides:[{element:'font',attributes:{size:null}}]};})();j.add('ljcut2',{init:function(m){'use strict';var n,o;(function(){var p='LJCut2',q='cut',r='LJCut2',s='lj-cut';function t(y){var z=y.startContainer.getParent(),A=y.endContainer.getParent(),B=y.getCommonAncestor(false);if(B.type===1&&!B.is('ol')&&!B.is('ul'))return;if(y.startContainer.type===3)if(z.is('li'))y.startContainer=z;if(y.endContainer.type===3)if(A.is('li'))y.endContainer=A;};function u(y){if(y.length===0)return;var z=y[0].getParent().clone();y[0].insertBeforeMe(z);y.forEach(function(A){A.move(z);});z.breakParent(z.getParent());return z;};function v(y){var z=y.startContainer.getParent();if((z.is('ul')||z.is('ol'))&&z.getFirst().equals(y.startContainer)){var A=y.endContainer.getParents().filter(function(B){return B.type===1&&(B.is('ul')||B.is('ol'));});if(A.length===0){y.startContainer=y.startContainer.getParent();return true;}}return false;};function w(y){var z=new d.selection(m.document),A=null,B=null,C=null,D=[],E;if(n)A=n;else{t(o);if(o.startContainer.equals(o.endContainer))D.push(o.startContainer);else{var F=o.startContainer;do{D.push(F);F=F.getNextSourceNode(true);}while(F&&!F.equals(o.endContainer));D.push(o.endContainer);}if(D.every(function(N){return N.type===1&&N.is('li');}))A=u(D);else{if(jQuery.browser.safari||jQuery.browser.msie||jQuery.browser.opera){E=new h('div');if(o.startContainer.type===1)o.startContainer.insertBeforeMe(E);else{o.insertNode(E);o.setStartAt(E,4);}}B=o.extractContents();}}var G=new h('iframe',m.document),H=new h('br',m.document);G.setAttributes({'lj-cmd':r,'lj-class':s+' '+s+'-open','class':s+'-wrap',frameBorder:0,allowTransparency:'true'});if(typeof y!=='undefined')G.setAttribute('text',y);var I=G.clone();I.setAttribute('lj-class',s+' '+s+'-close');if(A){G.insertBefore(A);I.insertAfter(A);}else if(B)if(C){I.insertBefore(C);G.insertBefore(I);I.insertBeforeMe(B);}else{if(D&&D[0].type!==3)m.insertHtml('<br id="__dummy"/>');if(E)E.insertBeforeMe(G);else m.insertElement(G);I.insertAfter(G);if(B.getChildCount()===0){H.clone().insertAfter(G);H.clone().insertBefore(I);}I.insertBeforeMe(B);var J=m.document.getById('__dummy');if(J)J.remove();m.fire('updateSnapshot');}if(E)E.remove();var K=new d.range(m.document);K.setStartAfter(G);K.setEndBefore(I);z.selectRanges([K]);var L=jQuery(m.document.getBody().$),M=false;L.find('ul, li').toArray().forEach(function(N){if(jQuery(N).text().length===0){jQuery(N).remove();
-M=true;}});if(M)m.fire('updateSnapshot');};LiveJournal.register_hook('cut_response',function(y){if(x)x.setAttribute('text',y);else{w(y);m.updateFrames();}});var x=null;m.on('selectionChange',function(y){var z=y.data.element;if(z&&z.is('iframe')&&z.getAttribute('lj-cmd')===p)x=z;else x=null;});m.on('contentDom',function(){m.updateFrames();});m.addCommand(p,{exec:function(){var y=new d.selection(m.document);n=y&&y.getSelectedElement();o=y.getRanges()[0];m.rteButton(p,q,{defaultText:x?x.getAttribute('text'):'',editMode:x?true:false});},editorFocus:false});m.ui.addButton(p,{label:CKLang.LJCut_Title,command:p});})();}});(function(){'use strict';var m='LJUser2',n='user',o={};j.add('ljuser2',{init:function(p){var q=null,r=new Image();r.src='/img/preloader/preloader-blue-white-xl.gif';p.on('selectionChange',function(u){var v=u.data.element;p.getCommand(m).setState(v.hasAttribute('data-user')?1:2);q=v.hasAttribute('data-user')?v:null;});function s(u){if(!u)return;var v=new d.range(p.document),w,x;if(u.is('img')){w=u;x=u.getNextSourceNode(true,1);}else{x=u;w=u.getPreviousSourceNode(true,1);}var y=p.document.getSelection();if(x&&w){v.setStartBefore(w);v.setEndAfter(x);if(y)y.selectRanges([v]);}else y.selectElement(u);return x||u;};p.on('contentDom',function(){this.document.on('keydown',function(u){var v=p.document.getSelection(),w=v&&v.getRanges()[0];if(w.collapsed&&u.data.getKey()===8){var x=w.getTouchedEndNode();if(x.type===3)x=x.getParent();if(x.hasAttribute('data-user')){u.data.preventDefault();s(x);}}});this.document.on('click',function(u){var v=u.data.getTarget();if(v&&v.hasAttribute('data-user'))s(v);});});function t(u,v){var w=new h('img'),x=new h('a');w.setAttributes({src:r.src,width:'16',height:'16','data-user':u.journal,'data-title':v});w.setStyle('cursor','default');var y=new Image();y.onload=function(){o[u.journal]=u.userhead_url;w.setAttribute('src',y.src);p.fire('updateSnapshot');};y.src=u.userhead_url;x.setAttributes({href:'#','data-cke-saved-href':'#','data-user':u.journal,'data-title':v,seen:true});x.setStyles({color:'blue',fontWeight:'bold'});x.setText(v||u.journal);p.insertElement(w);p.insertElement(x);p.fire('updateSnapshot');};LiveJournal.register_hook('user_response',function(u,v){if(u&&u.hasOwnProperty('ljuser'))t(u.ljuser,v);});p.addCommand(m,{exec:function(u){if(q){var v=q.getAttribute('data-user'),w=q.getAttribute('data-title');u.rteButton(m,n,{user:v,title:w,fromRte:true});}else u.rteButton(m,n);}});p.ui.addButton(m,{label:m,command:m});p.dataProcessor.htmlFilter.addRules({elements:{img:function(u){if(u.attributes['data-user'])return false;
-return u;},a:function(u){var v=u;if(u.attributes['data-user']){v=new a.htmlParser.element('lj');v.isEmpty=true;v.isOptionalClose=true;if(u.attributes.hasOwnProperty('data-user'))v.attributes.user=u.attributes['data-user'];if(u.attributes['data-title'])v.attributes.title=u.attributes['data-title'];return v;}else return u;}}});p.on('doubleclick',function(u){var v=u.data.element;if(v&&v.hasAttribute('data-user')){s(v);p.execFromEditor=true;p.execCommand(m);}});p.on('contentDom',function(){var u=jQuery(a.instances.ck.document.$);u.find('a[data-user]').each(function(v,w){if(w.seen)return;var x=w.getAttribute('data-user'),y=jQuery('<img/>',{style:'cursor: default; width: 16px; height: 16px;','data-user':x,'data-title':w.getAttribute('data-title'),src:o[x]||r.src}).insertBefore(jQuery(w));if(!o[x])LJ.Api.call('ljuser.get',{user:w.getAttribute('data-user'),raw:1},function(z){o[x]=z.ljuser.userhead_url;y.attr('src',z.ljuser.userhead_url);w.seen=true;});});});p.dataProcessor.dataFilter.addRules({elements:{lj:function(u){var v=u.attributes.user,w=new a.htmlParser.element('a');w.add(new a.htmlParser.text(u.attributes.title||v));w.attributes.href='#';w.attributes['data-cke-saved-href']='#';w.attributes.style='font-weight: bold; color: #00C;';w.attributes['data-user']=v;w.attributes['data-title']=u.attributes.title||'';return w;}}});}});})();(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);a.editorConfig=function(m){'use strict';j.addExternal('ljcolor','plugins/lj/ljcolor/plugin.js');j.addExternal('ljlink','plugins/lj/ljlink/plugin.js');
-j.addExternal('ljfont','plugins/lj/ljfont/plugin.js');j.addExternal('ljcut2','plugins/lj/ljcut/plugin.js');j.addExternal('ljuser2','plugins/lj/ljuser/plugin.js');j.addExternal('ljautogrow','plugins/lj/ljautogrow/plugin.js');var n=[Site.page.ljpost?'livejournal':'livejournal_old','ljcolor','ljlink'],o=['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)n.push('ljautogrow','ljspell','ljfont','ljcut2','ljuser2');else o.push('dialog','image','link','font');m.language='ru';m.autoParagraph=false;m.autoUpdateElement=false;m.docType='<!DOCTYPE html>';if(Site.page.ljpost){m.contentsCss='/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.fillEmptyBlocks=false;if(Site.is_dev_server)m.extraPlugins=n.join(',');else Array.prototype.push.apply(o,n);m.plugins=o.join(',');m.contentsLangDirection='ltr';m.fillEmptyBlocks=false;m.tabIndex=41;m.tabSpaces=2;m.startupShowBorders=false;m.toolbarCanCollapse=false;m.disableNativeSpellChecker=Site.page.ljpost?true:false;var p=[];function q(r,s){return r?s:undefined;};if(Site.page.ljpost)p=['Bold','Italic','Underline','Strike','LJFont','LJColor','-','LJLink2','LJUser2','-','LJImage',q(Site.media_embed_enabled,'LJEmbedLink'),'LJCut2','LJSpoiler','LJMap','LJLike','LJPollLink','NumberedList','BulletedList','LJJustifyLeft','LJJustifyCenter','LJJustifyRight','LJSpell','Undo','Redo'];else p=['Bold','Italic','Underline','Strike','TextColor','FontSize','-','LJLink','LJUserLink','image',q(Site.media_embed_enabled,'LJEmbedLink'),'LJPollLink','LJCutLink','LJCut','LJLike','LJSpoiler','-','UnorderedList','OrderedList','NumberedList','BulletedList','-','LJJustifyLeft','LJJustifyCenter','LJJustifyRight','-','Undo','Redo'];m.toolbar_Full=[p.filter(function(r){return r;})];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);};a.editorConfig(i);})();
+i.colorButton_backStyle={element:'span',styles:{'background-color':'#(color)'}};j.colordialog={init:function(m){m.addCommand('colordialog',new a.dialogCommand('colordialog'));a.dialog.add('colordialog',this.path+'dialogs/colordialog.js');}};j.add('colordialog',j.colordialog);j.add('ljcolor',{requires:['styles'],init:function(m){var n='LJColor';m.on('selectionChange',function(t){var u=t.data.element,v=m.getCommand(n);if(u.is('span')&&u.getStyle('color'))v.setState(1);else v.setState(2);});var o=m.config,p=m.lang.colorButton;function q(t){t=t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);var u='#'+('0'+parseInt(t[1],10).toString(16)).slice(-2)+('0'+parseInt(t[2],10).toString(16)).slice(-2)+('0'+parseInt(t[3],10).toString(16)).slice(-2);return u.toUpperCase();};function r(t,u){m.focus();m.fire('saveSnapshot');new a.style(o['colorButton_'+u+'Style'],{color:'inherit'}).remove(m.document);if(t){var v=o['colorButton_'+u+'Style'];v.childRule=u=='back'?function(w){return s(w);}:function(w){return!(w.is('a')||w.getElementsByTag('a').count())||s(w);};new a.style(v,{color:t}).apply(m.document);}m.fire('saveSnapshot');};LiveJournal.register_hook('selectedColor',function(t){r(t,'fore');});m.ui.addButton(n,{label:p.textColorTitle,command:n});m.addCommand(n,{exec:function(t){var u=null,v=t.getSelection();if(v){var w=v.getRanges()[0],x=w.startContainer.getParent();if(x.is('span')){u=x.getStyle('color');if(u)u=q(u);}}t.rteButton(n,'color',{selectedColor:u});}});function s(t){return t.getAttribute('contentEditable')=='false'||t.getAttribute('data-nostyle');};}});i.colorButton_foreStyle={element:'span',styles:{color:'#(color)'},overrides:[{element:'font',attributes:{color:null}}]};j.add('ljlink',{init:function(m){m.addCommand('link',new a.dialogCommand('link'));m.addCommand('unlink',new a.unlinkCommand());if(jQuery.browser.webkit)m.on('contentDom',function(){this.document.on('keydown',function(B){if(B.data.getKey()===13){var C=m.getSelection(),D,E;if(!C)return;D=C.getRanges()[0];E=D.endContainer.getParent();var F=D.checkStartOfBlock(),G=D.checkEndOfBlock();if(E.is('a')&&D.collapsed||D.endContainer.type===1&&D.endContainer.is('a')){m.insertHtml('<span>&nbsp;</span>');setTimeout(function(){if(G&&E&&E.getNext())E.getNext().remove();},100);}}});});m.on('selectionChange',function(B){if(m.readOnly)return;var C=m.getCommand('unlink'),D=B.data.path.lastElement&&B.data.path.lastElement.getAscendant('a',true);if(D&&D.getName()=='a'&&D.getAttribute('href')&&D.getChildCount())C.setState(2);else C.setState(0);
+});var n=/^javascript:/,o=/^mailto:([^?]+)(?:\?(.+))?$/,p=/subject=([^;?:@&=$,\/]*)/,q=/body=([^;?:@&=$,\/]*)/,r=/^#(.*)$/,s=/^((?:http|https|ftp|news):\/\/)?(.*)$/,t=/^(_(?:self|top|parent|blank))$/,u=/^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/,v=/^javascript:([^(]+)\(([^)]+)\)$/,w=/\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/,x=/(?:^|,)([^=]+)=(\d+|yes|no)/gi,y=function(B,C){var D=C&&(C.data('cke-saved-href')||C.getAttribute('href'))||'',E,F,G,H,I={};if(E=D.match(n))if(emailProtection=='encode')D=D.replace(u,function(aa,ab,ac){return 'mailto:'+String.fromCharCode.apply(String,ab.split(','))+(ac&&unescapeSingleQuote(ac));});else if(emailProtection)D.replace(v,function(aa,ab,ac){if(ab==compiledProtectionFunction.name){I.type='email';var ad=I.email={},ae=/[^,\s]+/g,af=/(^')|('$)/g,ag=ac.match(ae),ah=ag.length,ai,aj;for(var ak=0;ak<ah;ak++){aj=decodeURIComponent(unescapeSingleQuote(ag[ak].replace(af,'')));ai=compiledProtectionFunction.params[ak].toLowerCase();ad[ai]=aj;}ad.address=[ad.name,ad.domain].join('@');}});if(!I.type)if(G=D.match(r)){I.type='anchor';I.anchor={};I.anchor.name=I.anchor.id=G[1];}else if(F=D.match(o)){var J=D.match(p),K=D.match(q);I.type='email';var L=I.email={};L.address=F[1];J&&(L.subject=decodeURIComponent(J[1]));K&&(L.body=decodeURIComponent(K[1]));}else if(D&&(H=D.match(s))){I.type='url';I.url={};I.url.protocol=H[1];I.url.url=H[2];}else I.type='url';if(C){var M=C.getAttribute('target');I.target={};I.adv={};if(!M){var N=C.data('cke-pa-onclick')||C.getAttribute('onclick'),O=N&&N.match(w);if(O){I.target.type='popup';I.target.name=O[1];var P;while(P=x.exec(O[2])){if((P[2]=='yes'||P[2]=='1')&&!(P[1] in {height:1,width:1,top:1,left:1}))I.target[P[1]]=true;else if(isFinite(P[2]))I.target[P[1]]=P[2];}}}else{var Q=M.match(t);if(Q)I.target.type=I.target.name=M;else{I.target.type='frame';I.target.name=M;}}var R=this,S=function(aa,ab){var ac=C.getAttribute(ab);if(ac!==null)I.adv[aa]=ac||'';};S('advId','id');S('advLangDir','dir');S('advAccessKey','accessKey');I.adv.advName=C.data('cke-saved-name')||C.getAttribute('name')||'';S('advLangCode','lang');S('advTabIndex','tabindex');S('advTitle','title');S('advContentType','type');j.link.synAnchorSelector?I.adv.advCSSClasses=getLinkClass(C):S('advCSSClasses','class');S('advCharset','charset');S('advStyles','style');S('advRel','rel');}var T=I.anchors=[],U;if(j.link.emptyAnchorFix){var V=B.document.getElementsByTag('a');
+for(i=0,count=V.count();i<count;i++){U=V.getItem(i);if(U.data('cke-saved-name')||U.hasAttribute('name'))T.push({name:U.data('cke-saved-name')||U.getAttribute('name'),id:U.getAttribute('id')});}}else{var W=new d.nodeList(B.document.$.anchors);for(var X=0,Y=W.count();X<Y;X++){U=W.getItem(X);T[X]={name:U.getAttribute('name'),id:U.getAttribute('id')};}}if(j.link.fakeAnchor){var Z=B.document.getElementsByTag('img');for(X=0,Y=Z.count();X<Y;X++){if(U=j.link.tryRestoreFakeAnchor(B,Z.getItem(X)))T.push({name:U.getAttribute('name'),id:U.getAttribute('id')});}}this.selectedElement=C;return I;};LiveJournal.register_hook('link_response',function(B){var K=this;var C=B.url,D=B.target||'';if(C.length===0){m.execCommand('unlink');delete K.selectedElement;return;}if(!C.match(/^[a-z+]+:(\/\/)?/))C='http://'+C;var E={};E['data-cke-saved-href']=C;E.href=C;if(D)E.target=D;if(!K.selectedElement){var F=new h('a'),G=m.getSelection();F.setAttributes({'data-cke-saved-href':C,href:C});if(D)F.setAttribute('target',D);F.setText(z||C);m.insertElement(F);}else{var H=K.selectedElement,I=H.data('cke-saved-href'),J=H.getHtml();if(!E[D])H.removeAttribute('target');H.setAttributes(E);delete K.selectedElement;}});var z;LiveJournal.register_hook('link_hide',function(B){if(this.selectedElement)delete this.selectedElement;z='';});var A='LJLink2';m.addCommand(A,{exec:function(B){var C=B.getSelection(),D={},E=null;z=C.getSelectedText();if((E=j.link.getSelectedLink(B))&&E.hasAttribute('href'))C.selectElement(E);else E=null;var F='';if(E){var G=y(B,E).url;F=(G.protocol||'http://')+G.url;}D.defaultText=F;D.hasSelectedText=!!E;D.editMode=!!E;if(E)D.hasTarget=E.hasAttribute('target')?true:false;B.rteButton(A,'link',D);},editorFocus:false});m.ui.addButton(A,{label:m.lang.link.toolbar,command:A});},afterInit:function(m){var n=m.dataProcessor,o=n&&n.dataFilter,p=n&&n.htmlFilter,q=m._.elementsPath&&m._.elementsPath.filters;if(o)o.addRules({elements:{a:function(r){var s=r.attributes;if(!s.name)return null;var t=!r.children.length;if(j.link.synAnchorSelector){var u=t?'cke_anchor_empty':'cke_anchor',v=s['class'];if(s.name&&(!v||v.indexOf(u)<0))s['class']=(v||'')+' '+u;if(t&&j.link.emptyAnchorFix){s.contenteditable='false';s['data-cke-editable']=1;}}else if(j.link.fakeAnchor&&t)return m.createFakeParserElement(r,'cke_anchor','anchor');return null;}}});if(j.link.emptyAnchorFix&&p)p.addRules({elements:{a:function(r){delete r.attributes.contenteditable;}}});if(q)q.push(function(r,s){if(s=='a')if(j.link.tryRestoreFakeAnchor(m,r)||r.getAttribute('name')&&(!r.getAttribute('href')||!r.getChildCount()))return 'anchor';
+});},requires:['fakeobjects']});j.link={getSelectedLink:function(m){try{var n=m.getSelection();if(n.getType()==3){var o=n.getSelectedElement();if(o.is('a'))return o;}var p=n.getRanges(true)[0];p.shrink(2);var q=p.getCommonAncestor();return q.getAscendant('a',true);}catch(r){return null;}},fakeAnchor:b.opera||b.webkit,synAnchorSelector:c,emptyAnchorFix:c&&b.version<8,tryRestoreFakeAnchor:function(m,n){if(n&&n.data('cke-real-element-type')&&n.data('cke-real-element-type')=='anchor'){var o=m.restoreRealElement(n);if(o.data('cke-saved-name'))return o;}}};a.unlinkCommand=function(){};a.unlinkCommand.prototype={exec:function(m){var n=m.getSelection(),o=n.createBookmarks(),p=n.getRanges(),q,r;for(var s=0;s<p.length;s++){q=p[s].getCommonAncestor(true);r=q.getAscendant('a',true);if(!r)continue;p[s].selectNodeContents(r);}n.selectRanges(p);m.document.$.execCommand('unlink',false,null);n.selectBookmarks(o);},startDisabled:true};a.removeAnchorCommand=function(){};a.removeAnchorCommand.prototype={exec:function(m){var n=m.getSelection(),o=n.createBookmarks(),p;if(n&&(p=n.getSelectedElement())&&(j.link.fakeAnchor&&!p.getChildCount()?j.link.tryRestoreFakeAnchor(m,p):p.is('a')))p.remove(1);else if(p=j.link.getSelectedLink(m))if(p.hasAttribute('href')){p.removeAttributes({name:1,'data-cke-saved-name':1});p.removeClass('cke_anchor');}else p.remove(1);n.selectBookmarks(o);}};(function(){function m(p,q,r,s,t,u,v){var w=p.config,x=t.split(';'),y=[],z={};for(var A=0;A<x.length;A++){var B=x[A];if(B){B=B.split('/');var C={},D=x[A]=B[0];C[r]=y[A]=B[1]||D;z[D]=new a.style(v,C);z[D]._.definition.name=D;}else x.splice(A--,1);}p.ui.addRichCombo(q,{label:s.label,title:s.panelTitle,className:'cke_'+(r=='size'?'fontSize':'font'),panel:{css:p.skin.editor.css.concat(w.contentsCss),multiSelect:false,attributes:{'aria-label':s.panelTitle}},init:function(){this.startGroup(s.panelTitle);for(var E=0;E<x.length;E++){var F=x[E];this.add(F,z[F].buildPreview(),F);}},onClick:function(E){p.focus();p.fire('saveSnapshot');var F=z[E];if(this.getValue()==E)F.remove(p.document);else{var G=p.getSelection(),H=parseFloat(z[E]._.definition.styles['font-size']);for(var I in z)z[I].remove(p.document);F.apply(p.document);}p.fire('saveSnapshot');},onRender:function(){p.on('selectionChange',function(E){var F=this.getValue(),G=E.data.path,H=G.elements;for(var I=0,J;I<H.length;I++){J=H[I];for(var K in z){if(z[K].checkElementRemovable(J,true)){if(K!=F)this.setValue(K);return;}}}this.setValue('',u);},this);}});};j.add('ljfont',{requires:['richcombo','styles'],init:function(p){var q=p.config;
+m(p,'ljFontSize','size',p.lang.fontSize,q.fontSize_sizes,q.fontSize_defaultLabel,q.fontSize_style);}});i.font_style={element:'span',styles:{'font-family':'#(family)'},overrides:[{element:'font',attributes:{face:null}}]};var n={tiny:'0.7em',small:'0.9em',normal:'1.0em',large:'1.4em',huge:'1.8em'};i.fontSize_sizes='';for(var o in n)i.fontSize_sizes+=Site.ml_text['talk.font.'+o]+'/'+n[o]+';';i.fontSize_defaultLabel=Site.ml_text['talk.font.normal'];i.fontSize_style={element:'span',styles:{'font-size':'#(size)'},overrides:[{element:'font',attributes:{size:null}}]};})();j.add('ljcut2',{init:function(m){'use strict';var n,o;(function(){var p='LJCut2',q='cut',r='LJCut2',s='lj-cut';function t(y){var z=y.startContainer.getParent(),A=y.endContainer.getParent(),B=y.getCommonAncestor(false);if(B.type===1&&!B.is('ol')&&!B.is('ul'))return;if(y.startContainer.type===3)if(z.is('li'))y.startContainer=z;if(y.endContainer.type===3)if(A.is('li'))y.endContainer=A;};function u(y){if(y.length===0)return;var z=y[0].getParent().clone();y[0].insertBeforeMe(z);y.forEach(function(A){A.move(z);});z.breakParent(z.getParent());return z;};function v(y){var z=y.startContainer.getParent();if((z.is('ul')||z.is('ol'))&&z.getFirst().equals(y.startContainer)){var A=y.endContainer.getParents().filter(function(B){return B.type===1&&(B.is('ul')||B.is('ol'));});if(A.length===0){y.startContainer=y.startContainer.getParent();return true;}}return false;};function w(y){var z=new d.selection(m.document),A=null,B=null,C=null,D=[],E;if(n)A=n;else{t(o);if(o.startContainer.equals(o.endContainer))D.push(o.startContainer);else{var F=o.startContainer;do{D.push(F);F=F.getNextSourceNode(true);}while(F&&!F.equals(o.endContainer));D.push(o.endContainer);}if(D.every(function(N){return N.type===1&&N.is('li');}))A=u(D);else{if(jQuery.browser.safari||jQuery.browser.msie||jQuery.browser.opera){E=new h('div');if(o.startContainer.type===1)o.startContainer.insertBeforeMe(E);else{o.insertNode(E);o.setStartAt(E,4);}}B=o.extractContents();}}var G=new h('iframe',m.document),H=new h('br',m.document);G.setAttributes({'lj-cmd':r,'lj-class':s+' '+s+'-open','class':s+'-wrap',frameBorder:0,allowTransparency:'true'});if(typeof y!=='undefined')G.setAttribute('text',y);var I=G.clone();I.setAttribute('lj-class',s+' '+s+'-close');if(A){G.insertBefore(A);I.insertAfter(A);}else if(B)if(C){I.insertBefore(C);G.insertBefore(I);I.insertBeforeMe(B);}else{if(D&&D[0].type!==3)m.insertHtml('<br id="__dummy"/>');if(E)E.insertBeforeMe(G);else m.insertElement(G);
+I.insertAfter(G);if(B.getChildCount()===0){H.clone().insertAfter(G);H.clone().insertBefore(I);}I.insertBeforeMe(B);var J=m.document.getById('__dummy');if(J)J.remove();m.fire('updateSnapshot');}if(E)E.remove();var K=new d.range(m.document);K.setStartAfter(G);K.setEndBefore(I);z.selectRanges([K]);var L=jQuery(m.document.getBody().$),M=false;L.find('ul, li').toArray().forEach(function(N){if(jQuery(N).text().length===0){jQuery(N).remove();M=true;}});if(M)m.fire('updateSnapshot');};LiveJournal.register_hook('cut_response',function(y){if(x)x.setAttribute('text',y);else{w(y);m.updateFrames();}});var x=null;m.on('selectionChange',function(y){var z=y.data.element;if(z&&z.is('iframe')&&z.getAttribute('lj-cmd')===p)x=z;else x=null;});m.on('contentDom',function(){m.updateFrames();});m.addCommand(p,{exec:function(){var y=new d.selection(m.document);n=y&&y.getSelectedElement();o=y.getRanges()[0];m.rteButton(p,q,{defaultText:x?x.getAttribute('text'):'',editMode:x?true:false});},editorFocus:false});m.ui.addButton(p,{label:CKLang.LJCut_Title,command:p});})();}});(function(){'use strict';var m='LJUser2',n='user',o={};j.add('ljuser2',{init:function(p){var q=null,r=new Image();r.src='/img/preloader/preloader-blue-white-xl.gif';p.on('selectionChange',function(u){var v=u.data.element;p.getCommand(m).setState(v.hasAttribute('data-user')?1:2);q=v.hasAttribute('data-user')?v:null;});function s(u){if(!u)return;var v=new d.range(p.document),w,x;if(u.is('img')){w=u;x=u.getNextSourceNode(true,1);}else{x=u;w=u.getPreviousSourceNode(true,1);}var y=p.document.getSelection();if(x&&w){v.setStartBefore(w);v.setEndAfter(x);if(y)y.selectRanges([v]);}else y.selectElement(u);return x||u;};p.on('contentDom',function(){this.document.on('keydown',function(u){var v=p.document.getSelection(),w=v&&v.getRanges()[0];if(w.collapsed&&u.data.getKey()===8){var x=w.getTouchedEndNode();if(x.type===3)x=x.getParent();if(x.hasAttribute('data-user')){u.data.preventDefault();s(x);}}});this.document.on('click',function(u){var v=u.data.getTarget();if(v&&v.hasAttribute('data-user'))s(v);});});function t(u,v){var w=new h('img'),x=new h('a');w.setAttributes({src:r.src,width:'16',height:'16','data-user':u.journal,'data-title':v});w.setStyle('cursor','default');var y=new Image();y.onload=function(){o[u.journal]=u.userhead_url;w.setAttribute('src',y.src);p.fire('updateSnapshot');};y.src=u.userhead_url;x.setAttributes({href:'#','data-cke-saved-href':'#','data-user':u.journal,'data-title':v,seen:true});x.setStyles({color:'blue',fontWeight:'bold'});
+x.setText(v||u.journal);p.insertElement(w);p.insertElement(x);p.fire('updateSnapshot');};LiveJournal.register_hook('user_response',function(u,v){if(u&&u.hasOwnProperty('ljuser'))t(u.ljuser,v);});p.addCommand(m,{exec:function(u){if(q){var v=q.getAttribute('data-user'),w=q.getAttribute('data-title');u.rteButton(m,n,{user:v,title:w,fromRte:true});}else u.rteButton(m,n);}});p.ui.addButton(m,{label:m,command:m});p.dataProcessor.htmlFilter.addRules({elements:{img:function(u){if(u.attributes['data-user'])return false;return u;},a:function(u){var v=u;if(u.attributes['data-user']){v=new a.htmlParser.element('lj');v.isEmpty=true;v.isOptionalClose=true;if(u.attributes.hasOwnProperty('data-user'))v.attributes.user=u.attributes['data-user'];if(u.attributes['data-title'])v.attributes.title=u.attributes['data-title'];return v;}else return u;}}});p.on('doubleclick',function(u){var v=u.data.element;if(v&&v.hasAttribute('data-user')){s(v);p.execFromEditor=true;p.execCommand(m);}});p.on('contentDom',function(){var u=jQuery(a.instances.ck.document.$);u.find('a[data-user]').each(function(v,w){if(w.seen)return;var x=w.getAttribute('data-user'),y=jQuery('<img/>',{style:'cursor: default; width: 16px; height: 16px;','data-user':x,'data-title':w.getAttribute('data-title'),src:o[x]||r.src}).insertBefore(jQuery(w));if(!o[x])LJ.Api.call('ljuser.get',{user:w.getAttribute('data-user'),raw:1},function(z){o[x]=z.ljuser.userhead_url;y.attr('src',z.ljuser.userhead_url);w.seen=true;});});});p.dataProcessor.dataFilter.addRules({elements:{lj:function(u){var v=u.attributes.user,w=new a.htmlParser.element('a');w.add(new a.htmlParser.text(u.attributes.title||v));w.attributes.href='#';w.attributes['data-cke-saved-href']='#';w.attributes.style='font-weight: bold; color: #00C;';w.attributes['data-user']=v;w.attributes['data-title']=u.attributes.title||'';return w;}}});}});})();(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);a.editorConfig=function(m){'use strict';j.addExternal('ljcolor','plugins/lj/ljcolor/plugin.js');j.addExternal('ljlink','plugins/lj/ljlink/plugin.js');j.addExternal('ljfont','plugins/lj/ljfont/plugin.js');j.addExternal('ljcut2','plugins/lj/ljcut/plugin.js');j.addExternal('ljuser2','plugins/lj/ljuser/plugin.js');j.addExternal('ljautogrow','plugins/lj/ljautogrow/plugin.js');var n=[Site.page.ljpost?'livejournal':'livejournal_old','ljcolor','ljlink'],o=['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)n.push('ljautogrow','ljspell','ljfont','ljcut2','ljuser2');else o.push('dialog','image','link','font');m.language='ru';m.autoParagraph=false;m.autoUpdateElement=false;m.docType='<!DOCTYPE html>';if(Site.page.ljpost){m.contentsCss='/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.fillEmptyBlocks=false;if(Site.is_dev_server)m.extraPlugins=n.join(',');else Array.prototype.push.apply(o,n);m.plugins=o.join(',');m.contentsLangDirection='ltr';m.fillEmptyBlocks=false;m.tabIndex=41;m.tabSpaces=2;m.startupShowBorders=false;m.toolbarCanCollapse=false;m.disableNativeSpellChecker=Site.page.ljpost?true:false;var p=[];function q(r,s){return r?s:undefined;};if(Site.page.ljpost)p=['Bold','Italic','Underline','Strike','LJFont','LJColor','-','LJLink2','LJUser2','-','LJImage',q(Site.media_embed_enabled,'LJEmbedLink'),'LJCut2','LJSpoiler','LJMap','LJLike','LJPollLink','NumberedList','BulletedList','LJJustifyLeft','LJJustifyCenter','LJJustifyRight','LJSpell','Undo','Redo'];else p=['Bold','Italic','Underline','Strike','TextColor','FontSize','-','LJLink','LJUserLink','image',q(Site.media_embed_enabled,'LJEmbedLink'),'LJPollLink','LJCutLink','LJCut','LJLike','LJSpoiler','-','UnorderedList','OrderedList','NumberedList','BulletedList','-','LJJustifyLeft','LJJustifyCenter','LJJustifyRight','-','Undo','Redo'];
+m.toolbar_Full=[p.filter(function(r){return r;})];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);};a.editorConfig(i);})();

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