1
irmtfan
is this possible to include a js file to DHTML editor ?
  • 2004/12/16 17:26

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


i want use a js file (farsi.js) for put farsi keys to DHTML editor:
function storeCaret(textEl) {
    if (
textEl.createTextRangetextEl.caretPos document.selection.createRange().duplicate();

}
var 
lang 1;    // 1: Farsi, 0: English

// Farsi keyboard map based on ISIRI-2901
var farsikey = [
   
0x00200x00210x061B0x066B0x00A40x066A0x060C0x06AF,
   
0x00290x00280x002A0x002B0x06480x002D0x002E0x002F,
   
0x00300x00310x00320x00330x00340x00350x00360x0037,
   
0x00380x00390x003A0x06430x003E0x003D0x003C0x061F,
   
0x066C0x06240x200C0x06980x06490x064D0x06250x0623,
   
0x06220x06510x06290x00BB0x00AB0x06210x004E0x005D,
   
0x005B0x06520x064B0x06260x064F0x064E0x00560x064C,
   
0x00580x06500x06430x062C0x005C0x06860x00D70x0640,
   
0x200D0x06340x06300x06320x064A0x062B0x06280x0644,
   
0x06270x06470x062A0x06460x06450x067E0x062F0x062E,
   
0x062D0x06360x06420x06330x06410x06390x06310x0635,
   
0x06370x063A0x06380x007D0x007C0x007B0x007E ];


function 
changeLang() {
    if (
lang == 0) {
    
lang 1;
    return 
true;
  }
  else {
    
lang 0;
    return 
true;
  }
}

function 
FKeyDown (txtFrm){
 var 
key window.event.keyCode;
 if (
key == 145){
    if (
lang == 0) {
      
lang 1;
      return 
true;
    }
    else {
      
lang 0;
      return 
true;
    }

}

}
function 
FKeyPress(txtFrm) {
   var 
key window.event.keyCode;

  if (
key == 13) { window.event.keyCode 13; return true; }

   if (
lang == 1) { // If Farsi
     
if (key == 0x0020 && window.event.shiftKey// Shift-space -> ZWNJ
       
window.event.keyCode 0x200C;
     else
       
window.event.keyCode farsikey[key 0x0020];
     if (
farsikey[key 0x0020] == 92) {
        
window.event.keyCode 0x0698;
     }
     if (
farsikey[key 0x0020] == 8205) {
        
window.event.keyCode 0x067E;
     }
   }
   return 
true;
}

function 
change(obj){
if (
lang==0)
lang=1
else
lang=0;
obj.focus();
}

thsi file change the keyboard with scroll lock (key == 145)
i open class\xoopsform\fortextarea.php and change:
line 130:
return ".$this->getName()."' id='".$this->getName()."' rows='".$this->getRows()."' cols='".$this->getCols()."'".$this->getExtra().">".$this->getValue()."";

to this:
$form ="";
        
$form .=".$this->getName()."' id='".$this->getName()."' onkeypress=FKeyPress(".$this->getName().") onkeydown=FKeyDown(".$this->getName().") rows='".$this->getRows()."' cols='".$this->getCols()."'".$this->getExtra().">".$this->getValue()."";
        return 
$form;

but it doesnt work. am i missing something or edit a wrong file?
btw is this possible to include a js file to DHTML editor?

2
irmtfan
Re: is this possible to include a js file to DHTML editor ?
  • 2004/12/17 10:51

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


anyone? i think must put code in another file but which one?

Login

Who's Online

348 user(s) are online (243 user(s) are browsing Support Forums)


Members: 0


Guests: 348


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits