瀏覽代碼

Title font size, modal print info dialog

crobi 10 年之前
父節點
當前提交
4e940c5ea2
共有 6 個檔案被更改,包括 92 行新增23 行删除
  1. 23
    12
      generator/css/cards.css
  2. 7
    1
      generator/css/output.css
  3. 1
    1
      generator/data/card_data_example.js
  4. 52
    8
      generator/generate.html
  5. 1
    1
      generator/js/cards.js
  6. 8
    0
      generator/js/ui.js

+ 23
- 12
generator/css/cards.css 查看文件

99
     background-color: inherit;
99
     background-color: inherit;
100
     color: white;
100
     color: white;
101
 }
101
 }
102
-.card-title-big {
103
-    font-size: 6mm;
104
-    line-height: 6mm;
102
+.card-title-16 {
103
+    font-size: 16pt;
104
+    line-height: 6.5mm;
105
 }
105
 }
106
-.card-title-normal {
107
-    font-size: 5mm;
108
-    line-height: 6mm;
106
+.card-title-15 {
107
+    font-size: 15pt;
108
+    line-height: 6.5mm;
109
 }
109
 }
110
-.card-title-small {
111
-    font-size: 4mm;
110
+.card-title-14 {
111
+    font-size: 14pt;
112
     line-height: 6.5mm;
112
     line-height: 6.5mm;
113
 }
113
 }
114
-.card-title-tiny {
115
-    font-size: 3.5mm;
116
-    line-height: 6.75mm;
114
+.card-title-13 {
115
+    font-size: 13pt;
116
+    line-height: 7mm;
117
+}
118
+.card-title-12 {
119
+    font-size: 12pt;
120
+    line-height: 7mm;
121
+}
122
+.card-title-11 {
123
+    font-size: 11pt;
124
+    line-height: 7.5mm;
125
+}
126
+.card-title-10 {
127
+    font-size: 10pt;
128
+    line-height: 7.5mm;
117
 }
129
 }
118
-
119
 .card-subtitle {
130
 .card-subtitle {
120
     height: 18px;
131
     height: 18px;
121
     line-height: 18px;
132
     line-height: 18px;

+ 7
- 1
generator/css/output.css 查看文件

2
   background: rgb(204,204,204); 
2
   background: rgb(204,204,204); 
3
 }
3
 }
4
 
4
 
5
+body {
6
+    display: flex;
7
+    justify-content:center;
8
+    align-content:center;
9
+}
10
+
5
 .page-preview {
11
 .page-preview {
6
     background: white;
12
     background: white;
7
     margin: 0 auto;
13
     margin: 0 auto;
21
     /* Set the background to gray to visualize the page size in the print preview */
27
     /* Set the background to gray to visualize the page size in the print preview */
22
     background-color: gray;
28
     background-color: gray;
23
   }
29
   }
24
-}
30
+}

+ 1
- 1
generator/data/card_data_example.js 查看文件

77
         "count": 1,
77
         "count": 1,
78
         "color": "dimgray",
78
         "color": "dimgray",
79
         "title": "Shortsword of Very Long Names",
79
         "title": "Shortsword of Very Long Names",
80
-        "title_size": "tiny",
80
+        "title_size": "10",
81
         "icon": "crossed-swords",
81
         "icon": "crossed-swords",
