Permalink
Browse files

Переход на один .js скрипт

  • Loading branch information...
socketpair committed Jul 18, 2012
1 parent 67a57ff commit 28ef0a3c6d8450bcfe21b31be40c7a5b446e18a1
Showing with 45 additions and 32 deletions.
  1. +22 −0 build.sh
  2. +22 −10 index.html
  3. +1 −22 jslinux.js
View
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+{
+ echo '"use strict";'
+ echo 'var jslinux_start = (function () {'
+ echo 'var PCEmulator;'
+ cat utils.js; echo
+ echo 'function include(asd) { if (asd==="cpux86-ta.js") PCEmulator=cpux86_ta(); else PCEmulator=cpux86_std(); }'
+ cat term.js; echo
+ cat cpux86.js; echo
+ echo 'function cpux86_std() {'
+ cat cpux86-std.js; echo
+ echo 'return PCEmulator;'
+ echo '}'
+ echo 'function cpux86_ta() {'
+ cat cpux86-ta.js; echo
+ echo 'return PCEmulator;'
+ echo '}'
+ cat jslinux.js ; echo
+ echo 'return start;'
+ echo '}).call({});'
+} > all1.js
View
@@ -25,15 +25,27 @@
}
</style>
</head>
-<body onload="start()">
-<table border="0">
-<tr valign="top"><td>
-<script type="text/javascript" src="utils.js"></script>
-<script type="text/javascript" src="term.js"></script>
-<script type="text/javascript" src="cpux86.js"></script>
-<script type="text/javascript" src="jslinux.js"></script>
-<div id="copyright">&copy; 2011 Fabrice Bellard - <a href="news.html">News</a> - <a href="faq.html">FAQ</a> - <a href="tech.html">Technical notes</a></div>
-<td><input type="button" value="Clear clipboard" onclick="clear_clipboard();"><br><textarea row="4" cols="16" id="text_clipboard"></textarea>
-</table>
+<body onload="jslinux_start(myget, myset)">
+<script type="text/javascript">
+function myget() {
+ "use strict";
+ if (window.jsclipboard)
+ return window.jsclipboard;
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.open('GET', '/clipboard.txt', false);
+ xmlhttp.send(null);
+ if(xmlhttp.status < 400 && xmlhttp.status>=200 ) {
+ window.jsclipboard = xmlhttp.responseText;
+ return window.jsclipboard;
+ }
+ return '';
+}
+
+function myset(val) {
+ "use strict";
+ console.log(val);
+}
+</script>
+<script type="text/javascript" src="all1.js"></script>
</body>
</html>
View
@@ -23,34 +23,13 @@ function term_handler(str)
pc.serial.send_chars(str);
}
-function clipboard_set(val)
-{
- var el;
- el = document.getElementById("text_clipboard");
- el.value = val;
-}
-
-function clipboard_get()
-{
- var el;
- el = document.getElementById("text_clipboard");
- return el.value;
-}
-
-function clear_clipboard()
-{
- var el;
- el = document.getElementById("text_clipboard");
- el.value = "";
-}
-
/* just used to display the boot time in the VM */
function get_boot_time()
{
return (+new Date()) - boot_start_time;
}
-function start()
+function start(clipboard_get, clipboard_set)
{
var params;

0 comments on commit 28ef0a3

Please sign in to comment.