git @ Cat's Eye Technologies DAM / 18b5ee9
Make dam-widgets and dam-plus-widgets-web similarer, and fix bugs. Chris Pressey 3 years ago
4 changed file(s) with 16 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
1313
1414 <div id="installation"></div>
1515
16 <script>var module = {};</script><script src="dam.js"></script><script>var DAM = module.exports;</script>
16 <script>var module = {};</script><script src="../src/dam.js"></script><script>var DAM = module.exports;</script>
1717 <script>
1818 var div=DAM.maker("div"), p=DAM.maker("p"), span=DAM.maker("span"), button=DAM.maker("button"),
1919 canvas=DAM.maker("canvas"), label=DAM.maker("label"), br=DAM.maker("br"), input=DAM.maker("input"),
44 It consists of dam.js followed by dam-widgets.js, both with only small
55 hand modifications to make them load as-is in ES5. */
66
7 if (typeof window === 'undefined' || window.DAM === undefined) DAM = {};
7 if (typeof window === 'undefined' || window.DAM === undefined) var DAM = {};
88
99 DAM.makeElem = function(tag, args) {
1010 args = args || [];
3838 };
3939 };
4040
41 (function(DAM) { // ENTER-SCOPE
42
4143 /*
4244 * A labelled checkbox, where the checkbox appears to the left of the label.
4345 * Arguments after the first (config) argument will be applied to the label element.
199201 return DAM.makeElem('span', [{ 'class': "dam-widget dam-range" }, DAM.makeElem('label', [title, slider]), textInput, decButton, incButton]);
200202 };
201203
204 })(DAM); // EXIT-SCOPE
205
202206 if (typeof module !== 'undefined') module.exports = DAM;
55
66 import DAM from './dam.js'
77
8 (function(DAM) { // ENTER-SCOPE
9
810 /*
911 * A labelled checkbox, where the checkbox appears to the left of the label.
1012 * Arguments after the first (config) argument will be applied to the label element.
1113 */
12 var makeCheckbox = function(config) {
14 DAM.makeCheckbox = function(config) {
1315 if (typeof DAM.makeCheckboxCounter === 'undefined') DAM.makeCheckboxCounter = 0;
1416 var checkboxId = 'cfzzzb_' + (DAM.makeCheckboxCounter++);
1517
4143 * A collapsible panel.
4244 * Arguments after the first (config) argument will be applied to the inner container div element.
4345 */
44 var makePanel = function(config) {
46 DAM.makePanel = function(config) {
4547 var isOpen = !!(config.isOpen);
4648 var title = config.title || "";
4749
7678 /*
7779 * A select dropdown.
7880 */
79 var makeSelect = function(config) {
81 DAM.makeSelect = function(config) {
8082 var title = config.title || "";
8183 var options = config.options || [];
8284 var onchange = config.onchange || function(v) {};
98100 /*
99101 * A range control.
100102 */
101 var makeRange = function(config) {
103 DAM.makeRange = function(config) {
102104 var title = config.title || "";
103105 var min_ = config['min'];
104106 var max_ = config['max'];
166168 return DAM.makeElem('span', [{ 'class': "dam-widget dam-range" }, DAM.makeElem('label', [title, slider]), textInput, decButton, incButton]);
167169 };
168170
169 if (typeof module !== 'undefined') module.exports = {
170 makeCheckbox: makeCheckbox,
171 makePanel: makePanel,
172 makeSelect: makeSelect,
173 makeRange: makeRange
174 };
171 })(DAM); // EXIT-SCOPE
172
173 if (typeof module !== 'undefined') module.exports = DAM
00 /* dam.js version 0.1-PRE. This file is in the public domain. */
11
2 if (typeof window === 'undefined' || window.DAM === undefined) DAM = {};
2 if (typeof window === 'undefined' || window.DAM === undefined) var DAM = {};
33
44 DAM.makeElem = function(tag, args) {
55 args = args || [];