hexo-component-inferno 3.1.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/asset/js/algolia.js +51 -10
- package/asset/js/google_cse.js +50 -7
- package/asset/js/insight.js +48 -7
- package/lib/hexo/filter/locals.js +2 -2
- package/lib/schema/comment/valine.json +2 -2
- package/lib/schema/plugin/matomo.json +25 -0
- package/lib/schema/plugin/umami.json +25 -0
- package/lib/schema/search/algolia.json +4 -0
- package/lib/util/script.js +65 -0
- package/lib/view/comment/changyan.js +5 -5
- package/lib/view/comment/disqus.js +1 -1
- package/lib/view/comment/disqusjs.js +6 -5
- package/lib/view/comment/facebook.js +1 -1
- package/lib/view/comment/giscus.js +1 -1
- package/lib/view/comment/gitalk.js +6 -5
- package/lib/view/comment/gitment.js +6 -5
- package/lib/view/comment/isso.js +7 -3
- package/lib/view/comment/livere.js +1 -1
- package/lib/view/comment/twikoo.js +3 -4
- package/lib/view/comment/utterances.js +1 -1
- package/lib/view/comment/valine.js +3 -6
- package/lib/view/comment/waline.js +8 -7
- package/lib/view/common/article_media.js +2 -2
- package/lib/view/donate/afdian.js +1 -1
- package/lib/view/donate/alipay.js +1 -1
- package/lib/view/donate/buymeacoffee.js +1 -1
- package/lib/view/donate/patreon.js +1 -1
- package/lib/view/donate/paypal.js +1 -1
- package/lib/view/donate/wechat.js +1 -1
- package/lib/view/misc/article_licensing.js +1 -1
- package/lib/view/misc/meta.js +1 -1
- package/lib/view/misc/open_graph.js +1 -1
- package/lib/view/misc/paginator.js +9 -5
- package/lib/view/misc/structured_data.js +1 -1
- package/lib/view/misc/web_app.js +2 -2
- package/lib/view/plugin/baidu_analytics.js +1 -1
- package/lib/view/plugin/bing_webmaster.js +1 -1
- package/lib/view/plugin/busuanzi.js +1 -1
- package/lib/view/plugin/cnzz.js +1 -1
- package/lib/view/plugin/cookie_consent.js +1 -1
- package/lib/view/plugin/gallery.js +2 -2
- package/lib/view/plugin/google_analytics.js +1 -1
- package/lib/view/plugin/hotjar.js +1 -1
- package/lib/view/plugin/katex.js +1 -1
- package/lib/view/plugin/mathjax.js +1 -1
- package/lib/view/plugin/matomo.js +89 -0
- package/lib/view/plugin/outdated_browser.js +1 -1
- package/lib/view/plugin/progressbar.js +1 -1
- package/lib/view/plugin/statcounter.js +1 -1
- package/lib/view/plugin/twitter_conversion_tracking.js +1 -1
- package/lib/view/plugin/umami.js +88 -0
- package/lib/view/search/algolia.js +11 -5
- package/lib/view/search/baidu.js +5 -3
- package/lib/view/search/google_cse.js +4 -2
- package/lib/view/search/insight.js +1 -1
- package/lib/view/share/addthis.js +1 -1
- package/lib/view/share/addtoany.js +1 -1
- package/lib/view/share/bdshare.js +1 -1
- package/lib/view/share/sharejs.js +1 -1
- package/lib/view/share/sharethis.js +1 -1
- package/lib/view/widget/adsense.js +1 -1
- package/lib/view/widget/archives.js +23 -5
- package/lib/view/widget/categories.js +1 -1
- package/lib/view/widget/followit.js +1 -1
- package/lib/view/widget/links.js +1 -1
- package/lib/view/widget/recent_posts.js +1 -1
- package/lib/view/widget/subscribe_email.js +1 -1
- package/lib/view/widget/tags.js +1 -1
- package/lib/view/widget/toc.js +1 -1
- package/package.json +10 -5
- package/lib/core/migrate.test.js +0 -48
- package/lib/core/schema.test.js +0 -520
- package/lib/core/view.test.js +0 -41
- package/lib/hexo/filter/locals.test.js +0 -118
- package/lib/hexo/generator/assets.test.js +0 -32
- package/lib/hexo/generator/categories.test.js +0 -41
- package/lib/hexo/generator/category.test.js +0 -84
- package/lib/hexo/generator/insight.test.js +0 -95
- package/lib/hexo/generator/manifest.test.js +0 -52
- package/lib/hexo/generator/tags.test.js +0 -41
- package/lib/hexo/helper/cdn.test.js +0 -128
- package/lib/hexo/helper/page.test.js +0 -62
- package/lib/hexo/tag/message.test.js +0 -72
- package/lib/hexo/tag/tabs.test.js +0 -98
- package/lib/schema/schema/comment/changyan.json +0 -21
- package/lib/schema/schema/comment/disqus.json +0 -17
- package/lib/schema/schema/comment/disqusjs.json +0 -53
- package/lib/schema/schema/comment/facebook.json +0 -13
- package/lib/schema/schema/comment/giscus.json +0 -105
- package/lib/schema/schema/comment/gitalk.json +0 -81
- package/lib/schema/schema/comment/gitment.json +0 -47
- package/lib/schema/schema/comment/isso.json +0 -17
- package/lib/schema/schema/comment/livere.json +0 -17
- package/lib/schema/schema/comment/twikoo.json +0 -28
- package/lib/schema/schema/comment/utterances.json +0 -59
- package/lib/schema/schema/comment/valine.json +0 -105
- package/lib/schema/schema/comment/waline.json +0 -176
- package/lib/schema/schema/donate/afdian.json +0 -17
- package/lib/schema/schema/donate/alipay.json +0 -17
- package/lib/schema/schema/donate/buymeacoffee.json +0 -17
- package/lib/schema/schema/donate/patreon.json +0 -17
- package/lib/schema/schema/donate/paypal.json +0 -22
- package/lib/schema/schema/donate/wechat.json +0 -17
- package/lib/schema/schema/misc/manifest.json +0 -66
- package/lib/schema/schema/misc/meta.json +0 -11
- package/lib/schema/schema/misc/open_graph.json +0 -78
- package/lib/schema/schema/misc/poly_links.json +0 -35
- package/lib/schema/schema/misc/structured_data.json +0 -47
- package/lib/schema/schema/plugin/baidu_analytics.json +0 -14
- package/lib/schema/schema/plugin/bing_webmaster.json +0 -14
- package/lib/schema/schema/plugin/busuanzi.json +0 -7
- package/lib/schema/schema/plugin/cnzz.json +0 -19
- package/lib/schema/schema/plugin/cookie_consent.json +0 -38
- package/lib/schema/schema/plugin/gallery.json +0 -7
- package/lib/schema/schema/plugin/google_analytics.json +0 -14
- package/lib/schema/schema/plugin/hotjar.json +0 -14
- package/lib/schema/schema/plugin/katex.json +0 -7
- package/lib/schema/schema/plugin/mathjax.json +0 -7
- package/lib/schema/schema/plugin/outdated_browser.json +0 -7
- package/lib/schema/schema/plugin/progressbar.json +0 -7
- package/lib/schema/schema/plugin/statcounter.json +0 -19
- package/lib/schema/schema/plugin/twitter_conversion_tracking.json +0 -14
- package/lib/schema/schema/search/algolia.json +0 -13
- package/lib/schema/schema/search/baidu.json +0 -13
- package/lib/schema/schema/search/google_cse.json +0 -17
- package/lib/schema/schema/search/insight.json +0 -19
- package/lib/schema/schema/share/addthis.json +0 -17
- package/lib/schema/schema/share/addtoany.json +0 -13
- package/lib/schema/schema/share/bdshare.json +0 -13
- package/lib/schema/schema/share/sharejs.json +0 -13
- package/lib/schema/schema/share/sharethis.json +0 -17
- package/lib/schema/schema/widget/adsense.json +0 -21
- package/lib/schema/schema/widget/archives.json +0 -13
- package/lib/schema/schema/widget/categories.json +0 -13
- package/lib/schema/schema/widget/followit.json +0 -26
- package/lib/schema/schema/widget/links.json +0 -47
- package/lib/schema/schema/widget/recent_posts.json +0 -13
- package/lib/schema/schema/widget/subscribe_email.json +0 -22
- package/lib/schema/schema/widget/tags.json +0 -30
- package/lib/schema/schema/widget/toc.json +0 -31
- package/lib/util/cache.test.js +0 -24
- package/lib/util/classname.test.js +0 -13
- package/lib/util/yaml.test.js +0 -18
- package/lib/view/widget/toc.test.js +0 -30
package/asset/js/algolia.js
CHANGED
|
@@ -8,7 +8,7 @@ function loadAlgolia(config, translation) {
|
|
|
8
8
|
|
|
9
9
|
search.addWidgets([
|
|
10
10
|
instantsearch.widgets.configure({
|
|
11
|
-
attributesToSnippet: [
|
|
11
|
+
attributesToSnippet: [config.excerpt],
|
|
12
12
|
}),
|
|
13
13
|
]);
|
|
14
14
|
|
|
@@ -47,7 +47,7 @@ function loadAlgolia(config, translation) {
|
|
|
47
47
|
},
|
|
48
48
|
item: function (hit) {
|
|
49
49
|
let title = instantsearch.highlight({ attribute: 'title', hit });
|
|
50
|
-
let excerpt = instantsearch.highlight({ attribute:
|
|
50
|
+
let excerpt = instantsearch.highlight({ attribute: config.excerpt, hit });
|
|
51
51
|
title = title ? title : translation.untitled;
|
|
52
52
|
excerpt = excerpt
|
|
53
53
|
.replace(new RegExp('<em>', 'ig'), '[algolia-highlight]')
|
|
@@ -88,15 +88,56 @@ function loadAlgolia(config, translation) {
|
|
|
88
88
|
$('.searchbox').addClass('show');
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
const $main = $('.searchbox');
|
|
92
|
+
let opener = null;
|
|
93
|
+
|
|
94
|
+
function open() {
|
|
95
|
+
if (!$main.hasClass('show')) {
|
|
96
|
+
opener = document.activeElement;
|
|
97
|
+
$main.addClass('show');
|
|
98
|
+
}
|
|
99
|
+
$main.find('.searchbox-input').focus();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Return the focus to the element that opened the search box, unless it moved elsewhere
|
|
103
|
+
function close(restoreFocus = true) {
|
|
104
|
+
$main.removeClass('show');
|
|
105
|
+
if (restoreFocus && opener && document.contains(opener)) {
|
|
106
|
+
opener.focus();
|
|
107
|
+
}
|
|
108
|
+
opener = null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Open the search box with "/" (unless typing in a field) or Ctrl/Cmd+K
|
|
112
|
+
function isSearchShortcut(e) {
|
|
113
|
+
if (e.altKey) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
if (e.ctrlKey || e.metaKey) {
|
|
117
|
+
return !e.shiftKey && typeof e.key === 'string' && e.key.toLowerCase() === 'k';
|
|
118
|
+
}
|
|
119
|
+
// e.key is "/" whatever keys type it on the keyboard layout, so do not check e.shiftKey
|
|
120
|
+
const target = e.target;
|
|
121
|
+
const typing = target.isContentEditable || /^(input|textarea|select)$/i.test(target.tagName);
|
|
122
|
+
return e.key === '/' && !typing;
|
|
123
|
+
}
|
|
124
|
+
|
|
91
125
|
$(document)
|
|
92
|
-
.on('click', '.navbar-main .search',
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
$('
|
|
126
|
+
.on('click', '.navbar-main .search', open)
|
|
127
|
+
.on('click', '.searchbox .searchbox-mask', () => close())
|
|
128
|
+
.on('click', '.searchbox-close', () => close())
|
|
129
|
+
.on('focusin', (e) => {
|
|
130
|
+
// Close the search box when the focus moves to the rest of the page, e.g., by Tab
|
|
131
|
+
if ($main.hasClass('show') && !$main[0].contains(e.target)) {
|
|
132
|
+
close(false);
|
|
133
|
+
}
|
|
98
134
|
})
|
|
99
|
-
.on('
|
|
100
|
-
|
|
135
|
+
.on('keydown', (e) => {
|
|
136
|
+
if (isSearchShortcut(e)) {
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
open();
|
|
139
|
+
} else if (e.keyCode === 27 && $main.hasClass('show')) {
|
|
140
|
+
close();
|
|
141
|
+
}
|
|
101
142
|
});
|
|
102
143
|
}
|
package/asset/js/google_cse.js
CHANGED
|
@@ -16,15 +16,58 @@
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
let opener = null;
|
|
20
|
+
|
|
21
|
+
function open() {
|
|
22
|
+
const $main = $('.searchbox');
|
|
23
|
+
if (!$main.hasClass('show')) {
|
|
24
|
+
opener = document.activeElement;
|
|
25
|
+
$main.addClass('show');
|
|
26
|
+
}
|
|
27
|
+
$main.find('.searchbox-input').focus();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Return the focus to the element that opened the search box, unless it moved elsewhere
|
|
31
|
+
function close(restoreFocus = true) {
|
|
32
|
+
$('.searchbox').removeClass('show');
|
|
33
|
+
if (restoreFocus && opener && document.contains(opener)) {
|
|
34
|
+
opener.focus();
|
|
35
|
+
}
|
|
36
|
+
opener = null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Open the search box with "/" (unless typing in a field) or Ctrl/Cmd+K
|
|
40
|
+
function isSearchShortcut(e) {
|
|
41
|
+
if (e.altKey) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (e.ctrlKey || e.metaKey) {
|
|
45
|
+
return !e.shiftKey && typeof e.key === 'string' && e.key.toLowerCase() === 'k';
|
|
46
|
+
}
|
|
47
|
+
// e.key is "/" whatever keys type it on the keyboard layout, so do not check e.shiftKey
|
|
48
|
+
const target = e.target;
|
|
49
|
+
const typing = target.isContentEditable || /^(input|textarea|select)$/i.test(target.tagName);
|
|
50
|
+
return e.key === '/' && !typing;
|
|
51
|
+
}
|
|
52
|
+
|
|
19
53
|
$(document)
|
|
20
|
-
.on('click', '.navbar-main .search',
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.on('
|
|
24
|
-
|
|
54
|
+
.on('click', '.navbar-main .search', open)
|
|
55
|
+
.on('click', '.searchbox .searchbox-mask', () => close())
|
|
56
|
+
.on('click', '.searchbox-close', () => close())
|
|
57
|
+
.on('focusin', (e) => {
|
|
58
|
+
// Close the search box when the focus moves to the rest of the page, e.g., by Tab
|
|
59
|
+
const main = $('.searchbox')[0];
|
|
60
|
+
if (main && $(main).hasClass('show') && !main.contains(e.target)) {
|
|
61
|
+
close(false);
|
|
62
|
+
}
|
|
25
63
|
})
|
|
26
|
-
.on('
|
|
27
|
-
|
|
64
|
+
.on('keydown', (e) => {
|
|
65
|
+
if (isSearchShortcut(e)) {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
open();
|
|
68
|
+
} else if (e.keyCode === 27 && $('.searchbox').hasClass('show')) {
|
|
69
|
+
close();
|
|
70
|
+
}
|
|
28
71
|
})
|
|
29
72
|
.on(
|
|
30
73
|
'keydown',
|
package/asset/js/insight.js
CHANGED
|
@@ -87,7 +87,7 @@ function loadInsight(config, translation) {
|
|
|
87
87
|
|
|
88
88
|
return `<a class="searchbox-result-item" href="${url}">
|
|
89
89
|
<span class="searchbox-result-icon">
|
|
90
|
-
<i class="fa fa-${icon}"
|
|
90
|
+
<i class="fa fa-${icon}"></i>
|
|
91
91
|
</span>
|
|
92
92
|
<span class="searchbox-result-content">
|
|
93
93
|
<span class="searchbox-result-title">
|
|
@@ -287,6 +287,39 @@ function loadInsight(config, translation) {
|
|
|
287
287
|
scrollTo($($items[nextPosition]));
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
+
let opener = null;
|
|
291
|
+
|
|
292
|
+
function open() {
|
|
293
|
+
if (!$main.hasClass('show')) {
|
|
294
|
+
opener = document.activeElement;
|
|
295
|
+
$main.addClass('show');
|
|
296
|
+
}
|
|
297
|
+
$input.focus();
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Return the focus to the element that opened the search box, unless it moved elsewhere
|
|
301
|
+
function close(restoreFocus = true) {
|
|
302
|
+
$main.removeClass('show');
|
|
303
|
+
if (restoreFocus && opener && document.contains(opener)) {
|
|
304
|
+
opener.focus();
|
|
305
|
+
}
|
|
306
|
+
opener = null;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// Open the search box with "/" (unless typing in a field) or Ctrl/Cmd+K
|
|
310
|
+
function isSearchShortcut(e) {
|
|
311
|
+
if (e.altKey) {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
if (e.ctrlKey || e.metaKey) {
|
|
315
|
+
return !e.shiftKey && typeof e.key === 'string' && e.key.toLowerCase() === 'k';
|
|
316
|
+
}
|
|
317
|
+
// e.key is "/" whatever keys type it on the keyboard layout, so do not check e.shiftKey
|
|
318
|
+
const target = e.target;
|
|
319
|
+
const typing = target.isContentEditable || /^(input|textarea|select)$/i.test(target.tagName);
|
|
320
|
+
return e.key === '/' && !typing;
|
|
321
|
+
}
|
|
322
|
+
|
|
290
323
|
function gotoLink($item) {
|
|
291
324
|
if ($item && $item.length) {
|
|
292
325
|
location.href = $item.attr('href');
|
|
@@ -306,10 +339,7 @@ function loadInsight(config, translation) {
|
|
|
306
339
|
|
|
307
340
|
let touch = false;
|
|
308
341
|
$(document)
|
|
309
|
-
.on('click
|
|
310
|
-
$main.addClass('show');
|
|
311
|
-
$main.find('.searchbox-input').focus();
|
|
312
|
-
})
|
|
342
|
+
.on('click', '.navbar-main .search', open)
|
|
313
343
|
.on('click touchend', '.searchbox-result-item', function (e) {
|
|
314
344
|
if (e.type !== 'click' && !touch) {
|
|
315
345
|
return;
|
|
@@ -325,14 +355,25 @@ function loadInsight(config, translation) {
|
|
|
325
355
|
setTimeout(() => {
|
|
326
356
|
$('.navbar-main').css('pointer-events', 'auto');
|
|
327
357
|
}, 400);
|
|
328
|
-
|
|
358
|
+
close();
|
|
329
359
|
touch = false;
|
|
330
360
|
})
|
|
361
|
+
.on('focusin', (e) => {
|
|
362
|
+
// Close the search box when the focus moves to the rest of the page, e.g., by Tab
|
|
363
|
+
if ($main.hasClass('show') && !$main[0].contains(e.target)) {
|
|
364
|
+
close(false);
|
|
365
|
+
}
|
|
366
|
+
})
|
|
331
367
|
.on('keydown', (e) => {
|
|
368
|
+
if (isSearchShortcut(e)) {
|
|
369
|
+
e.preventDefault();
|
|
370
|
+
open();
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
332
373
|
if (!$main.hasClass('show')) return;
|
|
333
374
|
switch (e.keyCode) {
|
|
334
375
|
case 27: // ESC
|
|
335
|
-
|
|
376
|
+
close();
|
|
336
377
|
break;
|
|
337
378
|
case 38: // UP
|
|
338
379
|
selectItemByDiff(-1);
|
|
@@ -36,8 +36,8 @@ const yaml = require('js-yaml');
|
|
|
36
36
|
*/
|
|
37
37
|
module.exports = hexo => {
|
|
38
38
|
const RESERVED_KEYS = {
|
|
39
|
-
post: Object.keys(
|
|
40
|
-
page: Object.keys(
|
|
39
|
+
post: Object.keys(hexo.model('Post').schema.paths),
|
|
40
|
+
page: Object.keys(hexo.model('Page').schema.paths)
|
|
41
41
|
};
|
|
42
42
|
function loadLayoutConfig(layout) {
|
|
43
43
|
let config = {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"$id": "/comment/valine.json",
|
|
4
|
-
"description": "Valine comment plugin configurations",
|
|
4
|
+
"description": "Valine comment plugin configurations\nWARNING: Valine saves comments, including the commenters' email addresses, in a LeanCloud class that anyone with your public app ID and key can read. Consider Waline or another comment system instead.",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
7
7
|
"type": {
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"record_ip": {
|
|
71
71
|
"type": "boolean",
|
|
72
|
-
"description": "Record reviewer IP address",
|
|
72
|
+
"description": "Record reviewer IP address. The IP addresses can be read by anyone, like the email addresses",
|
|
73
73
|
"default": false,
|
|
74
74
|
"nullable": true
|
|
75
75
|
},
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "/plugin/matomo.json",
|
|
4
|
+
"description": "Matomo analytics plugin settings\nhttps://matomo.org",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"url": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "URL of your Matomo server, e.g., https://matomo.example.com/ or https://example.matomo.cloud/",
|
|
10
|
+
"nullable": true
|
|
11
|
+
},
|
|
12
|
+
"site_id": {
|
|
13
|
+
"type": ["string", "number"],
|
|
14
|
+
"description": "Matomo site ID",
|
|
15
|
+
"nullable": true
|
|
16
|
+
},
|
|
17
|
+
"disable_cookies": {
|
|
18
|
+
"type": "boolean",
|
|
19
|
+
"description": "Track visitors without setting cookies",
|
|
20
|
+
"default": false,
|
|
21
|
+
"nullable": true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": ["url", "site_id"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "/plugin/umami.json",
|
|
4
|
+
"description": "Umami analytics plugin settings\nhttps://umami.is/docs/tracker-configuration",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"website_id": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Umami website ID",
|
|
10
|
+
"nullable": true
|
|
11
|
+
},
|
|
12
|
+
"script_url": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "URL of the Umami tracker script. Change it to the one on your server if you host Umami yourself",
|
|
15
|
+
"default": "https://cloud.umami.is/script.js",
|
|
16
|
+
"nullable": true
|
|
17
|
+
},
|
|
18
|
+
"domains": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Only track the visits on these comma-separated domains",
|
|
21
|
+
"nullable": true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": ["website_id"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A utility function for building inline scripts that load external scripts without blocking the page.
|
|
3
|
+
* @module util/script
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Build an inline script that loads external scripts asynchronously and in order, and then runs the
|
|
8
|
+
* given code.
|
|
9
|
+
* <p>
|
|
10
|
+
* A script that is already on the page is not added again. If it has finished loading, or it was not
|
|
11
|
+
* added by this function, the next one is loaded, or the code runs, right away. This lets the inline
|
|
12
|
+
* script be run again, for example by PJAX after switching pages, without loading the external scripts
|
|
13
|
+
* twice.
|
|
14
|
+
*
|
|
15
|
+
* @param {string|string[]} urls URL(s) of the external scripts to load, in order.
|
|
16
|
+
* @param {string} code JavaScript code to run after all external scripts are loaded.
|
|
17
|
+
* @param {Object} [attrs] Extra attributes to set on the external script elements.
|
|
18
|
+
* @returns {string} The inline JavaScript code.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <script dangerouslySetInnerHTML={{ __html: loadScripts('/path/to/lib.js', 'lib.init();') }} />
|
|
22
|
+
*/
|
|
23
|
+
module.exports = function (urls, code, attrs = {}) {
|
|
24
|
+
return `(function () {
|
|
25
|
+
var urls = ${JSON.stringify([].concat(urls))};
|
|
26
|
+
var attrs = ${JSON.stringify(attrs)};
|
|
27
|
+
function run() {
|
|
28
|
+
${code}
|
|
29
|
+
}
|
|
30
|
+
function load(i) {
|
|
31
|
+
if (i >= urls.length) {
|
|
32
|
+
run();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
var script = null;
|
|
36
|
+
for (var j = 0; j < document.scripts.length; j++) {
|
|
37
|
+
if (document.scripts[j].getAttribute('src') === urls[i]) {
|
|
38
|
+
script = document.scripts[j];
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (script && script.getAttribute('data-loaded') !== 'false') {
|
|
43
|
+
load(i + 1);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (!script) {
|
|
47
|
+
script = document.createElement('script');
|
|
48
|
+
script.src = urls[i];
|
|
49
|
+
script.async = true;
|
|
50
|
+
script.setAttribute('data-loaded', 'false');
|
|
51
|
+
for (var name in attrs) {
|
|
52
|
+
script.setAttribute(name, attrs[name]);
|
|
53
|
+
}
|
|
54
|
+
script.addEventListener('load', function () {
|
|
55
|
+
this.setAttribute('data-loaded', 'true');
|
|
56
|
+
});
|
|
57
|
+
document.head.appendChild(script);
|
|
58
|
+
}
|
|
59
|
+
script.addEventListener('load', function () {
|
|
60
|
+
load(i + 1);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
load(0);
|
|
64
|
+
})();`;
|
|
65
|
+
};
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -22,6 +22,7 @@ var _require = require('inferno'),
|
|
|
22
22
|
Component = _require.Component;
|
|
23
23
|
var _require2 = require('../../util/cache'),
|
|
24
24
|
cacheComponent = _require2.cacheComponent;
|
|
25
|
+
var loadScripts = require('../../util/script');
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* ChangYan comment JSX component.
|
|
@@ -54,12 +55,11 @@ var ChangYan = /*#__PURE__*/function (_Component) {
|
|
|
54
55
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", null, null, 1, {
|
|
55
56
|
"id": "SOHUCS",
|
|
56
57
|
"sid": path
|
|
57
|
-
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
58
|
-
"charset": "utf-8",
|
|
59
|
-
"src": "https://changyan.sohu.com/upload/changyan.js"
|
|
60
58
|
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
61
59
|
"dangerouslySetInnerHTML": {
|
|
62
|
-
__html: js
|
|
60
|
+
__html: loadScripts('https://changyan.sohu.com/upload/changyan.js', js, {
|
|
61
|
+
charset: 'utf-8'
|
|
62
|
+
})
|
|
63
63
|
}
|
|
64
64
|
})], 4);
|
|
65
65
|
/* eslint-enable react/no-unknown-property */
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -22,6 +22,7 @@ var _require = require('inferno'),
|
|
|
22
22
|
Component = _require.Component;
|
|
23
23
|
var _require2 = require('../../util/cache'),
|
|
24
24
|
cacheComponent = _require2.cacheComponent;
|
|
25
|
+
var loadScripts = require('../../util/script');
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* DisqusJS comment JSX component.
|
|
@@ -74,16 +75,16 @@ var DisqusJs = /*#__PURE__*/function (_Component) {
|
|
|
74
75
|
var js = "new DisqusJS({\n shortname: '".concat(shortname, "',\n apikey: ").concat(JSON.stringify(apiKey), ",\n ").concat(siteTitle ? "siteName: ".concat(JSON.stringify(siteTitle), ",") : '', "\n ").concat(identifier ? "identifier: ".concat(JSON.stringify(identifier), ",") : '', "\n ").concat(url ? "url: ".concat(JSON.stringify(url), ",") : '', "\n ").concat(pageTitle ? "title: ".concat(JSON.stringify(pageTitle), ",") : '', "\n ").concat(api ? "api: ".concat(JSON.stringify(api), ",") : '', "\n ").concat(admin ? "admin: ".concat(JSON.stringify(admin), ",") : '', "\n ").concat(adminLabel ? "adminLabel: ".concat(JSON.stringify(adminLabel), ",") : '', "\n ").concat(nesting ? "nesting: ".concat(JSON.stringify(nesting), ",") : '', "\n });");
|
|
75
76
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "link", null, null, 1, {
|
|
76
77
|
"rel": "stylesheet",
|
|
77
|
-
"href": cssUrl
|
|
78
|
+
"href": cssUrl,
|
|
79
|
+
"media": "print",
|
|
80
|
+
"onload": "this.media='all'"
|
|
78
81
|
}), (0, _inferno.createVNode)(1, "div", null, (0, _inferno.createVNode)(1, "noscript", null, [(0, _inferno.createTextVNode)("Please enable JavaScript to view the"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "a", null, "comments powered by Disqus.", 16, {
|
|
79
82
|
"href": "//disqus.com/?ref_noscript"
|
|
80
83
|
})], 0), 2, {
|
|
81
84
|
"id": "disqus_thread"
|
|
82
|
-
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
83
|
-
"src": jsUrl
|
|
84
85
|
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
85
86
|
"dangerouslySetInnerHTML": {
|
|
86
|
-
__html: js
|
|
87
|
+
__html: loadScripts(jsUrl, js)
|
|
87
88
|
}
|
|
88
89
|
})], 4);
|
|
89
90
|
}
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -9,7 +9,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
9
9
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
10
10
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
11
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
|
-
function _toPrimitive(t,
|
|
12
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
13
13
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
14
14
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
15
15
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -23,6 +23,7 @@ var _require = require('inferno'),
|
|
|
23
23
|
Component = _require.Component;
|
|
24
24
|
var _require2 = require('../../util/cache'),
|
|
25
25
|
cacheComponent = _require2.cacheComponent;
|
|
26
|
+
var loadScripts = require('../../util/script');
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* Gitalk comment JSX component.
|
|
@@ -85,12 +86,12 @@ var Gitalk = /*#__PURE__*/function (_Component) {
|
|
|
85
86
|
"id": "comment-container"
|
|
86
87
|
}), (0, _inferno.createVNode)(1, "link", null, null, 1, {
|
|
87
88
|
"rel": "stylesheet",
|
|
88
|
-
"href": cssUrl
|
|
89
|
-
|
|
90
|
-
"
|
|
89
|
+
"href": cssUrl,
|
|
90
|
+
"media": "print",
|
|
91
|
+
"onload": "this.media='all'"
|
|
91
92
|
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
92
93
|
"dangerouslySetInnerHTML": {
|
|
93
|
-
__html: js
|
|
94
|
+
__html: loadScripts(jsUrl, js)
|
|
94
95
|
}
|
|
95
96
|
})], 4);
|
|
96
97
|
}
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -24,6 +24,7 @@ var _require = require('inferno'),
|
|
|
24
24
|
Component = _require.Component;
|
|
25
25
|
var _require2 = require('../../util/cache'),
|
|
26
26
|
cacheComponent = _require2.cacheComponent;
|
|
27
|
+
var loadScripts = require('../../util/script');
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Gitment comment JSX component.
|
|
@@ -67,12 +68,12 @@ var Gitment = /*#__PURE__*/function (_Component) {
|
|
|
67
68
|
"id": "comment-container"
|
|
68
69
|
}), (0, _inferno.createVNode)(1, "link", null, null, 1, {
|
|
69
70
|
"rel": "stylesheet",
|
|
70
|
-
"href": "https://imsun.github.io/gitment/style/default.css"
|
|
71
|
-
|
|
72
|
-
"
|
|
71
|
+
"href": "https://imsun.github.io/gitment/style/default.css",
|
|
72
|
+
"media": "print",
|
|
73
|
+
"onload": "this.media='all'"
|
|
73
74
|
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
74
75
|
"dangerouslySetInnerHTML": {
|
|
75
|
-
__html: js
|
|
76
|
+
__html: loadScripts('https://imsun.github.io/gitment/dist/gitment.browser.js', js)
|
|
76
77
|
}
|
|
77
78
|
})], 4);
|
|
78
79
|
}
|
package/lib/view/comment/isso.js
CHANGED
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -43,11 +43,15 @@ var Isso = /*#__PURE__*/function (_Component) {
|
|
|
43
43
|
if (!url) {
|
|
44
44
|
return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You forgot to set the "), (0, _inferno.createVNode)(1, "code", null, "url", 16), (0, _inferno.createTextVNode)(" for Isso. Please set it in "), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 4);
|
|
45
45
|
}
|
|
46
|
+
// Isso renders the thread as soon as its script runs, so add a new script every time this code
|
|
47
|
+
// runs (e.g., again by PJAX after switching pages) instead of loading it only once.
|
|
48
|
+
var js = "(function () {\n var script = document.createElement('script');\n script.src = ".concat(JSON.stringify("//".concat(url, "/js/embed.min.js")), ";\n script.async = true;\n script.setAttribute('data-isso', ").concat(JSON.stringify('//' + url), ");\n document.head.appendChild(script);\n })();");
|
|
46
49
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", null, null, 1, {
|
|
47
50
|
"id": "isso-thread"
|
|
48
51
|
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
49
|
-
"
|
|
50
|
-
|
|
52
|
+
"dangerouslySetInnerHTML": {
|
|
53
|
+
__html: js
|
|
54
|
+
}
|
|
51
55
|
})], 4);
|
|
52
56
|
}
|
|
53
57
|
}]);
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|