hexo-component-inferno 4.2.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -18
- package/asset/css/github-calendar.css +41 -0
- package/asset/js/algolia.js +18 -69
- package/asset/js/github-calendar.js +185 -0
- package/asset/js/google_cse.js +19 -68
- package/asset/js/insight.js +45 -208
- package/lib/core/commented_yaml.js +35 -0
- package/lib/core/default_value.js +150 -0
- package/lib/core/schema.js +8 -196
- package/lib/core/schema_util.js +14 -0
- package/lib/hexo/helper/cdn.js +10 -97
- package/lib/hexo/tag/tabs.js +4 -84
- package/lib/schema/comment/artalk.json +7 -1
- package/lib/schema/comment/facebook.json +1 -1
- package/lib/schema/comment/gitalk.json +23 -6
- package/lib/schema/comment/gitment.json +1 -1
- package/lib/schema/comment/twikoo.json +3 -3
- package/lib/schema/comment/waline.json +28 -3
- package/lib/schema/misc/open_graph.json +2 -1
- package/lib/schema/plugin/cookie_consent.json +2 -2
- package/lib/schema/plugin/mathjax.json +1 -1
- package/lib/schema/plugin/outdated_browser.json +1 -1
- package/lib/schema/share/bdshare.json +1 -1
- package/lib/schema/share/sharejs.json +1 -1
- package/lib/schema/share/web_share.json +13 -0
- package/lib/schema/widget/github_calendar.json +30 -0
- package/lib/schema/widget/profile.json +67 -0
- package/lib/util/archives.js +86 -0
- package/lib/util/categories.js +102 -0
- package/lib/util/cdn-rules.js +109 -0
- package/lib/util/cdn.js +116 -0
- package/lib/util/consent.js +122 -0
- package/lib/util/deprecate.js +1 -1
- package/lib/util/gallery.js +227 -0
- package/lib/util/insight-search.js +98 -0
- package/lib/util/searchbox.js +88 -0
- package/lib/util/tab-options.js +109 -0
- package/lib/view/comment/artalk.js +24 -6
- package/lib/view/comment/disqus.js +1 -1
- package/lib/view/comment/disqusjs.js +7 -6
- package/lib/view/comment/facebook.js +3 -16
- package/lib/view/comment/gitalk.js +18 -15
- package/lib/view/comment/gitment.js +2 -2
- package/lib/view/comment/twikoo.js +5 -3
- package/lib/view/comment/valine.js +4 -3
- package/lib/view/comment/waline.js +8 -6
- package/lib/view/misc/open_graph.js +3 -5
- package/lib/view/plugin/cookie_consent.js +8 -7
- package/lib/view/plugin/gallery.js +42 -19
- package/lib/view/plugin/katex.js +4 -4
- package/lib/view/plugin/mathjax.js +10 -7
- package/lib/view/plugin/outdated_browser.js +59 -45
- package/lib/view/plugin/progressbar.js +6 -1
- package/lib/view/plugin/waline_pageview.js +2 -2
- package/lib/view/search/algolia.js +8 -3
- package/lib/view/search/google_cse.js +13 -10
- package/lib/view/search/insight.js +9 -2
- package/lib/view/share/addthis.js +4 -9
- package/lib/view/share/addtoany.js +23 -5
- package/lib/view/share/bdshare.js +9 -30
- package/lib/view/share/sharejs.js +7 -34
- package/lib/view/share/sharethis.js +21 -6
- package/lib/view/share/web_share.js +153 -0
- package/lib/view/widget/archives.js +19 -71
- package/lib/view/widget/categories.js +20 -67
- package/lib/view/widget/github_calendar.js +94 -0
- package/lib/view/widget/profile.js +194 -0
- package/lib/view/widget/subscribe_email.js +4 -26
- package/package.json +6 -4
|
@@ -14,8 +14,9 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
14
14
|
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
15
15
|
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
16
16
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
17
|
+
/* eslint-env browser */
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
+
* Theme capability warning, without a third-party browser SDK or user-agent sniffing.
|
|
19
20
|
* @module view/plugin/outdated_browser
|
|
20
21
|
*/
|
|
21
22
|
var _require = require('inferno'),
|
|
@@ -23,16 +24,43 @@ var _require = require('inferno'),
|
|
|
23
24
|
var _require2 = require('../../util/cache'),
|
|
24
25
|
cacheComponent = _require2.cacheComponent;
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
// Keep this code ES5: it must also run in the browsers it warns about. Each invocation
|
|
28
|
+
// binds only its own notice, including after a page replacement; no global listeners.
|
|
29
|
+
/* eslint-disable no-var -- This function is serialized into an old-browser inline script. */
|
|
30
|
+
function checkBrowser(requiredFeatures) {
|
|
31
|
+
var notice = document.getElementById('outdated');
|
|
32
|
+
if (!notice) return;
|
|
33
|
+
function supports(property, value) {
|
|
34
|
+
if (window.CSS && typeof window.CSS.supports === 'function') {
|
|
35
|
+
return property === 'selector' ? window.CSS.supports('selector(' + value + ')') : window.CSS.supports(property, value);
|
|
36
|
+
}
|
|
37
|
+
if (property === 'selector') {
|
|
38
|
+
try {
|
|
39
|
+
document.querySelector(value);
|
|
40
|
+
return true;
|
|
41
|
+
} catch (e) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
var style = document.createElement('div').style;
|
|
46
|
+
style.setProperty(property, value);
|
|
47
|
+
return style.getPropertyValue(property) !== '';
|
|
48
|
+
}
|
|
49
|
+
var compatible = true;
|
|
50
|
+
for (var i = 0; i < requiredFeatures.length; i++) {
|
|
51
|
+
if (!supports(requiredFeatures[i][0], requiredFeatures[i][1])) {
|
|
52
|
+
compatible = false;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
notice.style.display = compatible ? 'none' : 'block';
|
|
57
|
+
document.getElementById('btnCloseUpdateBrowser').onclick = function () {
|
|
58
|
+
notice.style.display = 'none';
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/* eslint-enable no-var */
|
|
62
|
+
|
|
63
|
+
/** Non-blocking warning. Requirements are CSS property/value pairs, or ['selector', selector]. */
|
|
36
64
|
var OutdatedBrowser = /*#__PURE__*/function (_Component) {
|
|
37
65
|
function OutdatedBrowser() {
|
|
38
66
|
_classCallCheck(this, OutdatedBrowser);
|
|
@@ -44,27 +72,26 @@ var OutdatedBrowser = /*#__PURE__*/function (_Component) {
|
|
|
44
72
|
value: function render() {
|
|
45
73
|
var _this$props = this.props,
|
|
46
74
|
head = _this$props.head,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
});
|
|
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.\xA0"), (0, _inferno.createVNode)(1, "a", null, [(0, _inferno.createTextVNode)("Update my browser now"), (0, _inferno.createTextVNode)(' ')], 0, {
|
|
75
|
+
_this$props$requiredF = _this$props.requiredFeatures,
|
|
76
|
+
requiredFeatures = _this$props$requiredF === void 0 ? [['display', 'flex']] : _this$props$requiredF;
|
|
77
|
+
if (head) return null;
|
|
78
|
+
var js = '(' + checkBrowser.toString() + ')(' + JSON.stringify(requiredFeatures).replace(/</g, "\\u003c") + ');';
|
|
79
|
+
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", null, [(0, _inferno.createVNode)(1, "strong", null, "Your browser may not display this theme correctly.", 16, {
|
|
80
|
+
"style": "color:#332701;"
|
|
81
|
+
}), (0, _inferno.createVNode)(1, "p", null, [(0, _inferno.createTextVNode)("Some essential layout or color features are unavailable. You can continue reading or"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "a", null, "update your browser", 16, {
|
|
57
82
|
"id": "btnUpdateBrowser",
|
|
58
|
-
"href": "
|
|
59
|
-
|
|
60
|
-
|
|
83
|
+
"href": "https://browsehappy.com/",
|
|
84
|
+
"style": "color:#004085;text-decoration:underline;"
|
|
85
|
+
}), (0, _inferno.createTextVNode)(".")], 0, {
|
|
86
|
+
"style": "color:#332701;margin:8px 0;"
|
|
87
|
+
}), (0, _inferno.createVNode)(1, "button", null, "Dismiss", 16, {
|
|
88
|
+
"type": "button",
|
|
61
89
|
"id": "btnCloseUpdateBrowser",
|
|
62
|
-
"
|
|
63
|
-
})
|
|
64
|
-
"id": "outdated"
|
|
65
|
-
|
|
66
|
-
"
|
|
67
|
-
"defer": true
|
|
90
|
+
"style": "background:#fff;color:#332701;border:1px solid #332701;padding:4px 12px;cursor:pointer;"
|
|
91
|
+
})], 4, {
|
|
92
|
+
"id": "outdated",
|
|
93
|
+
"role": "status",
|
|
94
|
+
"style": "display:none;background:#fff3cd;color:#332701;padding:16px;margin:0;text-align:center;font:16px/1.5 sans-serif;"
|
|
68
95
|
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
69
96
|
"dangerouslySetInnerHTML": {
|
|
70
97
|
__html: js
|
|
@@ -73,25 +100,12 @@ var OutdatedBrowser = /*#__PURE__*/function (_Component) {
|
|
|
73
100
|
}
|
|
74
101
|
}]);
|
|
75
102
|
}(Component);
|
|
76
|
-
/**
|
|
77
|
-
* Cacheable outdated browser detection plugin JSX component.
|
|
78
|
-
* <p>
|
|
79
|
-
* This class is supposed to be used in combination with the <code>locals</code> hexo filter
|
|
80
|
-
* ({@link module:hexo/filter/locals}).
|
|
81
|
-
*
|
|
82
|
-
* @see module:util/cache.cacheComponent
|
|
83
|
-
* @example
|
|
84
|
-
* <OutdatedBrowser.Cacheable
|
|
85
|
-
* head={true}
|
|
86
|
-
* helper={{ cdn: function() {...} }} />
|
|
87
|
-
*/
|
|
88
103
|
OutdatedBrowser.Cacheable = cacheComponent(OutdatedBrowser, 'plugin.outdatedbrowser', function (props) {
|
|
89
104
|
var head = props.head,
|
|
90
|
-
|
|
105
|
+
requiredFeatures = props.requiredFeatures;
|
|
91
106
|
return {
|
|
92
107
|
head: head,
|
|
93
|
-
|
|
94
|
-
jsUrl: helper.cdn('outdatedbrowser', '1.1.5', 'outdatedbrowser/outdatedbrowser.min.js')
|
|
108
|
+
requiredFeatures: requiredFeatures
|
|
95
109
|
};
|
|
96
110
|
});
|
|
97
111
|
module.exports = OutdatedBrowser;
|
|
@@ -40,8 +40,13 @@ var ProgressBar = /*#__PURE__*/function (_Component) {
|
|
|
40
40
|
key: "render",
|
|
41
41
|
value: function render() {
|
|
42
42
|
var jsUrl = this.props.jsUrl;
|
|
43
|
-
var css = ".pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.pace-inactive{display:none}.pace .pace-progress{background:#3273dc;position:fixed;z-index:2000;top:0;right:100%;width:100%;height:
|
|
43
|
+
var css = ".pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.pace-inactive{display:none}.pace .pace-progress{background:#3273dc;position:fixed;z-index:2000;top:0;right:100%;width:100%;height:3px}";
|
|
44
|
+
var js = "window.paceOptions = Object.assign({}, window.paceOptions, {\n restartOnPushState: false,\n restartOnRequestAfter: false\n });\n document.addEventListener('pjax:send', function () {\n if (window.Pace) window.Pace.restart();\n });";
|
|
44
45
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "style", null, css, 0), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
46
|
+
"dangerouslySetInnerHTML": {
|
|
47
|
+
__html: js
|
|
48
|
+
}
|
|
49
|
+
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
45
50
|
"src": jsUrl
|
|
46
51
|
})], 4);
|
|
47
52
|
}
|
|
@@ -52,7 +52,7 @@ var WalinePageview = /*#__PURE__*/function (_Component) {
|
|
|
52
52
|
jsUrl = _this$props.jsUrl;
|
|
53
53
|
|
|
54
54
|
// Waline publishes the counter as an ES module, so load it with a dynamic import
|
|
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:
|
|
55
|
+
var js = "(function () {\n var abort = null;\n var generation = 0;\n function count() {\n var path = window.location.pathname;\n var current = ++generation;\n import(".concat(toJs(jsUrl), ").then(function (Waline) {\n if (current !== generation || path !== window.location.pathname) return;\n if (abort) {\n abort();\n }\n abort = Waline.pageviewCount({\n serverURL: ").concat(toJs(serverURL), ",\n path: path,\n });\n });\n }\n count();\n document.addEventListener('pjax:complete', count);\n })();");
|
|
56
56
|
return (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
57
57
|
"dangerouslySetInnerHTML": {
|
|
58
58
|
__html: js
|
|
@@ -94,7 +94,7 @@ WalinePageview.Cacheable = cacheComponent(WalinePageview, 'plugin.walinepageview
|
|
|
94
94
|
}
|
|
95
95
|
return {
|
|
96
96
|
serverURL: serverURL,
|
|
97
|
-
jsUrl: helper.cdn('@waline/client', '3.
|
|
97
|
+
jsUrl: helper.cdn('@waline/client', '3.16.1', 'dist/pageview.js')
|
|
98
98
|
};
|
|
99
99
|
});
|
|
100
100
|
module.exports = WalinePageview;
|
|
@@ -24,6 +24,7 @@ var _require2 = require('../../util/cache'),
|
|
|
24
24
|
cacheComponent = _require2.cacheComponent;
|
|
25
25
|
var _require3 = require('../../util/script'),
|
|
26
26
|
toJs = _require3.toJs;
|
|
27
|
+
var searchbox = require('../../util/searchbox');
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Algolia search engine JSX component.
|
|
@@ -71,7 +72,7 @@ var Algolia = /*#__PURE__*/function (_Component) {
|
|
|
71
72
|
indexName: indexName,
|
|
72
73
|
excerpt: excerpt
|
|
73
74
|
};
|
|
74
|
-
var js = "
|
|
75
|
+
var js = "function initAlgolia() {\n loadAlgolia(".concat(toJs(config), ", ").concat(toJs(translation), ");\n }\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', initAlgolia, { once: true });\n } else {\n initAlgolia();\n }");
|
|
75
76
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "searchbox", [(0, _inferno.createVNode)(1, "div", "searchbox-mask", null, 1, {
|
|
76
77
|
"style": "position:absolute;bottom:0px;left:0px;right:0px;top:0px;"
|
|
77
78
|
}), (0, _inferno.createVNode)(1, "div", "searchbox-container", [(0, _inferno.createVNode)(1, "div", "searchbox-header", [(0, _inferno.createVNode)(1, "div", "searchbox-input-container", null, 1, {
|
|
@@ -82,6 +83,10 @@ var Algolia = /*#__PURE__*/function (_Component) {
|
|
|
82
83
|
}), (0, _inferno.createVNode)(1, "a", "searchbox-close", "\xD7", 16, {
|
|
83
84
|
"href": "javascript:;"
|
|
84
85
|
})], 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, {
|
|
86
|
+
"dangerouslySetInnerHTML": {
|
|
87
|
+
__html: searchbox
|
|
88
|
+
}
|
|
89
|
+
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
85
90
|
"src": algoliaSearchUrl,
|
|
86
91
|
"crossorigin": "anonymous",
|
|
87
92
|
"defer": true
|
|
@@ -138,8 +143,8 @@ Algolia.Cacheable = cacheComponent(Algolia, 'search.algolia', function (props) {
|
|
|
138
143
|
apiKey: algolia ? algolia.apiKey : null,
|
|
139
144
|
indexName: algolia ? algolia.indexName : null,
|
|
140
145
|
excerpt: search.excerpt ? search.excerpt : 'excerpt',
|
|
141
|
-
algoliaSearchUrl: helper.cdn('algoliasearch', '
|
|
142
|
-
instantSearchUrl: helper.cdn('instantsearch.js', '4.
|
|
146
|
+
algoliaSearchUrl: helper.cdn('algoliasearch', '5.60.0', 'dist/lite/builds/browser.umd.js'),
|
|
147
|
+
instantSearchUrl: helper.cdn('instantsearch.js', '4.120.0', 'dist/instantsearch.production.min.js'),
|
|
143
148
|
jsUrl: helper.url_for('/js/algolia.js')
|
|
144
149
|
};
|
|
145
150
|
});
|
|
@@ -24,6 +24,7 @@ var _require2 = require('../../util/cache'),
|
|
|
24
24
|
cacheComponent = _require2.cacheComponent;
|
|
25
25
|
var _require3 = require('../../util/script'),
|
|
26
26
|
toJs = _require3.toJs;
|
|
27
|
+
var searchbox = require('../../util/searchbox');
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Google custom search engine JSX component.
|
|
@@ -48,22 +49,20 @@ var GoogleCSE = /*#__PURE__*/function (_Component) {
|
|
|
48
49
|
cx = _this$props.cx,
|
|
49
50
|
hint = _this$props.hint,
|
|
50
51
|
jsUrl = _this$props.jsUrl;
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "style", null, null, 1, {
|
|
54
|
-
"dangerouslySetInnerHTML": {
|
|
55
|
-
__html: css
|
|
56
|
-
}
|
|
57
|
-
}), (0, _inferno.createVNode)(1, "div", "searchbox", [(0, _inferno.createVNode)(1, "div", "searchbox-mask", null, 1, {
|
|
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=' + encodeURIComponent(cx);\n var body = document.querySelector('.searchbox .searchbox-body');\n gcse.onerror = function() {\n if (!body || !body.isConnected) return;\n body.textContent = 'Google search could not load. Check the configured cx value and your network or content blocker settings.';\n body.setAttribute('role', 'alert');\n };\n var s = document.getElementsByTagName('script')[0];\n s.parentNode.insertBefore(gcse, s);\n })();");
|
|
53
|
+
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "searchbox searchbox-google", [(0, _inferno.createVNode)(1, "div", "searchbox-mask", null, 1, {
|
|
58
54
|
"style": "position:absolute;bottom:0px;left:0px;right:0px;top:0px;"
|
|
59
|
-
}), (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)(
|
|
55
|
+
}), (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)(1, "span", "icon", (0, _inferno.createVNode)(1, "i", "fas fa-search"), 2, {
|
|
56
|
+
"aria-hidden": "true"
|
|
57
|
+
}), (0, _inferno.createVNode)(64, "input", "searchbox-input", null, 1, {
|
|
60
58
|
"type": "text",
|
|
61
59
|
"placeholder": hint
|
|
62
|
-
}),
|
|
60
|
+
})], 4), (0, _inferno.createVNode)(1, "a", "searchbox-close", "\xD7", 16, {
|
|
63
61
|
"href": "javascript:;"
|
|
64
62
|
})], 4), function () {
|
|
65
63
|
if (cx) {
|
|
66
|
-
|
|
64
|
+
// The theme owns narrow-screen layout; keep one result/pagination DOM on all devices.
|
|
65
|
+
var innerHtml = '<gcse:searchresults-only mobileLayout="disabled"></gcse:searchresults-only>';
|
|
67
66
|
return (0, _inferno.createVNode)(1, "div", "searchbox-body", null, 1, {
|
|
68
67
|
"dangerouslySetInnerHTML": {
|
|
69
68
|
__html: innerHtml
|
|
@@ -76,6 +75,10 @@ var GoogleCSE = /*#__PURE__*/function (_Component) {
|
|
|
76
75
|
__html: js1
|
|
77
76
|
}
|
|
78
77
|
}) : null], 0), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
78
|
+
"dangerouslySetInnerHTML": {
|
|
79
|
+
__html: searchbox
|
|
80
|
+
}
|
|
81
|
+
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
79
82
|
"src": jsUrl
|
|
80
83
|
})], 4);
|
|
81
84
|
}
|
|
@@ -24,6 +24,8 @@ var _require2 = require('../../util/cache'),
|
|
|
24
24
|
cacheComponent = _require2.cacheComponent;
|
|
25
25
|
var _require3 = require('../../util/script'),
|
|
26
26
|
toJs = _require3.toJs;
|
|
27
|
+
var searchbox = require('../../util/searchbox');
|
|
28
|
+
var createInsightSearch = require('../../util/insight-search');
|
|
27
29
|
|
|
28
30
|
/**
|
|
29
31
|
* Algolia search engine JSX component.
|
|
@@ -54,15 +56,20 @@ var Insight = /*#__PURE__*/function (_Component) {
|
|
|
54
56
|
translation = _this$props.translation,
|
|
55
57
|
contentUrl = _this$props.contentUrl,
|
|
56
58
|
jsUrl = _this$props.jsUrl;
|
|
57
|
-
var js = "
|
|
59
|
+
var js = "function initInsight() {\n loadInsight(".concat(toJs({
|
|
58
60
|
contentUrl: contentUrl
|
|
59
|
-
}), ", ").concat(toJs(translation), ");\n })
|
|
61
|
+
}), ", ").concat(toJs(translation), ");\n }\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', initInsight, { once: true });\n } else {\n initInsight();\n }");
|
|
60
62
|
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, {
|
|
61
63
|
"type": "text",
|
|
62
64
|
"placeholder": translation.hint
|
|
63
65
|
}), 2), (0, _inferno.createVNode)(1, "a", "searchbox-close", "\xD7", 16, {
|
|
64
66
|
"href": "javascript:;"
|
|
65
67
|
})], 4), (0, _inferno.createVNode)(1, "div", "searchbox-body")], 4), 2), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
68
|
+
"data-pjax": true,
|
|
69
|
+
"dangerouslySetInnerHTML": {
|
|
70
|
+
__html: "".concat(searchbox, "\nwindow.searchInsight = (").concat(createInsightSearch.toString(), ")();")
|
|
71
|
+
}
|
|
72
|
+
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
66
73
|
"data-pjax": true,
|
|
67
74
|
"src": jsUrl,
|
|
68
75
|
"defer": true
|
|
@@ -42,15 +42,10 @@ var AddThis = /*#__PURE__*/function (_Component) {
|
|
|
42
42
|
return _createClass(AddThis, [{
|
|
43
43
|
key: "render",
|
|
44
44
|
value: function render() {
|
|
45
|
-
deprecate('share.addthis', '
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "addthis_inline_share_toolbox"), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
51
|
-
"src": installUrl,
|
|
52
|
-
"defer": true
|
|
53
|
-
})], 4);
|
|
45
|
+
deprecate('share.addthis', 'Service shut down. Use AddToAny or ShareThis.');
|
|
46
|
+
return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("AddThis shut down on May 31, 2023. Set "), (0, _inferno.createVNode)(1, "code", null, "share.type", 16), (0, _inferno.createTextVNode)(" to "), (0, _inferno.createVNode)(1, "code", null, "web_share", 16), (0, _inferno.createTextVNode)(","), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "addtoany", 16), (0, _inferno.createTextVNode)(", or "), (0, _inferno.createVNode)(1, "code", null, "sharethis", 16), (0, _inferno.createTextVNode)(".")], 0, {
|
|
47
|
+
"role": "status"
|
|
48
|
+
});
|
|
54
49
|
}
|
|
55
50
|
}]);
|
|
56
51
|
}(Component);
|
|
@@ -22,6 +22,7 @@ var _require = require('inferno'),
|
|
|
22
22
|
Component = _require.Component;
|
|
23
23
|
var _require2 = require('../../util/cache'),
|
|
24
24
|
cacheComponent = _require2.cacheComponent;
|
|
25
|
+
var loadScripts = require('../../util/script');
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* AddToAny share buttons JSX component.
|
|
@@ -39,11 +40,23 @@ var AddToAny = /*#__PURE__*/function (_Component) {
|
|
|
39
40
|
return _createClass(AddToAny, [{
|
|
40
41
|
key: "render",
|
|
41
42
|
value: function render() {
|
|
43
|
+
var _this$props = this.props,
|
|
44
|
+
url = _this$props.url,
|
|
45
|
+
title = _this$props.title;
|
|
46
|
+
var initialize = "if (!kit || !kit.isConnected) return;\n if (window.a2a && typeof window.a2a.init_all === 'function') window.a2a.init_all();";
|
|
47
|
+
var js = "(function () {\n var kit = document.getElementById('addtoany-share');\n ".concat(loadScripts('https://static.addtoany.com/menu/page.js', initialize), "\n })();");
|
|
42
48
|
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "a2a_kit a2a_kit_size_32 a2a_default_style", [(0, _inferno.createVNode)(1, "a", "a2a_dd", null, 1, {
|
|
43
49
|
"href": "https://www.addtoany.com/share"
|
|
44
|
-
}), (0, _inferno.createVNode)(1, "a", "a2a_button_facebook"), (0, _inferno.createVNode)(1, "a", "a2a_button_twitter"), (0, _inferno.createVNode)(1, "a", "a2a_button_telegram"), (0, _inferno.createVNode)(1, "a", "a2a_button_whatsapp"), (0, _inferno.createVNode)(1, "a", "a2a_button_reddit")], 4
|
|
45
|
-
"
|
|
46
|
-
"
|
|
50
|
+
}), (0, _inferno.createVNode)(1, "a", "a2a_button_facebook"), (0, _inferno.createVNode)(1, "a", "a2a_button_twitter"), (0, _inferno.createVNode)(1, "a", "a2a_button_telegram"), (0, _inferno.createVNode)(1, "a", "a2a_button_whatsapp"), (0, _inferno.createVNode)(1, "a", "a2a_button_reddit")], 4, {
|
|
51
|
+
"id": "addtoany-share",
|
|
52
|
+
"style": "display:flex;justify-content:center;flex-wrap:wrap",
|
|
53
|
+
"data-a2a-url": url,
|
|
54
|
+
"data-a2a-title": title,
|
|
55
|
+
"data-share-provider": "addtoany"
|
|
56
|
+
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
57
|
+
"dangerouslySetInnerHTML": {
|
|
58
|
+
__html: js
|
|
59
|
+
}
|
|
47
60
|
})], 4);
|
|
48
61
|
}
|
|
49
62
|
}]);
|
|
@@ -58,7 +71,12 @@ var AddToAny = /*#__PURE__*/function (_Component) {
|
|
|
58
71
|
* @example
|
|
59
72
|
* <AddToAny.Cacheable />
|
|
60
73
|
*/
|
|
61
|
-
AddToAny.Cacheable = cacheComponent(AddToAny, 'share.addtoany', function (
|
|
62
|
-
|
|
74
|
+
AddToAny.Cacheable = cacheComponent(AddToAny, 'share.addtoany', function (_ref) {
|
|
75
|
+
var _ref$page = _ref.page,
|
|
76
|
+
page = _ref$page === void 0 ? {} : _ref$page;
|
|
77
|
+
return {
|
|
78
|
+
url: page.permalink,
|
|
79
|
+
title: page.title
|
|
80
|
+
};
|
|
63
81
|
});
|
|
64
82
|
module.exports = AddToAny;
|
|
@@ -17,16 +17,19 @@ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf
|
|
|
17
17
|
/**
|
|
18
18
|
* Baidu share buttons JSX component.
|
|
19
19
|
* @module view/share/bdshare
|
|
20
|
+
* @deprecated Retained for compatibility only. Use AddToAny or ShareThis instead.
|
|
20
21
|
*/
|
|
21
22
|
var _require = require('inferno'),
|
|
22
23
|
Component = _require.Component;
|
|
23
24
|
var _require2 = require('../../util/cache'),
|
|
24
25
|
cacheComponent = _require2.cacheComponent;
|
|
26
|
+
var _require3 = require('../../util/deprecate'),
|
|
27
|
+
deprecate = _require3.deprecate;
|
|
25
28
|
|
|
26
29
|
/**
|
|
27
30
|
* Baidu share buttons JSX component.
|
|
28
31
|
*
|
|
29
|
-
* @
|
|
32
|
+
* @deprecated Legacy integration with HTTP mixed content and obsolete targets. Use AddToAny or ShareThis instead.
|
|
30
33
|
* @example
|
|
31
34
|
* <BdShare />
|
|
32
35
|
*/
|
|
@@ -39,40 +42,16 @@ var BdShare = /*#__PURE__*/function (_Component) {
|
|
|
39
42
|
return _createClass(BdShare, [{
|
|
40
43
|
key: "render",
|
|
41
44
|
value: function render() {
|
|
42
|
-
|
|
43
|
-
return (0, _inferno.
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
}), (0, _inferno.createVNode)(1, "a", "bds_qzone", null, 1, {
|
|
47
|
-
"href": "#",
|
|
48
|
-
"data-cmd": "qzone",
|
|
49
|
-
"title": "分享到QQ空间"
|
|
50
|
-
}), (0, _inferno.createVNode)(1, "a", "bds_tsina", null, 1, {
|
|
51
|
-
"href": "#",
|
|
52
|
-
"data-cmd": "tsina",
|
|
53
|
-
"title": "分享到新浪微博"
|
|
54
|
-
}), (0, _inferno.createVNode)(1, "a", "bds_tqq", null, 1, {
|
|
55
|
-
"href": "#",
|
|
56
|
-
"data-cmd": "tqq",
|
|
57
|
-
"title": "分享到腾讯微博"
|
|
58
|
-
}), (0, _inferno.createVNode)(1, "a", "bds_renren", null, 1, {
|
|
59
|
-
"href": "#",
|
|
60
|
-
"data-cmd": "renren",
|
|
61
|
-
"title": "分享到人人网"
|
|
62
|
-
}), (0, _inferno.createVNode)(1, "a", "bds_weixin", null, 1, {
|
|
63
|
-
"href": "#",
|
|
64
|
-
"data-cmd": "weixin",
|
|
65
|
-
"title": "分享到微信"
|
|
66
|
-
})], 4), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
67
|
-
"dangerouslySetInnerHTML": {
|
|
68
|
-
__html: js
|
|
69
|
-
}
|
|
70
|
-
})], 4);
|
|
45
|
+
deprecate('share.bdshare', 'HTTP mixed content; use AddToAny or ShareThis.');
|
|
46
|
+
return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("This legacy Baidu Share integration is deprecated because it uses HTTP assets and obsolete sharing targets. Set "), (0, _inferno.createVNode)(1, "code", null, "share.type", 16), (0, _inferno.createTextVNode)(" to "), (0, _inferno.createVNode)(1, "code", null, "web_share", 16), (0, _inferno.createTextVNode)(","), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "addtoany", 16), (0, _inferno.createTextVNode)(", or "), (0, _inferno.createVNode)(1, "code", null, "sharethis", 16), (0, _inferno.createTextVNode)(".")], 0, {
|
|
47
|
+
"role": "status"
|
|
48
|
+
});
|
|
71
49
|
}
|
|
72
50
|
}]);
|
|
73
51
|
}(Component);
|
|
74
52
|
/**
|
|
75
53
|
* Cacheable Baidu share buttons JSX component.
|
|
54
|
+
* @deprecated Retained for compatibility only. Use AddToAny or ShareThis instead.
|
|
76
55
|
* <p>
|
|
77
56
|
* This class is supposed to be used in combination with the <code>locals</code> hexo filter
|
|
78
57
|
* ({@link module:hexo/filter/locals}).
|
|
@@ -15,21 +15,15 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
|
|
|
15
15
|
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
16
16
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
17
17
|
/**
|
|
18
|
-
* Share.js
|
|
18
|
+
* Retired Share.js configuration entry.
|
|
19
19
|
* @module view/share/sharejs
|
|
20
20
|
*/
|
|
21
21
|
var _require = require('inferno'),
|
|
22
22
|
Component = _require.Component;
|
|
23
23
|
var _require2 = require('../../util/cache'),
|
|
24
24
|
cacheComponent = _require2.cacheComponent;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* Share.js share buttons JSX component.
|
|
28
|
-
*
|
|
29
|
-
* @see https://github.com/overtrue/share.js
|
|
30
|
-
* @example
|
|
31
|
-
* <ShareJs cssUrl="/path/to/share.css" jsUrl="/path/to/social-share.js" />
|
|
32
|
-
*/
|
|
25
|
+
var _require3 = require('../../util/deprecate'),
|
|
26
|
+
deprecate = _require3.deprecate;
|
|
33
27
|
var ShareJs = /*#__PURE__*/function (_Component) {
|
|
34
28
|
function ShareJs() {
|
|
35
29
|
_classCallCheck(this, ShareJs);
|
|
@@ -39,33 +33,12 @@ var ShareJs = /*#__PURE__*/function (_Component) {
|
|
|
39
33
|
return _createClass(ShareJs, [{
|
|
40
34
|
key: "render",
|
|
41
35
|
value: function render() {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
jsUrl = _this$props.jsUrl;
|
|
45
|
-
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "link", null, null, 1, {
|
|
46
|
-
"rel": "stylesheet",
|
|
47
|
-
"href": cssUrl
|
|
48
|
-
}), (0, _inferno.createVNode)(1, "div", "social-share"), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
49
|
-
"src": jsUrl
|
|
50
|
-
})], 4);
|
|
36
|
+
deprecate('share.sharejs', 'Retired; select web_share or addtoany.');
|
|
37
|
+
return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("Share.js is retired. Set "), (0, _inferno.createVNode)(1, "code", null, "share.type", 16), (0, _inferno.createTextVNode)(" to "), (0, _inferno.createVNode)(1, "code", null, "web_share", 16), (0, _inferno.createTextVNode)(" or"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "addtoany", 16), (0, _inferno.createTextVNode)(".")], 0);
|
|
51
38
|
}
|
|
52
39
|
}]);
|
|
53
40
|
}(Component);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
* <p>
|
|
57
|
-
* This class is supposed to be used in combination with the <code>locals</code> hexo filter
|
|
58
|
-
* ({@link module:hexo/filter/locals}).
|
|
59
|
-
*
|
|
60
|
-
* @see module:util/cache.cacheComponent
|
|
61
|
-
* @example
|
|
62
|
-
* <ShareJs.Cacheable helper={{ cdn: function() {...} }} />
|
|
63
|
-
*/
|
|
64
|
-
ShareJs.Cacheable = cacheComponent(ShareJs, 'share.sharejs', function (props) {
|
|
65
|
-
var helper = props.helper;
|
|
66
|
-
return {
|
|
67
|
-
cssUrl: helper.cdn('social-share.js', '1.0.16', 'dist/css/share.min.css'),
|
|
68
|
-
jsUrl: helper.cdn('social-share.js', '1.0.16', 'dist/js/social-share.min.js')
|
|
69
|
-
};
|
|
41
|
+
ShareJs.Cacheable = cacheComponent(ShareJs, 'share.sharejs', function () {
|
|
42
|
+
return {};
|
|
70
43
|
});
|
|
71
44
|
module.exports = ShareJs;
|
|
@@ -22,6 +22,7 @@ var _require = require('inferno'),
|
|
|
22
22
|
Component = _require.Component;
|
|
23
23
|
var _require2 = require('../../util/cache'),
|
|
24
24
|
cacheComponent = _require2.cacheComponent;
|
|
25
|
+
var loadScripts = require('../../util/script');
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* ShareThis share buttons JSX component.
|
|
@@ -39,13 +40,23 @@ var ShareThis = /*#__PURE__*/function (_Component) {
|
|
|
39
40
|
return _createClass(ShareThis, [{
|
|
40
41
|
key: "render",
|
|
41
42
|
value: function render() {
|
|
42
|
-
var
|
|
43
|
+
var _this$props = this.props,
|
|
44
|
+
installUrl = _this$props.installUrl,
|
|
45
|
+
url = _this$props.url,
|
|
46
|
+
title = _this$props.title;
|
|
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 ShareThis. Please set it in"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 0);
|
|
45
49
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
50
|
+
var initialize = "\n if (!container || !container.isConnected || container.querySelector('.st-btn')) return;\n var sdk = window.__sharethis__;\n // Reuse the account settings when PJAX replaces the container.\n if (sdk && sdk.config && typeof sdk.load === 'function') {\n var settings = Object.assign({}, sdk.config['inline-share-buttons']);\n if (container.dataset.url) settings.url = container.dataset.url;\n if (container.dataset.title) settings.title = container.dataset.title;\n sdk.load('inline-share-buttons', settings);\n }";
|
|
51
|
+
return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "sharethis-inline-share-buttons", null, 1, {
|
|
52
|
+
"id": "sharethis-share",
|
|
53
|
+
"data-share-provider": "sharethis",
|
|
54
|
+
"data-url": url,
|
|
55
|
+
"data-title": title
|
|
56
|
+
}), (0, _inferno.createVNode)(1, "script", null, null, 1, {
|
|
57
|
+
"dangerouslySetInnerHTML": {
|
|
58
|
+
__html: "(function () {\n var container = document.getElementById('sharethis-share');\n ".concat(loadScripts(installUrl, initialize), "\n })();")
|
|
59
|
+
}
|
|
49
60
|
})], 4);
|
|
50
61
|
}
|
|
51
62
|
}]);
|
|
@@ -61,9 +72,13 @@ var ShareThis = /*#__PURE__*/function (_Component) {
|
|
|
61
72
|
* <ShareThis.Cacheable share={{ install_url: '******' }} />
|
|
62
73
|
*/
|
|
63
74
|
ShareThis.Cacheable = cacheComponent(ShareThis, 'share.sharethis', function (props) {
|
|
64
|
-
var share = props.share
|
|
75
|
+
var share = props.share,
|
|
76
|
+
_props$page = props.page,
|
|
77
|
+
page = _props$page === void 0 ? {} : _props$page;
|
|
65
78
|
return {
|
|
66
|
-
installUrl: share.install_url
|
|
79
|
+
installUrl: share.install_url,
|
|
80
|
+
url: page.permalink,
|
|
81
|
+
title: page.title
|
|
67
82
|
};
|
|
68
83
|
});
|
|
69
84
|
module.exports = ShareThis;
|