瀏覽代碼

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,4 +59,23 @@
59 59
 
60 60
 .form-horizontal {
61 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,7 +312,7 @@
312 312
                     <div class="form-group">
313 313
                         <label for="card-contents" class="col-sm-2 control-label">Contents</label>
314 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 316
                         </div>
317 317
                     </div>
318 318
                 </form>

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

@@ -178,6 +178,22 @@ function card_element_text(params, card_data, options) {
178 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 197
 function card_element_dndstats(params, card_data, options) {
182 198
     var stats = [10, 10, 10, 10, 10, 10];
183 199
     var mods = [0,0,0,0,0,0];
@@ -251,6 +267,8 @@ var card_element_generators = {
251 267
     description: card_element_description,
252 268
     dndstats: card_element_dndstats,
253 269
     text: card_element_text,
270
+    center: card_element_center,
271
+    justify: card_element_justify,
254 272
     bullet: card_element_bullet,
255 273
     fill: card_element_fill,
256 274
     section: card_element_section,

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

@@ -192,7 +192,6 @@ function ui_update_selected_card() {
192 192
         $("#card-color").val("").change();
193 193
     }
194 194
 
195
-    local_store_save();
196 195
     ui_render_selected_card();
197 196
 }
198 197
 
@@ -204,6 +203,7 @@ function ui_render_selected_card() {
204 203
         var back = card_generate_back(card, card_options);
205 204
         $('#preview-container').html(front + "\n" + back);
206 205
     }
206
+    local_store_save()
207 207
 }
208 208
 
209 209
 function ui_open_help() {
@@ -346,6 +346,14 @@ function ui_change_card_contents() {
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 357
 function ui_change_card_tags() {
350 358
     var value = $(this).val();
351 359
 
@@ -456,7 +464,27 @@ function local_store_load() {
456 464
 $(document).ready(function () {
457 465
     local_store_load();
458 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 489
     $("#button-generate").click(ui_generate);
462 490
     $("#button-load").click(function () { $("#file-load").click(); });
@@ -486,6 +514,9 @@ $(document).ready(function () {
486 514
     $("#card-contents").change(ui_change_card_contents);
487 515
     $("#card-tags").change(ui_change_card_tags);
488 516
 
517
+    $("#card-contents").keyup(ui_change_card_contents_keyup);
518
+
519
+
489 520
     $("#page-size").change(ui_change_option);
490 521
     $("#page-rows").change(ui_change_option);
491 522
     $("#page-columns").change(ui_change_option);

Loading…
取消
儲存