Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Morse Code, haha
Rating 4 V
icss21
post Jul 22 2006, 08:26 AM
Post #1


Newbie [Level 1]
*

Group: Members
Posts: 22
Joined: 20-July 06
Member No.: 26,937



very useful biggrin.gif you know why...

CODE

<A></A>
<P align=left><!-- saved from url=(0034)http://www.mathsking.net/morse.htm -->
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<META content=FrontPage.Editor.Document name=ProgId>
<script language=JavaScript>
var respecterCasse = true;
var ignorerCasse = false;
var motsEntiers = true;
var touteSousChaine = false;

function rechercher(cible,terme,respecterCasse,motSeulement) {

  var ind = 0;
  var suivant = 0;

  if (!respecterCasse) {
    terme = terme.toLowerCase();
    cible = cible.toLowerCase();
  }

  while ((ind = cible.indexOf(terme,suivant)) >= 0) {
    if (motSeulement) {
      var avant = ind - 1;
      var apres = ind + terme.length;
      if (!(espace(cible.charAt(avant)) && espace(cible.charAt(apres)))) {
        suivant = ind + terme.length;
        continue;
      }
    }
    return true;
  }

  return false;

}

function remplacer(cible, ancienTerme,nouveauTerme,respecterCasse,motSeulement) {

  var travail = cible;
  var ind = 0;
  var suivant = 0;

  if (!respecterCasse) {
    ancienTerme = ancienTerme.toLowerCase();
    travail = cible.toLowerCase();
  }

  while ((ind = travail.indexOf(ancienTerme,suivant)) >= 0) {
    if (motSeulement) {
      var avant = ind - 1;
      var apres = ind + ancienTerme.length;
      if (!(espace(travail.charAt(avant)) && espace(travail.charAt(apres)))) {
        suivant = ind + ancienTerme.length;
        continue;
      }
    }
    cible = cible.substring(0,ind) + nouveauTerme +
cible.substring(ind+ancienTerme.length,cible.length);
    travail = travail.substring(0,ind) + nouveauTerme +
travail.substring(ind+ancienTerme.length,travail.length);
    suivant = ind + nouveauTerme.length;
    if (suivant >= travail.length) { break; }
  }

  return cible;

}

function espace(check) {

  var espace = " ,/<>?!`';:%^&()=|{}" + '"' + "\\\n\t";


  for (var i = 0; i < espace.length; i++)
    if (check == espace.charAt(i)) { return true; }
  
  if (check == "") { return true; }
  if (check == null) { return true; }

  return false;

}

// STOP HIDING -->
function creerMatrice(num) {  for (var i=1; i <= num; i++)    this[i] = "";  this.length =

num;}
var MORSE = new creerMatrice(26+6);
var AVIATION = new creerMatrice(26+6);

MORSE[01] = ".-"
MORSE[02] = "-..."
MORSE[03] = "-.-."
MORSE[04] = "-.."
MORSE[05] = "."
MORSE[06] = "..-."
MORSE[07] = "--."
MORSE[08] = "...."
MORSE[09] = ".."
MORSE[10] = ".---"
MORSE[11] = "-.-"
MORSE[12] = ".-.."
MORSE[13] = "--"
MORSE[14] = "-."
MORSE[15] = "---"
MORSE[16] = ".--."
MORSE[17] = "--.-"
MORSE[18] = ".-."
MORSE[19] = "..."
MORSE[20] = "-"
MORSE[21] = "..-"
MORSE[22] = "...-"
MORSE[23] = ".--"
MORSE[24] = "-..-"
MORSE[25] = "-.--"
MORSE[26] = "--.."
MORSE[27] = "-.-.."
MORSE[28] = "--.-."
MORSE[29] = "----"
MORSE[30] = ".---."
MORSE[31] = "...-."
MORSE[32] = "..--"


CARACTERES = "ABCDEFGHIJKLMNOPQRSTUVWXYZ[@*]$#"




function CODE(LETTRE){

if(LETTRE == " "){
return " "
}


for(tg=0; tg<=26+6; tg++) {

var LT = CARACTERES.charAt(tg)



if(LT == LETTRE){
return MORSE[tg +1]

}

}
return ""
}


function GO() {
var text = document.forms[0].valeur.value
text = text.toUpperCase()
var MSG = ""
var LTR = ""
NUM = text.length


for(t = 0; t <= NUM-1; t++){
if (text.charAt(t) == '^') {
LTR = text.charAt(++t)
switch (LTR) {
  case 'C': case 'c': LTR = "["; break;
  case 'G': case 'g': LTR = "@"; break;
  case 'H': case 'h': LTR = "*"; break;
  case 'J': case 'j': LTR = "]"; break;
  case 'S': case 's': LTR = "$"; break;
  case 'U': case 'u': LTR = "#"; break;
}
} else {
LTR = text.charAt(t)
}
MSG = MSG + ( CODE(LTR) + " ");

}

document.forms[0].OUTPUT.value = MSG
}



