صارف:Nooruddin2020/مائکروسافٹ اردو.js
آپ کی توجہ درکار ہے۔ اس صفحہ میں جو اسکرپٹ شامل ہیں، وہ صفحہ لوڈ ہونے پر ہر دفعہ چلیں گی۔ لہذا خراب، غلط اور نامناسب کوڈ یا اسکرپٹ یہاں درج نہ کریں۔ اس سے آپ کے کھاتے کو بھی خطرہ لاحق ہو سکتا ہے۔ |
یاددہانی: محفوظ کرنے کے بعد تازہ ترین تبدیلیوں کو دیکھنے کے لیے آپ کو اپنے براؤزر کا کیش صاف کرنا ہوگا۔
- فائرفاکس/ سفاری: جب Reload پر کلک کریں تو Shift دبا کر رکھیں، یا Ctrl-F5 یا Ctrl-R دبائیں (Mac پر R- )
- گوگل کروم: Ctrl-Shift-R دبائیں (Mac پر Shift-R-⌘)
- انٹرنیٹ ایکسپلورر: جب Refresh پر کلک کریں تو Ctrl یا Ctrl-F5 دبائیں
- اوپیرا: Tools → Preferences میں جائیں اور کیش صاف کریں
اس اسکرپٹ کی دستاویزی تفصیلات صارف:Nooruddin2020/مائکروسافٹ اردو پر درج کی جا سکتی ہیں۔ |
//======================================================================
// Urdu Keymapper Version 0.4 beta
// Author : Saqib Saud
// Maintainer : Nooruddin2020 (نورالدین)
// License: GPL
//======================================================================
// Global variables
var ua = navigator.userAgent.toLowerCase();
var isIE = ((ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1));
var isGecko = (ua.indexOf("gecko") != -1);
var isOpera= window.opera;
function _s(c){return String.fromCharCode(c)}
var codes= new Array();
codes['a']=0x0645; // Arabic Letter Meem
codes['b']=0x0634; // Arabic Letter Sheen
codes['c']=0x06D2; // Arabic Letter Yeh Barree
codes['d']=0x0631; // Arabic Letter Reh
codes['e']=0x06BE; // Arabic Letter Heh Doachashmee
codes['f']=0x0646; // Arabic Letter Noon
codes['g']=0x0644; // Arabic Letter Laam
codes['h']=0x06C1; // Arabic Letter Heh
codes['i']=0x0628; // Arabic Letter Beh
codes['j']=0x0627; // Arabic Letter Alef
codes['k']=0x06A9; // Arabic Letter Kaf
codes['l']=0x0649; // Arabic Letter Alef Maksura
codes['m']=0x0639; // Arabic Letter Ain
codes['n']=0x063A; // Arabic Letter GHain
codes['o']=0x062C; // Arabic Letter Jeem
codes['p']=0x062D; // Arabic Letter Hah
codes['q']=0x0637; // Arabic Letter Tah
codes['r']=0x062F; // Arabic Letter Dal
codes['s']=0x0648; // Arabic Letter Waw
codes['t']=0x0679; // Arabic Letter Tteh
codes['u']=0x062A; // Arabic Letter Teh
codes['v']=0x0633; // Arabic Letter Seen
codes['w']=0x0635; // Arabic Letter Saad
codes['x']=0x0641; // Arabic Letter Feh
codes['y']=0x067E; // Arabic Letter Peh
codes['z']=0x0642; // Arabic Letter Qaf
codes['A']=0x0698; // Arabic Letter Zheh
codes['B']=0x0624; // Arabic Letter Waw with Hamza Above
codes['C']=0x06D3; // Arabic Letter Yey Barree sith Hamza above
codes['D']=0x0691; // Arabic Letter Rreh
codes['E']=0x0630; // Arabic Letter Zhaal
codes['F']=0x06BA; // Arabic Letter Noon GHunna
codes['G']=0x06C2; // Arabic Letter Heh Goal with Hamza above
codes['H']=0xFE80; // Arabic Letter Hamza Isolated form
codes['I']=0x0670; // Arabic Letter Superscript Alef
codes['J']=0x0622; // Arabic Letter Alef with Maddah above
codes['K']=0x06AF; // Arabic Letter Gaf
codes['L']=0x064A; // Arabic Letter Yeh
codes['M']=0x064F; //Arabic Damma
codes['N']=0x0626; // Arabic Letter Yeh with Hamza above
codes['O']=0x0686; // Arabic Letter Tcheh
codes['P']=0x062E; // Arabic Letter Khah
codes['Q']=0x0638; // Arabic Letter Zah
codes['R']=0x0688; // Arabic Letter Ddal
codes['S']=0x0632; // Arabic Letter Zeh / Zain
codes['T']=0x062B; // Arabic Letter Seh
codes['U']=0x0629; // Arabic Letter Teh Marbuta
codes['V']=0x0638;
codes['W']=0x0636; // Arabic Letter Dzad
codes['X']=0x0652; // Arabic Sukun / Jazm
codes['Z']=0x064b;// Arabic fATHATAN
codes['>']=0x0618; // Arabic Fatah
codes['<']=0x061A; // Arabic Kasra
codes[_s(32)]=32;
codes[_s(13)]=13;
codes[':']=0x061B;
codes[';']=0x061B;
codes[_s(39)]=0x2018;
codes[_s(34)]=0x201C;
codes[_s(46)]=0x06D4;
codes[_s(44)]=0x060C;
codes['!']= 0x0021;
codes['?']=0x061F;
codes[':']=58;
/* codes['[']=0x0654; // hamza above
codes[']']=0x0655; // hamza below
codes['~']=0x0653; // mad above
codes['^']=0x0652; // sukun
codes['/']=0x002F; // slash
codes['L']=0x064C; // do paish
codes['|']=0x0200C; // ZWNJ
codes['+']=0x002B;
codes['-']=0x002D;
codes['*']=0x00D7;
codes[_s(47)]=0x00F7;
codes[_s(37)]=0x066A;
codes['(']=0x0028;
codes[')']=0x0029;
codes['=']=0x003D;*/
codes['0']=0x0660; //Arabic digit zero
codes['1']=0x0661;
codes['2']=0x0662;
codes['3']=0x0663;
codes['4']=0x0664;
codes['5']=0x0665;
codes['6']=0x0666;
codes['7']=0x0667;
codes['8']=0x0668;
codes['9']=0x0669;//Arabic digit nine
function addTextEvent() {
var editForm =document.getElementById('editform');
if(editForm != null) {
var textBox=document.getElementById('wpTextbox1');
var textSummary = document.getElementById('wpSummary');
attachEvent(editForm,textBox);
addCheckbox(editForm,textBox );
if(textSummary) { attachEvent(editForm,textSummary); }
}
// add transliteration feature to search form
var searchForm = document.getElementById('searchform');
if( searchForm != null ) {
var searchBox = document.getElementById('searchInput');
if(searchBox) { attachEvent(searchForm,searchBox); }
}
// add transliteration feature to power search
var powerSearchForm = document.getElementById('search');
if( powerSearchForm != null) {
var powerSearchBox = document.getElementById('lsearchbox');
if( powerSearchBox ) { attachEvent(powerSearchForm, powerSearchBox );}
}
// add transliteration feature to move page
var movePageForm = document.getElementById('movepage');
if( movePageForm != null ) {
var newTitleBox = document.getElementById('wpNewTitleMain');
var reasonBox = document.getElementById('wpReason');
if( newTitleBox ) {attachEvent(movePageForm, newTitleBox);}
if( reasonBox ) {attachEvent(movePageForm, reasonBox ); }
}
// add transliteration feature to upload feature page
var upForm=document.getElementById('upload');
if(upForm)
{
var upName=document.getElementById('wpDestFile');
var upComment=document.getElementById('wpUploadDescription');
if(upName) attachEvent(upForm,upName);
if(upComment) attachEvent(upForm,upComment);
}
// add transliteration feature to create inputbox
var crForm=document.getElementById('createbox');
if(crForm)
{
var crName=crForm.title;
if(crName) attachEvent(crForm,crName);
}
//todo:using for loop .. all event handler to all input type="text"
}
function attachEvent(editForm,textBox){
checkrt(editForm); //what does this thing do?
if (textBox.addEventListener)
textBox.addEventListener("keypress", processKeys, false);
else if (textBox.attachEvent)
textBox.attachEvent("onkeypress", processKeys);
}
function addCheckbox(editform,textBox ){
var element = document.createElement("input");
element.setAttribute("type","checkbox");
element.setAttribute("id","realtime");
if (element.addEventListener)
element.addEventListener("click", rtClick, false);
else if (element.attachEvent)
element.attachEvent("onclick", rtClick);
var labelcheckBox = document.createTextNode('اردو کلیدی تختہ انتخاب بالعکس');
editform.insertBefore(element,textBox);
document.getElementById("realtime").checked = realTime;
editform.insertBefore(labelcheckBox,textBox);
}
var realTime = true;
function rtClick(event) {
realTime = !realTime;
}
var rtsupported = false;
var error;
function checkrt(editform){
try {
/*
var nav = navigator.userAgent.toUpperCase();
rtsupported = (nav.indexOf("GECKO") >= 0 || nav.indexOf("OPERA") >= 0 || nav.indexOf("SAFARI") >= 0);
*/
rtsupported = (document.selection != undefined)
if (!rtsupported) {
var element = document.createElement("TEXTAREA");
editform.appendChild(element);
if (element.selectionStart != undefined)
rtsupported = true;
editform.removeChild(element);
}
}
catch (error) {
}
}
function processKeys(event, objId) {
//document.getElementById("wpTextbox1").value = "cvbvc";
//alert(event.target.id);
//var as=event.target;
//as.value = "hjkhj";
//alert(as);
var charCode = (event.charCode) ? event.charCode : event.keyCode;
if (rtsupported){
if (charCode == 32 && event.ctrlKey) {
//ctrl +space to toggle
realTime = !realTime;
if(isIE){
event.returnValue=false;
event.cancelBubble=true;
}
else if(isGecko){
event.preventDefault();
event.stopPropagation();
}//to disable defualt behaviours
var check=document.getElementById("realtime")
if(check)
check.checked = realTime;
}
else if (realTime) mapKey(event);
}
}
function mapKey(event){
//var ua = navigator.userAgent.toLowerCase();
if ( (pressedKey(event) > 20) && !event.ctrlKey && !event.altKey && !event.metaKey) {
var c = _s(pressedKey(event));
if (codes[c] != undefined ){ //if value for key is not defined in array
if(isIE){
event.returnValue=false;
event.cancelBubble=true;
edInsertContent(event.srcElement, _s(codes[c]));
}
else if(isGecko){
event.preventDefault();
event.stopPropagation();
edInsertContent(event.target, _s(codes[c]));
}//to disable defualt behaviours
}
//alert( c);
}
}
// function : edInsertContent
// Aurthor: Alex King
// Js Quick Tags (Available under GPL)
// Site: http://alexking.org/blog/2004/06/03/js-quicktags-under-lgpl/
function edInsertContent(myField, myValue) {
//IE support
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
myField.focus();
}
//MOZILLA/NETSCAPE support
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
var scrollTop = myField.scrollTop;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
myField.focus();
myField.selectionStart = startPos + myValue.length;
myField.selectionEnd = startPos + myValue.length;
myField.scrollTop = scrollTop;
}
else {
myField.value += myValue;
myField.focus();
}
}
function pressedKey(event) {
if (isIE)
return event.keyCode;
else
return event.which;
}
//Get Hooked !
$(addTextEvent);
function addMenu()
{
var portlet = document.getElementById('p-tb');
if (portlet != null)
{
HIMHTML = '<div class="portlet">کلیدی تختہ ایم ایس<div class="pBody">';
HIMHTML += '<input id="ukm_ckspell" name="ukm_method" type="checkbox" onclick="rtClick();" /> <label class="radio" for="him_ckspell">کلیدی تختہ مائیکرو سافٹ (آزمائشی)</label> <small>[ctrl + space]</small></div></div>';
portlet.innerHTML = HIMHTML + portlet.innerHTML;
}
}
$(addMenu);