Download page now enforces restriction of only 1 theme per download
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
diff --git a/code.js b/code.js
index 2681bf2..4f9c39e 100644
--- a/code.js
+++ b/code.js
@@ -140,9 +140,12 @@ var components = {
meta: {
path: '{id}.css',
link: 'index.html?theme={id}',
+ exclusive: true
+ },
+ 'prism': {
+ title: 'Default',
option: 'default'
},
- 'prism': 'Default',
'prism-dark': 'Dark',
'prism-funky': 'Funky'
},
@@ -222,7 +225,7 @@ for (var id in themes) {
properties: {
htmlFor: 'theme=' + id
},
- contents: themes[id],
+ contents: themes[id].title || themes[id],
inside: p
});
}
diff --git a/download.html b/download.html
index 44b3647..4088790 100644
--- a/download.html
+++ b/download.html
@@ -12,7 +12,7 @@ form label {
padding: .2em;
}
-form input[type="checkbox"] {
+form input {
margin-right: .7em;
}
diff --git a/download.js b/download.js
index b3af23a..5b93ecc 100644
--- a/download.js
+++ b/download.js
@@ -71,16 +71,17 @@ for (var category in components) {
contents: [
{
tag: 'input',
- attributes: {
- 'data-id': id
- },
properties: {
- type: 'checkbox',
+ type: all.meta.exclusive? 'radio' : 'checkbox',
+ name: 'download-' + category,
+ value: id,
checked: checked,
disabled: disabled,
onclick: (function(id, category, all){
return function () {
- all[id].enabled = this.checked;
+ $$('input[name="' + this.name + '"]').forEach(function(input) {
+ all[input.value].enabled = input.checked;
+ });
update(category, id);
};