hexo-component-inferno 4.2.2 → 5.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/README.md +5 -18
- package/asset/css/github-calendar.css +41 -0
- package/asset/js/algolia.js +18 -69
- package/asset/js/github-calendar.js +185 -0
- package/asset/js/google_cse.js +19 -68
- package/asset/js/insight.js +45 -208
- package/lib/core/commented_yaml.js +35 -0
- package/lib/core/default_value.js +150 -0
- package/lib/core/schema.js +8 -196
- package/lib/core/schema_util.js +14 -0
- package/lib/hexo/helper/cdn.js +10 -97
- package/lib/hexo/tag/tabs.js +4 -84
- package/lib/schema/comment/artalk.json +7 -1
- package/lib/schema/comment/facebook.json +1 -1
- package/lib/schema/comment/gitalk.json +23 -6
- package/lib/schema/comment/gitment.json +1 -1
- package/lib/schema/comment/twikoo.json +3 -3
- package/lib/schema/comment/waline.json +28 -3
- package/lib/schema/misc/open_graph.json +2 -1
- package/lib/schema/plugin/cookie_consent.json +2 -2
- package/lib/schema/plugin/mathjax.json +1 -1
- package/lib/schema/plugin/outdated_browser.json +1 -1
- package/lib/schema/share/bdshare.json +1 -1
- package/lib/schema/share/sharejs.json +1 -1
- package/lib/schema/share/web_share.json +13 -0
- package/lib/schema/widget/github_calendar.json +30 -0
- package/lib/schema/widget/profile.json +67 -0
- package/lib/util/archives.js +86 -0
- package/lib/util/categories.js +102 -0
- package/lib/util/cdn-rules.js +109 -0
- package/lib/util/cdn.js +116 -0
- package/lib/util/consent.js +122 -0
- package/lib/util/deprecate.js +1 -1
- package/lib/util/gallery.js +227 -0
- package/lib/util/insight-search.js +98 -0
- package/lib/util/searchbox.js +88 -0
- package/lib/util/tab-options.js +109 -0
- package/lib/view/comment/artalk.js +24 -6
- package/lib/view/comment/disqus.js +1 -1
- package/lib/view/comment/disqusjs.js +7 -6
- package/lib/view/comment/facebook.js +3 -16
- package/lib/view/comment/gitalk.js +18 -15
- package/lib/view/comment/gitment.js +2 -2
- package/lib/view/comment/twikoo.js +5 -3
- package/lib/view/comment/valine.js +4 -3
- package/lib/view/comment/waline.js +8 -6
- package/lib/view/misc/open_graph.js +3 -5
- package/lib/view/plugin/cookie_consent.js +8 -7
- package/lib/view/plugin/gallery.js +42 -19
- package/lib/view/plugin/katex.js +4 -4
- package/lib/view/plugin/mathjax.js +10 -7
- package/lib/view/plugin/outdated_browser.js +59 -45
- package/lib/view/plugin/progressbar.js +6 -1
- package/lib/view/plugin/waline_pageview.js +2 -2
- package/lib/view/search/algolia.js +8 -3
- package/lib/view/search/google_cse.js +13 -10
- package/lib/view/search/insight.js +9 -2
- package/lib/view/share/addthis.js +4 -9
- package/lib/view/share/addtoany.js +23 -5
- package/lib/view/share/bdshare.js +9 -30
- package/lib/view/share/sharejs.js +7 -34
- package/lib/view/share/sharethis.js +21 -6
- package/lib/view/share/web_share.js +153 -0
- package/lib/view/widget/archives.js +19 -71
- package/lib/view/widget/categories.js +20 -67
- package/lib/view/widget/github_calendar.js +94 -0
- package/lib/view/widget/profile.js +194 -0
- package/lib/view/widget/subscribe_email.js +4 -26
- package/package.json +6 -4
|
@@ -22,8 +22,6 @@ var _require = require('inferno'),
|
|
|
22
22
|
Component = _require.Component;
|
|
23
23
|
var _require2 = require('../../util/cache'),
|
|
24
24
|
cacheComponent = _require2.cacheComponent;
|
|
25
|
-
var _require3 = require('../../util/script'),
|
|
26
|
-
toJs = _require3.toJs;
|
|
27
25
|
|
|
28
26
|
/**
|
|
29
27
|
* Facebook comment JSX component.
|
|
@@ -43,20 +41,9 @@ var Facebook = /*#__PURE__*/function (_Component) {
|
|
|
43
41
|
return _createClass(Facebook, [{
|
|
44
42
|
key: "render",
|
|
45
43
|
value: function render() {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var fbLanguage = language.split('-').join('_');
|
|
50
|
-
var js = "(function(d, s, id) {\n var js, fjs = d.getElementsByTagName(s)[0];\n // After a PJAX page switch, the SDK is loaded, so render the new comments box with it\n if (d.getElementById(id)) {\n if (window.FB) FB.XFBML.parse();\n return;\n }\n js = d.createElement(s); js.id = id;\n js.src = ".concat(toJs("//connect.facebook.net/".concat(fbLanguage, "/sdk.js#xfbml=1&version=v12.0")), ";\n fjs.parentNode.insertBefore(js, fjs);\n }(document, 'script', 'facebook-jssdk'));");
|
|
51
|
-
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "fb-comments", null, 1, {
|
|
52
|
-
"data-width": "100%",
|
|
53
|
-
"data-href": permalink,
|
|
54
|
-
"data-num-posts": "5"
|
|
55
|
-
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
56
|
-
"dangerouslySetInnerHTML": {
|
|
57
|
-
__html: js
|
|
58
|
-
}
|
|
59
|
-
})], 4);
|
|
44
|
+
return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("Facebook discontinued its Comments plugin on February 10, 2026. Please configure another comment provider in "), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 4, {
|
|
45
|
+
"role": "status"
|
|
46
|
+
});
|
|
60
47
|
}
|
|
61
48
|
}]);
|
|
62
49
|
}(Component);
|
|
@@ -25,6 +25,8 @@ var _require2 = require('../../util/cache'),
|
|
|
25
25
|
cacheComponent = _require2.cacheComponent;
|
|
26
26
|
var loadScripts = require('../../util/script');
|
|
27
27
|
var toJs = loadScripts.toJs;
|
|
28
|
+
var _require3 = require('../../util/appearance'),
|
|
29
|
+
isDark = _require3.isDark;
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
32
|
* Gitalk comment JSX component.
|
|
@@ -37,13 +39,12 @@ var toJs = loadScripts.toJs;
|
|
|
37
39
|
* owner="******",
|
|
38
40
|
* admin={["******"]},
|
|
39
41
|
* clientId="******",
|
|
40
|
-
*
|
|
42
|
+
* backend="issues",
|
|
41
43
|
* createIssueManually={false},
|
|
42
44
|
* distractionFreeMode={false},
|
|
43
45
|
* pagerDirection="last",
|
|
44
46
|
* perPage={10},
|
|
45
47
|
* proxy="******",
|
|
46
|
-
* flipMoveOptions={...},
|
|
47
48
|
* enableHotKey={true},
|
|
48
49
|
* language="zh-CN",
|
|
49
50
|
* jsUrl="/path/to/gitalk.js",
|
|
@@ -64,9 +65,12 @@ var Gitalk = /*#__PURE__*/function (_Component) {
|
|
|
64
65
|
owner = _this$props.owner,
|
|
65
66
|
admin = _this$props.admin,
|
|
66
67
|
clientId = _this$props.clientId,
|
|
67
|
-
|
|
68
|
+
_this$props$backend = _this$props.backend,
|
|
69
|
+
backend = _this$props$backend === void 0 ? 'issues' : _this$props$backend,
|
|
70
|
+
number = _this$props.number,
|
|
71
|
+
category = _this$props.category,
|
|
68
72
|
_this$props$createIss = _this$props.createIssueManually,
|
|
69
|
-
createIssueManually = _this$props$createIss === void 0 ?
|
|
73
|
+
createIssueManually = _this$props$createIss === void 0 ? true : _this$props$createIss,
|
|
70
74
|
_this$props$distracti = _this$props.distractionFreeMode,
|
|
71
75
|
distractionFreeMode = _this$props$distracti === void 0 ? false : _this$props$distracti,
|
|
72
76
|
_this$props$pagerDire = _this$props.pagerDirection,
|
|
@@ -74,16 +78,15 @@ var Gitalk = /*#__PURE__*/function (_Component) {
|
|
|
74
78
|
_this$props$perPage = _this$props.perPage,
|
|
75
79
|
perPage = _this$props$perPage === void 0 ? 10 : _this$props$perPage,
|
|
76
80
|
proxy = _this$props.proxy,
|
|
77
|
-
flipMoveOptions = _this$props.flipMoveOptions,
|
|
78
81
|
_this$props$enableHot = _this$props.enableHotKey,
|
|
79
82
|
enableHotKey = _this$props$enableHot === void 0 ? true : _this$props$enableHot,
|
|
80
83
|
language = _this$props.language,
|
|
81
84
|
jsUrl = _this$props.jsUrl,
|
|
82
85
|
cssUrl = _this$props.cssUrl;
|
|
83
|
-
if (!id || !repo || !owner || !admin || !clientId || !
|
|
84
|
-
return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You forgot to set the "), (0, _inferno.createVNode)(1, "code", null, "owner", 16), (0, _inferno.createTextVNode)(", "), (0, _inferno.createVNode)(1, "code", null, "admin", 16), (0, _inferno.createTextVNode)(", "), (0, _inferno.createVNode)(1, "code", null, "repo", 16), (0, _inferno.createTextVNode)(","), (0, _inferno.createVNode)(1, "code", null, "client_id", 16), (0, _inferno.createTextVNode)(", or "), (0, _inferno.createVNode)(1, "code", null, "
|
|
86
|
+
if (!id || !repo || !owner || !admin || !clientId || !proxy) {
|
|
87
|
+
return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You forgot to set the "), (0, _inferno.createVNode)(1, "code", null, "owner", 16), (0, _inferno.createTextVNode)(", "), (0, _inferno.createVNode)(1, "code", null, "admin", 16), (0, _inferno.createTextVNode)(", "), (0, _inferno.createVNode)(1, "code", null, "repo", 16), (0, _inferno.createTextVNode)(","), (0, _inferno.createVNode)(1, "code", null, "client_id", 16), (0, _inferno.createTextVNode)(", or "), (0, _inferno.createVNode)(1, "code", null, "proxy", 16), (0, _inferno.createTextVNode)(" for Gitalk. Please set it in"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 0);
|
|
85
88
|
}
|
|
86
|
-
var js = "var gitalk = new Gitalk({\n id: ".concat(toJs(id), ",\n repo: ").concat(toJs(repo), ",\n owner: ").concat(toJs(owner), ",\n clientID: ").concat(toJs(clientId), ",\n
|
|
89
|
+
var js = "if (!container || !container.isConnected || document.getElementById('comment-container') !== container) return;\n if (window.__gitalkInstance) window.__gitalkInstance.destroy();\n var gitalk = new Gitalk({\n id: ".concat(toJs(id), ",\n repo: ").concat(toJs(repo), ",\n owner: ").concat(toJs(owner), ",\n clientID: ").concat(toJs(clientId), ",\n backend: ").concat(toJs(backend), ",\n ").concat(number ? "number: ".concat(toJs(number), ",") : '', "\n ").concat(category ? "category: ".concat(toJs(category), ",") : '', "\n admin: ").concat(toJs(admin), ",\n createIssueManually: ").concat(!!createIssueManually, ",\n distractionFreeMode: ").concat(!!distractionFreeMode, ",\n perPage: ").concat(toJs(perPage), ",\n sortDirection: ").concat(toJs(pagerDirection), ",\n ").concat(proxy ? "proxy: ".concat(toJs(proxy), ",") : '', "\n mode: 'inline',\n maxHeight: null,\n stickyComposer: false,\n enableHotKey: ").concat(!!enableHotKey, ",\n ").concat(language ? "language: ".concat(toJs(language), ",") : '', "\n })\n gitalk.render('comment-container');\n window.__gitalkInstance = gitalk;\n var media = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)');\n function appearance() { container.setAttribute('data-theme', ").concat(isDark(), " ? 'dark' : 'light'); }\n appearance();\n var observer = new MutationObserver(appearance);\n observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-appearance'] });\n if (media && media.addEventListener) media.addEventListener('change', appearance);\n var destroy = gitalk.destroy;\n gitalk.destroy = function () {\n document.removeEventListener('hexo:page:before-replace', gitalk.destroy);\n observer.disconnect();\n if (media && media.removeEventListener) media.removeEventListener('change', appearance);\n destroy.call(gitalk);\n if (window.__gitalkInstance === gitalk) window.__gitalkInstance = null;\n };\n document.addEventListener('hexo:page:before-replace', gitalk.destroy);");
|
|
87
90
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", null, null, 1, {
|
|
88
91
|
"id": "comment-container"
|
|
89
92
|
}), (0, _inferno.createVNode)(1, "link", null, null, 1, {
|
|
@@ -93,7 +96,7 @@ var Gitalk = /*#__PURE__*/function (_Component) {
|
|
|
93
96
|
"onload": "this.media='all'"
|
|
94
97
|
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
95
98
|
"dangerouslySetInnerHTML": {
|
|
96
|
-
__html: loadScripts(jsUrl, js)
|
|
99
|
+
__html: "(function () {\n var container = document.getElementById('comment-container');\n ".concat(loadScripts(jsUrl, js), "\n })();")
|
|
97
100
|
}
|
|
98
101
|
})], 4);
|
|
99
102
|
}
|
|
@@ -113,13 +116,12 @@ var Gitalk = /*#__PURE__*/function (_Component) {
|
|
|
113
116
|
* owner: '******',
|
|
114
117
|
* admin: ['******'],
|
|
115
118
|
* client_id: '******',
|
|
116
|
-
*
|
|
119
|
+
* backend: 'issues',
|
|
117
120
|
* create_issue_manually: false,
|
|
118
121
|
* distraction_free_mode: false,
|
|
119
122
|
* pager_direction: 'last',
|
|
120
123
|
* per_page: 10,
|
|
121
124
|
* proxy: '******',
|
|
122
|
-
* flip_move_options: {...},
|
|
123
125
|
* enable_hotkey: true,
|
|
124
126
|
* language: 'zh-CN'
|
|
125
127
|
* }}
|
|
@@ -138,17 +140,18 @@ Gitalk.Cacheable = cacheComponent(Gitalk, 'comment.gitalk', function (props) {
|
|
|
138
140
|
owner: comment.owner,
|
|
139
141
|
admin: comment.admin,
|
|
140
142
|
clientId: comment.client_id,
|
|
141
|
-
|
|
143
|
+
backend: comment.backend || 'issues',
|
|
144
|
+
number: comment.number,
|
|
145
|
+
category: comment.category,
|
|
142
146
|
createIssueManually: comment.create_issue_manually,
|
|
143
147
|
distractionFreeMode: comment.distraction_free_mode,
|
|
144
148
|
pagerDirection: comment.pager_direction,
|
|
145
149
|
perPage: comment.per_page,
|
|
146
150
|
proxy: comment.proxy,
|
|
147
|
-
flipMoveOptions: comment.flip_move_options,
|
|
148
151
|
enableHotKey: comment.enable_hotkey,
|
|
149
152
|
language: comment.language,
|
|
150
|
-
cssUrl: helper.cdn('gitalk', '
|
|
151
|
-
jsUrl: helper.cdn('gitalk', '
|
|
153
|
+
cssUrl: helper.cdn('@aifire/gitalk', '2.0.0-beta.2', 'dist/gitalk.css'),
|
|
154
|
+
jsUrl: helper.cdn('@aifire/gitalk', '2.0.0-beta.2', 'dist/gitalk.js')
|
|
152
155
|
};
|
|
153
156
|
});
|
|
154
157
|
module.exports = Gitalk;
|
|
@@ -33,7 +33,7 @@ var _require3 = require('../../util/deprecate'),
|
|
|
33
33
|
* Gitment comment JSX component.
|
|
34
34
|
*
|
|
35
35
|
* @deprecated Gitment is no longer maintained, and the GitHub sign-in proxy it uses no longer works. Use
|
|
36
|
-
* Giscus
|
|
36
|
+
* Giscus or Utterances instead.
|
|
37
37
|
* @see https://github.com/imsun/gitment
|
|
38
38
|
* @example
|
|
39
39
|
* <Gitment
|
|
@@ -54,7 +54,7 @@ var Gitment = /*#__PURE__*/function (_Component) {
|
|
|
54
54
|
return _createClass(Gitment, [{
|
|
55
55
|
key: "render",
|
|
56
56
|
value: function render() {
|
|
57
|
-
deprecate('comment.gitment', '
|
|
57
|
+
deprecate('comment.gitment', 'Sign-in no longer works. Use Giscus or Utterances.');
|
|
58
58
|
var _this$props = this.props,
|
|
59
59
|
id = _this$props.id,
|
|
60
60
|
repo = _this$props.repo,
|
|
@@ -54,12 +54,14 @@ var Twikoo = /*#__PURE__*/function (_Component) {
|
|
|
54
54
|
if (!envId) {
|
|
55
55
|
return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You forgot to set the "), (0, _inferno.createVNode)(1, "code", null, "env_id", 16), (0, _inferno.createTextVNode)(" for Twikoo. Please set it in"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 0);
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
// init() unmounts the previous widget. Bind it to this page's element, not a selector that
|
|
58
|
+
// could resolve to a different page after an asynchronous SDK or locale load.
|
|
59
|
+
var js = "if (!container.isConnected) return;\n twikoo.init({\n el: container,\n envId: ".concat(toJs(envId), ",\n ").concat(region ? "region: ".concat(toJs(region), ",") : '', "\n ").concat(lang ? "lang: ".concat(toJs(lang), ",") : '', "\n });");
|
|
58
60
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "content twikoo", null, 1, {
|
|
59
61
|
"id": "twikoo"
|
|
60
62
|
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
61
63
|
"dangerouslySetInnerHTML": {
|
|
62
|
-
__html: loadScripts(jsUrl, js)
|
|
64
|
+
__html: "(function () {\n var container = document.getElementById('twikoo');\n ".concat(loadScripts(jsUrl, js), "\n })();")
|
|
63
65
|
}
|
|
64
66
|
})], 4);
|
|
65
67
|
}
|
|
@@ -89,7 +91,7 @@ Twikoo.Cacheable = cacheComponent(Twikoo, 'comment.twikoo', function (props) {
|
|
|
89
91
|
envId: comment.env_id,
|
|
90
92
|
region: comment.region,
|
|
91
93
|
lang: comment.lang || page.lang || page.language || config.language || 'zh-CN',
|
|
92
|
-
jsUrl: helper.cdn('twikoo', '
|
|
94
|
+
jsUrl: helper.cdn('twikoo', '2.0.17', 'dist/twikoo.all.min.js')
|
|
93
95
|
};
|
|
94
96
|
});
|
|
95
97
|
module.exports = Twikoo;
|
|
@@ -62,7 +62,7 @@ var Valine = /*#__PURE__*/function (_Component) {
|
|
|
62
62
|
return _createClass(Valine, [{
|
|
63
63
|
key: "render",
|
|
64
64
|
value: function render() {
|
|
65
|
-
deprecate('comment.valine', 'LeanCloud
|
|
65
|
+
deprecate('comment.valine', 'LeanCloud closes on 2027-01-12. Use Waline or Twikoo.');
|
|
66
66
|
var _this$props = this.props,
|
|
67
67
|
appId = _this$props.appId,
|
|
68
68
|
appKey = _this$props.appKey,
|
|
@@ -142,6 +142,7 @@ Valine.Cacheable = cacheComponent(Valine, 'comment.valine', function (props) {
|
|
|
142
142
|
helper = props.helper,
|
|
143
143
|
page = props.page,
|
|
144
144
|
config = props.config;
|
|
145
|
+
var language = comment.lang || page.lang || page.language || config.language;
|
|
145
146
|
return {
|
|
146
147
|
appId: comment.app_id,
|
|
147
148
|
appKey: comment.app_key,
|
|
@@ -150,7 +151,7 @@ Valine.Cacheable = cacheComponent(Valine, 'comment.valine', function (props) {
|
|
|
150
151
|
avatarForce: comment.avatar_force,
|
|
151
152
|
meta: comment.meta,
|
|
152
153
|
pageSize: comment.page_size,
|
|
153
|
-
lang:
|
|
154
|
+
lang: (Array.isArray(language) ? language[0] : language) || 'zh-CN',
|
|
154
155
|
visitor: comment.visitor,
|
|
155
156
|
highlight: comment.highlight,
|
|
156
157
|
recordIP: comment.record_ip,
|
|
@@ -159,7 +160,7 @@ Valine.Cacheable = cacheComponent(Valine, 'comment.valine', function (props) {
|
|
|
159
160
|
emojiMaps: comment.emoji_maps,
|
|
160
161
|
enableQQ: comment.enable_qq,
|
|
161
162
|
requiredFields: comment.required_fields,
|
|
162
|
-
jsUrl: helper.cdn('valine', '1.
|
|
163
|
+
jsUrl: helper.cdn('valine', '1.5.3', 'dist/Valine.min.js')
|
|
163
164
|
};
|
|
164
165
|
});
|
|
165
166
|
module.exports = Valine;
|
|
@@ -48,7 +48,6 @@ var _require4 = require('../../util/appearance'),
|
|
|
48
48
|
* highlighter={true}
|
|
49
49
|
* texRenderer={false}
|
|
50
50
|
* search={true}
|
|
51
|
-
* visitor={false}
|
|
52
51
|
* pageview={false}
|
|
53
52
|
* comment={false}
|
|
54
53
|
* copyright={true}
|
|
@@ -99,7 +98,8 @@ var Waline = /*#__PURE__*/function (_Component) {
|
|
|
99
98
|
}
|
|
100
99
|
// Without the dark option, follow the appearance of the page: the system color scheme for the auto
|
|
101
100
|
// appearance, or the data-appearance="dark" attribute of <html> otherwise
|
|
102
|
-
var
|
|
101
|
+
var followAppearance = dark === null || typeof dark === 'undefined' || dark === '';
|
|
102
|
+
var darkOption = followAppearance ? "".concat(getAppearance(), " === 'auto' ? 'auto' : 'html[data-appearance=\"dark\"]'") : toJs(dark);
|
|
103
103
|
// A path, such as /posts/hello/, or a JavaScript expression, such as window.location.pathname
|
|
104
104
|
var pathCode = path || 'window.location.pathname';
|
|
105
105
|
if (pathCode.startsWith('/')) {
|
|
@@ -108,7 +108,8 @@ var Waline = /*#__PURE__*/function (_Component) {
|
|
|
108
108
|
// Use a classic script with a dynamic import instead of a module script, so that PJAX, which only
|
|
109
109
|
// runs classic scripts, initializes Waline again after switching pages. The previous instance,
|
|
110
110
|
// whose element PJAX has replaced, is destroyed first.
|
|
111
|
-
var
|
|
111
|
+
var appearanceObserver = followAppearance ? "var instance = window.__walineInstance;\n if (instance) {\n var observer = new MutationObserver(function () {\n instance.update({ dark: ".concat(darkOption, ", path: path });\n });\n observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-appearance'] });\n var destroy = instance.destroy;\n instance.destroy = function () {\n observer.disconnect();\n destroy.call(instance);\n };\n }") : '';
|
|
112
|
+
var js = "(function () {\n var container = document.getElementById('waline-thread');\n var path = ".concat(pathCode, ";\n return import(").concat(toJs(jsUrl), ").then(function (Waline) {\n if (!container || !container.isConnected || document.getElementById('waline-thread') !== container) return;\n if (window.__walineInstance) {\n window.__walineInstance.destroy();\n }\n window.__walineInstance = Waline.init({\n el: '#waline-thread',\n serverURL: ").concat(toJs(serverURL), ",\n path: path,\n ").concat(lang ? "lang: ".concat(toJs(lang), ",") : '', "\n ").concat(locale ? "locale: ".concat(toJs(locale), ",") : '', "\n ").concat(emoji !== null && typeof emoji !== 'undefined' ? "emoji: ".concat(toJs(emoji), ",") : '', "\n dark: ").concat(darkOption, ",\n ").concat(meta ? "meta: ".concat(toJs(meta), ",") : '', "\n ").concat(Array.isArray(requiredMeta) ? "requiredMeta: ".concat(toJs(requiredMeta), ",") : '', "\n ").concat(login ? "login: ".concat(toJs(login), ",") : '', "\n ").concat(wordLimit ? "wordLimit: ".concat(toJs(wordLimit), ",") : '', "\n ").concat(pageSize ? "pageSize: ".concat(toJs(pageSize), ",") : '', "\n ").concat(imageUploader === false ? "imageUploader: false," : '', "\n ").concat(highlighter === false ? "highlighter: false," : '', "\n ").concat(texRenderer === false ? "texRenderer: false," : '', "\n ").concat(search === false ? "search: false," : '', "\n ").concat(typeof pageview !== 'undefined' ? "pageview: ".concat(toJs(pageview), ",") : '', "\n ").concat(typeof comment !== 'undefined' ? "comment: ".concat(toJs(comment), ",") : '', "\n noCopyright: ").concat(toJs(copyright === false), ",\n });\n ").concat(appearanceObserver, "\n });\n })();");
|
|
112
113
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "content", null, 1, {
|
|
113
114
|
"id": "waline-thread"
|
|
114
115
|
}), (0, _inferno.createVNode)(1, "link", null, null, 1, {
|
|
@@ -160,10 +161,11 @@ Waline.Cacheable = cacheComponent(Waline, 'comment.waline', function (props) {
|
|
|
160
161
|
helper = props.helper,
|
|
161
162
|
page = props.page,
|
|
162
163
|
config = props.config;
|
|
164
|
+
var language = comment.lang || page.lang || page.language || config.language;
|
|
163
165
|
return {
|
|
164
166
|
serverURL: comment.server_url,
|
|
165
167
|
path: comment.path,
|
|
166
|
-
lang:
|
|
168
|
+
lang: (Array.isArray(language) ? language[0] : language) || 'zh-CN',
|
|
167
169
|
locale: comment.locale,
|
|
168
170
|
emoji: comment.emoji,
|
|
169
171
|
dark: comment.dark,
|
|
@@ -181,8 +183,8 @@ Waline.Cacheable = cacheComponent(Waline, 'comment.waline', function (props) {
|
|
|
181
183
|
pageview: comment.pageview,
|
|
182
184
|
comment: comment.comment,
|
|
183
185
|
copyright: comment.copyright,
|
|
184
|
-
jsUrl: helper.cdn('@waline/client', '3.
|
|
185
|
-
cssUrl: helper.cdn('@waline/client', '3.
|
|
186
|
+
jsUrl: helper.cdn('@waline/client', '3.16.1', 'dist/waline.js'),
|
|
187
|
+
cssUrl: helper.cdn('@waline/client', '3.16.1', 'dist/waline.css')
|
|
186
188
|
};
|
|
187
189
|
});
|
|
188
190
|
module.exports = Waline;
|
|
@@ -29,6 +29,8 @@ var _require2 = require('hexo-util'),
|
|
|
29
29
|
encodeURL = _require2.encodeURL;
|
|
30
30
|
var _require3 = require('../../util/html'),
|
|
31
31
|
toPlainText = _require3.toPlainText;
|
|
32
|
+
var _require4 = require('../../util/deprecate'),
|
|
33
|
+
deprecate = _require4.deprecate;
|
|
32
34
|
var localeMap = {
|
|
33
35
|
en: 'en_US',
|
|
34
36
|
de: 'de_DE',
|
|
@@ -68,7 +70,6 @@ var localeMap = {
|
|
|
68
70
|
* twitterId="Twitter ID"
|
|
69
71
|
* twitterCard="summary"
|
|
70
72
|
* twitterSite="Twitter Site"
|
|
71
|
-
* googlePlus="/path/to/google/plus"
|
|
72
73
|
* facebookAdmins="Facebook admin ID"
|
|
73
74
|
* facebookAppId="Facebook APP ID" />
|
|
74
75
|
*/
|
|
@@ -226,10 +227,7 @@ module.exports = /*#__PURE__*/function (_Component) {
|
|
|
226
227
|
}));
|
|
227
228
|
}
|
|
228
229
|
if (googlePlus) {
|
|
229
|
-
|
|
230
|
-
"rel": "publisher",
|
|
231
|
-
"href": googlePlus
|
|
232
|
-
}));
|
|
230
|
+
deprecate('head.open_graph.google_plus', 'Ignored; remove google_plus from your configuration.');
|
|
233
231
|
}
|
|
234
232
|
if (facebookAdmins) {
|
|
235
233
|
htmlTags.push((0, _inferno.createVNode)(1, "meta", null, null, 1, {
|
|
@@ -22,8 +22,10 @@ var _require = require('inferno'),
|
|
|
22
22
|
Component = _require.Component;
|
|
23
23
|
var _require2 = require('../../util/cache'),
|
|
24
24
|
cacheComponent = _require2.cacheComponent;
|
|
25
|
-
var
|
|
26
|
-
|
|
25
|
+
var loadScripts = require('../../util/script');
|
|
26
|
+
var toJs = loadScripts.toJs;
|
|
27
|
+
var _require3 = require('../../util/consent'),
|
|
28
|
+
consentRuntime = _require3.consentRuntime;
|
|
27
29
|
|
|
28
30
|
/**
|
|
29
31
|
* A JSX component for alerting users about the use of cookies.
|
|
@@ -73,7 +75,9 @@ var CookieConsent = /*#__PURE__*/function (_Component) {
|
|
|
73
75
|
deny = text.deny,
|
|
74
76
|
link = text.link,
|
|
75
77
|
policy = text.policy;
|
|
76
|
-
var
|
|
78
|
+
var gated = type === 'opt-in' || type === 'opt-out';
|
|
79
|
+
var consentOptions = gated ? "revokeBtn: '<button type=\"button\" class=\"cc-revoke {{classes}}\">{{policy}}</button>',\n onStatusChange: function (status) { window.hexoComponentConsent.setStatus(status); },\n onRevokeChoice: function () { this.setStatus('deny'); }," : '';
|
|
80
|
+
var js = "".concat(gated ? consentRuntime(type) : '', "\n if (!window.hexoComponentCookieConsentPopup) {\n window.hexoComponentCookieConsentPopup = true;\n window.cookieconsent.initialise({\n type: ").concat(toJs(type), ",\n theme: ").concat(toJs(theme), ",\n static: ").concat(toJs(this.props["static"]), ",\n position: ").concat(toJs(position), ",\n ").concat(consentOptions, "\n content: {\n message: ").concat(toJs(message), ",\n dismiss: ").concat(toJs(dismiss), ",\n allow: ").concat(toJs(allow), ",\n deny: ").concat(toJs(deny), ",\n link: ").concat(toJs(link), ",\n policy: ").concat(toJs(policy), ",\n href: ").concat(toJs(policyLink), ",\n },\n palette: {\n popup: {\n background: \"#edeff5\",\n text: \"#838391\"\n },\n button: {\n background: \"#4b81e8\"\n },\n },\n }, function (popup) {\n window.hexoComponentCookieConsentPopup = popup;\n ").concat(gated ? 'window.hexoComponentConsent.setPopup(popup);' : '', "\n });\n }");
|
|
77
81
|
if (head) {
|
|
78
82
|
return (0, _inferno.createVNode)(1, "link", null, null, 1, {
|
|
79
83
|
"rel": "stylesheet",
|
|
@@ -81,11 +85,8 @@ var CookieConsent = /*#__PURE__*/function (_Component) {
|
|
|
81
85
|
});
|
|
82
86
|
}
|
|
83
87
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
84
|
-
"src": jsUrl,
|
|
85
|
-
"defer": true
|
|
86
|
-
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
87
88
|
"dangerouslySetInnerHTML": {
|
|
88
|
-
__html: js
|
|
89
|
+
__html: loadScripts(jsUrl, js)
|
|
89
90
|
}
|
|
90
91
|
})], 4);
|
|
91
92
|
}
|
|
@@ -15,29 +15,30 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
|
|
|
15
15
|
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
16
16
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* lightGallery and Justified Gallery plugins JSX component.
|
|
19
19
|
* @module view/plugin/gallery
|
|
20
20
|
*/
|
|
21
21
|
var _require = require('inferno'),
|
|
22
22
|
Component = _require.Component;
|
|
23
23
|
var _require2 = require('../../util/cache'),
|
|
24
24
|
cacheComponent = _require2.cacheComponent;
|
|
25
|
+
var gallery = require('../../util/gallery');
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
+
* lightGallery and Justified Gallery plugins JSX component.
|
|
28
29
|
*
|
|
29
|
-
* @see
|
|
30
|
+
* @see https://www.lightgalleryjs.com/
|
|
30
31
|
* @see http://miromannino.github.io/Justified-Gallery/
|
|
31
32
|
* @example
|
|
32
33
|
* <Gallery
|
|
33
34
|
* head={true}
|
|
34
35
|
* lightGallery={{
|
|
35
|
-
* jsUrl: '/path/to/lightgallery.js',
|
|
36
|
-
* cssUrl: '/path/to/lightgallery.css'
|
|
36
|
+
* jsUrl: '/path/to/lightgallery.min.js',
|
|
37
|
+
* cssUrl: '/path/to/lightgallery-bundle.min.css'
|
|
37
38
|
* }}
|
|
38
39
|
* justifiedGallery={{
|
|
39
|
-
* jsUrl: '/path/to/
|
|
40
|
-
* cssUrl: '/path/to/
|
|
40
|
+
* jsUrl: '/path/to/justified-gallery.js',
|
|
41
|
+
* cssUrl: '/path/to/justified-gallery.css'
|
|
41
42
|
* }} />
|
|
42
43
|
*/
|
|
43
44
|
var Gallery = /*#__PURE__*/function (_Component) {
|
|
@@ -53,32 +54,44 @@ var Gallery = /*#__PURE__*/function (_Component) {
|
|
|
53
54
|
head = _this$props.head,
|
|
54
55
|
lightGallery = _this$props.lightGallery,
|
|
55
56
|
justifiedGallery = _this$props.justifiedGallery;
|
|
57
|
+
var plugins = lightGallery.plugins || [];
|
|
56
58
|
if (head) {
|
|
57
59
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "link", null, null, 1, {
|
|
58
60
|
"rel": "stylesheet",
|
|
59
|
-
"href": lightGallery.cssUrl
|
|
61
|
+
"href": lightGallery.cssUrl,
|
|
62
|
+
"data-pjax": true
|
|
60
63
|
}), (0, _inferno.createVNode)(1, "link", null, null, 1, {
|
|
61
64
|
"rel": "stylesheet",
|
|
62
|
-
"href": justifiedGallery.cssUrl
|
|
65
|
+
"href": justifiedGallery.cssUrl,
|
|
66
|
+
"data-pjax": true
|
|
63
67
|
})], 4);
|
|
64
68
|
}
|
|
65
|
-
var js = "
|
|
69
|
+
var js = "".concat(gallery, "\nwindow.HexoGallery.lightGalleryPlugins = ").concat(JSON.stringify(plugins.map(function (plugin) {
|
|
70
|
+
return plugin.name;
|
|
71
|
+
})).replace(/</g, "\\u003c"), ";\nwindow.HexoGallery.init(document, {\n lightGallery: true,\n justifiedGallery: true\n });");
|
|
66
72
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
67
73
|
"src": lightGallery.jsUrl,
|
|
68
74
|
"defer": true
|
|
69
|
-
}), (
|
|
70
|
-
"
|
|
71
|
-
|
|
75
|
+
}), plugins.map(function (plugin) {
|
|
76
|
+
return (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
77
|
+
"src": plugin.jsUrl,
|
|
78
|
+
"defer": true
|
|
79
|
+
}, plugin.name);
|
|
72
80
|
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
73
81
|
"dangerouslySetInnerHTML": {
|
|
74
82
|
__html: js
|
|
75
83
|
}
|
|
76
|
-
})
|
|
84
|
+
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
85
|
+
"type": "module",
|
|
86
|
+
"dangerouslySetInnerHTML": {
|
|
87
|
+
__html: "import { JustifiedGallery } from ".concat(JSON.stringify(justifiedGallery.jsUrl).replace(/</g, "\\u003c"), ";\nwindow.JustifiedGallery = JustifiedGallery;\ndocument.dispatchEvent(new Event('hexo:gallery:ready'));")
|
|
88
|
+
}
|
|
89
|
+
})], 0);
|
|
77
90
|
}
|
|
78
91
|
}]);
|
|
79
92
|
}(Component);
|
|
80
93
|
/**
|
|
81
|
-
* Cacheable
|
|
94
|
+
* Cacheable lightGallery and Justified Gallery plugins JSX component.
|
|
82
95
|
* <p>
|
|
83
96
|
* This class is supposed to be used in combination with the <code>locals</code> hexo filter
|
|
84
97
|
* ({@link module:hexo/filter/locals}).
|
|
@@ -95,12 +108,22 @@ Gallery.Cacheable = cacheComponent(Gallery, 'plugin.gallery', function (props) {
|
|
|
95
108
|
return {
|
|
96
109
|
head: head,
|
|
97
110
|
lightGallery: {
|
|
98
|
-
jsUrl: helper.cdn('lightgallery', '
|
|
99
|
-
cssUrl: helper.cdn('lightgallery', '
|
|
111
|
+
jsUrl: helper.cdn('lightgallery', '3.0.0', 'lightgallery.min.js'),
|
|
112
|
+
cssUrl: helper.cdn('lightgallery', '3.0.0', 'css/lightgallery-bundle.min.css'),
|
|
113
|
+
plugins: [{
|
|
114
|
+
name: 'lgZoom',
|
|
115
|
+
jsUrl: helper.cdn('lightgallery', '3.0.0', 'plugins/zoom/lg-zoom.min.js')
|
|
116
|
+
}, {
|
|
117
|
+
name: 'lgThumbnail',
|
|
118
|
+
jsUrl: helper.cdn('lightgallery', '3.0.0', 'plugins/thumbnail/lg-thumbnail.min.js')
|
|
119
|
+
}, {
|
|
120
|
+
name: 'lgFullscreen',
|
|
121
|
+
jsUrl: helper.cdn('lightgallery', '3.0.0', 'plugins/fullscreen/lg-fullscreen.min.js')
|
|
122
|
+
}]
|
|
100
123
|
},
|
|
101
124
|
justifiedGallery: {
|
|
102
|
-
jsUrl: helper.cdn('
|
|
103
|
-
cssUrl: helper.cdn('
|
|
125
|
+
jsUrl: helper.cdn('justified-gallery', '4.0.2', 'dist/justified-gallery.js'),
|
|
126
|
+
cssUrl: helper.cdn('justified-gallery', '4.0.2', 'dist/assets/justified-gallery.css')
|
|
104
127
|
}
|
|
105
128
|
};
|
|
106
129
|
});
|
package/lib/view/plugin/katex.js
CHANGED
|
@@ -88,10 +88,10 @@ KaTeX.Cacheable = cacheComponent(KaTeX, 'plugin.katex', function (props) {
|
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
90
|
return {
|
|
91
|
-
jsUrl: helper.cdn('katex', '0.
|
|
92
|
-
cssUrl: helper.cdn('katex', '0.
|
|
93
|
-
autoRenderUrl: helper.cdn('katex', '0.
|
|
94
|
-
mhchemUrl: helper.cdn('katex', '0.
|
|
91
|
+
jsUrl: helper.cdn('katex', '0.19.1', 'dist/katex.min.js'),
|
|
92
|
+
cssUrl: helper.cdn('katex', '0.19.1', 'dist/katex.min.css'),
|
|
93
|
+
autoRenderUrl: helper.cdn('katex', '0.19.1', 'dist/contrib/auto-render.min.js'),
|
|
94
|
+
mhchemUrl: helper.cdn('katex', '0.19.1', 'dist/contrib/mhchem.min.js')
|
|
95
95
|
};
|
|
96
96
|
});
|
|
97
97
|
module.exports = KaTeX;
|
|
@@ -16,7 +16,7 @@ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new T
|
|
|
16
16
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
17
17
|
/**
|
|
18
18
|
* MathJax math renderer plugin JSX component.
|
|
19
|
-
* @module view/plugin/
|
|
19
|
+
* @module view/plugin/mathjax
|
|
20
20
|
*/
|
|
21
21
|
var _require = require('inferno'),
|
|
22
22
|
Component = _require.Component;
|
|
@@ -28,7 +28,7 @@ var _require2 = require('../../util/cache'),
|
|
|
28
28
|
*
|
|
29
29
|
* @see https://www.mathjax.org/
|
|
30
30
|
* @example
|
|
31
|
-
* <Mathjax jsUrl="/
|
|
31
|
+
* <Mathjax jsUrl="/mathjax/tex-mml-chtml.js" fontPath="/mathjax-newcm-font" />
|
|
32
32
|
*/
|
|
33
33
|
var Mathjax = /*#__PURE__*/function (_Component) {
|
|
34
34
|
function Mathjax() {
|
|
@@ -39,16 +39,18 @@ var Mathjax = /*#__PURE__*/function (_Component) {
|
|
|
39
39
|
return _createClass(Mathjax, [{
|
|
40
40
|
key: "render",
|
|
41
41
|
value: function render() {
|
|
42
|
-
var
|
|
43
|
-
|
|
42
|
+
var _this$props = this.props,
|
|
43
|
+
jsUrl = _this$props.jsUrl,
|
|
44
|
+
fontPath = _this$props.fontPath;
|
|
45
|
+
var js = "window.MathJax = window.MathJax || {\n tex: {\n inlineMath: [['$', '$'], ['\\\\(', '\\\\)']]\n },\n output: {\n font: 'mathjax-newcm',\n ".concat(fontPath ? "fontPath: ".concat(JSON.stringify(fontPath).replace(/</g, "\\u003c")) : '', "\n }\n };");
|
|
44
46
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
45
47
|
"type": "text/javascript",
|
|
46
|
-
"id": "MathJax-script",
|
|
47
|
-
"async": true,
|
|
48
48
|
"dangerouslySetInnerHTML": {
|
|
49
49
|
__html: js
|
|
50
50
|
}
|
|
51
51
|
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
52
|
+
"id": "MathJax-script",
|
|
53
|
+
"defer": true,
|
|
52
54
|
"src": jsUrl
|
|
53
55
|
})], 4);
|
|
54
56
|
}
|
|
@@ -73,7 +75,8 @@ Mathjax.Cacheable = cacheComponent(Mathjax, 'plugin.mathjax', function (props) {
|
|
|
73
75
|
return null;
|
|
74
76
|
}
|
|
75
77
|
return {
|
|
76
|
-
jsUrl: helper.cdn('mathjax', '
|
|
78
|
+
jsUrl: helper.cdn('mathjax', '4.1.3', 'tex-mml-chtml.js'),
|
|
79
|
+
fontPath: helper.cdn('@mathjax/mathjax-newcm-font', '4.1.3', 'chtml.js').replace(/\/chtml\.js$/, '')
|
|
77
80
|
};
|
|
78
81
|
});
|
|
79
82
|
module.exports = Mathjax;
|