<html> <head> <meta charset="UTF-8"> <title>Khowar Keyboard | Rehmat Aziz Chitrali</title> </head> <style> #Rachitrali-keyboard{width:630px;line-height:20px;font-size:1em}.Rachitrali-key,#Rachitrali-backspace,#Rachitrali-tab,#Rachitrali-k25,#Rachitrali-caps-lock,#Rachitrali-enter,#Rachitrali-left-shift,#Rachitrali-right-shift,#Rachitrali-space,#Rachitrali-left-ctrl,#Rachitrali-right-ctrl,#Rachitrali-left-alt,#Rachitrali-right-alt,#Rachitrali,#Rachitrali-escape{float:left;display:block;margin:1px;height:3em;line-height:2.75em;text-align:center;color:gray}.Rachitrali-key{width:40px}#Rachitrali-backspace{width:78px}#Rachitrali-tab{width:62px}#Rachitrali-k25{width:56px}#Rachitrali-caps-lock{width:76px}#Rachitrali-enter{width:84px}#Rachitrali-left-shift{width:46px}#Rachitrali-right-shift{width:114px}#Rachitrali-space{width:246px;text-align:center}#Rachitrali-right-ctrl,#Rachitrali-right-alt,#Rachitrali-escape{width:62px}#Rachitrali-left-ctrl,#Rachitrali-left-alt,#Rachitrali{width:60px}.Rachitrali-label-reference{color:gray;font-size:.9em;line-height:12px;text-align:left;cursor:default}.Rachitrali-label-natural{margin-top:-5px;color:#e0115f;line-height:20px;text-align:center;cursor:default}.Rachitrali-label-shift{margin-top:-5px;color:#057cb5;line-height:20px;text-align:center;cursor:default}#Rachitrali-k29 .Rachitrali-label-reference,#Rachitrali-k32 .Rachitrali-label-reference{color:#000}.Rachitrali-recessed span{color:#3C0}.Rachitrali-recessed-hover span{color:#ffd800}.Rachitrali-clear{clear:both}; </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script> var Rachitrali={};Rachitrali.util={keyCode:function(b){if(!b){var b=window.event}if($.browser.mozilla){var a=b.keyCode;switch(a){case 59:a=186;break;case 107:a=187;break;case 109:a=189;break;case 61:a=187;break;case 173:a=189;break}return a}if($.browser.opera){var a=b.keyCode;switch(a){case 59:a=186;break;case 61:a=187;break;case 109:a=189;break}return a}return b.keyCode},isCtrl:function(a){if(!a){var a=window.event}return a.ctrlKey},isAlt:function(a){if(!a){var a=window.event}return a.altKey},isShift:function(a){if(!a){var a=window.event}return a.shiftKey},insertAtCaret:function(a,f){var d=this.getSelectionStart(a);var b=this.getSelectionEnd(a);var c=a.value.length;a.value=a.value.substring(0,d)+f+a.value.substring(b,c);this.setCaretPosition(a,d+f.length,0)},deleteAtCaret:function(c,b,a){var g=this.getSelectionStart(c);var d=this.getSelectionEnd(c);var f=c.value.length;if(b>g){b=g}if(d+a>f){a=f-d}var h=c.value.substring(g-b,d+a);c.value=c.value.substring(0,g-b)+c.value.substring(d+a);this.setCaretPosition(c,g-b,0);return h},getSelectionStart:function(a){a.focus();if(a.selectionStart!==undefined){return a.selectionStart}else{if(document.selection){var b=document.selection.createRange();if(b==null){return 0}var d=a.createTextRange();var c=d.duplicate();d.moveToBookmark(b.getBookmark());c.setEndPoint("EndToStart",d);return c.text.length}}return 0},getSelectionEnd:function(a){a.focus();if(a.selectionEnd!==undefined){return a.selectionEnd}else{if(document.selection){var b=document.selection.createRange();if(b==null){return 0}var d=a.createTextRange();var c=d.duplicate();d.moveToBookmark(b.getBookmark());c.setEndPoint("EndToStart",d);return c.text.length+b.text.length}}return a.value.length},setCaretPosition:function(b,d,a){var c=b.value.length;if(d>c){d=c}if(d+a>c){a=c-a}b.focus();if(b.setSelectionRange){b.setSelectionRange(d,d+a)}else{if(b.createTextRange){var f=b.createTextRange();f.collapse(true);f.moveEnd("character",d+a);f.moveStart("character",d);f.select()}}b.focus()},selectAll:function(a){this.setCaretPosition(a,0,a.value.length)}};Rachitrali.layout=function(){this.keys=[];this.deadkeys=[];this.dir="ltr";this.name="US";this.lang="en"};Rachitrali.layout.prototype.loadDefault=function(){this.keys=[{i:"k0",c:"0",n:"`",s:"~"},{i:"k1",c:"0",n:"1",s:"!"},{i:"k2",c:"0",n:"2",s:"@"},{i:"k3",c:"0",n:"3",s:"#"},{i:"k4",c:"0",n:"4",s:"$"},{i:"k5",c:"0",n:"5",s:"%"},{i:"k6",c:"0",n:"6",s:"^"},{i:"k7",c:"0",n:"7",s:"&"},{i:"k8",c:"0",n:"8",s:"*"},{i:"k9",c:"0",n:"9",s:"("},{i:"k10",c:"0",n:"0",s:")"},{i:"k11",c:"0",n:"-",s:"_"},{i:"k12",c:"0",n:"=",s:"+"},{i:"k13",c:"1",n:"q",s:"Q"},{i:"k14",c:"1",n:"w",s:"W"},{i:"k15",c:"1",n:"e",s:"E"},{i:"k16",c:"1",n:"r",s:"R"},{i:"k17",c:"1",n:"t",s:"T"},{i:"k18",c:"1",n:"y",s:"Y"},{i:"k19",c:"1",n:"u",s:"U"},{i:"k20",c:"1",n:"i",s:"I"},{i:"k21",c:"1",n:"o",s:"O"},{i:"k22",c:"1",n:"p",s:"P"},{i:"k23",c:"0",n:"[",s:"{"},{i:"k24",c:"0",n:"]",s:"}"},{i:"k25",c:"0",n:"\\",s:"|"},{i:"k26",c:"1",n:"a",s:"A"},{i:"k27",c:"1",n:"s",s:"S"},{i:"k28",c:"1",n:"d",s:"D"},{i:"k29",c:"1",n:"f",s:"F"},{i:"k30",c:"1",n:"g",s:"G"},{i:"k31",c:"1",n:"h",s:"H"},{i:"k32",c:"1",n:"j",s:"J"},{i:"k33",c:"1",n:"k",s:"K"},{i:"k34",c:"1",n:"l",s:"L"},{i:"k35",c:"0",n:";",s:":"},{i:"k36",c:"0",n:"'",s:'"'},{i:"k37",c:"1",n:"z",s:"Z"},{i:"k38",c:"1",n:"x",s:"X"},{i:"k39",c:"1",n:"c",s:"C"},{i:"k40",c:"1",n:"v",s:"V"},{i:"k41",c:"1",n:"b",s:"B"},{i:"k42",c:"1",n:"n",s:"N"},{i:"k43",c:"1",n:"m",s:"M"},{i:"k44",c:"0",n:",",s:"<"},{i:"k45",c:"0",n:".",s:">"},{i:"k46",c:"0",n:"/",s:"?"},{i:"k47",c:"0",n:"\\",s:"|"}];this.dir="ltr";this.name="US";this.lang="en"};Rachitrali.layout.prototype.load=function(a){this.keys=a.keys;this.deadkeys=a.deadkeys;this.dir=a.dir;this.name=a.name;this.lang=a.lang?a.lang:"en"};Rachitrali.layout.parser={keyCodes:[192,49,50,51,52,53,54,55,56,57,48,189,187,81,87,69,82,84,89,85,73,79,80,219,221,220,65,83,68,70,71,72,74,75,76,186,222,90,88,67,86,66,78,77,188,190,191,220],getKeyCode:function(c,e,b){var d=c.length;for(var a=0;a<d;a++){if(c[a].i==b){return e==1?(c[a].s?c[a].s:""):(c[a].n?c[a].n:"")}}return 0},getKey:function(c,b){var d=c.length;for(var a=0;a<d;a++){if(c[a].i==b){return c[a]}}return null},isDeadkey:function(a,d){if(!a){return false}var c=a.length;for(var b=0;b<c;b++){if(a[b].k==d){return true}}return false},getMappedValue:function(a,e,d){if(!a){return""}var c=a.length;for(var b=0;b<c;b++){if(a[b].k==d&&a[b].b==e){return a[b].c}}return""},getKeyId:function(b){for(var a=0;a<48;a++){if(this.keyCodes[a]==b){return a}}return -1},getState:function(d,a,e,b,c){var f="n";if(!a&&!e&&d){f="n"}else{if(!a&&e&&!d){f="s"}else{if(!a&&e&&d){f="s"}else{if(a&&!e&&!d){f="n"}else{if(a&&!e&&d){f="t"}else{if(a&&e&&!d){f="s"}else{if(a&&e&&d){f="f"}}}}}}}if((f=="n"||f=="s")&&b){if(c=="1"){if(f=="n"){f="s"}else{f="n"}}if(c=="SGCap"){if(f=="n"){f="y"}else{if(f=="s"){f="z"}}}}return f}};Rachitrali.keyboard=function(a,d){this.defaultLayout=new Rachitrali.layout();this.defaultLayout.loadDefault();this.virtualLayout=new Rachitrali.layout();this.virtualLayout.loadDefault();this.currentLayout=this.virtualLayout;this.shift=false;this.shiftOn=false;this.caps=false;this.capsOn=false;this.alt=false;this.ctrl=false;this.altCtrlOn=false;this.fontSize=18;this.counter=0;this.interval=0;this.prev="";this.cancelkeypress=false;this.customOnBackspace=function(e){};this.customOnEnter=function(){};this.customOnSpace=function(){return false};this.customOnKey=function(e){return false};this.customOnEsc=function(){};this.customDrawKeyboard=function(e){return e};this.textbox=$("#"+d);this.nativeTextbox=document.getElementById(d);var c=['<div id="Rachitrali-keyboard">'];for(var b=0;b<13;b++){c.push('<button id="Rachitrali-k',b,'" class="Rachitrali-key"></button>')}c.push('<button id="Rachitrali-backspace"><span>Backspace</span></button>');c.push('<div class="Rachitrali-clear"></div>');c.push('<button id="Rachitrali-tab"><span>Tab</span></button>');for(var b=13;b<25;b++){c.push('<button id="Rachitrali-k',b,'" class="Rachitrali-key"></button>')}c.push('<button id="Rachitrali-k25"></button>');c.push('<div class="Rachitrali-clear"></div>');c.push('<button id="Rachitrali-caps-lock"><span>Caps Lock</span></button>');for(var b=26;b<37;b++){c.push('<button id="Rachitrali-k',b,'" class="Rachitrali-key"></button>')}c.push('<button id="Rachitrali-enter" class="Rachitrali-enter"><span>Enter</span></button>');c.push('<div class="Rachitrali-clear"></div>');c.push('<button id="Rachitrali-left-shift"><span>Shift</span></button>');c.push('<button id="Rachitrali-k47" class="Rachitrali-key"></button>');for(var b=37;b<47;b++){c.push('<button id="Rachitrali-k',b,'" class="Rachitrali-key"></button>')}c.push('<button id="Rachitrali-right-shift"><span>Shift</span></button>');c.push('<div class="Rachitrali-clear"></div>');c.push('<button id="Rachitrali-left-ctrl"><span>Ctrl</span></button>');c.push('<button id="Rachitrali"><span>Rachitrali</span></button>');c.push('<button id="Rachitrali-left-alt"><span>Alt</span></button>');c.push('<button id="Rachitrali-space"><span>Space</span></button>');c.push('<button id="Rachitrali-right-alt"><span>Alt</span></button>');c.push('<button id="Rachitrali-escape" title="Turn on/off keyboard input conversion"><span>Esc</span></button>');c.push('<button id="Rachitrali-right-ctrl"><span>Ctrl</span></button>');c.push('<div class="Rachitrali-clear"></div>');c.push("</div>");document.getElementById(a).innerHTML=c.join("");this.wireEvents();this.drawKeyboard()};Rachitrali.keyboard.prototype.loadDefaultLayout=function(a){this.defaultLayout.load(a);this.drawKeyboard()};Rachitrali.keyboard.prototype.loadVirtualLayout=function(a){this.virtualLayout.load(a);this.drawKeyboard();this.textbox.attr("dir",this.attr("dir"))};Rachitrali.keyboard.prototype.switchLayout=function(){this.currentLayout=(this.currentLayout===this.defaultLayout)?this.virtualLayout:this.defaultLayout;this.reset();this.drawKeyboard();this.textbox.attr("dir",this.attr("dir"))};Rachitrali.keyboard.prototype.onEsc=function(){this.switchLayout();this.customOnEsc()};Rachitrali.keyboard.prototype.onShift=function(){this.shift=!this.shift;this.drawKeyboard()};Rachitrali.keyboard.prototype.onAlt=function(){this.alt=!this.alt;this.drawKeyboard()};Rachitrali.keyboard.prototype.onCtrl=function(){this.ctrl=!this.ctrl;this.drawKeyboard()};Rachitrali.keyboard.prototype.onCapsLock=function(){this.caps=!this.caps;this.drawKeyboard()};Rachitrali.keyboard.prototype.onBackspace=function(){if(this.prev!=""){this.prev="";this.shift=false;this.drawKeyboard()}else{var a=Rachitrali.util.deleteAtCaret(this.nativeTextbox,1,0);this.customOnBackspace(a)}};Rachitrali.keyboard.prototype.onEnter=function(){Rachitrali.util.insertAtCaret(this.nativeTextbox,"\u000A");this.customOnEnter()};Rachitrali.keyboard.prototype.onSpace=function(){if(!this.customOnSpace()){Rachitrali.util.insertAtCaret(this.nativeTextbox,"\u0020")}};Rachitrali.keyboard.prototype.attr=function(a){if(a=="dir"){return this.currentLayout.dir}else{if(a=="lang"){return this.currentLayout.lang}else{if(a=="name"){return this.currentLayout.name}}}return""};Rachitrali.keyboard.prototype.reset=function(){this.shift=false;this.caps=false;this.alt=false;this.ctrl=false;this.counter=0;this.interval=0;this.prev=""};Rachitrali.keyboard.prototype.stopRepeat=function(){if(this.interval!=0){clearInterval(this.interval);this.counter=0;this.interval=0}};Rachitrali.keyboard.prototype.onKey=function(b){var a=Rachitrali.layout.parser.getKey(this.currentLayout.keys,b);if(a){var d=Rachitrali.layout.parser.getState(this.ctrl,this.alt,this.shift,this.caps,a.c?a.c:"0");var e=a[d]?a[d]:"";if(this.prev!=""){var c=Rachitrali.layout.parser.getMappedValue(this.currentLayout.deadkeys,e,this.prev);if(c!=""){Rachitrali.util.insertAtCaret(this.nativeTextbox,c)}this.prev=""}else{if(Rachitrali.layout.parser.isDeadkey(this.currentLayout.deadkeys,e)){this.prev=e}else{if(e!=""){if(!this.customOnKey(e)){Rachitrali.util.insertAtCaret(this.nativeTextbox,e)}}}}}};Rachitrali.keyboard.prototype.drawKeyboard=function(){if(!this.currentLayout.keys){return}var d,f,j,k;var g=this.currentLayout.keys.length;for(var e=0;e<g;e++){f=this.currentLayout.keys[e];if(!$("Rachitrali-"+f.i)){continue}var c=this.ctrl;var a=this.alt;var h=this.shift;var b=this.caps;if(this.shiftOn){h=true}if(this.capsOn){b=true}if(this.altCtrlOn){c=true;a=true}j=Rachitrali.layout.parser.getState(c,a,h,b,f.c?f.c:"0");k=f[j]?f[j]:"";if(this.prev!=""){k=Rachitrali.layout.parser.getMappedValue(this.currentLayout.deadkeys,k,this.prev)}if(!h){k=this.customDrawKeyboard(k);if(k==""){k=" "}d='<div class="Rachitrali-label-reference">'+Rachitrali.layout.parser.getKeyCode(this.defaultLayout.keys,0,f.i)+'</div><div class="Rachitrali-label-natural" style="font-size:'+this.fontSize+'px;"> '+k+"</div>"}else{if(k==""){k=" "}d='<div class="Rachitrali-label-reference">'+Rachitrali.layout.parser.getKeyCode(this.defaultLayout.keys,0,f.i)+'</div><div class="Rachitrali-label-shift" style="font-size:'+this.fontSize+'px;"> '+k+"</div>"}document.getElementById("Rachitrali-"+f.i).innerHTML=d}$("#Rachitrali-left-ctrl").removeClass();$("#Rachitrali-right-ctrl").removeClass();if(c){$("#Rachitrali-left-ctrl").addClass("Rachitrali-recessed"+(this.ctrl?"":"-hover"));$("#Rachitrali-right-ctrl").addClass("Rachitrali-recessed"+(this.ctrl?"":"-hover"))}$("#Rachitrali-left-alt").removeClass();$("#Rachitrali-right-alt").removeClass();if(a){$("#Rachitrali-left-alt").addClass("Rachitrali-recessed"+(this.alt?"":"-hover"));$("#Rachitrali-right-alt").addClass("Rachitrali-recessed"+(this.alt?"":"-hover"))}$("#Rachitrali-left-shift").removeClass();$("#Rachitrali-right-shift").removeClass();if(h){$("#Rachitrali-left-shift").addClass("Rachitrali-recessed"+(this.shift?"":"-hover"));$("#Rachitrali-right-shift").addClass("Rachitrali-recessed"+(this.shift?"":"-hover"))}$("#Rachitrali-caps-lock").removeClass();if(b){$("#Rachitrali-caps-lock").addClass("Rachitrali-recessed"+(this.caps?"":"-hover"))}};Rachitrali.keyboard.prototype.wireEvents=function(){var a=this;$("#Rachitrali-keyboard").delegate("button","mousedown",function(b){var c=this.id;a.interval=setInterval(function(){a.counter++;if(a.counter>5){switch(c){case"Rachitrali-backspace":a.onBackspace();break;default:if(c.search("Rachitrali-k([0-9])|([1-3][0-9])|(4[0-7])")!=-1){a.onKey(c.substr(7));a.shift=false;a.alt=false;a.ctrl=false;a.drawKeyboard()}break}}},50)});$("#Rachitrali-keyboard").delegate("button","mouseup",function(b){a.stopRepeat()});$("#Rachitrali-keyboard").delegate("button","mouseout",function(b){a.stopRepeat()});$("#Rachitrali-keyboard").delegate("button","click",function(b){var c=this.id;switch(c){case"Rachitrali-left-shift":case"Rachitrali-right-shift":a.onShift();break;case"Rachitrali-left-alt":case"Rachitrali-right-alt":a.onCtrl();a.onAlt();break;case"Rachitrali-left-ctrl":case"Rachitrali-right-ctrl":a.onAlt();a.onCtrl();break;case"Rachitrali-escape":a.onEsc();break;case"Rachitrali-caps-lock":a.onCapsLock();break;case"Rachitrali-backspace":a.onBackspace();break;case"Rachitrali-enter":a.onEnter();break;case"Rachitrali-space":a.onSpace();break;default:if(c.search("Rachitrali-k([0-9])|([1-3][0-9])|(4[0-7])")!=-1){a.onKey(c.substr(7));a.shift=false;a.alt=false;a.ctrl=false;a.drawKeyboard()}break}});$("#Rachitrali-left-shift, #Rachitrali-right-shift").bind("mouseover",function(b){a.shiftOn=true;a.drawKeyboard()});$("#Rachitrali-left-shift, #Rachitrali-right-shift").bind("mouseout",function(b){a.shiftOn=false;a.drawKeyboard()});$("#Rachitrali-left-ctrl, #Rachitrali-right-ctrl").bind("mouseover",function(b){a.altCtrlOn=true;a.drawKeyboard()});$("#Rachitrali-left-ctrl, #Rachitrali-right-ctrl").bind("mouseout",function(b){a.altCtrlOn=false;a.drawKeyboard()});$("#Rachitrali-left-alt, #Rachitrali-right-alt").bind("mouseover",function(b){a.altCtrlOn=true;a.drawKeyboard()});$("#Rachitrali-left-alt, #Rachitrali-right-alt").bind("mouseout",function(b){a.altCtrlOn=false;a.drawKeyboard()});$("#Rachitrali-caps-lock").bind("mouseover",function(b){a.capsOn=true;a.drawKeyboard()});$("#Rachitrali-caps-lock").bind("mouseout",function(b){a.capsOn=false;a.drawKeyboard()});a.textbox.bind("keydown",function(b){var d=Rachitrali.util.keyCode(b);if((d==65||d==67||d==86||d==88||d==89||d==90)&&(a.ctrl&&!a.alt&&!a.shift)){return}if(a.currentLayout==a.defaultLayout&&d!=27){return}switch(d){case 17:a.ctrl=false;a.onCtrl();break;case 18:a.alt=false;a.onAlt();break;case 16:a.shift=false;a.onShift();break;case 27:a.onEsc();break;case 8:a.onBackspace();b.preventDefault();break;case 32:a.onSpace();b.preventDefault();break;case 10:a.onEnter();b.preventDefault();break;default:var c=Rachitrali.layout.parser.getKeyId(Rachitrali.util.keyCode(b));if(c!=-1){a.onKey("k"+c);a.drawKeyboard();b.preventDefault();a.cancelkeypress=true}break}});if($.browser.opera){a.textbox.bind("keypress",function(b){if(a.cancelkeypress){b.preventDefault();a.cancelkeypress=false}})}a.textbox.bind("keyup",function(b){switch(Rachitrali.util.keyCode(b)){case 17:a.ctrl=true;a.onCtrl();break;case 18:a.alt=true;a.onAlt();break;case 16:a.shift=true;a.onShift();break;default:}})}; var keyboard = null; $(document).ready(function () { keyboard = new Rachitrali.keyboard("keyboard", "editor"); keyboard.fontSize = 22; keyboard.loadVirtualLayout({"name":"Khowar","dir":"rtl","keys":[{"i":"k0","c":"0","n":"ݰ","s":"څ","t":"؏"},{"i":"k1","c":"0","n":"۱","s":"!","t":"1"},{"i":"k2","c":"0","n":"۲","s":"@","t":"2"},{"i":"k3","c":"0","n":"۳","s":"ؔ","t":"3"},{"i":"k4","c":"0","n":"۴","s":"ؒ","t":"4"},{"i":"k5","c":"0","n":"۵","s":"٪","t":"5"},{"i":"k6","c":"0","n":"۶","s":"ؓ","t":"6"},{"i":"k7","c":"0","n":"۷","s":"ؑ","t":"7"},{"i":"k8","c":"0","n":"۸","s":"ؐ","t":"8"},{"i":"k9","c":"0","n":"۹","s":")","t":"9"},{"i":"k10","c":"0","n":"۰","s":"(","t":"0"},{"i":"k11","c":"0","n":"-","s":"_","t":"_"},{"i":"k12","c":"0","n":"=","s":"+","t":"+"},{"i":"k13","c":"1","n":"ق","s":"ځ","t":""},{"i":"k14","c":"1","n":"و","s":"ٔ","t":"ڇ"},{"i":"k15","c":"1","n":"ع","s":"ٰ","t":"ݜ"},{"i":"k16","c":"1","n":"ر","s":"ڑ","t":"ٻ"},{"i":"k17","c":"1","n":"ت","s":"ٹ","t":"ګ"},{"i":"k18","c":"1","n":"ے","s":"َ","t":"ێ"},{"i":"k19","c":"1","n":"ء","s":"ئ","t":"ݪ"},{"i":"k20","c":"1","n":"ی","s":"ِ","t":"ۇ"},{"i":"k21","c":"1","n":"ہ","s":"ۃ","t":"ڒ"},{"i":"k22","c":"1","n":"پ","s":"ُ","t":"ڗ"},{"i":"k23","c":"0","n":"ݮ","s":"ڵ","t":"ټ"},{"i":"k24","c":"0","n":"ݯ","s":"ﺃ","t":"ڂ"},{"i":"k25","c":"0","n":"ݱ","s":"ڄ","t":"ݨ"},{"i":"k26","c":"1","n":"ا","s":"آ","t":"ݩ"},{"i":"k27","c":"1","n":"س","s":"ص","t":"ݫ"},{"i":"k28","c":"1","n":"د","s":"ڈ","t":"ڷ"},{"i":"k29","c":"1","n":"ف","s":"ݲ","t":"ؤ"},{"i":"k30","c":"1","n":"گ","s":"غ","t":"ي"},{"i":"k31","c":"1","n":"ح","s":"ھ","t":"ݭ"},{"i":"k32","c":"1","n":"ج","s":"ض","t":"ڵ"},{"i":"k33","c":"1","n":"ک","s":"خ","t":"ړ"},{"i":"k34","c":"1","n":"ل","s":"ڙ","t":"ڨ"},{"i":"k35","c":"0","n":"؛","s":":","t":"ن٘"},{"i":"k36","c":"0","n":"'","s":"\"","t":"ډ"},{"i":"k37","c":"1","n":"ز","s":"ذ","t":"ٞ"},{"i":"k38","c":"1","n":"ش","s":"ژ","t":"ڠ"},{"i":"k39","c":"1","n":"چ","s":"ث","t":"ڳ"},{"i":"k40","c":"1","n":"ط","s":"ظ","t":"ڃ"},{"i":"k41","c":"1","n":"ب","s":"ً","t":"کٔ"},{"i":"k42","c":"1","n":"ن","s":"ں","t":"ې"},{"i":"k43","c":"1","n":"م","s":"٘","t":"ݙ"},{"i":"k44","c":"0","n":"،","s":"ٗ","t":"ٓ"},{"i":"k45","c":"0","n":"۔","s":".","t":"ڼ"},{"i":"k46","c":"0","n":"/","s":"؟","t":"ۉ"},{"i":"k47","c":"0","n":"\\","s":"|"}],"deadkeys":[]}); $("#editor").attr("dir", keyboard.attr("dir")); $("#editor").focus(); $("#editor").css({"font-size" : keyboard.fontSize + "px"}); $("#shrink").bind("click", function(){ if(keyboard.fontSize < 14) return; keyboard.fontSize -= 2; $("#editor, .Rachitrali-label-natural, .Rachitrali-label-shift").css({"font-size" : keyboard.fontSize + "px"}); }); $("#enlarge").bind("click", function(){ keyboard.fontSize += 2; $("#editor, .Rachitrali-label-natural, .Rachitrali-label-shift").css({"font-size" : keyboard.fontSize + "px"}); }); var textbox = document.getElementById("editor"); $("#selectAll").bind("click", function () { Rachitrali.util.setCaretPosition(textbox, 0, textbox.value.length); ga("send", "event", "Keyboard", "click", "Select"); }); var localStorageSupported = false; try { var item = 'item'; localStorage.setItem(item, item); localStorage.removeItem(item); localStorageSupported = true; } catch(e) {}; var jsonSupported = false; try{ var obj = JSON.parse(JSON.stringify({item: 'item'})); if(obj.item == 'item') jsonSupported = true; } catch(e){}; if(localStorageSupported && jsonSupported){ if(localStorage.getItem("khowar") == null){ localStorage.setItem("khowar", JSON.stringify({undo : [], redo : []})); } else{ $("#editor").val(JSON.parse(localStorage.getItem("khowar")).undo.pop()); } $("#clearAll").bind("click", function() { ga("send", "event", "Keyboard", "click", "Clear"); localStorage.setItem("khowar", JSON.stringify({undo : [], redo : []})); $("#editor").val(""); }); $("#undo").bind("click", function() { var obj = JSON.parse(localStorage.getItem("khowar")); if(obj.undo.length == 0) return; var item = obj.undo.pop(); if(item != $("#editor").val()){ obj.redo.push($("#editor").val()); $("#editor").val(item); } else{ $("#editor").val(obj.undo.length == 0 ? "" : obj.undo[obj.undo.length - 1]); obj.redo.push(item); } localStorage.setItem("khowar", JSON.stringify(obj)); }); $("#redo").bind("click", function() { var obj = JSON.parse(localStorage.getItem("khowar")); if(obj.redo.length == 0) return; var item = obj.redo.pop(); $("#editor").val(item); obj.undo.push(item); localStorage.setItem("khowar", JSON.stringify(obj)); }); setInterval(function(){ var obj = JSON.parse(localStorage.getItem("khowar")); var item = $("#editor").val(); if(obj.undo.length == 0 && item.length == 0) return; if(obj.undo.length == 0 || item != obj.undo[obj.undo.length - 1]){ obj.undo.push(item); localStorage.setItem("khowar", JSON.stringify(obj)); } }, 3000); } else{ $("#undo").hide(); $("#redo").hide(); $("#clearAll").hide(); } }); </script> <body> <p><textarea id="editor" name="editor" rows="" dir="ltr" style="width: 620px; height: 100px"></textarea></p> <p><span id="response"></span></p> <p id="action"><button id="selectAll">Select All</button> <button id="undo">Undo</button> <button id="redo">Redo</button> <button id="clearAll">Clear All</button> <button title="Shrink letters" id="shrink">-</button> <button title="Enlarge letters" id="enlarge">+</button> </p> <div id="keyboard"></div> </body> </html>