Disable/Enable the "Wrap" button upon editing/loading.
Chris Pressey
10 years ago
45 | 45 |
<button id="start">Start</button>
|
46 | 46 |
<button id="stop">Stop</button>
|
47 | 47 |
<button id="step">Step</button>
|
48 | |
<button onclick="c.wrapWith(document.getElementById('pixley-interpreter').innerHTML);">Wrap in Pixley Interpreter</button>
|
|
48 |
<button id="wrap" onclick="c.wrapWith(document.getElementById('pixley-interpreter').innerHTML);">Wrap in Pixley Interpreter</button>
|
49 | 49 |
<input id="speed" type="range" min="0" max="200" value="0" />
|
50 | 50 |
<span id="status"></span>
|
51 | 51 |
|
|
233 | 233 |
c.init({
|
234 | 234 |
'status': document.getElementById('status'),
|
235 | 235 |
'display': document.getElementById('display'),
|
236 | |
'output': document.getElementById('output')
|
|
236 |
'output': document.getElementById('output'),
|
|
237 |
'wrapButton': document.getElementById('wrap')
|
237 | 238 |
});
|
238 | 239 |
c.connect({
|
239 | 240 |
'start': 'start',
|
4 | 4 |
alert('ERROR! ' + msg);
|
5 | 5 |
};
|
6 | 6 |
|
|
7 |
var proto = new yoob.Controller();
|
7 | 8 |
function PixleyController() {
|
8 | 9 |
this.init = function(cfg) {
|
9 | 10 |
this.ast = undefined;
|
10 | 11 |
this.status = cfg.status;
|
11 | 12 |
this.display = cfg.display;
|
12 | 13 |
this.output = cfg.output;
|
|
14 |
this.wrapButton = cfg.wrapButton;
|
13 | 15 |
this.workerURL = cfg.workerURL || "../src/pixley-worker.js";
|
14 | 16 |
this.loadWorker();
|
15 | 17 |
this.running = false;
|
|
79 | 81 |
this.wrapWith = function(lambdaText) {
|
80 | 82 |
this.load('(' + lambdaText + ' (quote ' + depict(this.ast) + '))');
|
81 | 83 |
};
|
|
84 |
|
|
85 |
// Awkward But Hopefully Successful Attempts at Calling Super Methods
|
|
86 |
this.click_edit = function(e) {
|
|
87 |
proto.click_edit.apply(this, [e]);
|
|
88 |
if (this.wrapButton) this.wrapButton.disabled = true;
|
|
89 |
};
|
|
90 |
|
|
91 |
this.click_load = function(e) {
|
|
92 |
proto.click_load.apply(this, [e]);
|
|
93 |
if (this.wrapButton) this.wrapButton.disabled = false;
|
|
94 |
};
|
82 | 95 |
};
|
83 | |
PixleyController.prototype = new yoob.Controller();
|
|
96 |
PixleyController.prototype = proto;
|