Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <!-- <script src="https://cdn.tiny.cloud/1/no-api-key/tinymce/5/tinymce.min.js" referrerpolicy="origin">
- </script>
- Changes:
- -230104a - Translate JS version
- -220214 - Edit-Area test002
- -201019 - hidesubmit option
- <script src="js/tinymce/tinymce.min.js" referrerpolicy="origin">
- </script>
- -->
- <script language="javascript" type="text/javascript" src="edit_area/edit_area_full.js"></script>
- <script>
- editAreaLoader.init({
- id : "text_entered" // textarea id
- ,syntax: "basicsinclair" // syntax to be uses for highgliting
- ,start_highlight: true // to display with highlight mode on start-up
- ,allow_resize:"both"
- ,toolbar: "search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, change_smooth_selection, highlight, reset_highlight, word_wrap,syntax_selection, |, help"
- ,min_height:500
- ,min_width:800
- ,font_size: 18
- });
- function myFunction (){
- console.log(".....myFunction (){ START ");
- /*
- var txt = document.getElementById('text_entered');
- txt.value = greekstring_to_slug(txt.value);
- //alert("Hello onsubmit myfunction");
- */
- //document.getElementById('theForm').submit();
- var x = document.getElementsByName('theForm');
- editAreaLoader.setValue(greekstring_to_slug(editAreaLoader.getValue('text_entered')));
- x[0].submit(); // Form submission
- console.log(".....myFunction (){ END");
- }
- // Translate GREEK JS
- function greekcommands_to_slug(str) {
- console.log('greekcommands_to_slug');
- console.log(str);
- //https://gist.github.com/kostasx/7516158
- //+++ MAYBE ADD a from--to for ΤΥΠΩΣΕ=>PRINT, ΔΩΣΕ->INPUT , ΧΑΡΤΙ-PAPER
- //str = str.replace(/^\s+|\s+$/g, '') // TRIM WHITESPACE AT BOTH ENDS.
- // .toLowerCase(); // CONVERT TO LOWERCASE
- // BASIC COMMAND replace
- const from = [ 'ΤΥΠΩΣΕ','ΧΑΡΤΙ','ΜΕΛΑΝΙ','ΦΛΑΣ','ΠΕΡΙΘΩΡΙΟ','ΓΙΑ','ΕΠΟΜΕΝΟ','ΠΗΓΑΙΝΕ','ΠΑΝΕΕΛΑ','ΕΠΙΣΤΡΟΦΗ','ΠΑΤΑΤΑ' ];
- const to = [ 'PRINT','PAPER','INK','FLASH','BORDER','FOR','NEXT','GOTO','GOSUB','RETURN','PRINT' ];
- for ( var i = 0; i < from.length; i++ ) {
- console.log(from[i].toLowerCase());
- while( str.indexOf( from[i].toLowerCase()) !== -1 ){
- console.log(from[i]);
- str = str.replace( from[i].toLowerCase(), to[i] ); // CONVERT GREEK CHARACTERS TO LATIN LETTERS
- }
- }
- console.log('------greekcommands_to_slug');
- console.log(str);
- return str;
- }//END of function greekcommands_to_slug(str) {
- // Translate GREEK JS
- function greekstring_to_slug(str) {
- //https://gist.github.com/kostasx/7516158
- //first convert KEYWORDS
- str=greekcommands_to_slug(str);
- //+++ MAYBE ADD a from--to for ΤΥΠΩΣΕ=>PRINT, ΔΩΣΕ->INPUT , ΧΑΡΤΙ-PAPER
- str = str.replace(/^\s+|\s+$/g, '') // TRIM WHITESPACE AT BOTH ENDS.
- .toLowerCase(); // CONVERT TO LOWERCASE
- console.log('greekstring_to_slug AFT greekcommands_to_slug');
- console.log(str);
- // maybe remove "ου", "ΟΥ", ... "??"...
- const from = [ "ου", "ΟΥ", "Ού", "ού", "αυ", "ΑΥ", "Αύ", "αύ", "ευ", "ΕΥ", "Εύ", "εύ", "α", "Α", "ά", "Ά", "β", "Β", "γ", "Γ", "δ", "Δ", "ε", "Ε", "έ", "Έ", "ζ", "Ζ", "η", "Η", "ή", "Ή", "θ", "Θ", "ι", "Ι", "ί", "Ί", "ϊ", "ΐ", "Ϊ", "κ", "Κ", "λ", "Λ", "μ", "Μ", "ν", "Ν", "ξ", "Ξ", "ο", "Ο", "ό", "Ό", "π", "Π", "ρ", "Ρ", "σ", "Σ", "ς", "τ", "Τ", "υ", "Υ", "ύ", "Ύ", "ϋ", "ΰ", "Ϋ", "φ", "Φ", "χ", "Χ", "ψ", "Ψ", "ω", "Ω", "ώ", "Ώ" ];
- const to = [ "ou", "ou", "ou", "ou", "au", "au", "au", "au", "eu", "eu", "eu", "eu", "a", "a", "a", "a", "b", "b", "g", "g", "d", "d", "e", "e", "e", "e", "z", "z", "i", "i", "i", "i", "th", "th", "i", "i", "i", "i", "i", "i", "i", "k", "k", "l", "l", "m", "m", "n", "n", "ks", "ks", "o", "o", "o", "o", "p", "p", "r", "r", "s", "s", "s", "t", "t", "y", "y", "y", "y", "y", "y", "y", "f", "f", "x", "x", "ps", "ps", "o", "o", "o", "o" ];
- for ( var i = 0; i < from.length; i++ ) {
- while( str.indexOf( from[i]) !== -1 ){
- str = str.replace( from[i], to[i] ); // CONVERT GREEK CHARACTERS TO LATIN LETTERS
- }
- }
- return str;
- }//END of function greekstring_to_slug(str) {
- /*
- window.onload = function() {
- //alert("Hello onload");
- //editAreaLoader.getValue('text_entered');
- document.getElementById('theForm').onsubmit = function() {
- var txt = document.getElementById('text_entered');
- txt.value = greekstring_to_slug(txt.value);
- console.log("......document.getElementById('theForm').onsubmit");
- //alert("Hello onsubmit 1");
- };
- };
- */
- </script>
- </head>
- <body>
- <!-- <form action="handle-submit.php" name="theForm" target="emulator_output" id="theForm" method="post" onsubmit="editAreaLoader.getValue('text_entered')">
- -->
- <form action="handle-submit.php" name="theForm" target="emulator_output" id="theForm" method="post" onsubmit="myFunction();" >
- <textarea name="text_entered" id="text_entered" wrap="hard" >
- 10 PRINT "HELLO ΠΑΤΑΤΑ ΤΥΠΩΣΕ"
- 20 INPUT "AA= ";a$
- </textarea>
- <!--<div id="div-submit" >----------------------------div-submit -->
- <label for="name">ΟΝΟΜΑ ΣΧΟΛΕΙΟΥ (School):</label> <!--SchoolName -->
- <input type="text" id="schoolname" name="schoolname" size=15>
- <br>
- <br> ΤΑΞΗ (Class):
- <select name="taksi" id="taksi"> <!--Elementary Class -->
- <option value="Α">Α</option>
- <option value="Β">Β</option>
- <option value="Γ">Γ</option>
- <option value="Δ">Δ</option>
- <option value="Ε">Ε</option>
- <option value="ΣΤ">ΣΤ</option>
- </select> ΤΜΗΜΑ (sub-class):
- <select name="tmima" id="tmima"><!--Elementary SubClass -->
- <option value="1">1</option>
- <option value="2">2</option>
- </select>
- <BR>
- <label for="name">ΟΝΟΜΑ(ΤΑ)/Names:</label><!--Student names -->
- <input type="text" id="name" name="name" size=60>
- <br>
- <br>
- <input type="submit" value="ΥΠΟΒΟΛΗ">
- <!--</div>------------------------------------------div-submit -->
- </form>
- <hr>
- <!-- FUNCTIONS #################### -->
- <!--<script src="tinymce_lesson_js_footer.js" type="text/javascript"></script> -->
- <script>/*
- window.onload = function() {
- alert("Hello onload END");
- //editAreaLoader.getValue('text_entered');
- document.getElementById('theForm').onsubmit = function() {
- var txt = document.getElementById('text_entered');
- txt.value = greekstring_to_slug(txt.value);
- //alert("Hello onsubmit 1end");
- };
- };
- */
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement