hexo-component-inferno 4.1.0 → 4.2.1
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/LICENSE +21 -0
- package/README.md +159 -8
- package/asset/js/algolia.js +27 -10
- package/asset/js/insight.js +62 -44
- package/lib/core/migrate.js +23 -4
- package/lib/core/schema.js +31 -9
- package/lib/core/view.js +1 -1
- package/lib/hexo/filter/locals.js +5 -2
- package/lib/hexo/generator/category.js +8 -1
- package/lib/hexo/generator/insight.js +8 -15
- package/lib/hexo/generator/manifest.js +6 -0
- package/lib/hexo/helper/cdn.js +1 -1
- package/lib/hexo/tag/message.js +11 -1
- package/lib/hexo/tag/tabs.js +28 -5
- package/lib/schema/comment/cusdis.json +1 -1
- package/lib/schema/comment/giscus.json +9 -3
- package/lib/schema/comment/gitment.json +1 -1
- package/lib/schema/comment/utterances.json +4 -2
- package/lib/schema/comment/valine.json +13 -2
- package/lib/schema/comment/waline.json +3 -3
- package/lib/schema/misc/open_graph.json +0 -1
- package/lib/schema/plugin/waline_pageview.json +1 -1
- package/lib/schema/share/addthis.json +1 -1
- package/lib/schema/widget/archives.json +23 -0
- package/lib/schema/widget/categories.json +27 -0
- package/lib/schema/widget/recent_posts.json +5 -0
- package/lib/schema/widget/subscribe_email.json +1 -1
- package/lib/util/classname.js +1 -1
- package/lib/util/deprecate.js +28 -0
- package/lib/util/html.js +51 -0
- package/lib/util/script.js +30 -7
- package/lib/view/comment/artalk.js +3 -2
- package/lib/view/comment/beaudar.js +3 -2
- package/lib/view/comment/changyan.js +2 -1
- package/lib/view/comment/cusdis.js +2 -1
- package/lib/view/comment/disqus.js +3 -1
- package/lib/view/comment/disqusjs.js +3 -2
- package/lib/view/comment/facebook.js +3 -1
- package/lib/view/comment/giscus.js +3 -2
- package/lib/view/comment/gitalk.js +4 -2
- package/lib/view/comment/gitment.js +7 -2
- package/lib/view/comment/isso.js +5 -1
- package/lib/view/comment/twikoo.js +5 -1
- package/lib/view/comment/utterances.js +3 -2
- package/lib/view/comment/valine.js +7 -1
- package/lib/view/comment/waline.js +25 -21
- 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/wechat.js +1 -1
- package/lib/view/misc/meta.js +9 -3
- package/lib/view/misc/open_graph.js +12 -15
- package/lib/view/misc/structured_data.js +8 -9
- package/lib/view/misc/web_app.js +15 -6
- package/lib/view/plugin/baidu_analytics.js +3 -1
- package/lib/view/plugin/cookie_consent.js +3 -1
- package/lib/view/plugin/google_analytics.js +3 -1
- package/lib/view/plugin/hotjar.js +3 -1
- package/lib/view/plugin/matomo.js +3 -1
- package/lib/view/plugin/outdated_browser.js +1 -1
- package/lib/view/plugin/statcounter.js +3 -1
- package/lib/view/plugin/twitter_conversion_tracking.js +3 -1
- package/lib/view/plugin/waline_pageview.js +3 -1
- package/lib/view/search/algolia.js +3 -1
- package/lib/view/search/baidu.js +3 -1
- package/lib/view/search/google_cse.js +3 -1
- package/lib/view/search/insight.js +4 -2
- package/lib/view/share/addthis.js +4 -0
- package/lib/view/widget/archives.js +21 -10
- package/lib/view/widget/categories.js +22 -12
- package/lib/view/widget/links.js +1 -1
- package/lib/view/widget/recent_posts.js +2 -2
- package/lib/view/widget/subscribe_email.js +5 -0
- package/lib/view/widget/tags.js +4 -5
- package/package.json +4 -2
|
@@ -22,6 +22,8 @@ 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;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* A JSX component for alerting users about the use of cookies.
|
|
@@ -71,7 +73,7 @@ var CookieConsent = /*#__PURE__*/function (_Component) {
|
|
|
71
73
|
deny = text.deny,
|
|
72
74
|
link = text.link,
|
|
73
75
|
policy = text.policy;
|
|
74
|
-
var js = "window.addEventListener(\"load\", () => {\n window.cookieconsent.initialise({\n type: ".concat(
|
|
76
|
+
var js = "window.addEventListener(\"load\", () => {\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 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 });\n });");
|
|
75
77
|
if (head) {
|
|
76
78
|
return (0, _inferno.createVNode)(1, "link", null, null, 1, {
|
|
77
79
|
"rel": "stylesheet",
|
|
@@ -22,6 +22,8 @@ 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;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Google Analytics plugin JSX component.
|
|
@@ -40,7 +42,7 @@ var GoogleAnalytics = /*#__PURE__*/function (_Component) {
|
|
|
40
42
|
key: "render",
|
|
41
43
|
value: function render() {
|
|
42
44
|
var trackingId = this.props.trackingId;
|
|
43
|
-
var js = "window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n \n gtag('config',
|
|
45
|
+
var js = "window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n \n gtag('config', ".concat(toJs(trackingId), ");");
|
|
44
46
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
45
47
|
"src": "https://www.googletagmanager.com/gtag/js?id=".concat(trackingId),
|
|
46
48
|
"async": true
|
|
@@ -22,6 +22,8 @@ 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;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Hotjar user feedback plugin JSX component.
|
|
@@ -40,7 +42,7 @@ var Hotjar = /*#__PURE__*/function (_Component) {
|
|
|
40
42
|
key: "render",
|
|
41
43
|
value: function render() {
|
|
42
44
|
var siteId = this.props.siteId;
|
|
43
|
-
var js = "(function(h,o,t,j,a,r){\n h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n h._hjSettings={hjid:".concat(siteId, ",hjsv:6};\n a=o.getElementsByTagName('head')[0];\n r=o.createElement('script');r.async=1;\n r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n a.appendChild(r);\n })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');");
|
|
45
|
+
var js = "(function(h,o,t,j,a,r){\n h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n h._hjSettings={hjid:".concat(toJs(siteId), ",hjsv:6};\n a=o.getElementsByTagName('head')[0];\n r=o.createElement('script');r.async=1;\n r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n a.appendChild(r);\n })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');");
|
|
44
46
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
45
47
|
"dangerouslySetInnerHTML": {
|
|
46
48
|
__html: js
|
|
@@ -22,6 +22,8 @@ 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;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Matomo analytics plugin JSX component.
|
|
@@ -49,7 +51,7 @@ var Matomo = /*#__PURE__*/function (_Component) {
|
|
|
49
51
|
siteId = _this$props.siteId,
|
|
50
52
|
disableCookies = _this$props.disableCookies;
|
|
51
53
|
var baseUrl = url.endsWith('/') ? url : url + '/';
|
|
52
|
-
var js = "var _paq = window._paq = window._paq || [];\n ".concat(disableCookies ? "_paq.push(['disableCookies']);" : '', "\n _paq.push(['trackPageView']);\n _paq.push(['enableLinkTracking']);\n (function () {\n var u = ").concat(
|
|
54
|
+
var js = "var _paq = window._paq = window._paq || [];\n ".concat(disableCookies ? "_paq.push(['disableCookies']);" : '', "\n _paq.push(['trackPageView']);\n _paq.push(['enableLinkTracking']);\n (function () {\n var u = ").concat(toJs(baseUrl), ";\n _paq.push(['setTrackerUrl', u + 'matomo.php']);\n _paq.push(['setSiteId', ").concat(toJs(String(siteId)), "]);\n var g = document.createElement('script');\n g.async = true;\n g.src = u + 'matomo.js';\n document.head.appendChild(g);\n })();\n (function () {\n var referrer = location.href;\n document.addEventListener('pjax:complete', function () {\n _paq.push(['setReferrerUrl', referrer]);\n referrer = location.href;\n _paq.push(['setCustomUrl', referrer]);\n _paq.push(['setDocumentTitle', document.title]);\n _paq.push(['trackPageView']);\n _paq.push(['enableLinkTracking']);\n });\n })();");
|
|
53
55
|
return (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
54
56
|
"dangerouslySetInnerHTML": {
|
|
55
57
|
__html: js
|
|
@@ -53,7 +53,7 @@ var OutdatedBrowser = /*#__PURE__*/function (_Component) {
|
|
|
53
53
|
"href": cssUrl
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", null, [(0, _inferno.createVNode)(1, "h6", null, "Your browser is out-of-date!", 16), (0, _inferno.createVNode)(1, "p", null, [(0, _inferno.createTextVNode)("Update your browser to view this website correctly
|
|
56
|
+
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", null, [(0, _inferno.createVNode)(1, "h6", null, "Your browser is out-of-date!", 16), (0, _inferno.createVNode)(1, "p", null, [(0, _inferno.createTextVNode)("Update your browser to view this website correctly.\xA0"), (0, _inferno.createVNode)(1, "a", null, [(0, _inferno.createTextVNode)("Update my browser now"), (0, _inferno.createTextVNode)(' ')], 0, {
|
|
57
57
|
"id": "btnUpdateBrowser",
|
|
58
58
|
"href": "http://outdatedbrowser.com/"
|
|
59
59
|
})], 4), (0, _inferno.createVNode)(1, "p", "last", (0, _inferno.createVNode)(1, "a", null, "\xD7", 16, {
|
|
@@ -22,6 +22,8 @@ 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;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Statcounter statistics plugin JSX component.
|
|
@@ -42,7 +44,7 @@ var Statcounter = /*#__PURE__*/function (_Component) {
|
|
|
42
44
|
var _this$props = this.props,
|
|
43
45
|
project = _this$props.project,
|
|
44
46
|
security = _this$props.security;
|
|
45
|
-
var js = "\n var sc_project=".concat(
|
|
47
|
+
var js = "\n var sc_project=".concat(toJs(project), ";\n var sc_invisible=1;\n var sc_security=").concat(toJs(security), ";\n var sc_https=1;\n var sc_remove_link=1;");
|
|
46
48
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
47
49
|
"dangerouslySetInnerHTML": {
|
|
48
50
|
__html: js
|
|
@@ -22,6 +22,8 @@ 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;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Twitter conversion tracking plugin JSX component.
|
|
@@ -40,7 +42,7 @@ var TwiterCT = /*#__PURE__*/function (_Component) {
|
|
|
40
42
|
key: "render",
|
|
41
43
|
value: function render() {
|
|
42
44
|
var pixelId = this.props.pixelId;
|
|
43
|
-
var js = "\n !function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);\n },s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='//static.ads-twitter.com/uwt.js',\n a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');\n twq('init', ".concat(
|
|
45
|
+
var js = "\n !function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);\n },s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='//static.ads-twitter.com/uwt.js',\n a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');\n twq('init', ".concat(toJs(pixelId), ");\n twq('track', 'PageView');\n ");
|
|
44
46
|
return (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
45
47
|
"dangerouslySetInnerHTML": {
|
|
46
48
|
__html: js
|
|
@@ -22,6 +22,8 @@ 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;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Waline page view counter plugin JSX component.
|
|
@@ -50,7 +52,7 @@ var WalinePageview = /*#__PURE__*/function (_Component) {
|
|
|
50
52
|
jsUrl = _this$props.jsUrl;
|
|
51
53
|
|
|
52
54
|
// Waline publishes the counter as an ES module, so load it with a dynamic import
|
|
53
|
-
var js = "(function () {\n var abort = null;\n function count() {\n import(".concat(
|
|
55
|
+
var js = "(function () {\n var abort = null;\n function count() {\n import(".concat(toJs(jsUrl), ").then(function (Waline) {\n if (abort) {\n abort();\n }\n abort = Waline.pageviewCount({\n serverURL: ").concat(toJs(serverURL), ",\n path: window.location.pathname,\n });\n });\n }\n count();\n document.addEventListener('pjax:complete', count);\n })();");
|
|
54
56
|
return (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
55
57
|
"dangerouslySetInnerHTML": {
|
|
56
58
|
__html: js
|
|
@@ -22,6 +22,8 @@ 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;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Algolia search engine JSX component.
|
|
@@ -69,7 +71,7 @@ var Algolia = /*#__PURE__*/function (_Component) {
|
|
|
69
71
|
indexName: indexName,
|
|
70
72
|
excerpt: excerpt
|
|
71
73
|
};
|
|
72
|
-
var js = "document.addEventListener('DOMContentLoaded', function () {\n loadAlgolia(".concat(
|
|
74
|
+
var js = "document.addEventListener('DOMContentLoaded', function () {\n loadAlgolia(".concat(toJs(config), ", ").concat(toJs(translation), ");\n });");
|
|
73
75
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "searchbox", [(0, _inferno.createVNode)(1, "div", "searchbox-mask", null, 1, {
|
|
74
76
|
"style": "position:absolute;bottom:0px;left:0px;right:0px;top:0px;"
|
|
75
77
|
}), (0, _inferno.createVNode)(1, "div", "searchbox-container", [(0, _inferno.createVNode)(1, "div", "searchbox-header", [(0, _inferno.createVNode)(1, "div", "searchbox-input-container", null, 1, {
|
package/lib/view/search/baidu.js
CHANGED
|
@@ -22,6 +22,8 @@ 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;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Baidu search engine JSX component.
|
|
@@ -42,7 +44,7 @@ var Baidu = /*#__PURE__*/function (_Component) {
|
|
|
42
44
|
url = _this$props.url,
|
|
43
45
|
hint = _this$props.hint;
|
|
44
46
|
var siteUrl = url.replace(/http(s)*:\/\//, '');
|
|
45
|
-
var js = "(function ($) {\n $('.searchbox-input-container').on('submit', function (e) {\n var keyword = $('.searchbox-input[name=\"wd\"]').val();\n window.location =
|
|
47
|
+
var js = "(function ($) {\n $('.searchbox-input-container').on('submit', function (e) {\n var keyword = $('.searchbox-input[name=\"wd\"]').val();\n window.location = ".concat(toJs("https://www.baidu.com/s?wd=site:".concat(siteUrl, " ")), " + keyword;\n return false;\n });\n })(jQuery);\n (function (document, $) {\n $(document).on('click', '.navbar-main .search', function () {\n $('.searchbox').toggleClass('show');\n }).on('click', '.searchbox .searchbox-mask', function () {\n $('.searchbox').removeClass('show');\n }).on('click', '.searchbox-close', function () {\n $('.searchbox').removeClass('show');\n });\n })(document, jQuery);");
|
|
46
48
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "searchbox", [(0, _inferno.createVNode)(1, "div", "searchbox-mask", null, 1, {
|
|
47
49
|
"style": "position:absolute;bottom:0px;left:0px;right:0px;top:0px;"
|
|
48
50
|
}), (0, _inferno.createVNode)(1, "div", "searchbox-container", (0, _inferno.createVNode)(1, "div", "searchbox-header", [(0, _inferno.createVNode)(1, "form", "searchbox-input-container", (0, _inferno.createVNode)(64, "input", "searchbox-input", null, 1, {
|
|
@@ -22,6 +22,8 @@ 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;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Google custom search engine JSX component.
|
|
@@ -47,7 +49,7 @@ var GoogleCSE = /*#__PURE__*/function (_Component) {
|
|
|
47
49
|
hint = _this$props.hint,
|
|
48
50
|
jsUrl = _this$props.jsUrl;
|
|
49
51
|
var css = '.searchbox .searchbox-body { background: white; }';
|
|
50
|
-
var js1 = "(function() {\n var cx =
|
|
52
|
+
var js1 = "(function() {\n var cx = ".concat(toJs(cx), ";\n var gcse = document.createElement('script');\n gcse.type = 'text/javascript';\n gcse.async = true;\n gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;\n var s = document.getElementsByTagName('script')[0];\n s.parentNode.insertBefore(gcse, s);\n })();");
|
|
51
53
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "style", null, null, 1, {
|
|
52
54
|
"dangerouslySetInnerHTML": {
|
|
53
55
|
__html: css
|
|
@@ -22,6 +22,8 @@ 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;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Algolia search engine JSX component.
|
|
@@ -52,9 +54,9 @@ var Insight = /*#__PURE__*/function (_Component) {
|
|
|
52
54
|
translation = _this$props.translation,
|
|
53
55
|
contentUrl = _this$props.contentUrl,
|
|
54
56
|
jsUrl = _this$props.jsUrl;
|
|
55
|
-
var js = "document.addEventListener('DOMContentLoaded', function () {\n loadInsight(".concat(
|
|
57
|
+
var js = "document.addEventListener('DOMContentLoaded', function () {\n loadInsight(".concat(toJs({
|
|
56
58
|
contentUrl: contentUrl
|
|
57
|
-
}), ", ").concat(
|
|
59
|
+
}), ", ").concat(toJs(translation), ");\n });");
|
|
58
60
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "searchbox", (0, _inferno.createVNode)(1, "div", "searchbox-container", [(0, _inferno.createVNode)(1, "div", "searchbox-header", [(0, _inferno.createVNode)(1, "div", "searchbox-input-container", (0, _inferno.createVNode)(64, "input", "searchbox-input", null, 1, {
|
|
59
61
|
"type": "text",
|
|
60
62
|
"placeholder": translation.hint
|
|
@@ -22,10 +22,13 @@ 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/deprecate'),
|
|
26
|
+
deprecate = _require3.deprecate;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* AddThis share buttons JSX component.
|
|
28
30
|
*
|
|
31
|
+
* @deprecated AddThis shut down on May 31, 2023. Use AddToAny or ShareThis instead.
|
|
29
32
|
* @see https://www.addthis.com/dashboard
|
|
30
33
|
* @example
|
|
31
34
|
* <AddThis installUrl="******" />
|
|
@@ -39,6 +42,7 @@ var AddThis = /*#__PURE__*/function (_Component) {
|
|
|
39
42
|
return _createClass(AddThis, [{
|
|
40
43
|
key: "render",
|
|
41
44
|
value: function render() {
|
|
45
|
+
deprecate('share.addthis', 'AddThis shut down on May 31, 2023. Use AddToAny or ShareThis instead.');
|
|
42
46
|
var installUrl = this.props.installUrl;
|
|
43
47
|
if (!installUrl) {
|
|
44
48
|
return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You need to set "), (0, _inferno.createVNode)(1, "code", null, "install_url", 16), (0, _inferno.createTextVNode)(" to use AddThis. Please set it in"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 0);
|
|
@@ -25,6 +25,19 @@ var _require2 = require('../../util/cache'),
|
|
|
25
25
|
var _require3 = require('../../util/i18n'),
|
|
26
26
|
translate = _require3.translate;
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Get the first value that is set, i.e., neither null nor undefined.
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
function firstSet() {
|
|
33
|
+
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
34
|
+
values[_key] = arguments[_key];
|
|
35
|
+
}
|
|
36
|
+
return values.find(function (value) {
|
|
37
|
+
return value !== null && typeof value !== 'undefined';
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
28
41
|
/**
|
|
29
42
|
* Convert a Hexo language code into a Moment.js locale name.
|
|
30
43
|
* <p>
|
|
@@ -124,15 +137,13 @@ Archives.Cacheable = cacheComponent(Archives, 'widget.archives', function (props
|
|
|
124
137
|
page = props.page,
|
|
125
138
|
helper = props.helper,
|
|
126
139
|
widget = props.widget;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
_widget$showCount = widget.showCount,
|
|
132
|
-
showCount = _widget$showCount === void 0 ? true : _widget$showCount,
|
|
133
|
-
_widget$format = widget.format,
|
|
134
|
-
format = _widget$format === void 0 ? null : _widget$format,
|
|
140
|
+
// Options left empty in the config are null, which also take the defaults
|
|
141
|
+
var groupBy = firstSet(widget.group_by, 'monthly');
|
|
142
|
+
var order = firstSet(widget.order, -1);
|
|
143
|
+
var format = widget.format,
|
|
135
144
|
amount = widget.amount;
|
|
145
|
+
// show_count, like the tags widget, or showCount, which this widget used to read
|
|
146
|
+
var showCount = firstSet(widget.show_count, widget.showCount, true);
|
|
136
147
|
var url_for = helper.url_for,
|
|
137
148
|
_p = helper._p,
|
|
138
149
|
__ = helper.__;
|
|
@@ -154,7 +165,7 @@ Archives.Cacheable = cacheComponent(Archives, 'widget.archives', function (props
|
|
|
154
165
|
}
|
|
155
166
|
var year = date.year();
|
|
156
167
|
var month = date.month() + 1;
|
|
157
|
-
var name = date.format(format || (
|
|
168
|
+
var name = date.format(format || (groupBy === 'monthly' ? 'MMMM YYYY' : 'YYYY'));
|
|
158
169
|
var lastData = data[length - 1];
|
|
159
170
|
if (!lastData || lastData.name !== name) {
|
|
160
171
|
length = data.push({
|
|
@@ -169,7 +180,7 @@ Archives.Cacheable = cacheComponent(Archives, 'widget.archives', function (props
|
|
|
169
180
|
});
|
|
170
181
|
var link = function link(item) {
|
|
171
182
|
var url = "".concat(config.archive_dir, "/").concat(item.year, "/");
|
|
172
|
-
if (
|
|
183
|
+
if (groupBy === 'monthly') {
|
|
173
184
|
if (item.month < 10) url += '0';
|
|
174
185
|
url += "".concat(item.month, "/");
|
|
175
186
|
}
|
|
@@ -25,6 +25,19 @@ var _require2 = require('../../util/cache'),
|
|
|
25
25
|
var _require3 = require('../../util/i18n'),
|
|
26
26
|
translate = _require3.translate;
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Get the first value that is set, i.e., neither null nor undefined.
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
function firstSet() {
|
|
33
|
+
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
34
|
+
values[_key] = arguments[_key];
|
|
35
|
+
}
|
|
36
|
+
return values.find(function (value) {
|
|
37
|
+
return value !== null && typeof value !== 'undefined';
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
28
41
|
/**
|
|
29
42
|
* Categories widget JSX component.
|
|
30
43
|
*
|
|
@@ -114,25 +127,22 @@ Categories.Cacheable = cacheComponent(Categories, 'widget.categories', function
|
|
|
114
127
|
widget = _props$widget === void 0 ? {} : _props$widget;
|
|
115
128
|
var _widget$categories = widget.categories,
|
|
116
129
|
categories = _widget$categories === void 0 ? props.site.categories : _widget$categories,
|
|
117
|
-
_widget$orderBy = widget.orderBy,
|
|
118
|
-
orderBy = _widget$orderBy === void 0 ? 'name' : _widget$orderBy,
|
|
119
|
-
_widget$order = widget.order,
|
|
120
|
-
order = _widget$order === void 0 ? 1 : _widget$order,
|
|
121
|
-
_widget$showCurrent = widget.showCurrent,
|
|
122
|
-
showCurrent = _widget$showCurrent === void 0 ? false : _widget$showCurrent,
|
|
123
|
-
_widget$showCount = widget.showCount,
|
|
124
|
-
showCount = _widget$showCount === void 0 ? true : _widget$showCount,
|
|
125
130
|
amount = widget.amount;
|
|
131
|
+
// Options left empty in the config are null, which also take the defaults
|
|
132
|
+
var order = firstSet(widget.order, 1);
|
|
133
|
+
// Snake case, like the tags widget, or camel case, which this widget used to read
|
|
134
|
+
var orderBy = firstSet(widget.order_by, widget.orderBy, 'name');
|
|
135
|
+
var showCurrent = firstSet(widget.show_current, widget.showCurrent, false);
|
|
136
|
+
var showCount = firstSet(widget.show_count, widget.showCount, true);
|
|
126
137
|
var url_for = helper.url_for,
|
|
127
138
|
_p = helper._p,
|
|
128
139
|
__ = helper.__;
|
|
129
140
|
if (!categories || !categories.length) {
|
|
130
141
|
return null;
|
|
131
142
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
} catch (e) {}
|
|
143
|
+
|
|
144
|
+
// 0 or no depth shows all levels
|
|
145
|
+
var depth = parseInt(firstSet(widget.depth, props.depth), 10) || 0;
|
|
136
146
|
function prepareQuery(parent) {
|
|
137
147
|
var query = {};
|
|
138
148
|
if (parent) {
|
package/lib/view/widget/links.js
CHANGED
|
@@ -95,7 +95,7 @@ var Links = /*#__PURE__*/function (_Component) {
|
|
|
95
95
|
Links.Cacheable = cacheComponent(Links, 'widget.links', function (props) {
|
|
96
96
|
var helper = props.helper,
|
|
97
97
|
widget = props.widget;
|
|
98
|
-
if (!Object.keys(widget.links).length) {
|
|
98
|
+
if (!widget.links || !Object.keys(widget.links).length) {
|
|
99
99
|
return null;
|
|
100
100
|
}
|
|
101
101
|
return {
|
|
@@ -90,8 +90,8 @@ RecentPosts.Cacheable = cacheComponent(RecentPosts, 'widget.recentposts', functi
|
|
|
90
90
|
var site = props.site,
|
|
91
91
|
helper = props.helper,
|
|
92
92
|
widget = props.widget;
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
// A limit left empty in the config is null, which would show no posts
|
|
94
|
+
var limit = widget.limit > 0 ? widget.limit : 5;
|
|
95
95
|
var url_for = helper.url_for,
|
|
96
96
|
__ = helper.__,
|
|
97
97
|
date_xml = helper.date_xml,
|
|
@@ -22,10 +22,14 @@ 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/deprecate'),
|
|
26
|
+
deprecate = _require3.deprecate;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Google FeedBurner widget JSX component.
|
|
28
30
|
*
|
|
31
|
+
* @deprecated Google FeedBurner stopped email subscriptions in July 2021. Use the follow.it widget
|
|
32
|
+
* instead.
|
|
29
33
|
* @see https://feedburner.google.com/
|
|
30
34
|
* @example
|
|
31
35
|
* <SubscribeEmail
|
|
@@ -43,6 +47,7 @@ var SubscribeEmail = /*#__PURE__*/function (_Component) {
|
|
|
43
47
|
return _createClass(SubscribeEmail, [{
|
|
44
48
|
key: "render",
|
|
45
49
|
value: function render() {
|
|
50
|
+
deprecate('widget.subscribe_email', 'Google FeedBurner stopped email subscriptions in July 2021. Use the follow.it widget instead.');
|
|
46
51
|
var _this$props = this.props,
|
|
47
52
|
title = _this$props.title,
|
|
48
53
|
description = _this$props.description,
|
package/lib/view/widget/tags.js
CHANGED
|
@@ -95,11 +95,10 @@ Tags.Cacheable = cacheComponent(Tags, 'widget.tags', function (props) {
|
|
|
95
95
|
var helper = props.helper,
|
|
96
96
|
_props$widget = props.widget,
|
|
97
97
|
widget = _props$widget === void 0 ? {} : _props$widget;
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
show_count = _widget$show_count === void 0 ? true : _widget$show_count;
|
|
98
|
+
var amount = widget.amount;
|
|
99
|
+
// Options left empty in the config are null, which also take the defaults
|
|
100
|
+
var order_by = widget.order_by || 'name';
|
|
101
|
+
var show_count = widget.show_count !== false;
|
|
103
102
|
var tags = props.tags || props.site.tags;
|
|
104
103
|
var url_for = helper.url_for,
|
|
105
104
|
_p = helper._p,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hexo-component-inferno",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "A collection of Inferno.js layout components and utility scripts for Hexo",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": "https://github.com/ppoffice/hexo-component-inferno",
|
|
@@ -44,13 +44,15 @@
|
|
|
44
44
|
"eslint-plugin-jest": "^27.6.3",
|
|
45
45
|
"eslint-plugin-json": "^3.1.0",
|
|
46
46
|
"eslint-plugin-react": "^7.33.2",
|
|
47
|
-
"hexo": "^
|
|
47
|
+
"hexo": "^8.1.2",
|
|
48
48
|
"hexo-renderer-marked": "^6.2.0",
|
|
49
49
|
"html-minifier": "^4.0.0",
|
|
50
50
|
"inferno-server": "^8.2.3",
|
|
51
51
|
"inferno-test-utils": "^8.2.3",
|
|
52
52
|
"jest": "^29.7.0",
|
|
53
53
|
"jest-environment-jsdom": "^29.7.0",
|
|
54
|
+
"jquery": "^3.7.1",
|
|
55
|
+
"jsdom": "^20.0.3",
|
|
54
56
|
"jsdoc": "^4.0.2",
|
|
55
57
|
"minami": "^1.2.3",
|
|
56
58
|
"prettier": "^3.2.4",
|