function UNGO(){
var text = document.forms[0].OUTPUT.value
text = text.toUpperCase()
var MSG = text + " "

for(th=0;th<=25+6;th++){
AA = MORSE[th +1]
BB = CARACTERES.charAt(th)

MSG = remplacer(MSG,AA,BB,false, true)}
MSG = remplacer(MSG,"  ","%")
MSG = remplacer(MSG," ","")
MSG = remplacer(MSG,"%"," ")
document.forms[0].valeur.value = MSG

}

   </SCRIPT>
<B><I><FONT face="Comic Sans MS" size=4>MORSE</FONT></I></B><BR></P>
<TABLE height=152 cols=1 width="100%" border=0>
<TBODY>
<TR>
<TD height=1>
<FORM name=entree></TD></TR>
<TR>
<TD height=18><B><FONT face=Fixedsys size=4>alphabet:</FONT></B></TD></TR>
<TR>
<TD height=25><INPUT style="WIDTH: 377px; HEIGHT: 21px" size=50 name=valeur>&nbsp; <INPUT

onclick=GO() type=button size=15 value=translate to morse name=ok></TD></TR>
<TR>
<TD height=19><B><FONT face=Fixedsys size=4>morse code:</FONT></B></TD></TR>
<TR>
<TD height=25><INPUT style="WIDTH: 377px; HEIGHT: 21px" size=52 name=OUTPUT>&nbsp; <INPUT

onclick=UNGO() type=button size=15 value=translate to alphabet

name=decode></TD></TR></TBODY></TABLE><BR><INPUT type=reset value=delete><BR></FORM>
Go to the top of the page
 
+Quote Post
SolarX
post Jul 22 2006, 11:20 AM
Post #2


Member [Level 3]
******

Group: Members
Posts: 90
Joined: 5-January 06
From: our universe
Member No.: 16,648



It would be nice if you tell us what this piece of code does... wink.gif

Go to the top of the page
 
+Quote Post
icss21
post Jul 22 2006, 11:33 AM
Post #3


Newbie [Level 1]
*

Group: Members
Posts: 22
Joined: 20-July 06
Member No.: 26,937



its eh...translation tool,
the morse code

see here:
MORSE[01] = ".-"
MORSE[02] = "-..."
MORSE[03] = "-.-."
MORSE[04] = "-.."
MORSE[05] = "."
MORSE[06] = "..-."
MORSE[07] = "--."
MORSE[08] = "...."
MORSE[09] = ".."
MORSE[10] = ".---"
MORSE[11] = "-.-"
MORSE[12] = ".-.."
MORSE[13] = "--"
MORSE[14] = "-."
MORSE[15] = "---"
MORSE[16] = ".--."
MORSE[17] = "--.-"
MORSE[18] = ".-."
MORSE[19] = "..."
MORSE[20] = "-"
MORSE[21] = "..-"
MORSE[22] = "...-"
MORSE[23] = ".--"
MORSE[24] = "-..-"
MORSE[25] = "-.--"
MORSE[26] = "--.."
MORSE[27] = "-.-.."
MORSE[28] = "--.-."
MORSE[29] = "----"
MORSE[30] = ".---."
MORSE[31] = "...-."
MORSE[32] = "..--"

just have the type-words change into these symbols,and also change back

This post has been edited by icss21: Jul 22 2006, 11:36 AM
Go to the top of the page
 
+Quote Post
Lyon2
post Jul 22 2006, 11:37 AM
Post #4


The Ethical Hacker
***********

Group: [HOSTED]
Posts: 1,151
Joined: 27-May 05
From: Portugal (Europe)
Member No.: 7,566



Thanks, but explain it better.

What do i have to do, just insert it in a html page, or what?

Please give more information, it sounds very usefull and interesting, but i need to now more before i do anything else.
Go to the top of the page
 
+Quote Post
JField
post Jul 22 2006, 02:24 PM
Post #5


Member [Level 2]
*****

Group: Members
Posts: 77
Joined: 20-July 06
Member No.: 26,936



Good job.. thank you
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Whats The Best Code?(32)
  2. Disable Scrollbars, Menubars Etc....(6)
  3. I Forgot A Code(7)
  4. Scroll Color(2)
  5. Blendtrans Filter With Onmouseover?(1)
  6. Redirect Code Help(8)
  7. List-style Help(2)
  8. W3c Compliant Flash(0)
  9. Total Lines Of Code(3)
  10. Code For This Table Layout?(6)
  11. What Is The Xhtml 1.1 Code To Embed An Applet?(2)
  12. Code To Autocomplete A Form?(7)
  13. Realtime/wma Player In Websites(5)
  14. Html Question Concerning Pre Tag And Code Tag(8)
  15. Have You Used This Html Code?(9)
  1. Screen Resolution(6)
  2. My Very Sad Code(4)
  3. Transparent Roll Over Pictures(4)
  4. How To Display Php Code [resolved](8)
  5. Email Form Code(8)
  6. I Need Help With This Code(3)
  7. Applet Code(0)


 



- Lo-Fi Version Time is now: 30th August 2008 - 11:27 AM