瀏覽代碼

Update from master

Robert Autenrieth 8 年之前
父節點
當前提交
756814895f
共有 4 個文件被更改,包括 71 次插入3 次删除
  1. 19
    0
      generator/css/ui.css
  2. 1
    1
      generator/generate.html
  3. 18
    0
      generator/js/cards.js
  4. 33
    2
      generator/js/ui.js

+ 19
- 0
generator/css/ui.css 查看文件

59
 
59
 
60
 .form-horizontal {
60
 .form-horizontal {
61
     margin-top: 10px;
61
     margin-top: 10px;
62
+}
63
+
64
+
65
+.dropdown-menu>li>a {
66
+    padding-left: 35px;
67
+    position: relative;
68
+}
69
+
70
+.dropdown-menu a > span {
71
+    position: absolute;
72
+    left: 5px;
73
+    background-color: #000;
74
+    background-repeat: no-repeat;
75
+    background-position: center center;
76
+    width: 24px;
77
+    height: 24px;
78
+    background-size: auto 90%;
79
+    top: 50%;
80
+    margin-top: -12px;
62
 }
81
 }

+ 1
- 1
generator/generate.html 查看文件

312
                     <div class="form-group">
312
                     <div class="form-group">
313
                         <label for="card-contents" class="col-sm-2 control-label">Contents</label>
313
                         <label for="card-contents" class="col-sm-2 control-label">Contents</label>
314
                         <div class="col-sm-10">
314
                         <div class="col-sm-10">
315
-                            <textarea class="form-control" rows="14" id="card-contents" wrap="off"></textarea>
315
+                            <textarea class="form-control" rows="14" id="card-contents"></textarea>
316
                         </div>
316
                         </div>
317
                     </div>
317
                     </div>
318
                 </form>
318
                 </form>

+ 18
- 0
generator/js/cards.js 查看文件

178
     return result;
178
     return result;
179
 }
179
 }
180
 
180
 
181
+function card_element_center(params, card_data, options) {
182
+    var result = "";
183
+    result += '<div class="card-element card-description-line" style="text-align: center">';
184
+    result += '   <p class="card-p card-description-text">' + params[0] + '</p>';
185
+    result += '</div>';
186
+    return result;
187
+}
188
+
189
+function card_element_justify(params, card_data, options) {
190
+    var result = "";
191
+    result += '<div class="card-element card-description-line" style="text-align: justify; hyphens: auto">';
192
+    result += '   <p class="card-p card-description-text">' + params[0] + '</p>';
193
+    result += '</div>';
194
+    return result;
195
+}
196
+
181
 function card_element_dndstats(params, card_data, options) {
197
 function card_element_dndstats(params, card_data, options) {
182
     var stats = [10, 10, 10, 10, 10, 10];
198
     var stats = [10, 10, 10, 10, 10, 10];
183
     var mods = [0,0,0,0,0,0];
199
     var mods = [0,0,0,0,0,0];
251
     description: card_element_description,
267
     description: card_element_description,
252
     dndstats: card_element_dndstats,
268
     dndstats: card_element_dndstats,
253
     text: card_element_text,
269
     text: card_element_text,
270
+    center: card_element_center,
271
+    justify: card_element_justify,
254
     bullet: card_element_bullet,
272
     bullet: card_element_bullet,
255
     fill: card_element_fill,
273
     fill: card_element_fill,
256
     section: card_element_section,
274
     section: card_element_section,

+ 33
- 2
generator/js/ui.js 查看文件

192
         $("#card-color").val("").change();
192
         $("#card-color").val("").change();
193
     }
193
     }
194
 
194
 
195
-    local_store_save();
196
     ui_render_selected_card();
195
     ui_render_selected_card();
197
 }
196
 }
198
 
197
 
204
         var back = card_generate_back(card, card_options);
203
         var back = card_generate_back(card, card_options);
205
         $('#preview-container').html(front + "\n" + back);
204
         $('#preview-container').html(front + "\n" + back);
206
     }
205
     }
206
+    local_store_save()
207
 }
207
 }
208
 
208
 
209
 function ui_open_help() {
209
 function ui_open_help() {
346
     }
346
     }
347
 }
347
 }
348
 
348
 
349
+function ui_change_card_contents_keyup () {
350
+    clearTimeout(ui_change_card_contents_keyup.timeout)
351
+    ui_change_card_contents_keyup.timeout = setTimeout(function () {
352
+        $('#card-contents').trigger('change')
353
+    }, 200)
354
+}
355
+ui_change_card_contents_keyup.timeout = null
356
+
349
 function ui_change_card_tags() {
357
 function ui_change_card_tags() {
350
     var value = $(this).val();
358
     var value = $(this).val();
351
 
359
 
456
 $(document).ready(function () {
464
 $(document).ready(function () {
457
     local_store_load();
465
     local_store_load();
458
     ui_setup_color_selector();
466
     ui_setup_color_selector();
459
-    $('.icon-list').typeahead({source:icon_names});
467
+    $('.icon-list').typeahead({
468
+        source:icon_names,
469
+        items: 'all',
470
+        render: function (items) {
471
+          var that = this;
472
+
473
+          items = $(items).map(function (i, item) {
474
+            i = $(that.options.item).data('value', item);
475
+            i.find('a').html(that.highlighter(item));
476
+            var classname = 'icon-' + item.split(' ').join('-').toLowerCase()
477
+            i.find('a').append('<span class="' + classname + '"></span>')
478
+            return i[0];
479
+          });
480
+
481
+          if (this.autoSelect) {
482
+            items.first().addClass('active');
483
+          }
484
+          this.$menu.html(items);
485
+          return this;
486
+        }
487
+    });
460
 
488
 
461
     $("#button-generate").click(ui_generate);
489
     $("#button-generate").click(ui_generate);
462
     $("#button-load").click(function () { $("#file-load").click(); });
490
     $("#button-load").click(function () { $("#file-load").click(); });
486
     $("#card-contents").change(ui_change_card_contents);
514
     $("#card-contents").change(ui_change_card_contents);
487
     $("#card-tags").change(ui_change_card_tags);
515
     $("#card-tags").change(ui_change_card_tags);
488
 
516
 
517
+    $("#card-contents").keyup(ui_change_card_contents_keyup);
518
+
519
+
489
     $("#page-size").change(ui_change_option);
520
     $("#page-size").change(ui_change_option);
490
     $("#page-rows").change(ui_change_option);
521
     $("#page-rows").change(ui_change_option);
491
     $("#page-columns").change(ui_change_option);
522
     $("#page-columns").change(ui_change_option);

Loading…
取消
儲存