]> git.uio.no Git - usit-rt.git/blobdiff - share/html/NoAuth/RichText/ckeditor/plugins/colordialog/dialogs/colordialog.js
Dev to 4.0.11
[usit-rt.git] / share / html / NoAuth / RichText / ckeditor / plugins / colordialog / dialogs / colordialog.js
index 7c6cf8b9a3b963454c76c596bb1b24dcb813f4d0..322e50563d981709b1b6594aa1e3c6aed7fd1329 100644 (file)
@@ -1,7 +1,7 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+/*
+Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-CKEDITOR.dialog.add('colordialog',function(a){var b=CKEDITOR.dom.element,c=CKEDITOR.document,d=CKEDITOR.tools,e=a.lang.colordialog,f;function g(){return{type:'html',html:'&nbsp;'};};function h(){c.getById(w).removeStyle('background-color');f.getContentElement('picker','selectedColor').setValue('');};function i(y){if(!(y instanceof CKEDITOR.dom.event))y=new CKEDITOR.dom.event(y);var z=y.getTarget(),A;if(z.getName()=='a'&&(A=z.getChild(0).getHtml()))f.getContentElement('picker','selectedColor').setValue(A);};function j(y){if(!(y instanceof CKEDITOR.dom.event))y=y.data;var z=y.getTarget(),A;if(z.getName()=='a'&&(A=z.getChild(0).getHtml())){c.getById(u).setStyle('background-color',A);c.getById(v).setHtml(A);}};function k(){c.getById(u).removeStyle('background-color');c.getById(v).setHtml('&nbsp;');};var l=d.addFunction(k),m=i,n=CKEDITOR.tools.addFunction(m),o=j,p=k,q=CKEDITOR.tools.addFunction(function(y){y=new CKEDITOR.dom.event(y);var z=y.getTarget(),A,B,C=y.getKeystroke(),D=a.lang.dir=='rtl';switch(C){case 38:if(A=z.getParent().getParent().getPrevious()){B=A.getChild([z.getParent().getIndex(),0]);B.focus();p(y,z);o(y,B);}y.preventDefault();break;case 40:if(A=z.getParent().getParent().getNext()){B=A.getChild([z.getParent().getIndex(),0]);if(B&&B.type==1){B.focus();p(y,z);o(y,B);}}y.preventDefault();break;case 32:m(y);y.preventDefault();break;case D?37:39:if(A=z.getParent().getNext()){B=A.getChild(0);if(B.type==1){B.focus();p(y,z);o(y,B);y.preventDefault(true);}else p(null,z);}else if(A=z.getParent().getParent().getNext()){B=A.getChild([0,0]);if(B&&B.type==1){B.focus();p(y,z);o(y,B);y.preventDefault(true);}else p(null,z);}break;case D?39:37:if(A=z.getParent().getPrevious()){B=A.getChild(0);B.focus();p(y,z);o(y,B);y.preventDefault(true);}else if(A=z.getParent().getParent().getPrevious()){B=A.getLast().getChild(0);B.focus();p(y,z);o(y,B);y.preventDefault(true);}else p(null,z);break;default:return;}});function r(){var y=['00','33','66','99','cc','ff'];function z(E,F){for(var G=E;G<E+3;G++){var H=s.$.insertRow(-1);for(var I=F;I<F+3;I++)for(var J=0;J<6;J++)A(H,'#'+y[I]+y[J]+y[G]);}};function A(E,F){var G=new b(E.insertCell(-1));G.setAttribute('class','ColorCell');G.setStyle('background-color',F);G.setStyle('width','15px');G.setStyle('height','15px');var H=G.$.cellIndex+1+18*E.rowIndex;G.append(CKEDITOR.dom.element.createFromHtml('<a href="javascript: void(0);" role="option" aria-posinset="'+H+'"'+' aria-setsize="'+234+'"'+' style="cursor: pointer;display:block;width:100%;height:100% " title="'+CKEDITOR.tools.htmlEncode(F)+'"'+' onkeydown="CKEDITOR.tools.callFunction( '+q+', event, this )"'+' onclick="CKEDITOR.tools.callFunction('+n+', event, this ); return false;"'+' tabindex="-1"><span class="cke_voice_label">'+F+'</span>&nbsp;</a>',CKEDITOR.document));
-};z(0,0);z(3,0);z(0,3);z(3,3);var B=s.$.insertRow(-1);for(var C=0;C<6;C++)A(B,'#'+y[C]+y[C]+y[C]);for(var D=0;D<12;D++)A(B,'#000000');};var s=new b('table');r();var t=function(y){return CKEDITOR.tools.getNextId()+'_'+y;},u=t('hicolor'),v=t('hicolortext'),w=t('selhicolor'),x=t('color_table_label');return{title:e.title,minWidth:360,minHeight:220,onLoad:function(){f=this;},contents:[{id:'picker',label:e.title,accessKey:'I',elements:[{type:'hbox',padding:0,widths:['70%','10%','30%'],children:[{type:'html',html:'<table role="listbox" aria-labelledby="'+x+'" onmouseout="CKEDITOR.tools.callFunction( '+l+' );">'+s.getHtml()+'</table>'+'<span id="'+x+'" class="cke_voice_label">'+e.options+'</span>',onLoad:function(){var y=CKEDITOR.document.getById(this.domId);y.on('mouseover',j);},focus:function(){var y=this.getElement().getElementsByTag('a').getItem(0);y.focus();}},g(),{type:'vbox',padding:0,widths:['70%','5%','25%'],children:[{type:'html',html:'<span>'+e.highlight+'</span>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+u+'" style="border: 1px solid; height: 74px; width: 74px;"></div>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+v+'">&nbsp;</div><span>'+e.selected+'</span>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+w+'" style="border: 1px solid; height: 20px; width: 74px;"></div>'},{type:'text',label:e.selected,labelStyle:'display:none',id:'selectedColor',style:'width: 74px',onChange:function(){try{c.getById(w).setStyle('background-color',this.getValue());}catch(y){h();}}},g(),{type:'button',id:'clear',style:'margin-top: 5px',label:e.clear,onClick:h}]}]}]}]};});
+CKEDITOR.dialog.add('colordialog',function(a){var b=CKEDITOR.dom.element,c=CKEDITOR.document,d=a.lang.colordialog,e,f={type:'html',html:'&nbsp;'},g;function h(){c.getById(u).removeStyle('background-color');e.getContentElement('picker','selectedColor').setValue('');g&&g.removeAttribute('aria-selected');g=null;};function i(w){var x=w.data.getTarget(),y;if(x.getName()=='td'&&(y=x.getChild(0).getHtml())){g=x;g.setAttribute('aria-selected',true);e.getContentElement('picker','selectedColor').setValue(y);}};function j(w){w=w.replace(/^#/,'');for(var x=0,y=[];x<=2;x++)y[x]=parseInt(w.substr(x*2,2),16);var z=0.2126*y[0]+0.7152*y[1]+0.0722*y[2];return '#'+(z>=165?'000':'fff');};var k,l;function m(w){!w.name&&(w=new CKEDITOR.event(w));var x=!/mouse/.test(w.name),y=w.data.getTarget(),z;if(y.getName()=='td'&&(z=y.getChild(0).getHtml())){o(w);x?k=y:l=y;if(x){y.setStyle('border-color',j(z));y.setStyle('border-style','dotted');}c.getById(s).setStyle('background-color',z);c.getById(t).setHtml(z);}};function n(){var w=k.getChild(0).getHtml();k.setStyle('border-color',w);k.setStyle('border-style','solid');c.getById(s).removeStyle('background-color');c.getById(t).setHtml('&nbsp;');k=null;};function o(w){var x=!/mouse/.test(w.name),y=x&&k;if(y){var z=y.getChild(0).getHtml();y.setStyle('border-color',z);y.setStyle('border-style','solid');}if(!(k||l)){c.getById(s).removeStyle('background-color');c.getById(t).setHtml('&nbsp;');}};function p(w){var x=w.data,y=x.getTarget(),z,A,B=x.getKeystroke(),C=a.lang.dir=='rtl';switch(B){case 38:if(z=y.getParent().getPrevious()){A=z.getChild([y.getIndex()]);A.focus();}x.preventDefault();break;case 40:if(z=y.getParent().getNext()){A=z.getChild([y.getIndex()]);if(A&&A.type==1)A.focus();}x.preventDefault();break;case 32:case 13:i(w);x.preventDefault();break;case C?37:39:if(A=y.getNext()){if(A.type==1){A.focus();x.preventDefault(true);}}else if(z=y.getParent().getNext()){A=z.getChild([0]);if(A&&A.type==1){A.focus();x.preventDefault(true);}}break;case C?39:37:if(A=y.getPrevious()){A.focus();x.preventDefault(true);}else if(z=y.getParent().getPrevious()){A=z.getLast();A.focus();x.preventDefault(true);}break;default:return;}};function q(){v=CKEDITOR.dom.element.createFromHtml('<table tabIndex="-1" aria-label="'+d.options+'"'+' role="grid" style="border-collapse:separate;" cellspacing="0">'+'<caption class="cke_voice_label">'+d.options+'</caption>'+'<tbody role="presentation"></tbody></table>');v.on('mouseover',m);v.on('mouseout',o);var w=['00','33','66','99','cc','ff'];
+function x(C,D){for(var E=C;E<C+3;E++){var F=new b(v.$.insertRow(-1));F.setAttribute('role','row');for(var G=D;G<D+3;G++)for(var H=0;H<6;H++)y(F.$,'#'+w[G]+w[H]+w[E]);}};function y(C,D){var E=new b(C.insertCell(-1));E.setAttribute('class','ColorCell');E.setAttribute('tabIndex',-1);E.setAttribute('role','gridcell');E.on('keydown',p);E.on('click',i);E.on('focus',m);E.on('blur',o);E.setStyle('background-color',D);E.setStyle('border','1px solid '+D);E.setStyle('width','14px');E.setStyle('height','14px');var F=r('color_table_cell');E.setAttribute('aria-labelledby',F);E.append(CKEDITOR.dom.element.createFromHtml('<span id="'+F+'" class="cke_voice_label">'+D+'</span>',CKEDITOR.document));};x(0,0);x(3,0);x(0,3);x(3,3);var z=new b(v.$.insertRow(-1));z.setAttribute('role','row');for(var A=0;A<6;A++)y(z.$,'#'+w[A]+w[A]+w[A]);for(var B=0;B<12;B++)y(z.$,'#000000');};var r=function(w){return CKEDITOR.tools.getNextId()+'_'+w;},s=r('hicolor'),t=r('hicolortext'),u=r('selhicolor'),v;q();return{title:d.title,minWidth:360,minHeight:220,onLoad:function(){e=this;},onHide:function(){h();n();},contents:[{id:'picker',label:d.title,accessKey:'I',elements:[{type:'hbox',padding:0,widths:['70%','10%','30%'],children:[{type:'html',html:'<div></div>',onLoad:function(){CKEDITOR.document.getById(this.domId).append(v);},focus:function(){(k||this.getElement().getElementsByTag('td').getItem(0)).focus();}},f,{type:'vbox',padding:0,widths:['70%','5%','25%'],children:[{type:'html',html:'<span>'+d.highlight+'</span>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+s+'" style="border: 1px solid; height: 74px; width: 74px;"></div>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+t+'">&nbsp;</div><span>'+d.selected+'</span>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+u+'" style="border: 1px solid; height: 20px; width: 74px;"></div>'},{type:'text',label:d.selected,labelStyle:'display:none',id:'selectedColor',style:'width: 74px',onChange:function(){try{c.getById(u).setStyle('background-color',this.getValue());}catch(w){h();}}},f,{type:'button',id:'clear',style:'margin-top: 5px',label:d.clear,onClick:h}]}]}]}]};});