jekyll-theme-mdui 0.4.9.8 → 0.4.9.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/content/component/readtime.html +2 -3
- data/_includes/content/editor.html +820 -12
- data/_layouts/default.html +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc2a8b7ae5c4c650a7997c23aa2326d409c7c178
|
4
|
+
data.tar.gz: 26b338220a8e11b086f5e5f7a5b21a520ed1a021
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cf4939cffb194197a294d3c4fb4a053105ba481ac25dce1cf89814f506c77009a23219c9444a2c6f8b6b439814c75cf899bbcf28766b3f5780f91fb4e9eca1c
|
7
|
+
data.tar.gz: b8b593f1b24eb238710135e674b553a951cf6ea25a21278762b09eadd217c88f4bff48b0095b2e11cc5ac93abd998ecf6ce49c38ce071ba5620e9ff137deab59
|
@@ -12,10 +12,9 @@
|
|
12
12
|
background: #c0ffee !important;
|
13
13
|
}
|
14
14
|
</style>
|
15
|
-
|
16
|
-
{% assign words = content | number_of_words %}
|
15
|
+
{% assign words = content | strip_html | strip_newlines | size %}
|
17
16
|
{% if words < 360 %}
|
18
17
|
<a class="mdui-btn mdui-btn-block k-readtime" href="javascript:;">阅读本文需要1分钟</a>
|
19
18
|
{% else %}
|
20
|
-
<a class="mdui-btn mdui-btn-block k-readtime" href="javascript:;">阅读本文需要{{
|
19
|
+
<a class="mdui-btn mdui-btn-block k-readtime" href="javascript:;">阅读本文需要{{ content | strip_html | strip_newlines | size | divided_by:360 | round}}分钟</a>
|
21
20
|
{% endif %}
|
@@ -107,26 +107,834 @@
|
|
107
107
|
|
108
108
|
<!--marked-->
|
109
109
|
<script>
|
110
|
-
(function
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
110
|
+
(function () {
|
111
|
+
var block = {
|
112
|
+
newline: /^\n+/,
|
113
|
+
code: /^( {4}[^\n]+\n*)+/,
|
114
|
+
fences: noop,
|
115
|
+
hr: /^( *[-*_]){3,} *(?:\n+|$)/,
|
116
|
+
heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,
|
117
|
+
nptable: noop,
|
118
|
+
lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
|
119
|
+
blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,
|
120
|
+
list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
|
121
|
+
html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,
|
122
|
+
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
|
123
|
+
table: noop,
|
124
|
+
paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
|
125
|
+
text: /^[^\n]+/
|
126
|
+
};
|
127
|
+
block.bullet = /(?:[*+-]|\d+\.)/;
|
128
|
+
block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;
|
129
|
+
block.item = replace(block.item, "gm")(/bull/g, block.bullet)();
|
130
|
+
block.list = replace(block.list)(/bull/g, block.bullet)("hr", "\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def", "\\n+(?=" + block.def.source + ")")();
|
131
|
+
block.blockquote = replace(block.blockquote)("def", block.def)();
|
132
|
+
block._tag = "(?!(?:" + "a|em|strong|small|s|cite|q|dfn|abbr|data|time|code" + "|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo" + "|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";
|
133
|
+
block.html = replace(block.html)("comment", /<!--[\s\S]*?-->/)("closed", /<(tag)[\s\S]+?<\/\1>/)("closing", /<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g, block._tag)();
|
134
|
+
block.paragraph = replace(block.paragraph)("hr", block.hr)("heading", block.heading)("lheading", block.lheading)("blockquote", block.blockquote)("tag", "<" + block._tag)("def", block.def)();
|
135
|
+
block.normal = merge({}, block);
|
136
|
+
block.gfm = merge({}, block.normal, {
|
137
|
+
fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,
|
138
|
+
paragraph: /^/,
|
139
|
+
heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/
|
140
|
+
});
|
141
|
+
block.gfm.paragraph = replace(block.paragraph)("(?!", "(?!" + block.gfm.fences.source.replace("\\1", "\\2") + "|" + block.list.source.replace("\\1", "\\3") + "|")();
|
142
|
+
block.tables = merge({}, block.gfm, {
|
143
|
+
nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,
|
144
|
+
table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/
|
145
|
+
});
|
115
146
|
|
116
|
-
|
147
|
+
function Lexer(options) {
|
148
|
+
this.tokens = [];
|
149
|
+
this.tokens.links = {};
|
150
|
+
this.options = options || marked.defaults;
|
151
|
+
this.rules = block.normal;
|
152
|
+
if (this.options.gfm) {
|
153
|
+
if (this.options.tables) {
|
154
|
+
this.rules = block.tables
|
155
|
+
} else {
|
156
|
+
this.rules = block.gfm
|
157
|
+
}
|
158
|
+
}
|
159
|
+
}
|
160
|
+
Lexer.rules = block;
|
161
|
+
Lexer.lex = function (src, options) {
|
162
|
+
var lexer = new Lexer(options);
|
163
|
+
return lexer.lex(src)
|
164
|
+
};
|
165
|
+
Lexer.prototype.lex = function (src) {
|
166
|
+
src = src.replace(/\r\n|\r/g, "\n").replace(/\t/g, " ").replace(/\u00a0/g, " ").replace(/\u2424/g, "\n");
|
167
|
+
return this.token(src, true)
|
168
|
+
};
|
169
|
+
Lexer.prototype.token = function (src, top, bq) {
|
170
|
+
var src = src.replace(/^ +$/gm, ""),
|
171
|
+
next, loose, cap, bull, b, item, space, i, l;
|
172
|
+
while (src) {
|
173
|
+
if (cap = this.rules.newline.exec(src)) {
|
174
|
+
src = src.substring(cap[0].length);
|
175
|
+
if (cap[0].length > 1) {
|
176
|
+
this.tokens.push({
|
177
|
+
type: "space"
|
178
|
+
})
|
179
|
+
}
|
180
|
+
}
|
181
|
+
if (cap = this.rules.code.exec(src)) {
|
182
|
+
src = src.substring(cap[0].length);
|
183
|
+
cap = cap[0].replace(/^ {4}/gm, "");
|
184
|
+
this.tokens.push({
|
185
|
+
type: "code",
|
186
|
+
text: !this.options.pedantic ? cap.replace(/\n+$/, "") : cap
|
187
|
+
});
|
188
|
+
continue
|
189
|
+
}
|
190
|
+
if (cap = this.rules.fences.exec(src)) {
|
191
|
+
src = src.substring(cap[0].length);
|
192
|
+
this.tokens.push({
|
193
|
+
type: "code",
|
194
|
+
lang: cap[2],
|
195
|
+
text: cap[3] || ""
|
196
|
+
});
|
197
|
+
continue
|
198
|
+
}
|
199
|
+
if (cap = this.rules.heading.exec(src)) {
|
200
|
+
src = src.substring(cap[0].length);
|
201
|
+
this.tokens.push({
|
202
|
+
type: "heading",
|
203
|
+
depth: cap[1].length,
|
204
|
+
text: cap[2]
|
205
|
+
});
|
206
|
+
continue
|
207
|
+
}
|
208
|
+
if (top && (cap = this.rules.nptable.exec(src))) {
|
209
|
+
src = src.substring(cap[0].length);
|
210
|
+
item = {
|
211
|
+
type: "table",
|
212
|
+
header: cap[1].replace(/^ *| *\| *$/g, "").split(/ *\| */),
|
213
|
+
align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
|
214
|
+
cells: cap[3].replace(/\n$/, "").split("\n")
|
215
|
+
};
|
216
|
+
for (i = 0; i < item.align.length; i++) {
|
217
|
+
if (/^ *-+: *$/.test(item.align[i])) {
|
218
|
+
item.align[i] = "right"
|
219
|
+
} else {
|
220
|
+
if (/^ *:-+: *$/.test(item.align[i])) {
|
221
|
+
item.align[i] = "center"
|
222
|
+
} else {
|
223
|
+
if (/^ *:-+ *$/.test(item.align[i])) {
|
224
|
+
item.align[i] = "left"
|
225
|
+
} else {
|
226
|
+
item.align[i] = null
|
227
|
+
}
|
228
|
+
}
|
229
|
+
}
|
230
|
+
}
|
231
|
+
for (i = 0; i < item.cells.length; i++) {
|
232
|
+
item.cells[i] = item.cells[i].split(/ *\| */)
|
233
|
+
}
|
234
|
+
this.tokens.push(item);
|
235
|
+
continue
|
236
|
+
}
|
237
|
+
if (cap = this.rules.lheading.exec(src)) {
|
238
|
+
src = src.substring(cap[0].length);
|
239
|
+
this.tokens.push({
|
240
|
+
type: "heading",
|
241
|
+
depth: cap[2] === "=" ? 1 : 2,
|
242
|
+
text: cap[1]
|
243
|
+
});
|
244
|
+
continue
|
245
|
+
}
|
246
|
+
if (cap = this.rules.hr.exec(src)) {
|
247
|
+
src = src.substring(cap[0].length);
|
248
|
+
this.tokens.push({
|
249
|
+
type: "hr"
|
250
|
+
});
|
251
|
+
continue
|
252
|
+
}
|
253
|
+
if (cap = this.rules.blockquote.exec(src)) {
|
254
|
+
src = src.substring(cap[0].length);
|
255
|
+
this.tokens.push({
|
256
|
+
type: "blockquote_start"
|
257
|
+
});
|
258
|
+
cap = cap[0].replace(/^ *> ?/gm, "");
|
259
|
+
this.token(cap, top, true);
|
260
|
+
this.tokens.push({
|
261
|
+
type: "blockquote_end"
|
262
|
+
});
|
263
|
+
continue
|
264
|
+
}
|
265
|
+
if (cap = this.rules.list.exec(src)) {
|
266
|
+
src = src.substring(cap[0].length);
|
267
|
+
bull = cap[2];
|
268
|
+
this.tokens.push({
|
269
|
+
type: "list_start",
|
270
|
+
ordered: bull.length > 1
|
271
|
+
});
|
272
|
+
cap = cap[0].match(this.rules.item);
|
273
|
+
next = false;
|
274
|
+
l = cap.length;
|
275
|
+
i = 0;
|
276
|
+
for (; i < l; i++) {
|
277
|
+
item = cap[i];
|
278
|
+
space = item.length;
|
279
|
+
item = item.replace(/^ *([*+-]|\d+\.) +/, "");
|
280
|
+
if (~item.indexOf("\n ")) {
|
281
|
+
space -= item.length;
|
282
|
+
item = !this.options.pedantic ? item.replace(new RegExp("^ {1," + space + "}", "gm"), "") : item.replace(/^ {1,4}/gm, "")
|
283
|
+
}
|
284
|
+
if (this.options.smartLists && i !== l - 1) {
|
285
|
+
b = block.bullet.exec(cap[i + 1])[0];
|
286
|
+
if (bull !== b && !(bull.length > 1 && b.length > 1)) {
|
287
|
+
src = cap.slice(i + 1).join("\n") + src;
|
288
|
+
i = l - 1
|
289
|
+
}
|
290
|
+
}
|
291
|
+
loose = next || /\n\n(?!\s*$)/.test(item);
|
292
|
+
if (i !== l - 1) {
|
293
|
+
next = item.charAt(item.length - 1) === "\n";
|
294
|
+
if (!loose) {
|
295
|
+
loose = next
|
296
|
+
}
|
297
|
+
}
|
298
|
+
this.tokens.push({
|
299
|
+
type: loose ? "loose_item_start" : "list_item_start"
|
300
|
+
});
|
301
|
+
this.token(item, false, bq);
|
302
|
+
this.tokens.push({
|
303
|
+
type: "list_item_end"
|
304
|
+
})
|
305
|
+
}
|
306
|
+
this.tokens.push({
|
307
|
+
type: "list_end"
|
308
|
+
});
|
309
|
+
continue
|
310
|
+
}
|
311
|
+
if (cap = this.rules.html.exec(src)) {
|
312
|
+
src = src.substring(cap[0].length);
|
313
|
+
this.tokens.push({
|
314
|
+
type: this.options.sanitize ? "paragraph" : "html",
|
315
|
+
pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"),
|
316
|
+
text: cap[0]
|
317
|
+
});
|
318
|
+
continue
|
319
|
+
}
|
320
|
+
if ((!bq && top) && (cap = this.rules.def.exec(src))) {
|
321
|
+
src = src.substring(cap[0].length);
|
322
|
+
this.tokens.links[cap[1].toLowerCase()] = {
|
323
|
+
href: cap[2],
|
324
|
+
title: cap[3]
|
325
|
+
};
|
326
|
+
continue
|
327
|
+
}
|
328
|
+
if (top && (cap = this.rules.table.exec(src))) {
|
329
|
+
src = src.substring(cap[0].length);
|
330
|
+
item = {
|
331
|
+
type: "table",
|
332
|
+
header: cap[1].replace(/^ *| *\| *$/g, "").split(/ *\| */),
|
333
|
+
align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
|
334
|
+
cells: cap[3].replace(/(?: *\| *)?\n$/, "").split("\n")
|
335
|
+
};
|
336
|
+
for (i = 0; i < item.align.length; i++) {
|
337
|
+
if (/^ *-+: *$/.test(item.align[i])) {
|
338
|
+
item.align[i] = "right"
|
339
|
+
} else {
|
340
|
+
if (/^ *:-+: *$/.test(item.align[i])) {
|
341
|
+
item.align[i] = "center"
|
342
|
+
} else {
|
343
|
+
if (/^ *:-+ *$/.test(item.align[i])) {
|
344
|
+
item.align[i] = "left"
|
345
|
+
} else {
|
346
|
+
item.align[i] = null
|
347
|
+
}
|
348
|
+
}
|
349
|
+
}
|
350
|
+
}
|
351
|
+
for (i = 0; i < item.cells.length; i++) {
|
352
|
+
item.cells[i] = item.cells[i].replace(/^ *\| *| *\| *$/g, "").split(/ *\| */)
|
353
|
+
}
|
354
|
+
this.tokens.push(item);
|
355
|
+
continue
|
356
|
+
}
|
357
|
+
if (top && (cap = this.rules.paragraph.exec(src))) {
|
358
|
+
src = src.substring(cap[0].length);
|
359
|
+
this.tokens.push({
|
360
|
+
type: "paragraph",
|
361
|
+
text: cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1]
|
362
|
+
});
|
363
|
+
continue
|
364
|
+
}
|
365
|
+
if (cap = this.rules.text.exec(src)) {
|
366
|
+
src = src.substring(cap[0].length);
|
367
|
+
this.tokens.push({
|
368
|
+
type: "text",
|
369
|
+
text: cap[0]
|
370
|
+
});
|
371
|
+
continue
|
372
|
+
}
|
373
|
+
if (src) {
|
374
|
+
throw new Error("Infinite loop on byte: " + src.charCodeAt(0))
|
375
|
+
}
|
376
|
+
}
|
377
|
+
return this.tokens
|
378
|
+
};
|
379
|
+
var inline = {
|
380
|
+
escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
|
381
|
+
autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
|
382
|
+
url: noop,
|
383
|
+
tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
|
384
|
+
link: /^!?\[(inside)\]\(href\)/,
|
385
|
+
reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
|
386
|
+
nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
|
387
|
+
strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
|
388
|
+
em: /^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
|
389
|
+
code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
|
390
|
+
br: /^ {2,}\n(?!\s*$)/,
|
391
|
+
del: noop,
|
392
|
+
text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/
|
393
|
+
};
|
394
|
+
inline._inside = /(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;
|
395
|
+
inline._href = /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;
|
396
|
+
inline.link = replace(inline.link)("inside", inline._inside)("href", inline._href)();
|
397
|
+
inline.reflink = replace(inline.reflink)("inside", inline._inside)();
|
398
|
+
inline.normal = merge({}, inline);
|
399
|
+
inline.pedantic = merge({}, inline.normal, {
|
400
|
+
strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
401
|
+
em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/
|
402
|
+
});
|
403
|
+
inline.gfm = merge({}, inline.normal, {
|
404
|
+
escape: replace(inline.escape)("])", "~|])")(),
|
405
|
+
url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,
|
406
|
+
del: /^~~(?=\S)([\s\S]*?\S)~~/,
|
407
|
+
text: replace(inline.text)("]|", "~]|")("|", "|https?://|")()
|
408
|
+
});
|
409
|
+
inline.breaks = merge({}, inline.gfm, {
|
410
|
+
br: replace(inline.br)("{2,}", "*")(),
|
411
|
+
text: replace(inline.gfm.text)("{2,}", "*")()
|
412
|
+
});
|
117
413
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
414
|
+
function InlineLexer(links, options) {
|
415
|
+
this.options = options || marked.defaults;
|
416
|
+
this.links = links;
|
417
|
+
this.rules = inline.normal;
|
418
|
+
this.renderer = this.options.renderer || new Renderer;
|
419
|
+
this.renderer.options = this.options;
|
420
|
+
if (!this.links) {
|
421
|
+
throw new Error("Tokens array requires a `links` property.")
|
422
|
+
}
|
423
|
+
if (this.options.gfm) {
|
424
|
+
if (this.options.breaks) {
|
425
|
+
this.rules = inline.breaks
|
426
|
+
} else {
|
427
|
+
this.rules = inline.gfm
|
428
|
+
}
|
429
|
+
} else {
|
430
|
+
if (this.options.pedantic) {
|
431
|
+
this.rules = inline.pedantic
|
432
|
+
}
|
433
|
+
}
|
434
|
+
}
|
435
|
+
InlineLexer.rules = inline;
|
436
|
+
InlineLexer.output = function (src, links, options) {
|
437
|
+
var inline = new InlineLexer(links, options);
|
438
|
+
return inline.output(src)
|
439
|
+
};
|
440
|
+
InlineLexer.prototype.output = function (src) {
|
441
|
+
var out = "",
|
442
|
+
link, text, href, cap;
|
443
|
+
while (src) {
|
444
|
+
if (cap = this.rules.escape.exec(src)) {
|
445
|
+
src = src.substring(cap[0].length);
|
446
|
+
out += cap[1];
|
447
|
+
continue
|
448
|
+
}
|
449
|
+
if (cap = this.rules.autolink.exec(src)) {
|
450
|
+
src = src.substring(cap[0].length);
|
451
|
+
if (cap[2] === "@") {
|
452
|
+
text = cap[1].charAt(6) === ":" ? this.mangle(cap[1].substring(7)) : this.mangle(cap[1]);
|
453
|
+
href = this.mangle("mailto:") + text
|
454
|
+
} else {
|
455
|
+
text = escape(cap[1]);
|
456
|
+
href = text
|
457
|
+
}
|
458
|
+
out += this.renderer.link(href, null, text);
|
459
|
+
continue
|
460
|
+
}
|
461
|
+
if (!this.inLink && (cap = this.rules.url.exec(src))) {
|
462
|
+
src = src.substring(cap[0].length);
|
463
|
+
text = escape(cap[1]);
|
464
|
+
href = text;
|
465
|
+
out += this.renderer.link(href, null, text);
|
466
|
+
continue
|
467
|
+
}
|
468
|
+
if (cap = this.rules.tag.exec(src)) {
|
469
|
+
if (!this.inLink && /^<a /i.test(cap[0])) {
|
470
|
+
this.inLink = true
|
471
|
+
} else {
|
472
|
+
if (this.inLink && /^<\/a>/i.test(cap[0])) {
|
473
|
+
this.inLink = false
|
474
|
+
}
|
475
|
+
}
|
476
|
+
src = src.substring(cap[0].length);
|
477
|
+
out += this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0];
|
478
|
+
continue
|
479
|
+
}
|
480
|
+
if (cap = this.rules.link.exec(src)) {
|
481
|
+
src = src.substring(cap[0].length);
|
482
|
+
this.inLink = true;
|
483
|
+
out += this.outputLink(cap, {
|
484
|
+
href: cap[2],
|
485
|
+
title: cap[3]
|
486
|
+
});
|
487
|
+
this.inLink = false;
|
488
|
+
continue
|
489
|
+
}
|
490
|
+
if ((cap = this.rules.reflink.exec(src)) || (cap = this.rules.nolink.exec(src))) {
|
491
|
+
src = src.substring(cap[0].length);
|
492
|
+
link = (cap[2] || cap[1]).replace(/\s+/g, " ");
|
493
|
+
link = this.links[link.toLowerCase()];
|
494
|
+
if (!link || !link.href) {
|
495
|
+
out += cap[0].charAt(0);
|
496
|
+
src = cap[0].substring(1) + src;
|
497
|
+
continue
|
498
|
+
}
|
499
|
+
this.inLink = true;
|
500
|
+
out += this.outputLink(cap, link);
|
501
|
+
this.inLink = false;
|
502
|
+
continue
|
503
|
+
}
|
504
|
+
if (cap = this.rules.strong.exec(src)) {
|
505
|
+
src = src.substring(cap[0].length);
|
506
|
+
out += this.renderer.strong(this.output(cap[2] || cap[1]));
|
507
|
+
continue
|
508
|
+
}
|
509
|
+
if (cap = this.rules.em.exec(src)) {
|
510
|
+
src = src.substring(cap[0].length);
|
511
|
+
out += this.renderer.em(this.output(cap[2] || cap[1]));
|
512
|
+
continue
|
513
|
+
}
|
514
|
+
if (cap = this.rules.code.exec(src)) {
|
515
|
+
src = src.substring(cap[0].length);
|
516
|
+
out += this.renderer.codespan(escape(cap[2], true));
|
517
|
+
continue
|
518
|
+
}
|
519
|
+
if (cap = this.rules.br.exec(src)) {
|
520
|
+
src = src.substring(cap[0].length);
|
521
|
+
out += this.renderer.br();
|
522
|
+
continue
|
523
|
+
}
|
524
|
+
if (cap = this.rules.del.exec(src)) {
|
525
|
+
src = src.substring(cap[0].length);
|
526
|
+
out += this.renderer.del(this.output(cap[1]));
|
527
|
+
continue
|
528
|
+
}
|
529
|
+
if (cap = this.rules.text.exec(src)) {
|
530
|
+
src = src.substring(cap[0].length);
|
531
|
+
out += this.renderer.text(escape(this.smartypants(cap[0])));
|
532
|
+
continue
|
533
|
+
}
|
534
|
+
if (src) {
|
535
|
+
throw new Error("Infinite loop on byte: " + src.charCodeAt(0))
|
536
|
+
}
|
537
|
+
}
|
538
|
+
return out
|
539
|
+
};
|
540
|
+
InlineLexer.prototype.outputLink = function (cap, link) {
|
541
|
+
var href = escape(link.href),
|
542
|
+
title = link.title ? escape(link.title) : null;
|
543
|
+
return cap[0].charAt(0) !== "!" ? this.renderer.link(href, title, this.output(cap[1])) : this.renderer.image(href, title, escape(cap[1]))
|
544
|
+
};
|
545
|
+
InlineLexer.prototype.smartypants = function (text) {
|
546
|
+
if (!this.options.smartypants) {
|
547
|
+
return text
|
548
|
+
}
|
549
|
+
return text.replace(/---/g, "\u2014").replace(/--/g, "\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018").replace(/'/g, "\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201c").replace(/"/g, "\u201d").replace(/\.{3}/g, "\u2026")
|
550
|
+
};
|
551
|
+
InlineLexer.prototype.mangle = function (text) {
|
552
|
+
if (!this.options.mangle) {
|
553
|
+
return text
|
554
|
+
}
|
555
|
+
var out = "",
|
556
|
+
l = text.length,
|
557
|
+
i = 0,
|
558
|
+
ch;
|
559
|
+
for (; i < l; i++) {
|
560
|
+
ch = text.charCodeAt(i);
|
561
|
+
if (Math.random() > 0.5) {
|
562
|
+
ch = "x" + ch.toString(16)
|
563
|
+
}
|
564
|
+
out += "&#" + ch + ";"
|
565
|
+
}
|
566
|
+
return out
|
567
|
+
};
|
122
568
|
|
123
|
-
|
569
|
+
function Renderer(options) {
|
570
|
+
this.options = options || {}
|
571
|
+
}
|
572
|
+
Renderer.prototype.code = function (code, lang, escaped) {
|
573
|
+
if (this.options.highlight) {
|
574
|
+
var out = this.options.highlight(code, lang);
|
575
|
+
if (out != null && out !== code) {
|
576
|
+
escaped = true;
|
577
|
+
code = out
|
578
|
+
}
|
579
|
+
}
|
580
|
+
if (!lang) {
|
581
|
+
return "<pre><code>" + (escaped ? code : escape(code, true)) + "\n</code></pre>"
|
582
|
+
}
|
583
|
+
return '<pre><code class="' + this.options.langPrefix + escape(lang, true) + '">' + (escaped ? code : escape(code, true)) + "\n</code></pre>\n"
|
584
|
+
};
|
585
|
+
Renderer.prototype.blockquote = function (quote) {
|
586
|
+
return "<blockquote>\n" + quote + "</blockquote>\n"
|
587
|
+
};
|
588
|
+
Renderer.prototype.html = function (html) {
|
589
|
+
return html
|
590
|
+
};
|
591
|
+
Renderer.prototype.heading = function (text, level, raw) {
|
592
|
+
return "<h" + level + ' id="' + this.options.headerPrefix + raw.toLowerCase().replace(/[^\w]+/g, "-") + '">' + text + "</h" + level + ">\n"
|
593
|
+
};
|
594
|
+
Renderer.prototype.hr = function () {
|
595
|
+
return this.options.xhtml ? "<hr/>\n" : "<hr>\n"
|
596
|
+
};
|
597
|
+
Renderer.prototype.list = function (body, ordered) {
|
598
|
+
var type = ordered ? "ol" : "ul";
|
599
|
+
return "<" + type + ">\n" + body + "</" + type + ">\n"
|
600
|
+
};
|
601
|
+
Renderer.prototype.listitem = function (text) {
|
602
|
+
return "<li>" + text + "</li>\n"
|
603
|
+
};
|
604
|
+
Renderer.prototype.paragraph = function (text) {
|
605
|
+
return "<p>" + text + "</p>\n"
|
606
|
+
};
|
607
|
+
Renderer.prototype.table = function (header, body) {
|
608
|
+
return "<table>\n" + "<thead>\n" + header + "</thead>\n" + "<tbody>\n" + body + "</tbody>\n" + "</table>\n"
|
609
|
+
};
|
610
|
+
Renderer.prototype.tablerow = function (content) {
|
611
|
+
return "<tr>\n" + content + "</tr>\n"
|
612
|
+
};
|
613
|
+
Renderer.prototype.tablecell = function (content, flags) {
|
614
|
+
var type = flags.header ? "th" : "td";
|
615
|
+
var tag = flags.align ? "<" + type + ' style="text-align:' + flags.align + '">' : "<" + type + ">";
|
616
|
+
return tag + content + "</" + type + ">\n"
|
617
|
+
};
|
618
|
+
Renderer.prototype.strong = function (text) {
|
619
|
+
return "<strong>" + text + "</strong>"
|
620
|
+
};
|
621
|
+
Renderer.prototype.em = function (text) {
|
622
|
+
return "<em>" + text + "</em>"
|
623
|
+
};
|
624
|
+
Renderer.prototype.codespan = function (text) {
|
625
|
+
return "<code>" + text + "</code>"
|
626
|
+
};
|
627
|
+
Renderer.prototype.br = function () {
|
628
|
+
return this.options.xhtml ? "<br/>" : "<br>"
|
629
|
+
};
|
630
|
+
Renderer.prototype.del = function (text) {
|
631
|
+
return "<del>" + text + "</del>"
|
632
|
+
};
|
633
|
+
Renderer.prototype.link = function (href, title, text) {
|
634
|
+
if (this.options.sanitize) {
|
635
|
+
try {
|
636
|
+
var prot = decodeURIComponent(unescape(href)).replace(/[^\w:]/g, "").toLowerCase()
|
637
|
+
} catch (e) {
|
638
|
+
return ""
|
639
|
+
}
|
640
|
+
if (prot.indexOf("javascript:") === 0 || prot.indexOf("vbscript:") === 0 || prot.indexOf("data:") === 0) {
|
641
|
+
return ""
|
642
|
+
}
|
643
|
+
}
|
644
|
+
var out = '<a href="' + href + '"';
|
645
|
+
if (title) {
|
646
|
+
out += ' title="' + title + '"'
|
647
|
+
}
|
648
|
+
out += ">" + text + "</a>";
|
649
|
+
return out
|
650
|
+
};
|
651
|
+
Renderer.prototype.image = function (href, title, text) {
|
652
|
+
var out = '<img src="' + href + '" alt="' + text + '"';
|
653
|
+
if (title) {
|
654
|
+
out += ' title="' + title + '"'
|
655
|
+
}
|
656
|
+
out += this.options.xhtml ? "/>" : ">";
|
657
|
+
return out
|
658
|
+
};
|
659
|
+
Renderer.prototype.text = function (text) {
|
660
|
+
return text
|
661
|
+
};
|
124
662
|
|
125
|
-
|
663
|
+
function Parser(options) {
|
664
|
+
this.tokens = [];
|
665
|
+
this.token = null;
|
666
|
+
this.options = options || marked.defaults;
|
667
|
+
this.options.renderer = this.options.renderer || new Renderer;
|
668
|
+
this.renderer = this.options.renderer;
|
669
|
+
this.renderer.options = this.options
|
670
|
+
}
|
671
|
+
Parser.parse = function (src, options, renderer) {
|
672
|
+
var parser = new Parser(options, renderer);
|
673
|
+
return parser.parse(src)
|
674
|
+
};
|
675
|
+
Parser.prototype.parse = function (src) {
|
676
|
+
this.inline = new InlineLexer(src.links, this.options, this.renderer);
|
677
|
+
this.tokens = src.reverse();
|
678
|
+
var out = "";
|
679
|
+
while (this.next()) {
|
680
|
+
out += this.tok()
|
681
|
+
}
|
682
|
+
return out
|
683
|
+
};
|
684
|
+
Parser.prototype.next = function () {
|
685
|
+
return this.token = this.tokens.pop()
|
686
|
+
};
|
687
|
+
Parser.prototype.peek = function () {
|
688
|
+
return this.tokens[this.tokens.length - 1] || 0
|
689
|
+
};
|
690
|
+
Parser.prototype.parseText = function () {
|
691
|
+
var body = this.token.text;
|
692
|
+
while (this.peek().type === "text") {
|
693
|
+
body += "\n" + this.next().text
|
694
|
+
}
|
695
|
+
return this.inline.output(body)
|
696
|
+
};
|
697
|
+
Parser.prototype.tok = function () {
|
698
|
+
switch (this.token.type) {
|
699
|
+
case "space":
|
700
|
+
return "";
|
701
|
+
case "hr":
|
702
|
+
return this.renderer.hr();
|
703
|
+
case "heading":
|
704
|
+
return this.renderer.heading(this.inline.output(this.token.text), this.token.depth, this.token.text);
|
705
|
+
case "code":
|
706
|
+
return this.renderer.code(this.token.text, this.token.lang, this.token.escaped);
|
707
|
+
case "table":
|
708
|
+
var header = "",
|
709
|
+
body = "",
|
710
|
+
i, row, cell, flags, j;
|
711
|
+
cell = "";
|
712
|
+
for (i = 0; i < this.token.header.length; i++) {
|
713
|
+
flags = {
|
714
|
+
header: true,
|
715
|
+
align: this.token.align[i]
|
716
|
+
};
|
717
|
+
cell += this.renderer.tablecell(this.inline.output(this.token.header[i]), {
|
718
|
+
header: true,
|
719
|
+
align: this.token.align[i]
|
720
|
+
})
|
721
|
+
}
|
722
|
+
header += this.renderer.tablerow(cell);
|
723
|
+
for (i = 0; i < this.token.cells.length; i++) {
|
724
|
+
row = this.token.cells[i];
|
725
|
+
cell = "";
|
726
|
+
for (j = 0; j < row.length; j++) {
|
727
|
+
cell += this.renderer.tablecell(this.inline.output(row[j]), {
|
728
|
+
header: false,
|
729
|
+
align: this.token.align[j]
|
730
|
+
})
|
731
|
+
}
|
732
|
+
body += this.renderer.tablerow(cell)
|
733
|
+
}
|
734
|
+
return this.renderer.table(header, body);
|
735
|
+
case "blockquote_start":
|
736
|
+
var body = "";
|
737
|
+
while (this.next().type !== "blockquote_end") {
|
738
|
+
body += this.tok()
|
739
|
+
}
|
740
|
+
return this.renderer.blockquote(body);
|
741
|
+
case "list_start":
|
742
|
+
var body = "",
|
743
|
+
ordered = this.token.ordered;
|
744
|
+
while (this.next().type !== "list_end") {
|
745
|
+
body += this.tok()
|
746
|
+
}
|
747
|
+
return this.renderer.list(body, ordered);
|
748
|
+
case "list_item_start":
|
749
|
+
var body = "";
|
750
|
+
while (this.next().type !== "list_item_end") {
|
751
|
+
body += this.token.type === "text" ? this.parseText() : this.tok()
|
752
|
+
}
|
753
|
+
return this.renderer.listitem(body);
|
754
|
+
case "loose_item_start":
|
755
|
+
var body = "";
|
756
|
+
while (this.next().type !== "list_item_end") {
|
757
|
+
body += this.tok()
|
758
|
+
}
|
759
|
+
return this.renderer.listitem(body);
|
760
|
+
case "html":
|
761
|
+
var html = !this.token.pre && !this.options.pedantic ? this.inline.output(this.token.text) : this.token.text;
|
762
|
+
return this.renderer.html(html);
|
763
|
+
case "paragraph":
|
764
|
+
return this.renderer.paragraph(this.inline.output(this.token.text));
|
765
|
+
case "text":
|
766
|
+
return this.renderer.paragraph(this.parseText())
|
767
|
+
}
|
768
|
+
};
|
769
|
+
|
770
|
+
function escape(html, encode) {
|
771
|
+
return html.replace(!encode ? /&(?!#?\w+;)/g : /&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'")
|
772
|
+
}
|
773
|
+
|
774
|
+
function unescape(html) {
|
775
|
+
return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g, function (_, n) {
|
776
|
+
n = n.toLowerCase();
|
777
|
+
if (n === "colon") {
|
778
|
+
return ":"
|
779
|
+
}
|
780
|
+
if (n.charAt(0) === "#") {
|
781
|
+
return n.charAt(1) === "x" ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1))
|
782
|
+
}
|
783
|
+
return ""
|
784
|
+
})
|
785
|
+
}
|
786
|
+
|
787
|
+
function replace(regex, opt) {
|
788
|
+
regex = regex.source;
|
789
|
+
opt = opt || "";
|
790
|
+
return function self(name, val) {
|
791
|
+
if (!name) {
|
792
|
+
return new RegExp(regex, opt)
|
793
|
+
}
|
794
|
+
val = val.source || val;
|
795
|
+
val = val.replace(/(^|[^\[])\^/g, "$1");
|
796
|
+
regex = regex.replace(name, val);
|
797
|
+
return self
|
798
|
+
}
|
799
|
+
}
|
800
|
+
|
801
|
+
function noop() {}
|
802
|
+
noop.exec = noop;
|
126
803
|
|
804
|
+
function merge(obj) {
|
805
|
+
var i = 1,
|
806
|
+
target, key;
|
807
|
+
for (; i < arguments.length; i++) {
|
808
|
+
target = arguments[i];
|
809
|
+
for (key in target) {
|
810
|
+
if (Object.prototype.hasOwnProperty.call(target, key)) {
|
811
|
+
obj[key] = target[key]
|
812
|
+
}
|
813
|
+
}
|
814
|
+
}
|
815
|
+
return obj
|
816
|
+
}
|
127
817
|
|
818
|
+
function marked(src, opt, callback) {
|
819
|
+
if (callback || typeof opt === "function") {
|
820
|
+
if (!callback) {
|
821
|
+
callback = opt;
|
822
|
+
opt = null
|
823
|
+
}
|
824
|
+
opt = merge({}, marked.defaults, opt || {});
|
825
|
+
var highlight = opt.highlight,
|
826
|
+
tokens, pending, i = 0;
|
827
|
+
try {
|
828
|
+
tokens = Lexer.lex(src, opt)
|
829
|
+
} catch (e) {
|
830
|
+
return callback(e)
|
831
|
+
}
|
832
|
+
pending = tokens.length;
|
833
|
+
var done = function (err) {
|
834
|
+
if (err) {
|
835
|
+
opt.highlight = highlight;
|
836
|
+
return callback(err)
|
837
|
+
}
|
838
|
+
var out;
|
839
|
+
try {
|
840
|
+
out = Parser.parse(tokens, opt)
|
841
|
+
} catch (e) {
|
842
|
+
err = e
|
843
|
+
}
|
844
|
+
opt.highlight = highlight;
|
845
|
+
return err ? callback(err) : callback(null, out)
|
846
|
+
};
|
847
|
+
if (!highlight || highlight.length < 3) {
|
848
|
+
return done()
|
849
|
+
}
|
850
|
+
delete opt.highlight;
|
851
|
+
if (!pending) {
|
852
|
+
return done()
|
853
|
+
}
|
854
|
+
for (; i < tokens.length; i++) {
|
855
|
+
(function (token) {
|
856
|
+
if (token.type !== "code") {
|
857
|
+
return --pending || done()
|
858
|
+
}
|
859
|
+
return highlight(token.text, token.lang, function (err, code) {
|
860
|
+
if (err) {
|
861
|
+
return done(err)
|
862
|
+
}
|
863
|
+
if (code == null || code === token.text) {
|
864
|
+
return --pending || done()
|
865
|
+
}
|
866
|
+
token.text = code;
|
867
|
+
token.escaped = true;
|
868
|
+
--pending || done()
|
869
|
+
})
|
870
|
+
})(tokens[i])
|
871
|
+
}
|
872
|
+
return
|
873
|
+
}
|
874
|
+
try {
|
875
|
+
if (opt) {
|
876
|
+
opt = merge({}, marked.defaults, opt)
|
877
|
+
}
|
878
|
+
return Parser.parse(Lexer.lex(src, opt), opt)
|
879
|
+
} catch (e) {
|
880
|
+
e.message += "\nPlease report this to https://github.com/chjj/marked.";
|
881
|
+
if ((opt || marked.defaults).silent) {
|
882
|
+
return "<p>An error occured:</p><pre>" + escape(e.message + "", true) + "</pre>"
|
883
|
+
}
|
884
|
+
throw e
|
885
|
+
}
|
886
|
+
}
|
887
|
+
marked.options = marked.setOptions = function (opt) {
|
888
|
+
merge(marked.defaults, opt);
|
889
|
+
return marked
|
890
|
+
};
|
891
|
+
marked.defaults = {
|
892
|
+
gfm: true,
|
893
|
+
tables: true,
|
894
|
+
breaks: false,
|
895
|
+
pedantic: false,
|
896
|
+
sanitize: false,
|
897
|
+
sanitizer: null,
|
898
|
+
mangle: true,
|
899
|
+
smartLists: false,
|
900
|
+
silent: false,
|
901
|
+
highlight: null,
|
902
|
+
langPrefix: "lang-",
|
903
|
+
smartypants: false,
|
904
|
+
headerPrefix: "",
|
905
|
+
renderer: new Renderer,
|
906
|
+
xhtml: false
|
907
|
+
};
|
908
|
+
marked.Parser = Parser;
|
909
|
+
marked.parser = Parser.parse;
|
910
|
+
marked.Renderer = Renderer;
|
911
|
+
marked.Lexer = Lexer;
|
912
|
+
marked.lexer = Lexer.lex;
|
913
|
+
marked.InlineLexer = InlineLexer;
|
914
|
+
marked.inlineLexer = InlineLexer.output;
|
915
|
+
marked.parse = marked;
|
916
|
+
if (typeof module !== "undefined" && typeof exports === "object") {
|
917
|
+
module.exports = marked
|
918
|
+
} else {
|
919
|
+
if (typeof define === "function" && define.amd) {
|
920
|
+
define(function () {
|
921
|
+
return marked
|
922
|
+
})
|
923
|
+
} else {
|
924
|
+
this.marked = marked
|
925
|
+
}
|
926
|
+
}
|
927
|
+
}).call(function () {
|
928
|
+
return this || (typeof window !== "undefined" ? window : global)
|
929
|
+
}());
|
128
930
|
</script>
|
129
931
|
|
932
|
+
<!--chips-->
|
933
|
+
|
934
|
+
<script>
|
935
|
+
Materialize={};Materialize.guid=(function(){function s4(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return function(){return s4()+s4()+"-"+s4()+"-"+s4()+"-"+s4()+"-"+s4()+s4()+s4()}})();(function($){var materialChipsDefaults={data:[],placeholder:"",secondaryPlaceholder:"",autocompleteOptions:{},};$(document).ready(function(){$(document).on("click",".chip .close",function(e){var $chips=$(this).closest(".chips");if($chips.attr("data-initialized")){return}$(this).closest(".chip").remove()})});$.fn.material_chip=function(options){var self=this;this.$el=$(this);this.$document=$(document);this.SELS={CHIPS:".chips",CHIP:".chip",INPUT:"input",DELETE:".material-icons",SELECTED_CHIP:".selected",};if("data"===options){return this.$el.data("chips")}var curr_options=$.extend({},materialChipsDefaults,options);self.hasAutocomplete=!$.isEmptyObject(curr_options.autocompleteOptions.data);this.init=function(){var i=0;var chips;self.$el.each(function(){var $chips=$(this);var chipId=Materialize.guid();self.chipId=chipId;if(!curr_options.data||!(curr_options.data instanceof Array)){curr_options.data=[]}$chips.data("chips",curr_options.data);$chips.attr("data-index",i);$chips.attr("data-initialized",true);if(!$chips.hasClass(self.SELS.CHIPS)){$chips.addClass("chips")}self.chips($chips,chipId);i++})};this.handleEvents=function(){var SELS=self.SELS;self.$document.off("click.chips-focus",SELS.CHIPS).on("click.chips-focus",SELS.CHIPS,function(e){$(e.target).find(SELS.INPUT).focus()});self.$document.off("click.chips-select",SELS.CHIP).on("click.chips-select",SELS.CHIP,function(e){var $chip=$(e.target);if($chip.length){var wasSelected=$chip.hasClass("selected");var $chips=$chip.closest(SELS.CHIPS);$(SELS.CHIP).removeClass("selected");if(!wasSelected){self.selectChip($chip.index(),$chips)}}});self.$document.off("keydown.chips").on("keydown.chips",function(e){if($(e.target).is("input, textarea")){return}var $chip=self.$document.find(SELS.CHIP+SELS.SELECTED_CHIP);var $chips=$chip.closest(SELS.CHIPS);var length=$chip.siblings(SELS.CHIP).length;var index;if(!$chip.length){return}if(e.which===8||e.which===46){e.preventDefault();index=$chip.index();self.deleteChip(index,$chips);var selectIndex=null;if((index+1)<length){selectIndex=index}else{if(index===length||(index+1)===length){selectIndex=length-1}}if(selectIndex<0){selectIndex=null}if(null!==selectIndex){self.selectChip(selectIndex,$chips)}if(!length){$chips.find("input").focus()}}else{if(e.which===37){index=$chip.index()-1;if(index<0){return}$(SELS.CHIP).removeClass("selected");self.selectChip(index,$chips)}else{if(e.which===39){index=$chip.index()+1;$(SELS.CHIP).removeClass("selected");if(index>length){$chips.find("input").focus();return}self.selectChip(index,$chips)}}}});self.$document.off("focusin.chips",SELS.CHIPS+" "+SELS.INPUT).on("focusin.chips",SELS.CHIPS+" "+SELS.INPUT,function(e){var $currChips=$(e.target).closest(SELS.CHIPS);$currChips.addClass("focus");$currChips.siblings("label, .prefix").addClass("active");$(SELS.CHIP).removeClass("selected")});self.$document.off("focusout.chips",SELS.CHIPS+" "+SELS.INPUT).on("focusout.chips",SELS.CHIPS+" "+SELS.INPUT,function(e){var $currChips=$(e.target).closest(SELS.CHIPS);$currChips.removeClass("focus");if($currChips.data("chips")===undefined||!$currChips.data("chips").length){$currChips.siblings("label").removeClass("active")}$currChips.siblings(".prefix").removeClass("active")});self.$document.off("keydown.chips-add",SELS.CHIPS+" "+SELS.INPUT).on("keydown.chips-add",SELS.CHIPS+" "+SELS.INPUT,function(e){var $target=$(e.target);var $chips=$target.closest(SELS.CHIPS);var chipsLength=$chips.children(SELS.CHIP).length;if(13===e.which){if(self.hasAutocomplete&&$chips.find(".autocomplete-content.dropdown-content").length&&$chips.find(".autocomplete-content.dropdown-content").children().length){return}e.preventDefault();self.addChip({tag:$target.val()},$chips);$target.val("");return}if((8===e.keyCode||37===e.keyCode)&&""===$target.val()&&chipsLength){e.preventDefault();self.selectChip(chipsLength-1,$chips);$target.blur();return}});self.$document.off("click.chips-delete",SELS.CHIPS+" "+SELS.DELETE).on("click.chips-delete",SELS.CHIPS+" "+SELS.DELETE,function(e){var $target=$(e.target);var $chips=$target.closest(SELS.CHIPS);var $chip=$target.closest(SELS.CHIP);e.stopPropagation();self.deleteChip($chip.index(),$chips);$chips.find("input").focus()})};this.chips=function($chips,chipId){$chips.empty();$chips.data("chips").forEach(function(elem){$chips.append(self.renderChip(elem))});$chips.append($('<input id="'+chipId+'" class="input mdui-textfield-input" placeholder="">'));self.setPlaceholder($chips);var label=$chips.next("label");if(label.length){label.attr("for",chipId);if($chips.data("chips")!==undefined&&$chips.data("chips").length){label.addClass("active")}}var input=$("#"+chipId);if(self.hasAutocomplete){curr_options.autocompleteOptions.onAutocomplete=function(val){self.addChip({tag:val},$chips);input.val("");input.focus()
|
936
|
+
};input.autocomplete(curr_options.autocompleteOptions)}};this.renderChip=function(elem){if(!elem.tag){return}var $renderedChip=$('<div class="mdui-chip chip mdui-chip-title"></div>');$renderedChip.text(elem.tag);if(elem.image){$renderedChip.prepend($("<img />").attr("src",elem.image))}$renderedChip.append($('<i class="material-icons mdui-icon close">close</i>'));return $renderedChip};this.setPlaceholder=function($chips){if($chips.data("chips")!==undefined&&$chips.data("chips").length&&curr_options.placeholder){$chips.find("input").prop("placeholder",curr_options.placeholder)}else{if(($chips.data("chips")===undefined||!$chips.data("chips").length)&&curr_options.secondaryPlaceholder){$chips.find("input").prop("placeholder",curr_options.secondaryPlaceholder)}}};this.isValid=function($chips,elem){var chips=$chips.data("chips");var exists=false;for(var i=0;i<chips.length;i++){if(chips[i].tag===elem.tag){exists=true;return}}return""!==elem.tag&&!exists};this.addChip=function(elem,$chips){if(!self.isValid($chips,elem)){return}var $renderedChip=self.renderChip(elem);var newData=[];var oldData=$chips.data("chips");for(var i=0;i<oldData.length;i++){newData.push(oldData[i])}newData.push(elem);$chips.data("chips",newData);$renderedChip.insertBefore($chips.find("input"));$chips.trigger("chip.add",elem);self.setPlaceholder($chips)};this.deleteChip=function(chipIndex,$chips){var chip=$chips.data("chips")[chipIndex];$chips.find(".chip").eq(chipIndex).remove();var newData=[];var oldData=$chips.data("chips");for(var i=0;i<oldData.length;i++){if(i!==chipIndex){newData.push(oldData[i])}}$chips.data("chips",newData);$chips.trigger("chip.delete",chip);self.setPlaceholder($chips)};this.selectChip=function(chipIndex,$chips){var $chip=$chips.find(".chip").eq(chipIndex);if($chip&&false===$chip.hasClass("selected")){$chip.addClass("selected");$chips.trigger("chip.select",$chips.data("chips")[chipIndex])}};this.getChipsElement=function(index,$chips){return $chips.eq(index)};this.init();this.handleEvents()}}(jQuery));
|
937
|
+
</script>
|
130
938
|
<script>
|
131
939
|
$(function(){
|
132
940
|
$('.chips-initial').material_chip({
|
data/_layouts/default.html
CHANGED
@@ -14,6 +14,8 @@ layout: compress
|
|
14
14
|
{% if site.data.site.google_analytics != "" %}
|
15
15
|
{% include analytics/google.html %}
|
16
16
|
{% endif %}
|
17
|
+
{% include component/sw.html %}
|
18
|
+
{% include footer/footer.html %}
|
17
19
|
{% if site.data.site.uiux.meng == true%}
|
18
20
|
{% if site.data.meng.live2d.switch == true %}
|
19
21
|
{% include meng/live2d.html %}
|
@@ -37,7 +39,5 @@ layout: compress
|
|
37
39
|
{% include meng/aplayer.html %}
|
38
40
|
{% endif %}
|
39
41
|
{% endif %}
|
40
|
-
{% include component/sw.html %}
|
41
|
-
{% include footer/footer.html %}
|
42
42
|
</body>
|
43
43
|
</html>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-theme-mdui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.9.
|
4
|
+
version: 0.4.9.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KeJun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '3.
|
26
|
+
version: '3.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jekyll-paginate
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|