git @ Cat's Eye Technologies yoob.js / dad80f0
Make the Javascript more modern and/or actually working. Chris Pressey 5 years ago
1 changed file(s) with 8 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
00 /*
1 * This file is part of yoob.js version 0.12
1 * This file is part of yoob.js version 0.13-PRE
22 * Available from https://github.com/catseye/yoob.js/
33 * This file is in the public domain. See http://unlicense.org/ for details.
44 */
209209 };
210210 textInput.onchange = function(e) {
211211 var v = parseInt(textInput.value, 10);
212 if (v !== NaN) {
212 if (!isNaN(v)) {
213213 slider.value = "" + v;
214214 fun(v);
215215 }
257257 };
258258 textInput.onchange = function(e) {
259259 var v = parseInt(textInput.value, 10);
260 if (v !== NaN) {
260 if (!isNaN(v)) {
261261 slider.value = "" + v;
262262 callback(v);
263263 }
267267 if (withButtons) {
268268 decButton = yoob.makeButton(container, "-", function() {
269269 var v = parseInt(textInput.value, 10);
270 if (v !== NaN && v > min_) {
270 if ((!isNaN(v)) && v > min_) {
271271 v--;
272272 textInput.value = "" + v;
273273 slider.value = "" + v;
276276 });
277277 incButton = yoob.makeButton(container, "+", function() {
278278 var v = parseInt(textInput.value, 10);
279 if (v !== NaN && v < max_) {
279 if ((!isNaN(v)) && v < max_) {
280280 v++;
281281 textInput.value = "" + v;
282282 slider.value = "" + v;
302302
303303 yoob.makeSVGElem = function(svg, tag, cfg) {
304304 var elem = document.createElementNS(svg.namespaceURI, tag);
305 for (var key in cfg) {
306 if (cfg.hasOwnProperty(key)) {
307 elem.setAttribute(key, cfg[key]);
308 }
309 }
305 Object.keys(cfg).forEach(function(key) {
306 elem.setAttribute(key, cfg[key]);
307 });
310308 svg.appendChild(elem);
311309 return elem;
312310 };