56 | 56 |
this.controls[key] = value;
|
57 | 57 |
}
|
58 | 58 |
}
|
|
59 |
if (this.controls.stop) {
|
|
60 |
this.controls.stop.disabled = true;
|
|
61 |
}
|
59 | 62 |
|
60 | 63 |
var keys = ["source", "display"];
|
61 | 64 |
for (var i in keys) {
|
|
64 | 67 |
if (typeof value === 'string') {
|
65 | 68 |
value = document.getElementById(value);
|
66 | 69 |
}
|
67 | |
if (value !== undefined) {
|
|
70 |
if (value) {
|
68 | 71 |
this[key] = value;
|
69 | 72 |
}
|
70 | 73 |
}
|
|
73 | 76 |
if (typeof speed === 'string') {
|
74 | 77 |
speed = document.getElementById(speed);
|
75 | 78 |
}
|
76 | |
if (speed !== undefined) {
|
|
79 |
if (speed) {
|
77 | 80 |
this.speed = speed;
|
78 | 81 |
speed.value = this.delay;
|
79 | 82 |
var $this = this;
|
|
97 | 100 |
};
|
98 | 101 |
|
99 | 102 |
this.click_load = function(e) {
|
100 | |
this.stop();
|
|
103 |
this.click_stop();
|
101 | 104 |
this.load(this.source.value);
|
102 | 105 |
if (this.controls.edit) this.controls.edit.style.display = "inline";
|
103 | 106 |
if (this.controls.load) this.controls.load.style.display = "none";
|
104 | 107 |
if (this.controls.start) this.controls.start.disabled = false;
|
105 | 108 |
if (this.controls.step) this.controls.step.disabled = false;
|
106 | |
if (this.controls.stop) this.controls.stop.disabled = false;
|
|
109 |
if (this.controls.stop) this.controls.stop.disabled = true;
|
107 | 110 |
if (this.display) this.display.style.display = "block";
|
108 | 111 |
if (this.source) this.source.style.display = "none";
|
109 | 112 |
};
|
|
134 | 137 |
};
|
135 | 138 |
|
136 | 139 |
this.click_edit = function(e) {
|
137 | |
this.stop();
|
|
140 |
this.click_stop();
|
138 | 141 |
if (this.controls.edit) this.controls.edit.style.display = "none";
|
139 | 142 |
if (this.controls.load) this.controls.load.style.display = "inline";
|
140 | 143 |
if (this.controls.start) this.controls.start.disabled = true;
|
|
142 | 145 |
if (this.controls.stop) this.controls.stop.disabled = true;
|
143 | 146 |
if (this.display) this.display.style.display = "none";
|
144 | 147 |
if (this.source) this.source.style.display = "block";
|
|
148 |
};
|
|
149 |
|
|
150 |
this.click_start = function(e) {
|
|
151 |
this.start();
|
|
152 |
if (this.controls.start) this.controls.start.disabled = true;
|
|
153 |
if (this.controls.step) this.controls.step.disabled = false;
|
|
154 |
if (this.controls.stop) this.controls.stop.disabled = false;
|
145 | 155 |
};
|
146 | 156 |
|
147 | 157 |
this.start = function() {
|
|
152 | 162 |
this.intervalId = setInterval(function() { $this.step(); }, this.delay);
|
153 | 163 |
};
|
154 | 164 |
|
|
165 |
this.click_stop = function(e) {
|
|
166 |
this.stop();
|
|
167 |
if (this.controls.stop && this.controls.stop.disabled) {
|
|
168 |
return;
|
|
169 |
}
|
|
170 |
if (this.controls.start) this.controls.start.disabled = false;
|
|
171 |
if (this.controls.step) this.controls.step.disabled = false;
|
|
172 |
if (this.controls.stop) this.controls.stop.disabled = true;
|
|
173 |
};
|
|
174 |
|
155 | 175 |
this.stop = function() {
|
156 | 176 |
if (this.intervalId === undefined)
|
157 | 177 |
return;
|