spacevillain (spacevillain) wrote in changelog,
spacevillain
spacevillain
changelog

[livejournal] r22243: LJSUP-12397: Implement spellchecker in t...

Committer: atyurin
LJSUP-12397: Implement spellchecker in the rte editor
U   trunk/htdocs/js/ck/ckeditor.js
Modified: trunk/htdocs/js/ck/ckeditor.js
===================================================================
--- trunk/htdocs/js/ck/ckeditor.js	2012-06-14 13:38:40 UTC (rev 22242)
+++ trunk/htdocs/js/ck/ckeditor.js	2012-06-14 13:42:08 UTC (rev 22243)
@@ -135,5 +135,9 @@
 M+=P.html;}}M+='</span>';if(L.length){if(N){o.LJLike.node.setAttribute('buttons',L.join(','));o.LJLike.node.setAttribute('lj-content',encodeURIComponent(M));}else{N=new h('iframe',t.document);N.setAttribute('lj-class','lj-like');N.setAttribute('class','lj-like-wrap');N.setAttribute('buttons',L.join(','));N.setAttribute('lj-content',encodeURIComponent(M));N.setAttribute('lj-cmd','LJLike');N.setAttribute('frameBorder',0);N.setAttribute('allowTransparency','true');t.insertElement(N);}}else if(N)o.LJLike.node.remove();G.hide();}}),a.dialog.cancelButton];b.mac&&K.reverse();return{title:m.LJLike_name,width:145,height:Site.remote_is_sup?180:145,resizable:false,contents:[{id:'LJLike_Options',elements:[{type:'html',html:E}]}],onShow:function(){var L=t.getCommand('LJLike'),M=F=0,N=L.state==1,O=o.LJLike.node&&o.LJLike.node.getAttribute('buttons');a.note&&a.note.hide(true);for(;M<D;M++){var P=O?!!(O.indexOf(n[M].abbr)+1||O.indexOf(n[M].id)+1):true,Q=document.getElementById('like-'+n[M].abbr);if(Q){if(P&&!N)F++;Q.checked=P;}}if(F>0)G.getButton('LJLike_Ok').getElement().removeClass('btn-disabled');},onLoad:function(){G=this;H=G.parts.contents.getElementsByTag('input');for(var L=0;L<D;L++){var M=H.getItem(L);M&&M.on('click',C);}},buttons:K};});t.addCommand('LJLike',new a.dialogCommand('LJLikeDialog'));t.ui.addButton('LJLike',{label:m.LJLike_name,command:'LJLike'});})();},afterInit:function(t){var u=t.dataProcessor;function v(w,x,y,z){z=z||'text';var A=new a.htmlParser.element('iframe');A.attributes['lj-class']=x+' '+x+'-open';A.attributes['class']=x+'-wrap';A.attributes['lj-cmd']=y;A.attributes.frameBorder=0;A.attributes.allowTransparency='true';if(w.attributes.hasOwnProperty(z))A.attributes.text=w.attributes[z];w.children.unshift(A);var B=new a.htmlParser.element('iframe');B.attributes['lj-class']=x+' '+x+'-close';B.attributes['class']=x+'-wrap';B.attributes.frameBorder=0;B.attributes.allowTransparency='true';w.children.push(B);delete w.name;};u.dataFilter.addRules({elements:{'lj-like':function(w){var x=[],y=new a.htmlParser.element('iframe');y.attributes['lj-class']='lj-like';y.attributes['class']='lj-like-wrap';if(w.attributes.hasOwnProperty('style'))y.attributes['lj-style']=w.attributes.style;y.attributes['lj-cmd']='LJLike';y.attributes['lj-content']='<span class="lj-like-wrapper">';y.attributes.frameBorder=0;y.attributes.allowTransparency='true';var z=w.attributes.buttons&&w.attributes.buttons.split(',')||n.defaultButtons,A=z.length;for(var B=0;B<A;B++){var C=z[B].replace(/^\s*([a-z]{2,})\s*$/i,'$1'),D=n[C];
 if(D){y.attributes['lj-content']+=encodeURIComponent(D.html);x.push(C);}}y.attributes['lj-content']+='</span>';y.attributes.buttons=x.join(',');return y;},lj:(function(){function w(x){var y=t.document.getElementsByTag('lj');for(var z=0,A=y.count();z<A;z++){var B=y.getItem(z);if(B){var C=B.getAttribute('user'),D=B.getAttribute('title');if(x==(D?C+':'+D:C)){var E=new h.createFromHtml(p[x],t.document);E.setAttribute('lj-cmd','LJUserLink');B.insertBeforeMe(E);B.remove();}}}t.removeListener('dataReady',w);};return function(x){var y=x.attributes.user;if(!y||!y.length)return;var z=x.attributes.title,A=z?y+':'+z:y;if(p.hasOwnProperty(A)){var B=new a.htmlParser.fragment.fromHtml(p[A]).children[0];B.attributes['lj-cmd']='LJUserLink';return B;}else{var C={username:y};if(z)C.usertitle=z;HTTPReq.getJSON({data:HTTPReq.formEncoded(C),method:'POST',url:Site.siteroot+'/tools/endpoints/ljuser.bml',onError:function(D){alert(D+' "'+y+'"');},onData:function(D){if(D.error)return alert(D.error+' "'+y+'"');if(!D.success)return;p[A]=D.ljuser;D.ljuser=D.ljuser.replace('<span class="useralias-value">*</span>','');if(t.document)w(A);else t.on('dataReady',function(){w(A);});}});}};})(),'lj-map':function(w){var x=new a.htmlParser.element('iframe'),y='',z='',A=Number(w.attributes.width),B=Number(w.attributes.height);if(!isNaN(A)){y+='width:'+A+'px;';z+='width:'+(A-2)+'px;';}if(!isNaN(B)){y+='height:'+B+'px;';z+='height:'+(B-2)+'px;';}if(y.length){x.attributes.style=y;x.attributes['lj-style']=z;}x.attributes['lj-url']=w.attributes.url?encodeURIComponent(w.attributes.url):'';x.attributes['lj-class']='lj-map';x.attributes['class']='lj-map-wrap';x.attributes['lj-content']='<p class="lj-map">map</p>';x.attributes.frameBorder=0;x.attributes.allowTransparency='true';return x;},'lj-raw':function(w){w.name='lj:raw';},'lj-wishlist':function(w){w.name='lj:wishlist';},'lj-template':function(w){var x=new a.htmlParser.element('iframe');x.attributes['lj-class']='lj-template';x.attributes['class']='lj-template-wrap';x.attributes.frameBorder=0;x.attributes.allowTransparency='true';x.attributes['lj-attributes']=encodeURIComponent(LiveJournal.JSON.stringify(w.attributes));return x;},'lj-cut':function(w){v(w,'lj-cut','LJCut');},'lj-spoiler':function(w){v(w,'lj-spoiler','LJSpoiler','title');},iframe:function(w){if(w.attributes['lj-class']&&w.attributes['lj-class'].indexOf('lj-')+1==1)return w;var x=new a.htmlParser.element('iframe'),y='',z='',A=Number(w.attributes.width),B=Number(w.attributes.height);if(!isNaN(A)){y+='width:'+A+'px;';
 z+='width:'+(A-2)+'px;';}if(!isNaN(B)){y+='height:'+B+'px;';z+='height:'+(B-2)+'px;';}if(y.length){x.attributes.style=y;x.attributes['lj-style']=z;}x.attributes['lj-url']=w.attributes.src?encodeURIComponent(w.attributes.src):'';x.attributes['lj-class']='lj-iframe';x.attributes['class']='lj-iframe-wrap';x.attributes['lj-content']='<p class="lj-iframe">iframe</p>';x.attributes.frameBorder=0;x.attributes.allowTransparency='true';return x;},a:function(w){if(w.parent.attributes&&!w.parent.attributes['lj:user'])w.attributes['lj-cmd']='LJLink';},img:function(w){var x=w.parent&&w.parent.parent;if(!x||!x.attributes||!x.attributes['lj:user'])w.attributes['lj-cmd']='image';},div:function(w){if(w.attributes['class']=='lj-cut')v(w,'lj-cut','LJCut');}}},5);u.htmlFilter.addRules({elements:{iframe:function(w){var x=w,y=false,z='text',A=/lj-[a-z]+/i.exec(w.attributes['lj-class']);if(A)A=A[0];else return w;switch(A){case 'lj-like':x=new a.htmlParser.element('lj-like');x.attributes.buttons=w.attributes.buttons;if(w.attributes.hasOwnProperty('lj-style'))x.attributes.style=w.attributes['lj-style'];x.isEmpty=true;x.isOptionalClose=true;break;case 'lj-embed':x=new a.htmlParser.element('lj-embed');x.attributes.id=w.attributes.id;if(w.attributes.hasOwnProperty('source_user'))x.attributes.source_user=w.attributes.source_user;x.children=new a.htmlParser.fragment.fromHtml(decodeURIComponent(w.attributes['lj-data'])).children;x.isOptionalClose=true;break;case 'lj-map':x=new a.htmlParser.element('lj-map');x.attributes.url=decodeURIComponent(w.attributes['lj-url']);w.attributes.style&&(w.attributes.style+';').replace(/([a-z-]+):(.*?);/gi,function(F,G,H){x.attributes[G.toLowerCase()]=parseInt(H);});x.isOptionalClose=x.isEmpty=true;break;case 'lj-iframe':x=new a.htmlParser.element('iframe');x.attributes.src=decodeURIComponent(w.attributes['lj-url']);w.attributes.style&&(w.attributes.style+';').replace(/([a-z-]+):(.*?);/gi,function(F,G,H){x.attributes[G.toLowerCase()]=parseInt(H);});x.attributes.frameBorder=0;break;case 'lj-poll':x=new a.htmlParser.fragment.fromHtml(decodeURIComponent(w.attributes['lj-data'])).children[0];break;case 'lj-repost':x=new a.htmlParser.element('lj-repost');x.attributes.button=w.attributes['lj-button'];x.children=new a.htmlParser.fragment.fromHtml(w.attributes['lj-text']).children;break;case 'lj-template':x=new a.htmlParser.element('lj-template');x.attributes=LiveJournal.JSON.parse(encodeURIComponent(w.attributes['lj-attributes']));x.isOptionalClose=x.isEmpty=true;
-break;case 'lj-spoiler':y=true;z='title';case 'lj-cut':if(w.attributes['lj-class'].indexOf(A+'-open')+1){var B=w.next,C=0;x=new a.htmlParser.element(A);if(w.attributes.hasOwnProperty('text'))x.attributes[z]=w.attributes.text;while(B){if(B.name=='iframe'){var D=B.attributes['lj-class'];if(D.indexOf(A+'-close')+1){if(y&&C)C--;else{x.next=B;break;}}else if(D.indexOf(A+'-open')+1)if(y)C++;else{x.next=B;break;}}B.parent.children.remove(B);x.add(B);var E=B.next;B.next=null;B=E;}}else x=false;break;default:if(!w.children.length)x=false;}return x;},span:function(w){var x=w.attributes['lj:user'];if(x){var y=new a.htmlParser.element('lj');y.attributes.user=x;try{var z=w.children[1].children[0].children[0].value;}catch(A){return false;}if(z&&z!=x)y.attributes.title=z;y.isOptionalClose=y.isEmpty=true;return y;}else if(w.attributes.style=='display: none;'||!w.children.length)return false;},div:function(w){if(!w.children.length)return false;},'lj:raw':function(w){w.name='lj-raw';},'lj:wishlist':function(w){w.name='lj-wishlist';}},attributes:{'lj-cmd':function(){return false;},contenteditable:function(){return false;}}});},requires:['fakeobjects','domiterator']});})();j.add('ljspell',{requires:['menu'],onLoad:function(){j.ljspell=e.createClass({base:a.menu,$:function(m){LJ.console.log(arguments);this.base.call(this,m,{panel:{className:m.skinClass+' cke_contextmenu',attributes:{'aria-label':m.lang.contextmenu.options}}});},proto:{addTarget:function(m,n){m.on('mousedown',function(o){LJ.console.log(arguments);});}}});},beforeInit:function(m){m.ljspell=new j.ljspell(m);}});a.editorConfig=function(m){m.language='ru';m.autoParagraph=false;m.autoUpdateElement=false;m.docType='<!DOCTYPE html>';m.contentsCss='/js/ck/contents.css?t='+Site.version;m.plugins=['ajax','basicstyles','bidi','blockquote','button','colorbutton','colordialog','dialog','enterkey','entities','font','format','htmldataprocessor','image','keystrokes','link','list','liststyle','pastefromword','specialchar','tab','table','toolbar','undo','wysiwygarea','onchange','livejournal'].join(',');if(jQuery.browser.msie||jQuery.browser.opera)m.plugins+=',contextmenu';m.autoGrow_maxHeight=400;m.contentsLangDirection='ltr';m.fillEmptyBlocks=false;m.tabIndex=1;m.tabSpaces=2;m.startupShowBorders=false;m.toolbarCanCollapse=false;m.disableNativeSpellChecker=false;m.toolbar_Full=[['Bold','Italic','Underline','Strike','TextColor','FontSize','-','LJLink','LJUserLink','image']];if(top.Site.media_embed_enabled)m.toolbar_Full[0].push('LJEmbedLink');
-m.toolbar_Full[0].push('LJPollLink','LJCutLink','LJCut','LJLike','LJSpoiler','-','UnorderedList','OrderedList','NumberedList','BulletedList','-','LJJustifyLeft','LJJustifyCenter','LJJustifyRight','-','Undo','Redo');m.enterMode=2;m.shiftEnterMode=1;m.keystrokes=[[2228224+121,'contextMenu'],[1114112+90,'undo'],[1114112+89,'redo'],[1114112+2228224+90,'redo'],[1114112+76,'link'],[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;m.protectedSource.push(/<lj-poll-\d+\s*\/?>/gi);m.protectedSource.push(/<lj-replace name="first_post"\s*\/?>/gi);};a.editorConfig(i);})();
+break;case 'lj-spoiler':y=true;z='title';case 'lj-cut':if(w.attributes['lj-class'].indexOf(A+'-open')+1){var B=w.next,C=0;x=new a.htmlParser.element(A);if(w.attributes.hasOwnProperty('text'))x.attributes[z]=w.attributes.text;while(B){if(B.name=='iframe'){var D=B.attributes['lj-class'];if(D.indexOf(A+'-close')+1){if(y&&C)C--;else{x.next=B;break;}}else if(D.indexOf(A+'-open')+1)if(y)C++;else{x.next=B;break;}}B.parent.children.remove(B);x.add(B);var E=B.next;B.next=null;B=E;}}else x=false;break;default:if(!w.children.length)x=false;}return x;},span:function(w){var x=w.attributes['lj:user'];if(x){var y=new a.htmlParser.element('lj');y.attributes.user=x;try{var z=w.children[1].children[0].children[0].value;}catch(A){return false;}if(z&&z!=x)y.attributes.title=z;y.isOptionalClose=y.isEmpty=true;return y;}else if(w.attributes.style=='display: none;'||!w.children.length)return false;},div:function(w){if(!w.children.length)return false;},'lj:raw':function(w){w.name='lj-raw';},'lj:wishlist':function(w){w.name='lj-wishlist';}},attributes:{'lj-cmd':function(){return false;},contenteditable:function(){return false;}}});},requires:['fakeobjects','domiterator']});})();(function(m,n){var o;function p(B){return B.type==3&&B.getLength()>0&&(!o||!B.isReadOnly());};function q(B){return!(B.type==1&&B.isBlockBoundary(e.extend({},f.$empty,f.$nonEditable)));};var r=function(){var B=this;return{textNode:B.textNode,offset:B.offset,character:B.textNode?B.textNode.getText().charAt(B.offset):null,hitMatchBoundary:B._.matchBoundary};},s,t=function(B,C){s=new a.style(e.extend({attributes:{'data-cke-highlight':1,'data-incorrect':1,'data-id':0},fullMatch:1,ignoreReadonly:1,childRule:function(){return 1;}},{element:'span',styles:{'border-bottom':'1px solid red',cursor:'pointer'}},true));var D=function(P,Q){var R=this,S=new d.walker(P);S.guard=Q?q:function(T){!q(T)&&(R._.matchBoundary=true);};S.evaluator=p;S.breakOnFalse=1;if(P.startContainer.type==3){this.textNode=P.startContainer;this.offset=P.startOffset-1;}this._={matchWord:Q,walker:S,matchBoundary:false};};D.prototype={next:function(){return this.move();},back:function(){return this.move(true);},move:function(P){var R=this;var Q=R.textNode;if(Q===null)return r.call(R);R._.matchBoundary=false;if(Q&&P&&R.offset>0){R.offset--;return r.call(R);}else if(Q&&R.offset<Q.getLength()-1){R.offset++;return r.call(R);}else{Q=null;while(!Q){Q=R._.walker[P?'previous':'next'].call(R._.walker);if(R._.matchWord&&!Q||R._.walker._.end)break;}R.textNode=Q;if(Q)R.offset=P?Q.getLength()-1:0;
+else R.offset=0;}return r.call(R);}};var E=function(P,Q){this._={walker:P,cursors:[],rangeLength:Q,highlightRange:null,isMatched:0};};E.prototype={toDomRange:function(){var P=new d.range(B.document),Q=this._.cursors;if(Q.length<1){var R=this._.walker.textNode;if(R)P.setStartAfter(R);else return null;}else{var S=Q[0],T=Q[Q.length-1];P.setStart(S.textNode,S.offset);P.setEnd(T.textNode,T.offset+1);}return P;},updateFromDomRange:function(P){var S=this;var Q,R=new D(P);S._.cursors=[];do{Q=R.next();if(Q.character)S._.cursors.push(Q);}while(Q.character);S._.rangeLength=S._.cursors.length;},setMatched:function(){this._.isMatched=true;},clearMatched:function(){this._.isMatched=false;},isMatched:function(){return this._.isMatched;},highlight:function(){var S=this;if(S._.cursors.length<1)return;if(S._.highlightRange)S.removeHighlight();var P=S.toDomRange(),Q=P.createBookmark();s.applyToRange(P);P.moveToBookmark(Q);S._.highlightRange=P;var R=P.startContainer;if(R.type!=1)R=R.getParent();R.scrollIntoView();S.updateFromDomRange(P);},highlightx:function(){var R=this;if(R._.cursors.length<1)return;if(R._.highlightRange)R.removeHighlight();var P=R.toDomRange(),Q=P.createBookmark();P.moveToBookmark(Q);R.updateFromDomRange(P);},removeHighlight:function(P){var R=this;if(!R._.highlightRange)return;var Q=R._.highlightRange.createBookmark();s.removeFromRange(P||R._.highlightRange);R._.highlightRange.moveToBookmark(Q);R.updateFromDomRange(R._.highlightRange);R._.highlightRange=null;},isReadOnly:function(){if(!this._.highlightRange)return 0;return this._.highlightRange.startContainer.isReadOnly();},moveBack:function(){var R=this;var P=R._.walker.back(),Q=R._.cursors;if(P.hitMatchBoundary)R._.cursors=Q=[];Q.unshift(P);if(Q.length>R._.rangeLength)Q.pop();return P;},moveNext:function(){var R=this;var P=R._.walker.next(),Q=R._.cursors;if(P.hitMatchBoundary)R._.cursors=Q=[];Q.push(P);if(Q.length>R._.rangeLength)Q.shift();return P;},getEndCharacter:function(){var P=this._.cursors;if(P.length<1)return null;return P[P.length-1].character;},getNextCharacterRange:function(P){var Q,R,S=this._.cursors;if((Q=S[S.length-1])&&Q.textNode)R=new D(F(Q));else R=this._.walker;return new E(R,P);},getCursors:function(){return this._.cursors;}};function F(P,Q){var R=new d.range();R.setStart(P.textNode,Q?P.offset:P.offset+1);R.setEndAt(B.document.getBody(),2);return R;};function G(P){var Q=new d.range();Q.setStartAt(B.document.getBody(),1);Q.setEnd(P.textNode,P.offset);return Q;};var H=0,I=1,J=2,K=function(P,Q){var R=[-1];
+if(Q)P=P.toLowerCase();for(var S=0;S<P.length;S++){R.push(R[S]+1);while(R[S+1]>0&&P.charAt(S)!=P.charAt(R[S+1]-1))R[S+1]=R[R[S+1]-1]+1;}this._={overlap:R,state:0,ignoreCase:!!Q,pattern:P};};K.prototype={feedCharacter:function(P){var Q=this;if(Q._.ignoreCase)P=P.toLowerCase();for(;;){if(P==Q._.pattern.charAt(Q._.state)){Q._.state++;if(Q._.state==Q._.pattern.length){Q._.state=0;return J;}return I;}else if(!Q._.state)return H;else Q._.state=Q._.overlap[Q._.state];}return null;},reset:function(){this._.state=0;}};var L=/[.,"'?!;: \u0085\u00a0\u1680\u280e\u2028\u2029\u202f\u205f\u3000]/,M=function(P){if(!P)return true;var Q=P.charCodeAt(0);return Q>=9&&Q<=13||Q>=8192&&Q<=8202||L.test(P);},N={searchRange:null,matchRange:null,find:function(P,Q,R,S,T,U){var ad=this;if(!ad.matchRange)ad.matchRange=new E(new D(ad.searchRange),P.length);else ad.matchRange=ad.matchRange.getNextCharacterRange(P.length);var V=new K(P,!Q),W=H,X='%';while(X!==null){ad.matchRange.moveNext();while(X=ad.matchRange.getEndCharacter()){W=V.feedCharacter(X);if(W==J)break;if(ad.matchRange.moveNext().hitMatchBoundary)V.reset();}if(W==J){var Y=ad.matchRange.getCursors(),Z=Y[Y.length-1],aa=Y[0],ab=new D(G(aa),true),ac=new D(F(Z),true);if(!(M(ab.back().character)&&M(ac.next().character)))continue;ad.matchRange.setMatched();if(T!==false)ad.matchRange.highlightx();return ad.matchRange;}}if(S&&!U){ad.searchRange=u(1);ad.matchRange=null;return arguments.callee.apply(ad,Array.prototype.slice.call(arguments).concat([true]));}return false;}},O=B.lang.findAndReplace;return N;};function u(B,C){var D,E=C.getSelection(),F=C.document.getBody();if(E&&!B){D=E.getRanges()[0].clone();D.collapse(true);}else{D=new d.range();D.setStartAt(F,1);}D.setEndAt(F,2);return D;};j.add('ljspell',{options:{classNames:{wordActive:'active',area:'b-spelling-textarea',skipError:'b-spelling-item-skip',bubbleContainer:'b-spelling-bubble',bubbleNoSuggestions:'b-spelling-item-no'},selectors:{bubbleItem:'.b-spelling-item',fake:'.b-spelling-faketextarea',error:'.b-spelling-error'},tmpl:{spellError:'<span class="b-spelling-word b-spelling-error" data-id="{id}"><span class="b-spelling-inner">{word}</span></span>',wrapper:'<div class="b-spelling"><div class="b-spelling-faketextarea"></div></div>',bubble:'<div class="b-spelling-bubble-container"></div>',bubbleList:'<ul class="b-spelling-items">{items}</ul>',bubbleItem:'<li class="b-spelling-item"><span class="b-spelling-item-word">{word}</span></li>',bubbleItemNoSuggestions:'<li class="b-spelling-item b-spelling-item-no"><span class="b-spelling-item-word">'+LiveJournal.getLocalizedStr('widget.form.no_suggestions')+'</span></li>'},enabled:false},init:function(B){var C=this,D=(function(E){var F,G,H;
+return{save:function(){F=E.getSelection();G=F.getRanges()[0];H=G.createBookmark(true);E.focusManager.blur();E.focusManager.forceBlur();},restore:function(){F.unlock();G.moveToBookmark(H);E.getSelection().selectRanges([G]);}};})(B);B.on('contentDom',function(){var E=m(this.document.getBody().$),F=m('#cke_ck'),G=C.options,H=m(G.tmpl.bubble);H.bubble({showOn:'click',alwaysShowUnderTarget:true,classNames:{containerAddClass:G.classNames.bubbleContainer}});E.on('click','span[data-incorrect]',function(I){var J=m(this),K=A[J.attr('data-word')].map(function(L){return G.tmpl.bubbleItem.supplant({word:L});});if(K.length===0)K.push(G.tmpl.bubbleItemNoSuggestions);H.html(G.tmpl.bubbleList.supplant({items:K.join('')})).off('click').on('click',G.selectors.bubbleItem,function(){if(m(this).hasClass(G.classNames.bubbleNoSuggestions))return;var L=E.find('span[data-id="'+J.attr('data-id')+'"]');m(L[0]).replaceWith(m(this).text());if(L.length>1)L.slice(1).detach();H.bubble('hide');}).bubble('hide').bubble('show',F).bubble('absolute',I.clientX,I.clientY+F.offset().top+60);});});a.ljspell={id:0,getWordRanges:function(E){var F=[];this.finder.searchRange=u(1,B);this.finder.matchRange=null;while((range=this.finder.find(E,false,false,false))!==false)F.push(range);return F;},highlightWord:function(E){var F=this;D.save();var G=s._.definition.attributes;G['data-word']=E;this.getWordRanges(E).forEach(function(H){G['data-id']=F.id++;H.highlight();});D.restore();},removeHighlight:function(E){D.save();m('span[data-incorrect]',B.document.getBody().$).each(function(F,G){jQuery(G).replaceWith(jQuery(G).html());});D.restore();this.id=0;}};B.dataProcessor.htmlFilter.addRules({elements:{span:function(E){if(E.attributes['data-incorrect']||E.attributes['data-id']){delete E.name;var F=E.children[0];if(F)F.value=F.value.replace(/\&nbsp;/,' ');return E;}}}});a.ljspell.finder=t(B);B.on('change',function(E){z(m(E.editor.document.getBody().$).text(),function(F){a.ljspell.removeHighlight();m.extend(v,F);for(var G in v)a.ljspell.highlightWord(G);});});}});var v={},w=false,x={},y=null;function z(B,C){if(y)clearTimeout(y);y=setTimeout(function(){var D={},E=B.replace(/\&nbsp;/ig,' ').match(/[a-zа-яё]+/gi),F;if(!E)return;for(F=0;F<E.length;F++)D[E[F]]=1;var G=Object.keys(x);for(F=0;F<G.length;F++){if(D[G[F]])delete D[G[F]];}for(F=0;F<E.length;F++)x[E[F].toLowerCase()]=1;m.ajax({url:LiveJournal.getAjaxUrl('spellcheck'),type:'POST',dataType:'json',data:{html:Object.keys(D).join(' ')},success:function(H){C(H.words);
+m.extend(A,H.words);}});},1000);};var A={};})(jQuery,window);a.editorConfig=function(m){var n=['ljspell','livejournal'],o=['ajax','basicstyles','bidi','blockquote','button','colorbutton','colordialog','dialog','enterkey','entities','font','format','htmldataprocessor','image','keystrokes','link','list','liststyle','pastefromword','specialchar','tab','table','toolbar','undo','wysiwygarea','onchange'];m.language='ru';m.autoParagraph=false;m.autoUpdateElement=false;m.docType='<!DOCTYPE html>';m.contentsCss='/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(',');if(jQuery.browser.msie||jQuery.browser.opera)m.plugins+=',contextmenu';m.autoGrow_maxHeight=400;m.contentsLangDirection='ltr';m.fillEmptyBlocks=false;m.tabIndex=1;m.tabSpaces=2;m.startupShowBorders=false;m.toolbarCanCollapse=false;m.disableNativeSpellChecker=false;m.toolbar_Full=[['Bold','Italic','Underline','Strike','TextColor','FontSize','-','LJLink','LJUserLink','image']];if(top.Site.media_embed_enabled)m.toolbar_Full[0].push('LJEmbedLink');m.toolbar_Full[0].push('LJPollLink','LJCutLink','LJCut','LJLike','LJSpoiler','-','UnorderedList','OrderedList','NumberedList','BulletedList','-','LJJustifyLeft','LJJustifyCenter','LJJustifyRight','-','Undo','Redo');m.enterMode=2;m.shiftEnterMode=1;m.keystrokes=[[2228224+121,'contextMenu'],[1114112+90,'undo'],[1114112+89,'redo'],[1114112+2228224+90,'redo'],[1114112+76,'link'],[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;m.protectedSource.push(/<lj-poll-\d+\s*\/?>/gi);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