hexo-component-inferno 3.1.2 → 4.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/asset/js/algolia.js +51 -10
- package/asset/js/google_cse.js +50 -7
- package/asset/js/insight.js +48 -7
- package/lib/hexo/filter/locals.js +2 -2
- package/lib/hexo/helper/cdn.js +10 -2
- package/lib/schema/comment/artalk.json +37 -0
- package/lib/schema/comment/beaudar.json +62 -0
- package/lib/schema/comment/cusdis.json +34 -0
- package/lib/schema/comment/giscus.json +7 -1
- package/lib/schema/comment/utterances.json +15 -1
- package/lib/schema/comment/valine.json +2 -2
- package/lib/schema/comment/waline.json +1 -1
- package/lib/schema/plugin/matomo.json +25 -0
- package/lib/schema/plugin/umami.json +25 -0
- package/lib/schema/plugin/waline_pageview.json +14 -0
- package/lib/schema/search/algolia.json +4 -0
- package/lib/schema/widget/archives.json +5 -0
- package/lib/schema/widget/categories.json +5 -0
- package/lib/schema/widget/tags.json +1 -1
- package/lib/util/appearance.js +40 -0
- package/lib/util/i18n.js +24 -0
- package/lib/util/script.js +110 -0
- package/lib/view/comment/artalk.js +118 -0
- package/lib/view/comment/beaudar.js +133 -0
- package/lib/view/comment/changyan.js +5 -5
- package/lib/view/comment/cusdis.js +119 -0
- package/lib/view/comment/disqus.js +1 -1
- package/lib/view/comment/disqusjs.js +6 -5
- package/lib/view/comment/facebook.js +1 -1
- package/lib/view/comment/giscus.js +32 -22
- package/lib/view/comment/gitalk.js +6 -5
- package/lib/view/comment/gitment.js +6 -5
- package/lib/view/comment/isso.js +7 -3
- package/lib/view/comment/livere.js +1 -1
- package/lib/view/comment/twikoo.js +3 -4
- package/lib/view/comment/utterances.js +26 -17
- package/lib/view/comment/valine.js +3 -6
- package/lib/view/comment/waline.js +16 -9
- package/lib/view/common/article_media.js +2 -2
- package/lib/view/donate/afdian.js +1 -1
- package/lib/view/donate/alipay.js +1 -1
- package/lib/view/donate/buymeacoffee.js +1 -1
- package/lib/view/donate/patreon.js +1 -1
- package/lib/view/donate/paypal.js +1 -1
- package/lib/view/donate/wechat.js +1 -1
- package/lib/view/misc/article_licensing.js +1 -1
- package/lib/view/misc/meta.js +1 -1
- package/lib/view/misc/open_graph.js +1 -1
- package/lib/view/misc/paginator.js +9 -5
- package/lib/view/misc/structured_data.js +1 -1
- package/lib/view/misc/web_app.js +2 -2
- package/lib/view/plugin/baidu_analytics.js +1 -1
- package/lib/view/plugin/bing_webmaster.js +1 -1
- package/lib/view/plugin/busuanzi.js +1 -1
- package/lib/view/plugin/cnzz.js +1 -1
- package/lib/view/plugin/cookie_consent.js +1 -1
- package/lib/view/plugin/gallery.js +2 -2
- package/lib/view/plugin/google_analytics.js +1 -1
- package/lib/view/plugin/hotjar.js +1 -1
- package/lib/view/plugin/katex.js +1 -1
- package/lib/view/plugin/mathjax.js +1 -1
- package/lib/view/plugin/matomo.js +89 -0
- package/lib/view/plugin/outdated_browser.js +1 -1
- package/lib/view/plugin/progressbar.js +1 -1
- package/lib/view/plugin/statcounter.js +1 -1
- package/lib/view/plugin/twitter_conversion_tracking.js +1 -1
- package/lib/view/plugin/umami.js +88 -0
- package/lib/view/plugin/waline_pageview.js +98 -0
- package/lib/view/search/algolia.js +11 -5
- package/lib/view/search/baidu.js +5 -3
- package/lib/view/search/google_cse.js +4 -2
- package/lib/view/search/insight.js +1 -1
- package/lib/view/share/addthis.js +1 -1
- package/lib/view/share/addtoany.js +1 -1
- package/lib/view/share/bdshare.js +1 -1
- package/lib/view/share/sharejs.js +1 -1
- package/lib/view/share/sharethis.js +1 -1
- package/lib/view/widget/adsense.js +1 -1
- package/lib/view/widget/archives.js +45 -12
- package/lib/view/widget/categories.js +23 -7
- package/lib/view/widget/followit.js +1 -1
- package/lib/view/widget/links.js +1 -1
- package/lib/view/widget/recent_posts.js +1 -1
- package/lib/view/widget/subscribe_email.js +1 -1
- package/lib/view/widget/tags.js +19 -6
- package/lib/view/widget/toc.js +1 -1
- package/package.json +10 -5
- package/lib/core/migrate.test.js +0 -48
- package/lib/core/schema.test.js +0 -520
- package/lib/core/view.test.js +0 -41
- package/lib/hexo/filter/locals.test.js +0 -118
- package/lib/hexo/generator/assets.test.js +0 -32
- package/lib/hexo/generator/categories.test.js +0 -41
- package/lib/hexo/generator/category.test.js +0 -84
- package/lib/hexo/generator/insight.test.js +0 -95
- package/lib/hexo/generator/manifest.test.js +0 -52
- package/lib/hexo/generator/tags.test.js +0 -41
- package/lib/hexo/helper/cdn.test.js +0 -128
- package/lib/hexo/helper/page.test.js +0 -62
- package/lib/hexo/tag/message.test.js +0 -72
- package/lib/hexo/tag/tabs.test.js +0 -98
- package/lib/schema/schema/comment/changyan.json +0 -21
- package/lib/schema/schema/comment/disqus.json +0 -17
- package/lib/schema/schema/comment/disqusjs.json +0 -53
- package/lib/schema/schema/comment/facebook.json +0 -13
- package/lib/schema/schema/comment/giscus.json +0 -105
- package/lib/schema/schema/comment/gitalk.json +0 -81
- package/lib/schema/schema/comment/gitment.json +0 -47
- package/lib/schema/schema/comment/isso.json +0 -17
- package/lib/schema/schema/comment/livere.json +0 -17
- package/lib/schema/schema/comment/twikoo.json +0 -28
- package/lib/schema/schema/comment/utterances.json +0 -59
- package/lib/schema/schema/comment/valine.json +0 -105
- package/lib/schema/schema/comment/waline.json +0 -176
- package/lib/schema/schema/donate/afdian.json +0 -17
- package/lib/schema/schema/donate/alipay.json +0 -17
- package/lib/schema/schema/donate/buymeacoffee.json +0 -17
- package/lib/schema/schema/donate/patreon.json +0 -17
- package/lib/schema/schema/donate/paypal.json +0 -22
- package/lib/schema/schema/donate/wechat.json +0 -17
- package/lib/schema/schema/misc/manifest.json +0 -66
- package/lib/schema/schema/misc/meta.json +0 -11
- package/lib/schema/schema/misc/open_graph.json +0 -78
- package/lib/schema/schema/misc/poly_links.json +0 -35
- package/lib/schema/schema/misc/structured_data.json +0 -47
- package/lib/schema/schema/plugin/baidu_analytics.json +0 -14
- package/lib/schema/schema/plugin/bing_webmaster.json +0 -14
- package/lib/schema/schema/plugin/busuanzi.json +0 -7
- package/lib/schema/schema/plugin/cnzz.json +0 -19
- package/lib/schema/schema/plugin/cookie_consent.json +0 -38
- package/lib/schema/schema/plugin/gallery.json +0 -7
- package/lib/schema/schema/plugin/google_analytics.json +0 -14
- package/lib/schema/schema/plugin/hotjar.json +0 -14
- package/lib/schema/schema/plugin/katex.json +0 -7
- package/lib/schema/schema/plugin/mathjax.json +0 -7
- package/lib/schema/schema/plugin/outdated_browser.json +0 -7
- package/lib/schema/schema/plugin/progressbar.json +0 -7
- package/lib/schema/schema/plugin/statcounter.json +0 -19
- package/lib/schema/schema/plugin/twitter_conversion_tracking.json +0 -14
- package/lib/schema/schema/search/algolia.json +0 -13
- package/lib/schema/schema/search/baidu.json +0 -13
- package/lib/schema/schema/search/google_cse.json +0 -17
- package/lib/schema/schema/search/insight.json +0 -19
- package/lib/schema/schema/share/addthis.json +0 -17
- package/lib/schema/schema/share/addtoany.json +0 -13
- package/lib/schema/schema/share/bdshare.json +0 -13
- package/lib/schema/schema/share/sharejs.json +0 -13
- package/lib/schema/schema/share/sharethis.json +0 -17
- package/lib/schema/schema/widget/adsense.json +0 -21
- package/lib/schema/schema/widget/archives.json +0 -13
- package/lib/schema/schema/widget/categories.json +0 -13
- package/lib/schema/schema/widget/followit.json +0 -26
- package/lib/schema/schema/widget/links.json +0 -47
- package/lib/schema/schema/widget/recent_posts.json +0 -13
- package/lib/schema/schema/widget/subscribe_email.json +0 -22
- package/lib/schema/schema/widget/tags.json +0 -30
- package/lib/schema/schema/widget/toc.json +0 -31
- package/lib/util/cache.test.js +0 -24
- package/lib/util/classname.test.js +0 -13
- package/lib/util/yaml.test.js +0 -18
- package/lib/view/widget/toc.test.js +0 -30
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -56,6 +56,7 @@ var Algolia = /*#__PURE__*/function (_Component) {
|
|
|
56
56
|
applicationId = _this$props.applicationId,
|
|
57
57
|
apiKey = _this$props.apiKey,
|
|
58
58
|
indexName = _this$props.indexName,
|
|
59
|
+
excerpt = _this$props.excerpt,
|
|
59
60
|
jsUrl = _this$props.jsUrl,
|
|
60
61
|
algoliaSearchUrl = _this$props.algoliaSearchUrl,
|
|
61
62
|
instantSearchUrl = _this$props.instantSearchUrl;
|
|
@@ -65,17 +66,20 @@ var Algolia = /*#__PURE__*/function (_Component) {
|
|
|
65
66
|
var config = {
|
|
66
67
|
applicationId: applicationId,
|
|
67
68
|
apiKey: apiKey,
|
|
68
|
-
indexName: indexName
|
|
69
|
+
indexName: indexName,
|
|
70
|
+
excerpt: excerpt
|
|
69
71
|
};
|
|
70
72
|
var js = "document.addEventListener('DOMContentLoaded', function () {\n loadAlgolia(".concat(JSON.stringify(config), ", ").concat(JSON.stringify(translation), ");\n });");
|
|
71
|
-
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "searchbox",
|
|
73
|
+
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "searchbox", [(0, _inferno.createVNode)(1, "div", "searchbox-mask", null, 1, {
|
|
74
|
+
"style": "position:absolute;bottom:0px;left:0px;right:0px;top:0px;"
|
|
75
|
+
}), (0, _inferno.createVNode)(1, "div", "searchbox-container", [(0, _inferno.createVNode)(1, "div", "searchbox-header", [(0, _inferno.createVNode)(1, "div", "searchbox-input-container", null, 1, {
|
|
72
76
|
"id": "algolia-input"
|
|
73
77
|
}), (0, _inferno.createVNode)(1, "div", null, null, 1, {
|
|
74
78
|
"id": "algolia-poweredby",
|
|
75
79
|
"style": "display:flex;margin:0 .5em 0 1em;align-items:center;line-height:0"
|
|
76
80
|
}), (0, _inferno.createVNode)(1, "a", "searchbox-close", "\xD7", 16, {
|
|
77
81
|
"href": "javascript:;"
|
|
78
|
-
})], 4), (0, _inferno.createVNode)(1, "div", "searchbox-body"), (0, _inferno.createVNode)(1, "div", "searchbox-footer")], 4),
|
|
82
|
+
})], 4), (0, _inferno.createVNode)(1, "div", "searchbox-body"), (0, _inferno.createVNode)(1, "div", "searchbox-footer")], 4)], 4), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
79
83
|
"src": algoliaSearchUrl,
|
|
80
84
|
"crossorigin": "anonymous",
|
|
81
85
|
"defer": true
|
|
@@ -118,7 +122,8 @@ var Algolia = /*#__PURE__*/function (_Component) {
|
|
|
118
122
|
*/
|
|
119
123
|
Algolia.Cacheable = cacheComponent(Algolia, 'search.algolia', function (props) {
|
|
120
124
|
var config = props.config,
|
|
121
|
-
helper = props.helper
|
|
125
|
+
helper = props.helper,
|
|
126
|
+
search = props.search;
|
|
122
127
|
var algolia = config.algolia;
|
|
123
128
|
return {
|
|
124
129
|
translation: {
|
|
@@ -130,6 +135,7 @@ Algolia.Cacheable = cacheComponent(Algolia, 'search.algolia', function (props) {
|
|
|
130
135
|
applicationId: algolia ? algolia.applicationID : null,
|
|
131
136
|
apiKey: algolia ? algolia.apiKey : null,
|
|
132
137
|
indexName: algolia ? algolia.indexName : null,
|
|
138
|
+
excerpt: search.excerpt ? search.excerpt : 'excerpt',
|
|
133
139
|
algoliaSearchUrl: helper.cdn('algoliasearch', '4.0.3', 'dist/algoliasearch-lite.umd.js'),
|
|
134
140
|
instantSearchUrl: helper.cdn('instantsearch.js', '4.3.1', 'dist/instantsearch.production.min.js'),
|
|
135
141
|
jsUrl: helper.url_for('/js/algolia.js')
|
package/lib/view/search/baidu.js
CHANGED
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -43,13 +43,15 @@ var Baidu = /*#__PURE__*/function (_Component) {
|
|
|
43
43
|
hint = _this$props.hint;
|
|
44
44
|
var siteUrl = url.replace(/http(s)*:\/\//, '');
|
|
45
45
|
var js = "(function ($) {\n $('.searchbox-input-container').on('submit', function (e) {\n var keyword = $('.searchbox-input[name=\"wd\"]').val();\n window.location = '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
|
-
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "searchbox", (0, _inferno.createVNode)(1, "div", "searchbox-
|
|
46
|
+
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "searchbox", [(0, _inferno.createVNode)(1, "div", "searchbox-mask", null, 1, {
|
|
47
|
+
"style": "position:absolute;bottom:0px;left:0px;right:0px;top:0px;"
|
|
48
|
+
}), (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, {
|
|
47
49
|
"name": "wd",
|
|
48
50
|
"type": "text",
|
|
49
51
|
"placeholder": hint
|
|
50
52
|
}), 2), (0, _inferno.createVNode)(1, "a", "searchbox-close", "\xD7", 16, {
|
|
51
53
|
"href": "javascript:;"
|
|
52
|
-
})], 4), 2),
|
|
54
|
+
})], 4), 2)], 4), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
53
55
|
"dangerouslySetInnerHTML": {
|
|
54
56
|
__html: js
|
|
55
57
|
}
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -52,7 +52,9 @@ var GoogleCSE = /*#__PURE__*/function (_Component) {
|
|
|
52
52
|
"dangerouslySetInnerHTML": {
|
|
53
53
|
__html: css
|
|
54
54
|
}
|
|
55
|
-
}), (0, _inferno.createVNode)(1, "div", "searchbox", [(0, _inferno.createVNode)(1, "div", "searchbox-
|
|
55
|
+
}), (0, _inferno.createVNode)(1, "div", "searchbox", [(0, _inferno.createVNode)(1, "div", "searchbox-mask", null, 1, {
|
|
56
|
+
"style": "position:absolute;bottom:0px;left:0px;right:0px;top:0px;"
|
|
57
|
+
}), (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, {
|
|
56
58
|
"type": "text",
|
|
57
59
|
"placeholder": hint
|
|
58
60
|
}), 2), (0, _inferno.createVNode)(1, "a", "searchbox-close", "\xD7", 16, {
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -20,10 +20,30 @@ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf
|
|
|
20
20
|
*/
|
|
21
21
|
var _require = require('inferno'),
|
|
22
22
|
Component = _require.Component;
|
|
23
|
-
var _require2 = require('
|
|
24
|
-
|
|
25
|
-
var _require3 = require('../../util/
|
|
26
|
-
|
|
23
|
+
var _require2 = require('../../util/cache'),
|
|
24
|
+
cacheComponent = _require2.cacheComponent;
|
|
25
|
+
var _require3 = require('../../util/i18n'),
|
|
26
|
+
translate = _require3.translate;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Convert a Hexo language code into a Moment.js locale name.
|
|
30
|
+
* <p>
|
|
31
|
+
* Same as Hexo's internal <code>toMomentLocale</code>, copied here so that the component does not
|
|
32
|
+
* depend on Hexo's private modules.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} lang Hexo language code, such as <code>zh-CN</code> or <code>en_US</code>.
|
|
35
|
+
* @returns {string|undefined} Moment.js locale name.
|
|
36
|
+
*/
|
|
37
|
+
function toMomentLocale(lang) {
|
|
38
|
+
if (lang === undefined) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
// moment.locale('') and moment.locale(null) both equal moment.locale('en')
|
|
42
|
+
if (!lang || lang === 'en' || lang === 'default') {
|
|
43
|
+
return 'en';
|
|
44
|
+
}
|
|
45
|
+
return lang.toLowerCase().replace('_', '-');
|
|
46
|
+
}
|
|
27
47
|
|
|
28
48
|
/**
|
|
29
49
|
* Archives widget JSX component.
|
|
@@ -52,12 +72,18 @@ var Archives = /*#__PURE__*/function (_Component) {
|
|
|
52
72
|
var _this$props = this.props,
|
|
53
73
|
items = _this$props.items,
|
|
54
74
|
title = _this$props.title,
|
|
55
|
-
showCount = _this$props.showCount
|
|
56
|
-
|
|
75
|
+
showCount = _this$props.showCount,
|
|
76
|
+
moreUrl = _this$props.moreUrl,
|
|
77
|
+
moreTitle = _this$props.moreTitle;
|
|
78
|
+
return (0, _inferno.createVNode)(1, "div", "card widget", (0, _inferno.createVNode)(1, "div", "card-content", (0, _inferno.createVNode)(1, "div", "menu", [(0, _inferno.createVNode)(1, "h3", "menu-label", title, 0), (0, _inferno.createVNode)(1, "ul", "menu-list", [items.map(function (archive) {
|
|
57
79
|
return (0, _inferno.createVNode)(1, "li", null, (0, _inferno.createVNode)(1, "a", "level is-mobile", [(0, _inferno.createVNode)(1, "span", "level-start", (0, _inferno.createVNode)(1, "span", "level-item", archive.name, 0), 2), showCount ? (0, _inferno.createVNode)(1, "span", "level-end", (0, _inferno.createVNode)(1, "span", "level-item tag", archive.count, 0), 2) : null], 0, {
|
|
58
80
|
"href": archive.url
|
|
59
81
|
}), 2);
|
|
60
|
-
}), 0)
|
|
82
|
+
}), moreUrl ? (0, _inferno.createVNode)(1, "li", null, (0, _inferno.createVNode)(1, "a", "level is-mobile", [(0, _inferno.createVNode)(1, "span", "level-start", (0, _inferno.createVNode)(1, "span", "level-item", moreTitle, 0), 2), (0, _inferno.createVNode)(1, "span", "level-end", (0, _inferno.createVNode)(1, "span", "level-item icon is-small", (0, _inferno.createVNode)(1, "i", "fas fa-chevron-right"), 2, {
|
|
83
|
+
"aria-hidden": "true"
|
|
84
|
+
}), 2)], 4, {
|
|
85
|
+
"href": moreUrl
|
|
86
|
+
}), 2) : null], 0)], 4), 2), 2, {
|
|
61
87
|
"data-type": "archives"
|
|
62
88
|
});
|
|
63
89
|
}
|
|
@@ -105,9 +131,11 @@ Archives.Cacheable = cacheComponent(Archives, 'widget.archives', function (props
|
|
|
105
131
|
_widget$showCount = widget.showCount,
|
|
106
132
|
showCount = _widget$showCount === void 0 ? true : _widget$showCount,
|
|
107
133
|
_widget$format = widget.format,
|
|
108
|
-
format = _widget$format === void 0 ? null : _widget$format
|
|
134
|
+
format = _widget$format === void 0 ? null : _widget$format,
|
|
135
|
+
amount = widget.amount;
|
|
109
136
|
var url_for = helper.url_for,
|
|
110
|
-
_p = helper._p
|
|
137
|
+
_p = helper._p,
|
|
138
|
+
__ = helper.__;
|
|
111
139
|
var posts = site.posts.sort('date', order);
|
|
112
140
|
if (!posts.length) {
|
|
113
141
|
return null;
|
|
@@ -147,8 +175,11 @@ Archives.Cacheable = cacheComponent(Archives, 'widget.archives', function (props
|
|
|
147
175
|
}
|
|
148
176
|
return url_for(url);
|
|
149
177
|
};
|
|
178
|
+
|
|
179
|
+
// Link to the archive page when some of the archives are not shown
|
|
180
|
+
var hasMore = amount > 0 && data.length > amount;
|
|
150
181
|
return {
|
|
151
|
-
items: data.map(function (item) {
|
|
182
|
+
items: (hasMore ? data.slice(0, amount) : data).map(function (item) {
|
|
152
183
|
return {
|
|
153
184
|
name: item.name,
|
|
154
185
|
count: item.count,
|
|
@@ -156,7 +187,9 @@ Archives.Cacheable = cacheComponent(Archives, 'widget.archives', function (props
|
|
|
156
187
|
};
|
|
157
188
|
}),
|
|
158
189
|
title: _p('common.archive', Infinity),
|
|
159
|
-
showCount: showCount
|
|
190
|
+
showCount: showCount,
|
|
191
|
+
moreUrl: hasMore ? url_for("".concat(config.archive_dir, "/")) : null,
|
|
192
|
+
moreTitle: translate(__, 'widget.more', 'More')
|
|
160
193
|
};
|
|
161
194
|
});
|
|
162
195
|
module.exports = Archives;
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -22,6 +22,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/i18n'),
|
|
26
|
+
translate = _require3.translate;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Categories widget JSX component.
|
|
@@ -66,8 +68,14 @@ var Categories = /*#__PURE__*/function (_Component) {
|
|
|
66
68
|
var _this$props = this.props,
|
|
67
69
|
title = _this$props.title,
|
|
68
70
|
showCount = _this$props.showCount,
|
|
69
|
-
categories = _this$props.categories
|
|
70
|
-
|
|
71
|
+
categories = _this$props.categories,
|
|
72
|
+
moreUrl = _this$props.moreUrl,
|
|
73
|
+
moreTitle = _this$props.moreTitle;
|
|
74
|
+
return (0, _inferno.createVNode)(1, "div", "card widget", (0, _inferno.createVNode)(1, "div", "card-content", (0, _inferno.createVNode)(1, "div", "menu", [(0, _inferno.createVNode)(1, "h3", "menu-label", title, 0), (0, _inferno.createVNode)(1, "ul", "menu-list", [this.renderList(categories, showCount), moreUrl ? (0, _inferno.createVNode)(1, "li", null, (0, _inferno.createVNode)(1, "a", "level is-mobile", [(0, _inferno.createVNode)(1, "span", "level-start", (0, _inferno.createVNode)(1, "span", "level-item", moreTitle, 0), 2), (0, _inferno.createVNode)(1, "span", "level-end", (0, _inferno.createVNode)(1, "span", "level-item icon is-small", (0, _inferno.createVNode)(1, "i", "fas fa-chevron-right"), 2, {
|
|
75
|
+
"aria-hidden": "true"
|
|
76
|
+
}), 2)], 4, {
|
|
77
|
+
"href": moreUrl
|
|
78
|
+
}), 2) : null], 0)], 4), 2), 2, {
|
|
71
79
|
"data-type": "categories"
|
|
72
80
|
});
|
|
73
81
|
}
|
|
@@ -113,9 +121,11 @@ Categories.Cacheable = cacheComponent(Categories, 'widget.categories', function
|
|
|
113
121
|
_widget$showCurrent = widget.showCurrent,
|
|
114
122
|
showCurrent = _widget$showCurrent === void 0 ? false : _widget$showCurrent,
|
|
115
123
|
_widget$showCount = widget.showCount,
|
|
116
|
-
showCount = _widget$showCount === void 0 ? true : _widget$showCount
|
|
124
|
+
showCount = _widget$showCount === void 0 ? true : _widget$showCount,
|
|
125
|
+
amount = widget.amount;
|
|
117
126
|
var url_for = helper.url_for,
|
|
118
|
-
_p = helper._p
|
|
127
|
+
_p = helper._p,
|
|
128
|
+
__ = helper.__;
|
|
119
129
|
if (!categories || !categories.length) {
|
|
120
130
|
return null;
|
|
121
131
|
}
|
|
@@ -163,10 +173,16 @@ Categories.Cacheable = cacheComponent(Categories, 'widget.categories', function
|
|
|
163
173
|
};
|
|
164
174
|
});
|
|
165
175
|
}
|
|
176
|
+
|
|
177
|
+
// Only limit the top-level categories, and link to the category page when some are not shown
|
|
178
|
+
var list = hierarchicalList(0);
|
|
179
|
+
var hasMore = amount > 0 && list.length > amount;
|
|
166
180
|
return {
|
|
167
181
|
showCount: showCount,
|
|
168
|
-
categories:
|
|
169
|
-
title: _p('common.category', Infinity)
|
|
182
|
+
categories: hasMore ? list.slice(0, amount) : list,
|
|
183
|
+
title: _p('common.category', Infinity),
|
|
184
|
+
moreUrl: hasMore ? url_for('categories/') : null,
|
|
185
|
+
moreTitle: translate(__, 'widget.more', 'More')
|
|
170
186
|
};
|
|
171
187
|
});
|
|
172
188
|
module.exports = Categories;
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
package/lib/view/widget/links.js
CHANGED
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
package/lib/view/widget/tags.js
CHANGED
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -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/i18n'),
|
|
26
|
+
translate = _require3.translate;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Tags widget JSX component.
|
|
@@ -50,12 +52,18 @@ var Tags = /*#__PURE__*/function (_Component) {
|
|
|
50
52
|
var _this$props = this.props,
|
|
51
53
|
tags = _this$props.tags,
|
|
52
54
|
title = _this$props.title,
|
|
53
|
-
showCount = _this$props.showCount
|
|
54
|
-
|
|
55
|
+
showCount = _this$props.showCount,
|
|
56
|
+
moreUrl = _this$props.moreUrl,
|
|
57
|
+
moreTitle = _this$props.moreTitle;
|
|
58
|
+
return (0, _inferno.createVNode)(1, "div", "card widget", (0, _inferno.createVNode)(1, "div", "card-content", (0, _inferno.createVNode)(1, "div", "menu", [(0, _inferno.createVNode)(1, "h3", "menu-label", title, 0), (0, _inferno.createVNode)(1, "div", "field is-grouped is-grouped-multiline", [tags.map(function (tag) {
|
|
55
59
|
return (0, _inferno.createVNode)(1, "div", "control", (0, _inferno.createVNode)(1, "a", "tags has-addons", [(0, _inferno.createVNode)(1, "span", "tag", tag.name, 0), showCount ? (0, _inferno.createVNode)(1, "span", "tag", tag.count, 0) : null], 0, {
|
|
56
60
|
"href": tag.url
|
|
57
61
|
}), 2);
|
|
58
|
-
}), 0)
|
|
62
|
+
}), moreUrl ? (0, _inferno.createVNode)(1, "div", "control", (0, _inferno.createVNode)(1, "a", "tags has-addons", (0, _inferno.createVNode)(1, "span", "tag", [(0, _inferno.createVNode)(1, "span", null, moreTitle, 0), (0, _inferno.createVNode)(1, "span", "icon is-small", (0, _inferno.createVNode)(1, "i", "fas fa-chevron-right"), 2, {
|
|
63
|
+
"aria-hidden": "true"
|
|
64
|
+
})], 4), 2, {
|
|
65
|
+
"href": moreUrl
|
|
66
|
+
}), 2) : null], 0)], 4), 2), 2, {
|
|
59
67
|
"data-type": "tags"
|
|
60
68
|
});
|
|
61
69
|
}
|
|
@@ -94,19 +102,24 @@ Tags.Cacheable = cacheComponent(Tags, 'widget.tags', function (props) {
|
|
|
94
102
|
show_count = _widget$show_count === void 0 ? true : _widget$show_count;
|
|
95
103
|
var tags = props.tags || props.site.tags;
|
|
96
104
|
var url_for = helper.url_for,
|
|
97
|
-
_p = helper._p
|
|
105
|
+
_p = helper._p,
|
|
106
|
+
__ = helper.__;
|
|
98
107
|
if (!tags || !tags.length) {
|
|
99
108
|
return null;
|
|
100
109
|
}
|
|
101
110
|
tags = tags.sort(order_by).filter(function (tag) {
|
|
102
111
|
return tag.length;
|
|
103
112
|
});
|
|
104
|
-
|
|
113
|
+
// Link to the tag page when some of the tags are not shown
|
|
114
|
+
var hasMore = amount > 0 && tags.length > amount;
|
|
115
|
+
if (hasMore) {
|
|
105
116
|
tags = tags.limit(amount);
|
|
106
117
|
}
|
|
107
118
|
return {
|
|
108
119
|
showCount: show_count,
|
|
109
120
|
title: _p('common.tag', Infinity),
|
|
121
|
+
moreUrl: hasMore ? url_for('tags/') : null,
|
|
122
|
+
moreTitle: translate(__, 'widget.more', 'More'),
|
|
110
123
|
tags: tags.map(function (tag) {
|
|
111
124
|
return {
|
|
112
125
|
name: tag.name,
|
package/lib/view/widget/toc.js
CHANGED
|
@@ -6,7 +6,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
6
6
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
7
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t,
|
|
9
|
+
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
12
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hexo-component-inferno",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
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",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"format": "npm run _format -- --write",
|
|
18
18
|
"format-check": "npm run _format -- --check",
|
|
19
19
|
"docs": "jsdoc src/**/* -d doc -t node_modules/minami",
|
|
20
|
-
"build": "babel src --out-dir lib && cp -r src/schema lib/schema",
|
|
20
|
+
"build": "babel src --out-dir lib && mkdir -p lib/schema && cp -r src/schema/. lib/schema",
|
|
21
21
|
"clean": "rm -rf lib doc coverage",
|
|
22
22
|
"prepare": "npm run build"
|
|
23
23
|
},
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"lib/",
|
|
29
|
+
"!lib/**/*.test.js",
|
|
29
30
|
"asset/"
|
|
30
31
|
],
|
|
31
32
|
"devDependencies": {
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
"@babel/preset-env": "^7.23.9",
|
|
35
36
|
"@types/hexo": "^3.8.12",
|
|
36
37
|
"@types/hexo-util": "^0.6.8",
|
|
37
|
-
"babel-plugin-inferno": "
|
|
38
|
+
"babel-plugin-inferno": "~6.8.5",
|
|
38
39
|
"cheerio": "1.0.0-rc.12",
|
|
39
40
|
"deepmerge": "^4.3.1",
|
|
40
41
|
"eslint": "^8.56.0",
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
"eslint-plugin-jest": "^27.6.3",
|
|
44
45
|
"eslint-plugin-json": "^3.1.0",
|
|
45
46
|
"eslint-plugin-react": "^7.33.2",
|
|
47
|
+
"hexo": "^7.1.1",
|
|
46
48
|
"hexo-renderer-marked": "^6.2.0",
|
|
47
49
|
"html-minifier": "^4.0.0",
|
|
48
50
|
"inferno-server": "^8.2.3",
|
|
@@ -52,11 +54,11 @@
|
|
|
52
54
|
"jsdoc": "^4.0.2",
|
|
53
55
|
"minami": "^1.2.3",
|
|
54
56
|
"prettier": "^3.2.4",
|
|
55
|
-
"taffydb": "^2.7.3"
|
|
57
|
+
"taffydb": "^2.7.3",
|
|
58
|
+
"typescript": "^5.9.3"
|
|
56
59
|
},
|
|
57
60
|
"dependencies": {
|
|
58
61
|
"ajv": "^8.12.0",
|
|
59
|
-
"hexo": "^7.1.1",
|
|
60
62
|
"hexo-pagination": "^3.0.0",
|
|
61
63
|
"hexo-util": "^3.2.0",
|
|
62
64
|
"inferno": "^8.2.3",
|
|
@@ -64,5 +66,8 @@
|
|
|
64
66
|
"js-yaml": "^4.1.0",
|
|
65
67
|
"moment": "^2.30.1",
|
|
66
68
|
"semver": "^7.5.4"
|
|
69
|
+
},
|
|
70
|
+
"peerDependencies": {
|
|
71
|
+
"hexo": "^7.1.1 || ^8.0.0"
|
|
67
72
|
}
|
|
68
73
|
}
|