Selaa lähdekoodia

Adding support for pictures

1. Back Image: Here you can provide a url to an image and it will use it
as the background instead of the usual gradient and background icon.

2. Images in Content: Here you have a new verb "picture" which allows
you to add an image to the content of your card and scale it to fit
appropriately. The syntax is "picture | url | heightInPixels"

3. More Colors: Because you can now use any image as a background, I ran
into the problem of the default image clashing terribly with the images
I was using. So I added all the other colors to the color picker and
increased the maxWidth of the picker to fit all the new colors. I could
have been more picky about which colors because there are a lot of
duplicates with different names, but I didn't have the time for it.

4. It looks like I made some changes to bootstrap.min.css. It was a
while back and I don't remember what it does. However I was able to use
a better diffing tool than the one which comes with github and was able
to tell that it's a hack of a change made to .dropdown-menu changing
"min-width:160px" to "width:640px"

It's been a while and I really can't recall what that's for; it's
probably for the colorpicker but if it is, I don't really know of a
clean way to do it. I'll test it to see if it's even necessary and
remove it if it isn't. Let me know your thoughts on this as I'm not
really a web developer so I don't know if it's ok to muck with this. My
general strategy for UI is to change things with the developer toolbar
and then make the changes to the corresponding file if it looks good, so
feel free to tell me if my code sucks, and if it should be improved in
any way.
roquedaime 9 vuotta sitten
vanhempi
commit
918fdd148c

+ 7
- 3
generator/css/cards.css Näytä tiedosto

@@ -23,7 +23,7 @@
23 23
 }
24 24
 
25 25
 .card-back {
26
-    background-color: white;
26
+/*     background-color: white; */
27 27
     border-radius: 4mm;
28 28
     border-color: inherit;
29 29
     margin: 3mm;
@@ -129,13 +129,17 @@
129 129
 }
130 130
 .card-subtitle {
131 131
     height: 18px;
132
-    line-height: 18px;
133 132
     margin-bottom: 0.0em;
133
+    line-height: 18px;
134 134
     font-family: 'Noto Sans', 'Myriad Pro', Calibri, Helvetica, Arial, sans-serif;
135 135
     font-size: 10pt;
136 136
     font-style: italic;
137 137
 }
