spacevillain (spacevillain) wrote in changelog,
spacevillain
spacevillain
changelog

[livejournal] r23437: LJSUP-14512: Disable livejournal spellch...

Committer: atyurin
LJSUP-14512: Disable livejournal spellchecker for every browser except IE
U   trunk/htdocs/js/ck/ckeditor.js
U   trunk/htdocs/js/ck/config.js
Modified: trunk/htdocs/js/ck/ckeditor.js
===================================================================
--- trunk/htdocs/js/ck/ckeditor.js	2012-12-06 14:20:37 UTC (rev 23436)
+++ trunk/htdocs/js/ck/ckeditor.js	2012-12-06 15:28:40 UTC (rev 23437)
@@ -158,5 +158,5 @@
 G++){H=E[G];for(I in t){if(t[I].checkElementRemovable(H,true)){if(I!==v){B(I);F.setState(1);}return;}}}B(u);F.setState(2);});},requires:['styles']});i.font_style={element:'span',styles:{'font-family':'#(family)'},overrides:[{element:'font',attributes:{face:null}}]};var n={tiny:'0.7em',small:'0.9em',normal:'1.0em',large:'1.4em',huge:'1.8em'};i.fontSize_sizes='';for(var o in n)i.fontSize_sizes+=Site.ml_text['talk.font.'+o]+'/'+n[o]+';';i.fontSize_defaultLabel=Site.ml_text['talk.font.normal'];i.fontSize_style={element:'span',styles:{'font-size':'#(size)'},overrides:[{element:'font',attributes:{size:null}}]};})(jQuery);(function(m){'use strict';var n={LJCut:{tag:'lj-cut',widget:'cut'},LJSpoiler:{tag:'lj-spoiler',widget:'spoiler'}};j.add('ljcut',{init:function(o){var p,q,r=null;function s(y){var z=y;while(!z.getParent().is('body'))z=z.getParent();if(z!==y)y.breakParent(z);};function t(){var y=jQuery(o.document.getBody().$),z=false;y.find('ul, ol, li').each(function(){if(m(this).text().length===0){m(this).remove();z=true;}});};function u(y,z){var A=new d.selection(o.document),B=false,C=n[y].tag,D=new h('iframe',o.document),E=new h('br',o.document);D.setAttributes({'lj-cmd':y,'lj-class':C+' '+C+'-open','class':C+'-wrap',frameBorder:0,allowTransparency:'true'});if(typeof z!=='undefined')D.setAttribute('text',z);var F=D.clone();F.setAttribute('lj-class',C+' '+C+'-close');if(q.cloneContents().getChildCount()===0)B=true;q.insertNode(D);q.collapse();q.insertNode(F);s(D);s(F);if(B){E.clone().insertAfter(D);E.clone().insertBefore(F);}var G=new d.range(o.document);G.setStartAfter(D);G.setEndBefore(F);A.selectRanges([G]);o.focus();t();};function v(y,z){if(r&&r.getAttribute('lj-cmd')===y)r.setAttribute('text',z);else{u(y,z===Site.page.rtedata[y+'_PromptText']?undefined:z);o.updateFrames();}};function w(y,z){o.addCommand(y,{exec:function(){var A=new d.selection(o.document);p=A&&A.getSelectedElement();q=A.getRanges()[0];var B={defaultText:r?r.getAttribute('text'):'',editMode:r?true:false};if(r&&r.getAttribute('lj-cmd')!==y)B=null;o.rteButton(y,z,B);},editorFocus:false});o.ui.addButton(y,{label:a.CKLang[y+'_Title'],command:y});};LiveJournal.register_hook('cut_response',function(y){v('LJCut',y);});LiveJournal.register_hook('spoiler_response',function(y){v('LJSpoiler',y);});o.on('selectionChange',function(y){var z=y.data.element;if(z&&z.is('iframe')&&n[z.getAttribute('lj-cmd')])r=z;else r=null;});o.on('contentDom',function(){o.updateFrames();});for(var x in n)w(x,n[x].widget);},afterInit:function(o){function p(q,r,s){var t=n[r].tag;
 s=s||'text';var u=new a.htmlParser.element('iframe');u.attributes['lj-class']=t+' '+t+'-open';u.attributes['class']=t+'-wrap';u.attributes['lj-cmd']=r;u.attributes.frameBorder=0;u.attributes.allowTransparency='true';if(q.attributes.hasOwnProperty(s))u.attributes.text=q.attributes[s];q.children.unshift(u);var v=new a.htmlParser.element('iframe');v.attributes['lj-class']=t+' '+t+'-close';v.attributes['class']=t+'-wrap';v.attributes.frameBorder=0;v.attributes.allowTransparency='true';q.children.push(v);delete q.name;};o.dataProcessor.dataFilter.addRules({elements:{'lj-cut':function(q){p(q,'LJCut');},'lj-spoiler':function(q){p(q,'LJSpoiler','title');}}});}});})(jQuery);(function(m){'use strict';var n='LJUser2',o='user',p={},q={},r='/img/userinfo-disabled.gif';j.add('ljuser2',{init:function(s){var t=null,u=new Image();u.src='/img/preloader/preloader-blue-white-xl.gif';s.on('selectionChange',function(y){var z=y.data.element;s.getCommand(n).setState(z.hasAttribute('data-user')?1:2);t=z.hasAttribute('data-user')?z:null;});function v(y){var z={};if(!y)return null;if(y.is('img')){z.head=y;z.link=y.getNextSourceNode(true,1);}else{z.link=y;z.head=y.getPreviousSourceNode(true,1);}return z;};function w(y){if(!y)return;var z=new d.range(s.document),A=v(y),B=A.head,C=A.link,D=s.document.getSelection();if(C&&B){z.setStartBefore(B);z.setEndAfter(C);if(D)D.selectRanges([z]);}else D.selectElement(y);return C||y;};s.on('contentDom',function(){this.document.on('keydown',function(y){var z=s.document.getSelection(),A=z&&z.getRanges()[0];if(A.collapsed&&y.data.getKey()===8){var B=A.getTouchedEndNode();if(B.type===3)B=B.getParent();if(B.hasAttribute('data-user')){y.data.preventDefault();w(B);}}});this.document.on('click',function(y){var z=y.data.getTarget();if(z&&z.hasAttribute('data-user'))w(z);});});function x(y,z){var A=new h('img'),B=new h('a');A.setAttributes({src:u.src,width:'16',height:'16','data-user':y.journal,'data-title':z});A.setStyle('cursor','default');var C=new Image();C.onload=function(){p[y.journal]=y.userhead_url;A.setAttribute('src',C.src);s.fire('updateSnapshot');};C.src=y.userhead_url;B.setAttributes({href:'#','data-cke-saved-href':'#','data-user':y.journal,'data-title':z,seen:true});B.setStyles({color:'blue',fontWeight:'bold'});B.setText(z||y.journal);s.insertElement(A);s.insertElement(B);s.fire('updateSnapshot');};LiveJournal.register_hook('user_response',function(y,z){if(y&&y.hasOwnProperty('ljuser'))x(y.ljuser,z);});s.addCommand(n,{exec:function(y){if(t){var z=t.getAttribute('data-user'),A=t.getAttribute('data-title');
 y.rteButton(n,o,{user:z,title:A,fromRte:true});}else y.rteButton(n,o);}});s.ui.addButton(n,{label:n,command:n});s.dataProcessor.htmlFilter.addRules({elements:{img:function(y){if(y.attributes['data-user'])return false;return y;},a:function(y){var z=y;if(y.attributes['data-user']){z=new a.htmlParser.element('lj');z.isEmpty=true;z.isOptionalClose=true;if(y.attributes.hasOwnProperty('data-user'))z.attributes.user=y.attributes['data-user'];if(y.attributes['data-title'])z.attributes.title=y.attributes['data-title'];return z;}else return y;}}});s.on('doubleclick',function(y){var z=y.data.element;if(z&&z.hasAttribute('data-user')){w(z);s.execFromEditor=true;s.execCommand(n);}});s.on('contentDom',function(){var y=m(a.instances.ck.document.$);y.find('a[data-user]').each(function(z,A){if(A.seen)return;var B=A.getAttribute('data-user'),C=m('<img/>',{style:'cursor: default; width: 16px; height: 16px;','data-user':B,'data-title':A.getAttribute('data-title'),src:q[B]&&r||p[B]||u.src}).insertBefore(m(A));if(q[B])m(A).addClass('lj-user-undefined');if(!p[B]&&!q[B])LJ.Api.call('ljuser.get',{user:B,raw:1},function(D){if(D.error){m(A).addClass('lj-user-undefined');C.attr('src',r);q[B]=true;return;}p[B]=D.ljuser.userhead_url;C.attr('src',D.ljuser.userhead_url);A.seen=true;});});});s.dataProcessor.dataFilter.addRules({elements:{lj:function(y){var z=y.attributes.user,A=new a.htmlParser.element('a');A.add(new a.htmlParser.text(y.attributes.title||z));A.attributes.href='#';A.attributes['data-cke-saved-href']='#';A.attributes.style='font-weight: bold; color: #00C;';A.attributes['data-user']=z;A.attributes['data-title']=y.attributes.title||'';return A;}}});}});})(jQuery);(function(m){'use strict';var n={minHeight:400,maxHeight:0},o=null,p=false,q=['contentDom','selectionChange','insertElement'],r,s,t;function u(){var x,y;if(!r)return;x=o.document.getBody().$.clientHeight+30,y=Math.max(n.minHeight,x);if(y>n.maxHeight&&n.maxHeight!==0)y=n.maxHeight;o.resize('',y,true);};function v(){if(r||!p)return;r=true;q.forEach(function(x){o.on(x,u);});o.document.on('keyup',u);s=o.document.getBody().getStyle('overflow-y')||'visible';o.document.getBody().setStyle('overflow-y','hidden');t=o.window.getViewPaneSize().height;u();};function w(){if(!r)return;r=false;q.forEach(function(x){o.removeListener(x,u);});o.document.removeListener('keyup',u);o.resize('',t,true);o.document.getBody().setStyle('overflow-y',s);};j.add('ljautogrow',{init:function(x){o=x;o.on('instanceReady',function(){o.on('contentDom',function(){if(p)return;
-p=true;v();});});}});a.editor.prototype.autogrow={enable:v,disable:w,resize:u,config:function(x,y){if(typeof y==='undefined')return n[x];else{n[x]=y;u();}}};})(jQuery);a.editorConfig=function(m){'use strict';var n,o;if(Site.page.ljpost)n={livejournal:'plugins/livejournal/plugin.js',ljcolor:'plugins/lj/ljcolor/plugin.js',ljlink:'plugins/lj/ljlink/plugin.js',ljfont:'plugins/lj/ljfont/plugin.js',ljcut:'plugins/lj/ljcut/plugin.js',ljuser2:'plugins/lj/ljuser/plugin.js',ljautogrow:'plugins/lj/ljautogrow/plugin.js',ljspell:'plugins/ljspell/plugin.js'};else n={livejournal_old:'plugins/livejournal_old/plugin.js'};for(o in n)j.addExternal(o,n[o]);var p=['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)p.push('dialog','image','link','font');m.extraPlugins=Object.keys(n).join(',');if(Site.is_dev_server){console.warn('Development server, loading plugins as external files');for(o in n){delete j.registered[o];j.addExternal(o,n[o]);}}m.plugins=p.join(',');m.language='ru';m.autoParagraph=false;m.autoUpdateElement=false;m.docType='<!DOCTYPE html>';if(Site.page.ljpost){m.contentsCss=Site.statprefix+'/js/ck/contents_new.css?t='+Site.version;m.styleText=Site.statprefix+'/js/ck/contents_new.css?t='+Site.version;m.bodyClass='lj-main-body';}else{m.contentsCss='/js/ck/contents.css?t='+Site.version;m.styleText=Site.statprefix+'/js/ck/contents.css?t='+Site.version;}m.contentsLangDirection='ltr';m.fillEmptyBlocks=false;m.tabIndex=41;m.tabSpaces=2;m.startupShowBorders=false;m.toolbarCanCollapse=false;m.disableNativeSpellChecker=Site.page.ljpost?true:false;var q=[];function r(s,t){return s?t:undefined;};if(Site.page.ljpost)q=['Bold','Italic','Underline','Strike','LJFont','LJColor','-','LJLink2','LJUser2','-','LJImage',r(Site.media_embed_enabled,'LJEmbedLink'),'LJCut','LJSpoiler','LJMap','LJLike','LJPollLink','NumberedList','BulletedList','LJJustifyLeft','LJJustifyCenter','LJJustifyRight','LJSpell','Undo','Redo'];else q=['Bold','Italic','Underline','Strike','TextColor','FontSize','-','LJLink','LJUserLink','image',r(Site.media_embed_enabled,'LJEmbedLink'),'LJPollLink','LJCutLink','LJCut','LJLike','LJSpoiler','-','UnorderedList','OrderedList','NumberedList','BulletedList','-','LJJustifyLeft','LJJustifyCenter','LJJustifyRight','-','Undo','Redo'];m.toolbar_Full=[q.filter(function(s){return s;
+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';var n=jQuery.browser.msie,o,p;if(Site.page.ljpost){o={livejournal:'plugins/livejournal/plugin.js',ljcolor:'plugins/lj/ljcolor/plugin.js',ljlink:'plugins/lj/ljlink/plugin.js',ljfont:'plugins/lj/ljfont/plugin.js',ljcut:'plugins/lj/ljcut/plugin.js',ljuser2:'plugins/lj/ljuser/plugin.js',ljautogrow:'plugins/lj/ljautogrow/plugin.js'};if(n)o.ljspell='plugins/ljspell/plugin.js';}else o={livejournal_old:'plugins/livejournal_old/plugin.js'};for(p in o)j.addExternal(p,o[p]);var q=['ajax','basicstyles','bidi','blockquote','button','colorbutton','colordialog','enterkey','entities','format','htmldataprocessor','keystrokes','list','liststyle','pastefromword','specialchar','tab','table','toolbar','undo','wysiwygarea','onchange'];if(!Site.page.ljpost)q.push('dialog','image','link','font');m.extraPlugins=Object.keys(o).join(',');if(Site.is_dev_server){console.warn('Development server, loading plugins as external files');for(p in o){delete j.registered[p];j.addExternal(p,o[p]);}}m.plugins=q.join(',');m.language='ru';m.autoParagraph=false;m.autoUpdateElement=false;m.docType='<!DOCTYPE html>';if(Site.page.ljpost){m.contentsCss=Site.statprefix+'/js/ck/contents_new.css?t='+Site.version;m.styleText=Site.statprefix+'/js/ck/contents_new.css?t='+Site.version;m.bodyClass='lj-main-body';}else{m.contentsCss='/js/ck/contents.css?t='+Site.version;m.styleText=Site.statprefix+'/js/ck/contents.css?t='+Site.version;}m.contentsLangDirection='ltr';m.fillEmptyBlocks=false;m.tabIndex=41;m.tabSpaces=2;m.startupShowBorders=false;m.toolbarCanCollapse=false;m.disableNativeSpellChecker=n?true:false;var r=[];function s(t,u){return t?u:undefined;};if(Site.page.ljpost)r=['Bold','Italic','Underline','Strike','LJFont','LJColor','-','LJLink2','LJUser2','-','LJImage',s(Site.media_embed_enabled,'LJEmbedLink'),'LJCut','LJSpoiler','LJMap','LJLike','LJPollLink','NumberedList','BulletedList','LJJustifyLeft','LJJustifyCenter','LJJustifyRight','LJSpell','Undo','Redo'];else r=['Bold','Italic','Underline','Strike','TextColor','FontSize','-','LJLink','LJUserLink','image',s(Site.media_embed_enabled,'LJEmbedLink'),'LJPollLink','LJCutLink','LJCut','LJLike','LJSpoiler','-','UnorderedList','OrderedList','NumberedList','BulletedList','-','LJJustifyLeft','LJJustifyCenter','LJJustifyRight','-','Undo','Redo'];m.toolbar_Full=[r.filter(function(t){return t;
 })];m.enterMode=2;m.shiftEnterMode=1;m.keystrokes=[[2228224+121,'contextMenu'],[1114112+90,'undo'],[1114112+89,'redo'],[1114112+2228224+90,'redo'],[1114112+76,'LJLink2'],[1114112+66,'bold'],[1114112+73,'italic'],[1114112+85,'underline']];m.colorButton_colors='000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF';m.fontSize_sizes='smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large';m.disableObjectResizing=true;m.format_tags='p;h1;h2;h3;h4;h5;h6;pre;address';m.removeFormatTags='b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var';m.removeFormatAttributes='class,style,lang,width,height,align,hspace,valign';m.coreStyles_bold={element:'b',overrides:'strong'};m.coreStyles_italic={element:'i',overrides:'em'};m.indentClasses=[];m.indentOffset=0;m.pasteFromWordRemoveFontStyles=false;m.pasteFromWordRemoveStyles=false;if(!Site.page.ljpost)m.protectedSource.push(/<lj-poll-\d+\s*\/?>/gi);m.LJFontDefault='normal';m.LJFontStyle={element:'span',styles:{'font-size':'#(size)'},overrides:[{element:'font',attributes:{size:null}}]};m.LJFontSize={tiny:'0.7em',small:'0.9em',normal:'1.0em',large:'1.4em',huge:'1.8em'};m.protectedSource.push(/<lj-replace name="first_post"\s*\/?>/gi);};if(!Site.is_dev_server)a.editorConfig(i);})();

