Pull CodeMirror from CDN, use submodule for polyfill

This commit is contained in:
Joshua Bell 2013-12-08 15:48:03 -08:00
parent 207fed95cb
commit 728c1599e5
6 changed files with 34 additions and 37 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "polyfill"]
path = polyfill
url = https://github.com/inexorabletash/polyfill.git

View File

@ -1,15 +1,9 @@
jsbasic - Applesoft BASIC in JavaScript
=======================================
This is hosted for playing with at http://calormen.com/applesoft/
This is hosted for playing with at http://calormen.com/applesoft/
For older browsers, the code depends on various [polyfills](http://github.com/inexorabletash/polyfill).
For syntax highlighting, the editor optionally uses [CodeMirror](http://codemirror.net) and custom BASIC parser/styles.
Clone these into sibling directories, so you end up with a structure like:
jsbasic/
polyfill/
CodeMirror/
Use `git clone --recursive` to get [polyfill](http://github.com/inexorabletash/polyfill) for older browsers.
Notes & Known Issues
--------------------
@ -35,4 +29,3 @@ You can run your basic programs from the command line (with only basic text inpu
* Clone the repository locally
* On Windows, run from a command prompt via: `cscript.exe cbasic.js your_program.txt`
* On Mac/Linux, install Mozilla Rhino, run from the command prompt via: `java -jar PATH_TO/js.jar cbasic.js your_program.txt`

View File

@ -6,16 +6,16 @@
<link rel="stylesheet" href="styles.css" type="text/css">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Suppress browser compat button -->
<script type="text/javascript" src="../polyfill/polyfill.js?update=2012-02-08"></script>
<script type="text/javascript">
<script src="polyfill/polyfill.js?update=2012-02-08"></script>
<script>
(function () {
function load(url) { document.write('<script type="text/javascript" src="' + url + '"></' + 'script>'); }
if (!window.JSON) { load('../polyfill/json2.js'); }
if (!window.localStorage || !window.sessionStorage) { load('../polyfill/storage.js'); }
if (!('getContext' in document.createElement('canvas'))) { load('../polyfill/flashcanvas.js'); }
function load(url) { document.write('<script src="' + url + '"></' + 'script>'); }
if (!window.JSON) { load('polyfill/json2.js'); }
if (!window.localStorage || !window.sessionStorage) { load('polyfill/storage.js'); }
if (!('getContext' in document.createElement('canvas'))) { load('polyfill/flashcanvas.js'); }
}());
</script>
<script type="text/javascript" src="../polyfill/keyboard.js"></script>
<script src="polyfill/keyboard.js"></script>
<h1>Applesoft BASIC in Javascript</h1>
<p>
@ -130,8 +130,8 @@ By <a href="mailto:inexorabletash@gmail.com">Joshua Bell</a>
<div id="paper"></div>
<!-- CodeMirror syntax highlighting - this is optional -->
<script src="../CodeMirror/lib/codemirror.js"></script>
<link rel="stylesheet" href="../CodeMirror/lib/codemirror.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.css">
<script src="cm/basic.js"></script>
<link rel="stylesheet" href="cm/basic.css">
<style type="text/css">
@ -139,17 +139,17 @@ By <a href="mailto:inexorabletash@gmail.com">Joshua Bell</a>
.CodeMirror-scroll { height: 100%; }
</style>
<script type="text/javascript" src="basic.js?2012-02-08"></script>
<script type="text/javascript" src="bell.js"></script>
<script type="text/javascript" src="tty.js"></script>
<script type="text/javascript" src="lores.js"></script>
<script type="text/javascript" src="hires.js"></script>
<script type="text/javascript" src="dos.js"></script>
<script type="text/javascript" src="printer.js"></script>
<script type="text/javascript" src="index.js"></script>
<script src="basic.js?2012-02-08"></script>
<script src="bell.js"></script>
<script src="tty.js"></script>
<script src="lores.js"></script>
<script src="hires.js"></script>
<script src="dos.js"></script>
<script src="printer.js"></script>
<script src="index.js"></script>
<!-- Google Analytics -->
<script type="text/javascript">
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18610679-3']);
_gaq.push(['_trackPageview']);

1
polyfill Submodule

@ -0,0 +1 @@
Subproject commit fc2ff48f6ebed7e80c7b3cd62f83e2f22fd3b9bb

View File

@ -594,7 +594,7 @@ function which implements the logic for walking over the array.<p>
</ol>
</section>
<script type="text/javascript" src="../polyfill/polyfill.js"></script>
<script src="polyfill/polyfill.js"></script>
<script>
(function buildTOC(el) {
var html = [];

View File

@ -7,15 +7,15 @@
document.write('<link rel="stylesheet" href="' + baseURL + 'display.css">');
function load(url) { document.write('<script type="text/javascript" src="' + url + '"></script>'); }
load(baseURL + '../polyfill/polyfill.js');
load(baseURL + '../polyfill/keyboard.js');
load(baseURL + 'tty.js');
load(baseURL + 'lores.js');
load(baseURL + 'hires.js');
load(baseURL + 'bell.js');
load(baseURL + 'dos.js');
load(baseURL + 'basic.js');
function load(url) { document.write('<script src="' + baseURL + url + '"></script>'); }
load('polyfill/polyfill.js');
load('polyfill/keyboard.js');
load('tty.js');
load('lores.js');
load('hires.js');
load('bell.js');
load('dos.js');
load('basic.js');
function createInstance(src) {
function ce(element, attributes, children) {