mirror of
https://github.com/UnickSoft/graphonline.git
synced 2025-07-03 16:25:59 +00:00
2 lines
3.5 KiB
JavaScript
Executable File
2 lines
3.5 KiB
JavaScript
Executable File
(function(){var a=function(b){return function(){var d=this.getValue();var c=d&&CKEDITOR.dialog.validate.integer()(d)&&(d>0);if(!c){alert(b)}return c}};CKEDITOR.dialog.add("myMonkeySettingsDialog",function(b){return{title:"Mr. Monkey Settings",minWidth:400,minHeight:200,contents:[{id:"tab-typing",label:"Typing",elements:[{type:"checkbox",id:"typeRandom",label:"Type Randomly",setup:function(c){this.setValue(c[this.id])},commit:function(c){c[this.id]=this.getValue()}},{type:"text",id:"typeRandomInterval",label:"Type Interval",validate:a("'Type Interval' must be a positive a number"),setup:function(c){this.setValue(c[this.id])},commit:function(c){c[this.id]=this.getValue()}},{type:"text",id:"typeRandomKeys",label:"Keys",validate:function(){var j=this.getValue();var k=!(j&&(typeof j)=="string");var f=false;if(!k){var h=j.split(",");for(var e=0,c=h.length;e<c;e++){var d=h[e];if(d.length!=1){if(d.length>0){if(d[0]=="#"){var g=d.substring(1);if(isNaN(parseInt(g))){f=true;break}}else{f=true;break}}else{f=true;break}}}}if(k){alert("Keys setting can not be empty");return false}else{if(f){alert("Keys must be a comma separated list of characters or char codes prefixed by #");return false}else{return true}}},setup:function(e){var f=new Array();for(var d=0,c=e[this.id].length;d<c;d++){if((typeof e[this.id][d])=="number"){f.push("#"+e[this.id][d])}else{f.push(e[this.id][d])}}this.setValue(f)},commit:function(f){var g=this.getValue().split(",");var h=new Array();for(var e=0,c=g.length;e<c;e++){var d=g[e];if(d.length==1){h.push(d)}else{if(d.length>0){if(d[0]=="#"){h.push(parseInt(d.substring(1)))}}}}f[this.id]=h}},{type:"text",id:"typeRandomMaxKeyStrokesAtOnce",label:"Max Key Strokes at Once",validate:a("'Max Key Strokes at Once' must be a positive a number"),setup:function(c){this.setValue(c[this.id])},commit:function(c){c[this.id]=this.getValue()}},{type:"text",id:"typeRandomKeyStrokeInterval",label:"Key Stroke Interval",validate:a("'Key Stroke Interval' must be a positive a number"),setup:function(c){this.setValue(c[this.id])},commit:function(c){c[this.id]=this.getValue()}}]},{id:"tab-lorem-paste",label:"Paste Lorem Ipsum",elements:[{type:"checkbox",id:"pasteLoremIpsum",label:"Randomly Paste Lorem Ipsum",validate:function(){},setup:function(c){this.setValue(c[this.id])},commit:function(c){c[this.id]=this.getValue()}},{type:"text",id:"pasteLoremIpsumInterval",label:"Paste Interval",validate:a("'Paste Interval' must be a positive a number"),setup:function(c){this.setValue(c[this.id])},commit:function(c){c[this.id]=this.getValue()}},{type:"text",id:"pasteLoremIpsumBlockSize",label:"Paste Block Size",validate:a("'Paste Block Size' must be a positive a number"),setup:function(c){this.setValue(c[this.id])},commit:function(c){c[this.id]=this.getValue()}},{type:"textarea",id:"pasteLoremIpsumText",label:"Text",validate:CKEDITOR.dialog.validate.notEmpty("Text field cannot be empty"),setup:function(c){this.setValue(c[this.id])},commit:function(c){c[this.id]=this.getValue()}}]},{id:"tab-selection",label:"Selection",elements:[{type:"checkbox",id:"selectionChange",label:"Randomly Change Selection",setup:function(c){this.setValue(c[this.id])},commit:function(c){c[this.id]=this.getValue()}},{type:"text",id:"selectionChangeInterval",label:"Selection Change Interval",validate:a("'Selection Change Interval' must be a positive a number"),setup:function(c){this.setValue(c[this.id])},commit:function(c){c[this.id]=this.getValue()}}]}],onShow:function(){this.setupContent(b.getMrMonkeySettings())},onOk:function(){var c={};this.commitContent(c);b.setMrMonkeySettings(c)}}})}).call(this);
|