Modified: trunk/htdocs/js/ck/config.js
===================================================================
--- trunk/htdocs/js/ck/config.js	2012-12-06 14:20:37 UTC (rev 23436)
+++ trunk/htdocs/js/ck/config.js	2012-12-06 15:28:40 UTC (rev 23437)
@@ -1,6 +1,8 @@
 CKEDITOR.editorConfig = function(config) {
     'use strict';
 
+    var isIE = jQuery.browser.msie;
+
     var extraPlugins,
         pluginName;
 
@@ -12,9 +14,12 @@
             'ljfont'     : 'plugins/lj/ljfont/plugin.js'    ,
             'ljcut'      : 'plugins/lj/ljcut/plugin.js'     ,
             'ljuser2'    : 'plugins/lj/ljuser/plugin.js'    ,
-            'ljautogrow' : 'plugins/lj/ljautogrow/plugin.js',
-            'ljspell'    : 'plugins/ljspell/plugin.js'
+            'ljautogrow' : 'plugins/lj/ljautogrow/plugin.js'
         };
+
+        if (isIE) {
+            extraPlugins['ljspell'] = 'plugins/ljspell/plugin.js';
+        }
     } else {
         extraPlugins = {
             'livejournal_old': 'plugins/livejournal_old/plugin.js'
@@ -86,7 +91,7 @@
     config.startupShowBorders = false;
     config.toolbarCanCollapse = false;
 
-    config.disableNativeSpellChecker = Site.page.ljpost ? true : false;
+    config.disableNativeSpellChecker = isIE ? true : false;
 
     var toolbar = [];
 

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