82
         "contents": [
82
         "contents": [
83
             "subtitle | Simple melee weapon (10gp)",
83
             "subtitle | Simple melee weapon (10gp)",

+ 52
- 8
generator/generate.html 查看文件

153
                         <label for="default-title-size" class="col-sm-2 control-label">Title</label>
153
                         <label for="default-title-size" class="col-sm-2 control-label">Title</label>
154
                         <div class="col-sm-10">
154
                         <div class="col-sm-10">
155
                             <select class="form-control" id="default-title-size">
155
                             <select class="form-control" id="default-title-size">
156
-                                <option value="big">big font</option>
157
-                                <option value="normal" selected>normal font</option>
158
-                                <option value="small">small font</option>
159
-                                <option value="tiny">tiny font</option>
156
+                                <option value="16">16pt font</option>
157
+                                <option value="15">15pt font</option>
158
+                                <option value="14">14pt font</option>
159
+                                <option value="13" selected>13pt font</option>
160
+                                <option value="12">12pt font</option>
161
+                                <option value="11">11pt font</option>
162
+                                <option value="10">10pt font</option>
160
                             </select>
163
                             </select>
161
                         </div>
164
                         </div>
162
                     </div>
165
                     </div>
211
                             <input type="text" id="card-title" class="form-control" placeholder="Title">
214
                             <input type="text" id="card-title" class="form-control" placeholder="Title">
212
                         </div>
215
                         </div>
213
                     </div>
216
                     </div>
217
+                    <div class="form-group">
218
+                        <label for="card-title-size" class="col-sm-2 control-label">Title</label>
219
+                        <div class="col-sm-10">
220
+                            <select class="form-control" id="card-title-size" data-property="title_size">
221
+                                <option value="" selected>default font</option>
222
+                                <option value="16">16pt font</option>
223
+                                <option value="15">15pt font</option>
224
+                                <option value="14">14pt font</option>
225
+                                <option value="13">13pt font</option>
226
+                                <option value="12">12pt font</option>
227
+                                <option value="11">11pt font</option>
228
+                                <option value="10">10pt font</option>
229
+                            </select>
230
+                        </div>
231
+                    </div>
214
                     <div class="form-group">
232
                     <div class="form-group">
215
                         <label for="card-count" class="col-sm-2 control-label">Count</label>
233
                         <label for="card-count" class="col-sm-2 control-label">Count</label>
216
                         <div class="col-sm-10">
234
                         <div class="col-sm-10">
217
-                            <input type="number" id="card-count" class="form-control" placeholder="Count" data-property="count">
235
+                            <input type="number" id="card-count" class="form-control" placeholder="Count" data-property="count" value="1">
218
                         </div>
236
                         </div>
219
                     </div>
237
                     </div>
220
                     <div class="form-group">
238
                     <div class="form-group">
224
                                 <span class="input-group-btn">
242
                                 <span class="input-group-btn">
225
                                     <button class="btn btn-default icon-select-button" type="button">Search</button>
243
                                     <button class="btn btn-default icon-select-button" type="button">Search</button>
226
                                 </span>
244
                                 </span>
227
-                                <input type="text" id="card-icon" class="form-control icon-list" placeholder="Icon name (default icon if empty)" data-property="icon">
245
+                                <input type="text" id="card-icon" class="form-control icon-list" placeholder="Default icon" data-property="icon">
228
                             </div>
246
                             </div>
229
                         </div>
247
                         </div>
230
                     </div>
248
                     </div>
235
                                 <span class="input-group-btn">
253
                                 <span class="input-group-btn">
236
                                     <button class="btn btn-default icon-select-button" type="button">Search</button>
254
                                     <button class="btn btn-default icon-select-button" type="button">Search</button>
237
                                 </span>
255
                                 </span>
238
-                                <input type="text" id="card-icon-back" class="form-control icon-list" placeholder="Icon name (same as front if empty)" data-property="icon_back">
256
+                                <input type="text" id="card-icon-back" class="form-control icon-list" placeholder="Same as front" data-property="icon_back">
239
                             </div>
257
                             </div>
240
                         </div>
258
                         </div>
241
                     </div>
259
                     </div>
244
                         <div class="col-sm-10">
262
                         <div class="col-sm-10">
245
                             <div class="input-group">
263
                             <div class="input-group">
246
                                 <select id="card_color_selector" class="colorselector-data"></select>
264
                                 <select id="card_color_selector" class="colorselector-data"></select>
247
-                                <input type="text" id="card-color" class="form-control" placeholder="Card color (default color if empty)" data-property="color">
265
+                                <input type="text" id="card-color" class="form-control" placeholder="Default color" data-property="color">
248
                             </div>
266
                             </div>
249
                         </div>
267
                         </div>
250
                     </div>
268
                     </div>
263
             </div>
281
             </div>
264
         </div>
282
         </div>
265
     </div>
283
     </div>
284
+    <!-- Modal -->
285
+    <div class="modal" id="print-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
286
+        <div class="modal-dialog">
287
+            <div class="modal-content">
288
+                <div class="modal-header">
289
+                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
290
+                    <h4 class="modal-title" id="myModalLabel">Printing generated cards</h4>
291
+                </div>
292
+                <div class="modal-body">
293
+                    <ul>
294
+                        <li>The generated cards open in a new tab or window. If you don't see any new tab or window, check your popup blocker.</li>
295
+                        <li>Make sure to use the correct paper size (same as in the editor).</li>
296
+                        <li>Enable double sided printing (flip on long edge).</li>
297
+                        <li>Do not scale the document to fit the page.</li>
298
+                        <li>
299
+                            Some printers are not very precise (pages print slightly shifted or rotated) and the cards will not line up with the card backs.
300
+                            If this is the case, there's nothing you can do. Try a different printer or print single-sided.
301
+                        </li>
302
+                    </ul>
303
+                </div>
304
+                <div class="modal-footer">
305
+                    <button type="button" class="btn btn-default" data-dismiss="modal">Ok, got it</button>
306
+                </div>
307
+            </div>
308
+        </div>
309
+    </div>
266
 </body>
310
 </body>
267
 </html>
311
 </html>

+ 1
- 1
generator/js/cards.js 查看文件

5
     return {
5
     return {
6
         default_color: "black",
6
         default_color: "black",
7
         default_icon: "ace",
7
         default_icon: "ace",
8
-        default_title_size: "normal",
8
+        default_title_size: "13",
9
         page_size: "A4",
9
         page_size: "A4",
10
         page_rows: 3,
10
         page_rows: 3,
11
         page_columns: 3,
11
         page_columns: 3,

+ 8
- 0
generator/js/ui.js 查看文件

33
     return result;
33
     return result;
34
 }
34
 }
35
 
35
 
36
+var ui_generate_modal_shown = false;
36
 function ui_generate() {
37
 function ui_generate() {
37
     // Generate output HTML
38
     // Generate output HTML
38
     var card_html = card_pages_generate_html(card_data, card_options);
39
     var card_html = card_pages_generate_html(card_data, card_options);
41
     // Use a separate window to avoid CSS conflicts
42
     // Use a separate window to avoid CSS conflicts
42
     var tab = window.open("output.html", 'rpg-cards-output');
43
     var tab = window.open("output.html", 'rpg-cards-output');
43
 
44
 
45
+    if (ui_generate_modal_shown == false) {
46
+        $("#print-modal").modal('show');
47
+        ui_generate_modal_shown = true;
48
+    }
49
+
44
     // Send the generated HTML to the new window
50
     // Send the generated HTML to the new window
45
     // Use a delay to give the new window time to set up a message listener
51
     // Use a delay to give the new window time to set up a message listener
46
     setTimeout(function () { tab.postMessage(card_html, '*') }, 100);
52
     setTimeout(function () { tab.postMessage(card_html, '*') }, 100);
148
     var card = ui_selected_card();
154
     var card = ui_selected_card();
149
     if (card) {
155
     if (card) {
150
         $("#card-title").val(card.title);
156
         $("#card-title").val(card.title);
157
+        $("#card-title-size").val(card.title_size);
151
         $("#card-count").val(card.count);
158
         $("#card-count").val(card.count);
152
         $("#card-icon").val(card.icon);
159
         $("#card-icon").val(card.icon);
153
         $("#card-icon-back").val(card.icon_back);
160
         $("#card-icon-back").val(card.icon_back);
368
     $("#selected-card").change(ui_update_selected_card);
375
     $("#selected-card").change(ui_update_selected_card);
369
 
376
 
370
     $("#card-title").change(ui_change_card_title);
377
     $("#card-title").change(ui_change_card_title);
378
+    $("#card-title-size").change(ui_change_card_property);
371
     $("#card-icon").change(ui_change_card_property);
379
     $("#card-icon").change(ui_change_card_property);
372
     $("#card-count").change(ui_change_card_property);
380
     $("#card-count").change(ui_change_card_property);
373
     $("#card-icon-back").change(ui_change_card_property);
381
     $("#card-icon-back").change(ui_change_card_property);

Loading…
取消
儲存