hexo-component-inferno 4.2.2 → 5.1.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/cusdis.json +1 -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/livere.json +9 -3
- 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/cusdis.js +4 -0
- 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/livere.js +25 -4
- 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
|
@@ -59,15 +59,22 @@ var Artalk = /*#__PURE__*/function (_Component) {
|
|
|
59
59
|
pageTitle = _this$props.pageTitle,
|
|
60
60
|
locale = _this$props.locale,
|
|
61
61
|
darkMode = _this$props.darkMode,
|
|
62
|
+
preferRemoteConf = _this$props.preferRemoteConf,
|
|
62
63
|
jsUrl = _this$props.jsUrl,
|
|
63
|
-
cssUrl = _this$props.cssUrl
|
|
64
|
+
cssUrl = _this$props.cssUrl,
|
|
65
|
+
_this$props$localeUrl = _this$props.localeUrls,
|
|
66
|
+
localeUrls = _this$props$localeUrl === void 0 ? [] : _this$props$localeUrl;
|
|
64
67
|
if (!server) {
|
|
65
68
|
return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You forgot to set the "), (0, _inferno.createVNode)(1, "code", null, "server", 16), (0, _inferno.createTextVNode)(" for Artalk. Please set it in"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 0);
|
|
66
69
|
}
|
|
67
70
|
// Without the dark_mode option, follow the appearance of the page
|
|
68
|
-
var
|
|
71
|
+
var followAppearance = darkMode === null || typeof darkMode === 'undefined';
|
|
72
|
+
var darkModeOption = followAppearance ? "".concat(getAppearance(), " === 'auto' ? 'auto' : ").concat(isDark()) : toJs(darkMode);
|
|
69
73
|
// PJAX replaces the element of the previous instance, so destroy it before initializing again
|
|
70
|
-
var js = "if (window.__artalkInstance) {\n window.__artalkInstance.destroy();\n }\n window.__artalkInstance = Artalk.init({\n el: '#artalk-thread',\n server: ".concat(toJs(server), ",\n ").concat(site ? "site: ".concat(toJs(site), ",") : '', "\n ").concat(pageKey ? "pageKey: ".concat(toJs(pageKey), ",") : '', "\n ").concat(pageTitle ? "pageTitle: ".concat(toJs(pageTitle), ",") : '', "\n ").concat(locale ? "locale: ".concat(toJs(locale), ",") : '', "\n darkMode: ").concat(darkModeOption, ",\n });");
|
|
74
|
+
var js = "if (!container || !container.isConnected) return;\n if (window.__artalkInstance) {\n window.__artalkInstance.destroy();\n }\n window.__artalkInstance = Artalk.init({\n el: '#artalk-thread',\n server: ".concat(toJs(server), ",\n ").concat(site ? "site: ".concat(toJs(site), ",") : '', "\n ").concat(pageKey ? "pageKey: ".concat(toJs(pageKey), ",") : '', "\n ").concat(pageTitle ? "pageTitle: ".concat(toJs(pageTitle), ",") : '', "\n ").concat(locale ? "locale: ".concat(toJs(locale), ",") : '', "\n ").concat(typeof preferRemoteConf === 'boolean' ? "preferRemoteConf: ".concat(preferRemoteConf, ",") : '', "\n darkMode: ").concat(darkModeOption, ",\n });");
|
|
75
|
+
if (followAppearance) {
|
|
76
|
+
js += "\n var instance = window.__artalkInstance;\n var observer = new MutationObserver(function () {\n instance.update({ darkMode: ".concat(darkModeOption, " });\n });\n observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-appearance'] });\n instance.on('unmounted', function () { observer.disconnect(); });");
|
|
77
|
+
}
|
|
71
78
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", null, null, 1, {
|
|
72
79
|
"id": "artalk-thread"
|
|
73
80
|
}), (0, _inferno.createVNode)(1, "link", null, null, 1, {
|
|
@@ -77,7 +84,7 @@ var Artalk = /*#__PURE__*/function (_Component) {
|
|
|
77
84
|
"onload": "this.media='all'"
|
|
78
85
|
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
79
86
|
"dangerouslySetInnerHTML": {
|
|
80
|
-
__html: loadScripts(jsUrl, js)
|
|
87
|
+
__html: "(function () {\n var container = document.getElementById('artalk-thread');\n ".concat(loadScripts([jsUrl].concat(localeUrls), js), "\n })();")
|
|
81
88
|
}
|
|
82
89
|
})], 4);
|
|
83
90
|
}
|
|
@@ -105,6 +112,13 @@ Artalk.Cacheable = cacheComponent(Artalk, 'comment.artalk', function (props) {
|
|
|
105
112
|
var comment = props.comment,
|
|
106
113
|
helper = props.helper,
|
|
107
114
|
page = props.page;
|
|
115
|
+
// The full bundle includes en and zh-CN only. Other published dictionaries register themselves
|
|
116
|
+
// on window.ArtalkI18n before initialization. For auto, make every supported dictionary available.
|
|
117
|
+
var externalLocales = ['zh-TW', 'ja', 'ko', 'fr', 'ru', 'tr'];
|
|
118
|
+
var language = String(comment.locale || '').toLowerCase();
|
|
119
|
+
var localeNames = externalLocales.filter(function (name) {
|
|
120
|
+
return language === 'auto' || language === name.toLowerCase() || language.startsWith(name.toLowerCase() + '-');
|
|
121
|
+
});
|
|
108
122
|
return {
|
|
109
123
|
server: comment.server,
|
|
110
124
|
site: comment.site,
|
|
@@ -112,8 +126,12 @@ Artalk.Cacheable = cacheComponent(Artalk, 'comment.artalk', function (props) {
|
|
|
112
126
|
pageTitle: page.title,
|
|
113
127
|
locale: comment.locale,
|
|
114
128
|
darkMode: comment.dark_mode,
|
|
115
|
-
|
|
116
|
-
|
|
129
|
+
preferRemoteConf: comment.prefer_remote_conf,
|
|
130
|
+
jsUrl: helper.cdn('artalk', '2.10.0', 'dist/Artalk.js'),
|
|
131
|
+
cssUrl: helper.cdn('artalk', '2.10.0', 'dist/Artalk.css'),
|
|
132
|
+
localeUrls: localeNames.map(function (name) {
|
|
133
|
+
return helper.cdn('artalk', '2.10.0', "dist/i18n/".concat(name, ".js"));
|
|
134
|
+
})
|
|
117
135
|
};
|
|
118
136
|
});
|
|
119
137
|
module.exports = Artalk;
|
|
@@ -26,10 +26,13 @@ var loadScripts = require('../../util/script');
|
|
|
26
26
|
var toJs = loadScripts.toJs;
|
|
27
27
|
var _require3 = require('../../util/appearance'),
|
|
28
28
|
getAppearance = _require3.getAppearance;
|
|
29
|
+
var _require4 = require('../../util/deprecate'),
|
|
30
|
+
deprecate = _require4.deprecate;
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
* Cusdis comment JSX component.
|
|
32
34
|
*
|
|
35
|
+
* @deprecated Cusdis was archived on July 17, 2026. Use another comment system instead.
|
|
33
36
|
* @see https://cusdis.com/doc
|
|
34
37
|
* @example
|
|
35
38
|
* <Cusdis
|
|
@@ -50,6 +53,7 @@ var Cusdis = /*#__PURE__*/function (_Component) {
|
|
|
50
53
|
return _createClass(Cusdis, [{
|
|
51
54
|
key: "render",
|
|
52
55
|
value: function render() {
|
|
56
|
+
deprecate('comment.cusdis', 'Archived on 2026-07-17. Use another comment system.');
|
|
53
57
|
var _this$props = this.props,
|
|
54
58
|
_this$props$host = _this$props.host,
|
|
55
59
|
host = _this$props$host === void 0 ? 'https://cusdis.com' : _this$props$host,
|
|
@@ -53,7 +53,7 @@ var Disqus = /*#__PURE__*/function (_Component) {
|
|
|
53
53
|
if (!shortname) {
|
|
54
54
|
return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You forgot to set the "), (0, _inferno.createVNode)(1, "code", null, "shortname", 16), (0, _inferno.createTextVNode)(" for Disqus. Please set it in"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 0);
|
|
55
55
|
}
|
|
56
|
-
var js = "var disqus_config = function () {\n this.page.url = ".concat(toJs(permalink), ";\n this.page.identifier = ").concat(toJs(disqusId || path), ";\n };\n (function() {\n var d = document, s = d.createElement('script');
|
|
56
|
+
var js = "var disqus_config = function () {\n this.page.url = ".concat(toJs(permalink), ";\n this.page.identifier = ").concat(toJs(disqusId || path), ";\n };\n (function() {\n var d = document, s = d.createElement('script');\n // Disqus parses computed link/background colors with a legacy RGB-only parser.\n // Serialize the current theme colors to sRGB without changing the rest of the page.\n var thread = d.getElementById('disqus_thread');\n var canvas = d.createElement('canvas');\n canvas.width = canvas.height = 1;\n var context = canvas.getContext('2d');\n function rgb(color) {\n context.clearRect(0, 0, 1, 1);\n context.fillStyle = color;\n context.fillRect(0, 0, 1, 1);\n var pixel = context.getImageData(0, 0, 1, 1).data;\n return 'rgba(' + pixel[0] + ',' + pixel[1] + ',' + pixel[2] + ',' + pixel[3] / 255 + ')';\n }\n var link = d.createElement('a');\n link.href = '#';\n thread.appendChild(link);\n var linkColor = rgb(getComputedStyle(link).color);\n thread.removeChild(link);\n var style = d.createElement('style');\n style.textContent = '#disqus_thread a { color: ' + linkColor + '; }';\n thread.parentNode.insertBefore(style, thread);\n for (var node = thread; node; node = node.parentElement) {\n var background = rgb(getComputedStyle(node).backgroundColor);\n if (background !== 'rgba(0,0,0,0)') {\n thread.style.backgroundColor = background;\n break;\n }\n }\n s.src = ").concat(toJs("//".concat(shortname, ".disqus.com/embed.js")), ";\n s.setAttribute('data-timestamp', +new Date());\n (d.head || d.body).appendChild(s);\n })();");
|
|
57
57
|
return (0, _inferno.createFragment)([(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, {
|
|
58
58
|
"href": "//disqus.com/?ref_noscript"
|
|
59
59
|
})], 0), 2, {
|
|
@@ -42,7 +42,7 @@ var toJs = loadScripts.toJs;
|
|
|
42
42
|
* permalink="/page/permanent/path"
|
|
43
43
|
* pageTitle="******"
|
|
44
44
|
* siteTitle="******"
|
|
45
|
-
* jsUrl="/path/to/
|
|
45
|
+
* jsUrl="/path/to/disqusjs.es2015.umd.min.js"
|
|
46
46
|
* cssUrl="/path/to/disqusjs.css" />
|
|
47
47
|
*/
|
|
48
48
|
var DisqusJs = /*#__PURE__*/function (_Component) {
|
|
@@ -73,7 +73,8 @@ var DisqusJs = /*#__PURE__*/function (_Component) {
|
|
|
73
73
|
}
|
|
74
74
|
var url = permalink || path;
|
|
75
75
|
var identifier = disqusId || path;
|
|
76
|
-
var js = "new DisqusJS({\n shortname: ".concat(toJs(shortname), ",\n apikey: ").concat(toJs(apiKey), ",\n ").concat(siteTitle ? "siteName: ".concat(toJs(siteTitle), ",") : '', "\n ").concat(identifier ? "identifier: ".concat(toJs(identifier), ",") : '', "\n ").concat(url ? "url: ".concat(toJs(url), ",") : '', "\n ").concat(pageTitle ? "title: ".concat(toJs(pageTitle), ",") : '', "\n ").concat(api ? "api: ".concat(toJs(api), ",") : '', "\n ").concat(admin ? "admin: ".concat(toJs(admin), ",") : '', "\n ").concat(adminLabel ? "adminLabel: ".concat(toJs(adminLabel), ",") : '', "\n ").concat(nesting ? "nesting: ".concat(toJs(nesting), ",") : '', "\n });");
|
|
76
|
+
var js = "if (!container.isConnected) return;\n instance = new DisqusJS({\n shortname: ".concat(toJs(shortname), ",\n apikey: ").concat(toJs(apiKey), ",\n ").concat(siteTitle ? "siteName: ".concat(toJs(siteTitle), ",") : '', "\n ").concat(identifier ? "identifier: ".concat(toJs(identifier), ",") : '', "\n ").concat(url ? "url: ".concat(toJs(url), ",") : '', "\n ").concat(pageTitle ? "title: ".concat(toJs(pageTitle), ",") : '', "\n ").concat(api ? "api: ".concat(toJs(api), ",") : '', "\n ").concat(admin ? "admin: ".concat(toJs(admin), ",") : '', "\n ").concat(adminLabel ? "adminLabel: ".concat(toJs(adminLabel), ",") : '', "\n ").concat(nesting ? "nesting: ".concat(toJs(nesting), ",") : '', "\n });\n instance.render(container);");
|
|
77
|
+
var script = "(function () {\n var container = document.getElementById('disqusjs');\n var instance;\n function destroy() {\n document.removeEventListener('hexo:page:before-replace', destroy);\n if (instance) instance.destroy();\n }\n document.addEventListener('hexo:page:before-replace', destroy);\n ".concat(loadScripts(jsUrl, js), "\n })();");
|
|
77
78
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "link", null, null, 1, {
|
|
78
79
|
"rel": "stylesheet",
|
|
79
80
|
"href": cssUrl,
|
|
@@ -82,10 +83,10 @@ var DisqusJs = /*#__PURE__*/function (_Component) {
|
|
|
82
83
|
}), (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, {
|
|
83
84
|
"href": "//disqus.com/?ref_noscript"
|
|
84
85
|
})], 0), 2, {
|
|
85
|
-
"id": "
|
|
86
|
+
"id": "disqusjs"
|
|
86
87
|
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
87
88
|
"dangerouslySetInnerHTML": {
|
|
88
|
-
__html:
|
|
89
|
+
__html: script
|
|
89
90
|
}
|
|
90
91
|
})], 4);
|
|
91
92
|
}
|
|
@@ -134,8 +135,8 @@ DisqusJs.Cacheable = cacheComponent(DisqusJs, 'comment.disqusjs', function (prop
|
|
|
134
135
|
permalink: page.permalink,
|
|
135
136
|
pageTitle: page.title,
|
|
136
137
|
siteTitle: config.title,
|
|
137
|
-
jsUrl: helper.cdn('disqusjs', '
|
|
138
|
-
cssUrl: helper.cdn('disqusjs', '
|
|
138
|
+
jsUrl: helper.cdn('disqusjs', '3.2.2', 'dist/browser/disqusjs.es2015.umd.min.js'),
|
|
139
|
+
cssUrl: helper.cdn('disqusjs', '3.2.2', 'dist/browser/styles/disqusjs.css')
|
|
139
140
|
};
|
|
140
141
|
});
|
|
141
142
|
module.exports = DisqusJs;
|
|
@@ -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,
|
|
@@ -22,12 +22,17 @@ 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
|
* LiveRe comment JSX component.
|
|
29
|
+
* <p>
|
|
30
|
+
* Renders the current LiveRe widget when <code>clientId</code> is set, and the legacy LiveRe City
|
|
31
|
+
* widget when only <code>uid</code> is set.
|
|
28
32
|
*
|
|
29
|
-
* @see https://livere.
|
|
33
|
+
* @see https://admin.livere.org/
|
|
30
34
|
* @example
|
|
35
|
+
* <LiveRe clientId="******" />
|
|
31
36
|
* <LiveRe uid="******" />
|
|
32
37
|
*/
|
|
33
38
|
var LiveRe = /*#__PURE__*/function (_Component) {
|
|
@@ -39,9 +44,24 @@ var LiveRe = /*#__PURE__*/function (_Component) {
|
|
|
39
44
|
return _createClass(LiveRe, [{
|
|
40
45
|
key: "render",
|
|
41
46
|
value: function render() {
|
|
42
|
-
var
|
|
47
|
+
var _this$props = this.props,
|
|
48
|
+
clientId = _this$props.clientId,
|
|
49
|
+
uid = _this$props.uid;
|
|
50
|
+
if (clientId) {
|
|
51
|
+
// <livere-comment> is a custom element, so the widget also starts on pages that PJAX inserts
|
|
52
|
+
// after the script is loaded
|
|
53
|
+
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "livere-comment", null, null, 1, {
|
|
54
|
+
"client-id": clientId
|
|
55
|
+
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
56
|
+
"dangerouslySetInnerHTML": {
|
|
57
|
+
__html: loadScripts('https://www.livere.org/livere-widget.js', '', {
|
|
58
|
+
type: 'module'
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
})], 4);
|
|
62
|
+
}
|
|
43
63
|
if (!uid) {
|
|
44
|
-
return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You forgot to set the "), (0, _inferno.createVNode)(1, "code", null, "
|
|
64
|
+
return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You forgot to set the "), (0, _inferno.createVNode)(1, "code", null, "client_id", 16), (0, _inferno.createTextVNode)(" for LiveRe. Please set it in"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 0);
|
|
45
65
|
}
|
|
46
66
|
var js = "(function(d, s) {\n var j, e = d.getElementsByTagName(s)[0];\n\n if (typeof LivereTower === 'function') { return; }\n\n j = d.createElement(s);\n j.src = 'https://cdn-city.livere.com/js/embed.dist.js';\n j.async = true;\n\n e.parentNode.insertBefore(j, e);\n })(document, 'script');";
|
|
47
67
|
return (0, _inferno.createVNode)(1, "div", null, [(0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
@@ -64,11 +84,12 @@ var LiveRe = /*#__PURE__*/function (_Component) {
|
|
|
64
84
|
*
|
|
65
85
|
* @see module:util/cache.cacheComponent
|
|
66
86
|
* @example
|
|
67
|
-
* <LiveRe.Cacheable comment={{
|
|
87
|
+
* <LiveRe.Cacheable comment={{ client_id: '******' }} />
|
|
68
88
|
*/
|
|
69
89
|
LiveRe.Cacheable = cacheComponent(LiveRe, 'comment.livere', function (props) {
|
|
70
90
|
var comment = props.comment;
|
|
71
91
|
return {
|
|
92
|
+
clientId: comment.client_id,
|
|
72
93
|
uid: comment.uid
|
|
73
94
|
};
|
|
74
95
|
});
|
|
@@ -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
|
}
|