Browse Source

Label changes sync with theme changes. themes.json cleanup.

parisminton 7 years ago
parent
commit
7297446f98
2 changed files with 37 additions and 53 deletions
  1. 23 2
      client/index.js
  2. 14 51
      settings/themes.json

+ 23 - 2
client/index.js View File

@@ -75,6 +75,10 @@ function submitted() {
75 75
     return setClass("error", "No valid theme detected.");
76 76
   }
77 77
 
78
+  if (theme.labelText) {
79
+    label = theme.labelText;
80
+  }
81
+
78 82
   video.kill();
79 83
   audio.pause();
80 84
 
@@ -237,7 +241,7 @@ function updateAudioFile() {
237 241
 
238 242
 }
239 243
 
240
-function updateCaption() {
244
+function updateCaption(label) {
241 245
   preview.caption(this.value);
242 246
 }
243 247
 
@@ -246,7 +250,24 @@ function updateLabel() {
246 250
 }
247 251
 
248 252
 function updateTheme() {
249
-  preview.theme(d3.select(this.options[this.selectedIndex]).datum());
253
+  var theme_obj = d3.select(this.options[this.selectedIndex]).datum(),
254
+      that = this;
255
+
256
+  // Automatically set the label for themes that have them
257
+  preview.theme(theme_obj);
258
+  if (theme_obj.labelText) {
259
+    preview.label(theme_obj.labelText);
260
+    $('#input-label').children().each(function (i, c) {
261
+      if (c.value === that.options[that.selectedIndex].value) {
262
+        $(c).prop('selected', true);
263
+        return false;
264
+      }
265
+    });
266
+    $('#input-label').prop('disabled', true);
267
+  }
268
+  else {
269
+    $('#input-label').prop('disabled', false);
270
+  }
250 271
 }
251 272
 
252 273
 function preloadImages(themes) {

+ 14 - 51
settings/themes.json View File

@@ -1,19 +1,20 @@
1 1
 {
2 2
   "default": {
3
-    "width": 1280,
4
-    "height": 720,
3
+    "width": 1000,
4
+    "height": 560,
5 5
     "framesPerSecond": 20,
6 6
     "maxDuration": 300,
7 7
     "samplesPerFrame": 128,
8
-    "pattern": "wave",
8
+    "pattern": "halfbars",
9 9
     "waveTop": 150,
10
-    "waveBottom": 420,
11
-    "captionTop": 470,
12
-    "captionFont": "300 52px 'Source Sans Pro'",
13
-    "captionLineHeight": 52,
10
+    "waveBottom": 710,
11
+    "captionAlign": "left",
12
+    "captionTop": 70,
13
+    "captionLeft": 50,
14
+    "captionRight": 860,
15
+    "captionFont": "300 71px 'NYT Franklin Light'",
16
+    "captionLineHeight": 80,
14 17
     "captionLineSpacing": 7,
15
-    "captionLeft": 200,
16
-    "captionRight": 1080,
17 18
     "labelFont": "44px 'NYT Karnak'",
18 19
     "labelAlign": "left",
19 20
     "labelTop": 470,
@@ -22,70 +23,32 @@
22 23
     "labelLineSpacing": 4
23 24
   },
24 25
   "NYT Light": {
25
-    "width": 1000,
26
-    "height": 560,
27
-    "pattern": "halfbars",
28 26
     "waveColor": "#d9d9d9",
29
-    "waveBottom": 710,
30 27
     "foregroundColor": "#000",
31
-    "captionFont": "300 71px 'NYT Franklin Light'",
32
-    "captionLineHeight": 80,
33
-    "captionAlign": "left",
34
-    "captionTop": 70,
35
-    "captionLeft": 50,
36
-    "captionRight": 860,
37 28
     "backgroundImage": "t_logo_light.png",
38 29
     "labelColor": "#000"
39 30
   },
40 31
   "NYT Dark": {
41
-    "width": 1000,
42
-    "height": 560,
43
-    "pattern": "halfbars",
44 32
     "backgroundColor": "#000",
45 33
     "waveColor": "#4d4d4d",
46
-    "waveBottom": 710,
47 34
     "foregroundColor": "#fff",
48
-    "captionFont": "300 71px 'NYT Franklin Light'",
49
-    "captionLineHeight": 80,
50
-    "captionAlign": "left",
51
-    "captionTop": 70,
52
-    "captionLeft": 50,
53
-    "captionRight": 860,
54 35
     "backgroundImage": "t_logo_dark.png",
55 36
     "labelColor": "#fff"
56 37
   },
57 38
   "Still Processing": {
58
-    "width": 1000,
59
-    "height": 560,
60
-    "pattern": "halfbars",
61 39
     "waveColor": "rgba(102, 80, 62, 0.25)",
62
-    "waveBottom": 710,
63 40
     "foregroundColor": "#66503e",
64 41
     "backgroundColor": "#f4d7b9",
65
-    "captionFont": "300 71px 'NYT Franklin Light'",
66
-    "captionLineHeight": 80,
67
-    "captionAlign": "left",
68
-    "captionTop": 70,
69
-    "captionLeft": 50,
70
-    "captionRight": 860,
71 42
     "backgroundImage": "t_logo_white_alpha.png",
72
-    "labelColor": "#fff"
43
+    "labelColor": "#fff",
44
+    "labelText": "Still Processing"
73 45
   },
74 46
   "The Daily": {
75
-    "width": 1000,
76
-    "height": 560,
77
-    "pattern": "halfbars",
78 47
     "waveColor": "rgba(102, 102, 102, 0.25)",
79
-    "waveBottom": 710,
80 48
     "foregroundColor": "#fff",
81 49
     "backgroundColor": "#f4d7b9",
82
-    "captionFont": "300 71px 'NYT Franklin Light'",
83
-    "captionLineHeight": 80,
84
-    "captionAlign": "left",
85
-    "captionTop": 70,
86
-    "captionLeft": 50,
87
-    "captionRight": 860,
88 50
     "backgroundImage": "the_daily_audiogram_background.png",
89
-    "labelColor": "#fff"
51
+    "labelColor": "#fff",
52
+    "labelText": "The Daily"
90 53
   }
91 54
 }