138
-
138
+.card-picture {
139
+    height: 80px;
140
+    line-height: 18px;
141
+    margin-bottom: 0.0em;
142
+}
139 143
 .card-property-line {
140 144
     text-indent: -1em;
141 145
     margin-left: 1em;

+ 33
- 7
generator/js/cards.js Näytä tiedosto

@@ -108,6 +108,12 @@ function card_element_subtitle(params, card_data, options) {
108 108
     return '<div class="card-element card-subtitle">' + subtitle + '</div>';
109 109
 }
110 110
 
111
+function card_element_picture(params, card_data, options) {
112
+    var url = params[0] || "";
113
+	var height = params[1] || "";
114
+    return '<div class="card-element card-picture" style ="background-image: url(&quot;' + url + '&quot;); background-size: contain; background-position: center;background-repeat: no-repeat; height:' + height + 'px"></div>';
115
+}
116
+
111 117
 function card_element_ruler(params, card_data, options) {
112 118
     var color = card_data_color_front(card_data, options);
113 119
     var fill = 'fill="' + color + '"';
@@ -144,6 +150,13 @@ function card_element_property(params, card_data, options) {
144 150
     result += '<div class="card-element card-property-line">';
145 151
     result += '   <h4 class="card-property-name">' + params[0] + '</h4>';
146 152
     result += '   <p class="card-p card-property-text">' + params[1] + '</p>';
153
+	if (params[2])
154
+	{
155
+		result += '   <div style="float:right">';
156
+		result += '       <h4 class="card-property-name">' + params[2] + '</h4>';
157
+		result += '       <p class="card-p card-property-text">' + params[3] + '</p>';
158
+		result += '   </div>';
159
+	}
147 160
     result += '</div>';
148 161
     return result;
149 162
 }
@@ -241,7 +254,8 @@ var card_element_generators = {
241 254
     bullet: card_element_bullet,
242 255
     fill: card_element_fill,
243 256
     section: card_element_section,
244
-    disabled: card_element_empty
257
+    disabled: card_element_empty,
258
+	picture: card_element_picture
245 259
 };
246 260
 
247 261
 // ============================================================================
@@ -299,15 +313,27 @@ function card_generate_front(data, options) {
299 313
 function card_generate_back(data, options) {
300 314
     var color = card_data_color_back(data, options)
301 315
     var style_color = card_generate_color_style(color, options);
302
-    var style_gradient = card_generate_color_gradient_style(color, options);
303
-    var icon = card_data_icon_back(data, options);
316
+	var url = data.background_image;
317
+	var background_style = "";
318
+	if (url)
319
+	{
320
+		background_style = 'style = "background-image: url(&quot;' + url + '&quot;); background-size: contain; background-position: center; background-repeat: no-repeat;"'
321
+	}
322
+	else 
323
+	{
324
+		background_style = card_generate_color_gradient_style(color, options);
325
+    }
326
+	var icon = card_data_icon_back(data, options);
304 327
 
305 328
     var result = "";
306 329
     result += '<div class="card card-size-' + options.card_size + '" ' + style_color + '>';
307
-    result += '  <div class="card-back" ' + style_gradient + '>';
308
-    result += '    <div class="card-back-inner">';
309
-    result += '      <div class="card-back-icon icon-' + icon + '" ' + style_color + '></div>';
310
-    result += '    </div>';
330
+    result += '  <div class="card-back" ' + background_style + '>';
331
+	if (!url)
332
+	{
333
+		result += '    <div class="card-back-inner">';
334
+		result += '      <div class="card-back-icon icon-' + icon + '" ' + style_color + '></div>';
335
+		result += '    </div>';
336
+	}
311 337
     result += '  </div>';
312 338
     result += '</div>';
313 339
 

+ 142
- 11
generator/js/colors.js Näytä tiedosto

@@ -144,15 +144,146 @@ var css_color_names = [
144 144
 
145 145
 var card_colors = {
146 146
     "": "",
147
-    "dimgray": "dimgray",
148
-    "black": "black",
149
-    "darkgoldenrod": "darkgoldenrod",
150
-    "saddlebrown": "saddlebrown",
151
-    "indianred": "indianred",
152
-    "maroon": "maroon",
153
-    "indigo": "indigo",
154
-    "darkblue": "darkblue",
155
-    "royalblue": "royalblue",
156
-    "darkgreen": "darkgreen",
157
-    "#666633": "#666633"
147
+    "DimGray": "DimGray",
148
+    "Black": "Black",
149
+    "DarkGoldenrod": "DarkGoldenrod",
150
+    "SaddleBrown": "SaddleBrown",
151
+    "IndianRed": "IndianRed",
152
+    "Maroon": "Maroon",
153
+    "Indigo": "Indigo",
154
+    "DarkBlue": "DarkBlue",
155
+    "RoyalBlue": "RoyalBlue",
156
+    "DarkGreen": "DarkGreen",
157
+    "#666633": "#666633",
158
+    "Navy": "Navy",          
159
+    "MediumBlue": "MediumBlue",           
160
+    "Blue": "Blue",           
161
+    "Green": "Green",                
162
+    "Teal": "Teal",                 
163
+    "DarkCyan": "DarkCyan",             
164
+    "DeepSkyBlue": "DeepSkyBlue",          
165
+    "DarkTurquoise": "DarkTurquoise",        
166
+    "MediumSpringGreen": "MediumSpringGreen",    
167
+    "Lime": "Lime",                 
168
+    "SpringGreen": "SpringGreen",          
169
+    "Aqua": "Aqua",                 
170
+    "Cyan": "Cyan",                 
171
+    "MidnightBlue": "MidnightBlue",     
172
+    "DodgerBlue": "DodgerBlue",
173
+    "LightSeaGreen": "LightSeaGreen",
174
+    "ForestGreen": "ForestGreen",
175
+    "SeaGreen": "SeaGreen",
176
+    "DarkSlateGray": "DarkSlateGray",
177
+    "LimeGreen": "LimeGreen",
178
+    "MediumSeaGreen": "MediumSeaGreen",
179
+    "Turquoise": "Turquoise",
180
+    "SteelBlue": "SteelBlue",
181
+    "DarkSlateBlue": "DarkSlateBlue",
182
+    "MediumTurquoise": "MediumTurquoise",
183
+    "DarkOliveGreen": "DarkOliveGreen",
184
+    "CadetBlue": "CadetBlue",
185
+    "CornflowerBlue": "CornflowerBlue",
186
+    "MediumAquaMarine": "MediumAquaMarine",
187
+    "SlateBlue": "SlateBlue",
188
+    "OliveDrab": "OliveDrab",
189
+    "SlateGray": "SlateGray",
190
+    "LightSlateGray": "LightSlateGray",
191
+    "MediumSlateBlue": "MediumSlateBlue",
192
+    "LawnGreen": "LawnGreen",
193
+    "Chartreuse": "Chartreuse",
194
+    "Aquamarine": "Aquamarine",
195
+    "Maroon": "Maroon",
196
+    "Purple": "Purple",
197
+    "Olive": "Olive",
198
+    "Gray": "Gray",
199
+    "SkyBlue": "SkyBlue",
200
+    "LightSkyBlue": "LightSkyBlue",
201
+    "BlueViolet": "BlueViolet",
202
+    "DarkRed": "DarkRed",
203
+    "DarkMagenta": "DarkMagenta",
204
+    "DarkSeaGreen": "DarkSeaGreen",
205
+    "LightGreen": "LightGreen",
206
+    "MediumPurple": "MediumPurple",
207
+    "DarkViolet": "DarkViolet",
208
+    "PaleGreen": "PaleGreen",
209
+    "DarkOrchid": "DarkOrchid",
210
+    "YellowGreen": "YellowGreen",
211
+    "Sienna": "Sienna",
212
+    "Brown": "Brown",
213
+    "DarkGray": "DarkGray",
214
+    "LightBlue": "LightBlue",
215
+    "GreenYellow": "GreenYellow",
216
+    "PaleTurquoise": "PaleTurquoise",
217
+    "LightSteelBlue": "LightSteelBlue",
218
+    "PowderBlue": "PowderBlue",
219
+    "FireBrick": "FireBrick",
220
+    "MediumOrchid": "MediumOrchid",
221
+    "RosyBrown": "RosyBrown",
222
+    "DarkKhaki": "DarkKhaki",
223
+    "Silver": "Silver",
224
+    "MediumVioletRed": "MediumVioletRed",
225
+    "Peru": "Peru",
226
+    "Chocolate": "Chocolate",
227
+    "Tan": "Tan",
228
+    "LightGray": "LightGray",
229
+    "Thistle": "Thistle",
230
+    "Orchid": "Orchid",
231
+    "GoldenRod": "GoldenRod",
232
+    "PaleVioletRed": "PaleVioletRed",
233
+    "Crimson": "Crimson",
234
+    "Gainsboro": "Gainsboro",
235
+    "Plum": "Plum",
236
+    "BurlyWood": "BurlyWood",
237
+    "LightCyan": "LightCyan",
238
+    "Lavender": "Lavender",
239
+    "DarkSalmon": "DarkSalmon",
240
+    "Violet": "Violet",
241
+    "PaleGoldenRod": "PaleGoldenRod",
242
+    "LightCoral": "LightCoral",
243
+    "Khaki": "Khaki",
244
+    "AliceBlue": "AliceBlue",
245
+    "HoneyDew": "HoneyDew",
246
+    "Azure": "Azure",
247
+    "SandyBrown": "SandyBrown",
248
+    "Wheat": "Wheat",
249
+    "Beige": "Beige",
250
+    "WhiteSmoke": "WhiteSmoke",
251
+    "MintCream": "MintCream",
252
+    "GhostWhite": "GhostWhite",
253
+    "Salmon": "Salmon",
254
+    "AntiqueWhite": "AntiqueWhite",
255
+    "Linen": "Linen",
256
+    "LightGoldenRodYellow": "LightGoldenRodYellow",
257
+    "OldLace": "OldLace",
258
+    "Red": "Red",
259
+    "Fuchsia": "Fuchsia",
260
+    "Magenta": "Magenta",
261
+    "DeepPink": "DeepPink",
262
+    "OrangeRed": "OrangeRed",
263
+    "Tomato": "Tomato",
264
+    "HotPink": "HotPink",
265
+    "Coral": "Coral",
266
+    "DarkOrange": "DarkOrange",
267
+    "LightSalmon": "LightSalmon",
268
+    "Orange": "Orange",
269
+    "LightPink": "LightPink",
270
+    "Pink": "Pink",
271
+    "Gold": "Gold",
272
+    "PeachPuff": "PeachPuff",
273
+    "NavajoWhite": "NavajoWhite",
274
+    "Moccasin": "Moccasin",
275
+    "Bisque": "Bisque",
276
+    "MistyRose": "MistyRose",
277
+    "BlanchedAlmond": "BlanchedAlmond",
278
+    "PapayaWhip": "PapayaWhip",
279
+    "LavenderBlush": "LavenderBlush",
280
+    "SeaShell": "SeaShell",
281
+    "Cornsilk": "Cornsilk",
282
+    "LemonChiffon": "LemonChiffon",
283
+    "FloralWhite": "FloralWhite",
284
+    "Snow": "Snow",
285
+    "Yellow": "Yellow",
286
+    "LightYellow": "LightYellow",
287
+    "Ivory": "Ivory",
288
+    "White": "White",
158 289
 }

+ 4
- 1
generator/js/ui.js Näytä tiedosto

@@ -176,6 +176,7 @@ function ui_update_selected_card() {
176 176
         $("#card-count").val(card.count);
177 177
         $("#card-icon").val(card.icon);
178 178
         $("#card-icon-back").val(card.icon_back);
179
+		$("#card-background").val(card.background_image);
179 180
         $("#card-contents").val(card.contents.join("\n"));
180 181
         $("#card-tags").val(card.tags.join(", "));
181 182
         $("#card-color").val(card.color).change();
@@ -185,6 +186,7 @@ function ui_update_selected_card() {
185 186
         $("#card-count").val(1);
186 187
         $("#card-icon").val("");
187 188
         $("#card-icon-back").val("");
189
+		$("#card-background").val("")
188 190
         $("#card-contents").val("");
189 191
         $("#card-tags").val("");
190 192
         $("#card-color").val("").change();
@@ -454,7 +456,8 @@ $(document).ready(function () {
454 456
     $("#card-icon").change(ui_change_card_property);
455 457
     $("#card-count").change(ui_change_card_property);
456 458
     $("#card-icon-back").change(ui_change_card_property);
457
-    $("#card-color").change(ui_change_card_color);
459
+	$("#card-background").change(ui_change_card_property);
460
+	$("#card-color").change(ui_change_card_color);
458 461
     $("#card-contents").change(ui_change_card_contents);
459 462
     $("#card-tags").change(ui_change_card_tags);
460 463
 

+ 1
- 1
generator/lib/bootstrap/css/bootstrap.min.css
File diff suppressed because it is too large
Näytä tiedosto


+ 2
- 2
generator/lib/colorpicker/css/bootstrap-colorselector.css Näytä tiedosto

@@ -12,8 +12,8 @@
12 12
   top: 80%;
13 13
   left: -7px;
14 14
   padding: 4px;
15
-  min-width: 130px;
16
-  max-width: 130px;
15
+/*  min-width: 130px;*/
16
+/*  max-width: 130px;*/
17 17
 }
18 18
 
19 19
 /*

Loading…
Peruuta
Tallenna