hexo-component-inferno 4.2.2 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +5 -18
  2. package/asset/css/github-calendar.css +41 -0
  3. package/asset/js/algolia.js +18 -69
  4. package/asset/js/github-calendar.js +185 -0
  5. package/asset/js/google_cse.js +19 -68
  6. package/asset/js/insight.js +45 -208
  7. package/lib/core/commented_yaml.js +35 -0
  8. package/lib/core/default_value.js +150 -0
  9. package/lib/core/schema.js +8 -196
  10. package/lib/core/schema_util.js +14 -0
  11. package/lib/hexo/helper/cdn.js +10 -97
  12. package/lib/hexo/tag/tabs.js +4 -84
  13. package/lib/schema/comment/artalk.json +7 -1
  14. package/lib/schema/comment/cusdis.json +1 -1
  15. package/lib/schema/comment/facebook.json +1 -1
  16. package/lib/schema/comment/gitalk.json +23 -6
  17. package/lib/schema/comment/gitment.json +1 -1
  18. package/lib/schema/comment/livere.json +9 -3
  19. package/lib/schema/comment/twikoo.json +3 -3
  20. package/lib/schema/comment/waline.json +28 -3
  21. package/lib/schema/misc/open_graph.json +2 -1
  22. package/lib/schema/plugin/cookie_consent.json +2 -2
  23. package/lib/schema/plugin/mathjax.json +1 -1
  24. package/lib/schema/plugin/outdated_browser.json +1 -1
  25. package/lib/schema/share/bdshare.json +1 -1
  26. package/lib/schema/share/sharejs.json +1 -1
  27. package/lib/schema/share/web_share.json +13 -0
  28. package/lib/schema/widget/github_calendar.json +30 -0
  29. package/lib/schema/widget/profile.json +67 -0
  30. package/lib/util/archives.js +86 -0
  31. package/lib/util/categories.js +102 -0
  32. package/lib/util/cdn-rules.js +109 -0
  33. package/lib/util/cdn.js +116 -0
  34. package/lib/util/consent.js +122 -0
  35. package/lib/util/deprecate.js +1 -1
  36. package/lib/util/gallery.js +227 -0
  37. package/lib/util/insight-search.js +98 -0
  38. package/lib/util/searchbox.js +88 -0
  39. package/lib/util/tab-options.js +109 -0
  40. package/lib/view/comment/artalk.js +24 -6
  41. package/lib/view/comment/cusdis.js +4 -0
  42. package/lib/view/comment/disqus.js +1 -1
  43. package/lib/view/comment/disqusjs.js +7 -6
  44. package/lib/view/comment/facebook.js +3 -16
  45. package/lib/view/comment/gitalk.js +18 -15
  46. package/lib/view/comment/gitment.js +2 -2
  47. package/lib/view/comment/livere.js +25 -4
  48. package/lib/view/comment/twikoo.js +5 -3
  49. package/lib/view/comment/valine.js +4 -3
  50. package/lib/view/comment/waline.js +8 -6
  51. package/lib/view/misc/open_graph.js +3 -5
  52. package/lib/view/plugin/cookie_consent.js +8 -7
  53. package/lib/view/plugin/gallery.js +42 -19
  54. package/lib/view/plugin/katex.js +4 -4
  55. package/lib/view/plugin/mathjax.js +10 -7
  56. package/lib/view/plugin/outdated_browser.js +59 -45
  57. package/lib/view/plugin/progressbar.js +6 -1
  58. package/lib/view/plugin/waline_pageview.js +2 -2
  59. package/lib/view/search/algolia.js +8 -3
  60. package/lib/view/search/google_cse.js +13 -10
  61. package/lib/view/search/insight.js +9 -2
  62. package/lib/view/share/addthis.js +4 -9
  63. package/lib/view/share/addtoany.js +23 -5
  64. package/lib/view/share/bdshare.js +9 -30
  65. package/lib/view/share/sharejs.js +7 -34
  66. package/lib/view/share/sharethis.js +21 -6
  67. package/lib/view/share/web_share.js +153 -0
  68. package/lib/view/widget/archives.js +19 -71
  69. package/lib/view/widget/categories.js +20 -67
  70. package/lib/view/widget/github_calendar.js +94 -0
  71. package/lib/view/widget/profile.js +194 -0
  72. package/lib/view/widget/subscribe_email.js +4 -26
  73. package/package.json +6 -4
@@ -15,29 +15,30 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
15
15
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
16
16
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
17
17
  /**
18
- * Light Gallery and Justified Gallery plugins JSX component.
18
+ * lightGallery and Justified Gallery plugins JSX component.
19
19
  * @module view/plugin/gallery
20
20
  */
21
21
  var _require = require('inferno'),
22
22
  Component = _require.Component;
23
23
  var _require2 = require('../../util/cache'),
24
24
  cacheComponent = _require2.cacheComponent;
25
+ var gallery = require('../../util/gallery');
25
26
 
26
27
  /**
27
- * Light Gallery and Justified Gallery plugins JSX component.
28
+ * lightGallery and Justified Gallery plugins JSX component.
28
29
  *
29
- * @see http://sachinchoolur.github.io/lightGallery/
30
+ * @see https://www.lightgalleryjs.com/
30
31
  * @see http://miromannino.github.io/Justified-Gallery/
31
32
  * @example
32
33
  * <Gallery
33
34
  * head={true}
34
35
  * lightGallery={{
35
- * jsUrl: '/path/to/lightgallery.js',
36
- * cssUrl: '/path/to/lightgallery.css'
36
+ * jsUrl: '/path/to/lightgallery.min.js',
37
+ * cssUrl: '/path/to/lightgallery-bundle.min.css'
37
38
  * }}
38
39
  * justifiedGallery={{
39
- * jsUrl: '/path/to/justifiedGallery.js',
40
- * cssUrl: '/path/to/justifiedGallery.css'
40
+ * jsUrl: '/path/to/justified-gallery.js',
41
+ * cssUrl: '/path/to/justified-gallery.css'
41
42
  * }} />
42
43
  */
43
44
  var Gallery = /*#__PURE__*/function (_Component) {
@@ -53,32 +54,44 @@ var Gallery = /*#__PURE__*/function (_Component) {
53
54
  head = _this$props.head,
54
55
  lightGallery = _this$props.lightGallery,
55
56
  justifiedGallery = _this$props.justifiedGallery;
57
+ var plugins = lightGallery.plugins || [];
56
58
  if (head) {
57
59
  return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "link", null, null, 1, {
58
60
  "rel": "stylesheet",
59
- "href": lightGallery.cssUrl
61
+ "href": lightGallery.cssUrl,
62
+ "data-pjax": true
60
63
  }), (0, _inferno.createVNode)(1, "link", null, null, 1, {
61
64
  "rel": "stylesheet",
62
- "href": justifiedGallery.cssUrl
65
+ "href": justifiedGallery.cssUrl,
66
+ "data-pjax": true
63
67
  })], 4);
64
68
  }
65
- var js = "window.addEventListener(\"load\", () => {\n if (typeof $.fn.lightGallery === 'function') {\n $('.article').lightGallery({ selector: '.gallery-item' });\n }\n if (typeof $.fn.justifiedGallery === 'function') {\n if ($('.justified-gallery > p > .gallery-item').length) {\n $('.justified-gallery > p > .gallery-item').unwrap();\n }\n $('.justified-gallery').justifiedGallery();\n }\n });";
69
+ var js = "".concat(gallery, "\nwindow.HexoGallery.lightGalleryPlugins = ").concat(JSON.stringify(plugins.map(function (plugin) {
70
+ return plugin.name;
71
+ })).replace(/</g, "\\u003c"), ";\nwindow.HexoGallery.init(document, {\n lightGallery: true,\n justifiedGallery: true\n });");
66
72
  return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "script", null, null, 1, {
67
73
  "src": lightGallery.jsUrl,
68
74
  "defer": true
69
- }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
70
- "src": justifiedGallery.jsUrl,
71
- "defer": true
75
+ }), plugins.map(function (plugin) {
76
+ return (0, _inferno.createVNode)(1, "script", null, null, 1, {
77
+ "src": plugin.jsUrl,
78
+ "defer": true
79
+ }, plugin.name);
72
80
  }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
73
81
  "dangerouslySetInnerHTML": {
74
82
  __html: js
75
83
  }
76
- })], 4);
84
+ }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
85
+ "type": "module",
86
+ "dangerouslySetInnerHTML": {
87
+ __html: "import { JustifiedGallery } from ".concat(JSON.stringify(justifiedGallery.jsUrl).replace(/</g, "\\u003c"), ";\nwindow.JustifiedGallery = JustifiedGallery;\ndocument.dispatchEvent(new Event('hexo:gallery:ready'));")
88
+ }
89
+ })], 0);
77
90
  }
78
91
  }]);
79
92
  }(Component);
80
93
  /**
81
- * Cacheable Light Gallery and Justified Gallery plugins JSX component.
94
+ * Cacheable lightGallery and Justified Gallery plugins JSX component.
82
95
  * <p>
83
96
  * This class is supposed to be used in combination with the <code>locals</code> hexo filter
84
97
  * ({@link module:hexo/filter/locals}).
@@ -95,12 +108,22 @@ Gallery.Cacheable = cacheComponent(Gallery, 'plugin.gallery', function (props) {
95
108
  return {
96
109
  head: head,
97
110
  lightGallery: {
98
- jsUrl: helper.cdn('lightgallery', '1.10.0', 'dist/js/lightgallery-all.min.js'),
99
- cssUrl: helper.cdn('lightgallery', '1.10.0', 'dist/css/lightgallery.min.css')
111
+ jsUrl: helper.cdn('lightgallery', '3.0.0', 'lightgallery.min.js'),
112
+ cssUrl: helper.cdn('lightgallery', '3.0.0', 'css/lightgallery-bundle.min.css'),
113
+ plugins: [{
114
+ name: 'lgZoom',
115
+ jsUrl: helper.cdn('lightgallery', '3.0.0', 'plugins/zoom/lg-zoom.min.js')
116
+ }, {
117
+ name: 'lgThumbnail',
118
+ jsUrl: helper.cdn('lightgallery', '3.0.0', 'plugins/thumbnail/lg-thumbnail.min.js')
119
+ }, {
120
+ name: 'lgFullscreen',
121
+ jsUrl: helper.cdn('lightgallery', '3.0.0', 'plugins/fullscreen/lg-fullscreen.min.js')
122
+ }]
100
123
  },
101
124
  justifiedGallery: {
102
- jsUrl: helper.cdn('justifiedGallery', '3.8.1', 'dist/js/jquery.justifiedGallery.min.js'),
103
- cssUrl: helper.cdn('justifiedGallery', '3.8.1', 'dist/css/justifiedGallery.min.css')
125
+ jsUrl: helper.cdn('justified-gallery', '4.0.2', 'dist/justified-gallery.js'),
126
+ cssUrl: helper.cdn('justified-gallery', '4.0.2', 'dist/assets/justified-gallery.css')
104
127
  }
105
128
  };
106
129
  });
@@ -88,10 +88,10 @@ KaTeX.Cacheable = cacheComponent(KaTeX, 'plugin.katex', function (props) {
88
88
  return null;
89
89
  }
90
90
  return {
91
- jsUrl: helper.cdn('katex', '0.15.1', 'dist/katex.min.js'),
92
- cssUrl: helper.cdn('katex', '0.15.1', 'dist/katex.min.css'),
93
- autoRenderUrl: helper.cdn('katex', '0.15.1', 'dist/contrib/auto-render.min.js'),
94
- mhchemUrl: helper.cdn('katex', '0.15.1', 'dist/contrib/mhchem.min.js')
91
+ jsUrl: helper.cdn('katex', '0.19.1', 'dist/katex.min.js'),
92
+ cssUrl: helper.cdn('katex', '0.19.1', 'dist/katex.min.css'),
93
+ autoRenderUrl: helper.cdn('katex', '0.19.1', 'dist/contrib/auto-render.min.js'),
94
+ mhchemUrl: helper.cdn('katex', '0.19.1', 'dist/contrib/mhchem.min.js')
95
95
  };
96
96
  });
97
97
  module.exports = KaTeX;
@@ -16,7 +16,7 @@ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new T
16
16
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
17
17
  /**
18
18
  * MathJax math renderer plugin JSX component.
19
- * @module view/plugin/katex
19
+ * @module view/plugin/mathjax
20
20
  */
21
21
  var _require = require('inferno'),
22
22
  Component = _require.Component;
@@ -28,7 +28,7 @@ var _require2 = require('../../util/cache'),
28
28
  *
29
29
  * @see https://www.mathjax.org/
30
30
  * @example
31
- * <Mathjax jsUrl="/path/to/mathjax.js" />
31
+ * <Mathjax jsUrl="/mathjax/tex-mml-chtml.js" fontPath="/mathjax-newcm-font" />
32
32
  */
33
33
  var Mathjax = /*#__PURE__*/function (_Component) {
34
34
  function Mathjax() {
@@ -39,16 +39,18 @@ var Mathjax = /*#__PURE__*/function (_Component) {
39
39
  return _createClass(Mathjax, [{
40
40
  key: "render",
41
41
  value: function render() {
42
- var jsUrl = this.props.jsUrl;
43
- var js = "MathJax = {\n tex: {\n inlineMath: [['$', '$'], ['\\\\(', '\\\\)']]\n },\n svg: {\n fontCache: 'global'\n },\n chtml: {\n matchFontHeight: false\n }\n };";
42
+ var _this$props = this.props,
43
+ jsUrl = _this$props.jsUrl,
44
+ fontPath = _this$props.fontPath;
45
+ var js = "window.MathJax = window.MathJax || {\n tex: {\n inlineMath: [['$', '$'], ['\\\\(', '\\\\)']]\n },\n output: {\n font: 'mathjax-newcm',\n ".concat(fontPath ? "fontPath: ".concat(JSON.stringify(fontPath).replace(/</g, "\\u003c")) : '', "\n }\n };");
44
46
  return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "script", null, null, 1, {
45
47
  "type": "text/javascript",
46
- "id": "MathJax-script",
47
- "async": true,
48
48
  "dangerouslySetInnerHTML": {
49
49
  __html: js
50
50
  }
51
51
  }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
52
+ "id": "MathJax-script",
53
+ "defer": true,
52
54
  "src": jsUrl
53
55
  })], 4);
54
56
  }
@@ -73,7 +75,8 @@ Mathjax.Cacheable = cacheComponent(Mathjax, 'plugin.mathjax', function (props) {
73
75
  return null;
74
76
  }
75
77
  return {
76
- jsUrl: helper.cdn('mathjax', '3.2.2', 'es5/tex-mml-chtml.js')
78
+ jsUrl: helper.cdn('mathjax', '4.1.3', 'tex-mml-chtml.js'),
79
+ fontPath: helper.cdn('@mathjax/mathjax-newcm-font', '4.1.3', 'chtml.js').replace(/\/chtml\.js$/, '')
77
80
  };
78
81
  });
79
82
  module.exports = Mathjax;
@@ -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
- * Outdated browser detection plugin JSX component.
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
- * Outdated browser detection plugin JSX component.
28
- *
29
- * @see https://github.com/outdatedbrowser/outdated-browser
30
- * @example
31
- * <OutdatedBrowser
32
- * head={true}
33
- * cssUrl="/path/to/outdatedbrowser.css"
34
- * jsUrl="/path/to/outdatedbrowser.js" />
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
- jsUrl = _this$props.jsUrl,
48
- cssUrl = _this$props.cssUrl;
49
- var js = "window.addEventListener(\"load\", function () {\n outdatedBrowser({\n bgColor: '#f25648',\n color: '#ffffff',\n lowerThan: 'object-fit' // display on IE11 or below\n });\n });";
50
- if (head) {
51
- return (0, _inferno.createVNode)(1, "link", null, null, 1, {
52
- "rel": "stylesheet",
53
- "href": cssUrl
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": "http://outdatedbrowser.com/"
59
- })], 4), (0, _inferno.createVNode)(1, "p", "last", (0, _inferno.createVNode)(1, "a", null, "\xD7", 16, {
60
- "href": "#",
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
- "title": "Close"
63
- }), 2)], 4, {
64
- "id": "outdated"
65
- }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
66
- "src": jsUrl,
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
- helper = props.helper;
105
+ requiredFeatures = props.requiredFeatures;
91
106
  return {
92
107
  head: head,
93
- cssUrl: helper.cdn('outdatedbrowser', '1.1.5', 'outdatedbrowser/outdatedbrowser.min.css'),
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:2px}";
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: window.location.pathname,\n });\n });\n }\n count();\n document.addEventListener('pjax:complete', count);\n })();");
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.3.0', 'dist/pageview.js')
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 = "document.addEventListener('DOMContentLoaded', function () {\n loadAlgolia(".concat(toJs(config), ", ").concat(toJs(translation), ");\n });");
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', '4.0.3', 'dist/algoliasearch-lite.umd.js'),
142
- instantSearchUrl: helper.cdn('instantsearch.js', '4.3.1', 'dist/instantsearch.production.min.js'),
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 css = '.searchbox .searchbox-body { background: white; }';
52
- var js1 = "(function() {\n var cx = ".concat(toJs(cx), ";\n var gcse = document.createElement('script');\n gcse.type = 'text/javascript';\n gcse.async = true;\n gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;\n var s = document.getElementsByTagName('script')[0];\n s.parentNode.insertBefore(gcse, s);\n })();");
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)(64, "input", "searchbox-input", null, 1, {
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
- }), 2), (0, _inferno.createVNode)(1, "a", "searchbox-close", "\xD7", 16, {
60
+ })], 4), (0, _inferno.createVNode)(1, "a", "searchbox-close", "\xD7", 16, {
63
61
  "href": "javascript:;"
64
62
  })], 4), function () {
65
63
  if (cx) {
66
- var innerHtml = '<gcse:searchresults-only></gcse:searchresults-only>';
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 = "document.addEventListener('DOMContentLoaded', function () {\n loadInsight(".concat(toJs({
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', 'AddThis shut down on May 31, 2023. Use AddToAny or ShareThis instead.');
46
- var installUrl = this.props.installUrl;
47
- if (!installUrl) {
48
- return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You need to set "), (0, _inferno.createVNode)(1, "code", null, "install_url", 16), (0, _inferno.createTextVNode)(" to use AddThis. Please set it in"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 0);
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), (0, _inferno.createVNode)(1, "script", null, null, 1, {
45
- "src": "https://static.addtoany.com/menu/page.js",
46
- "defer": true
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 (props) {
62
- return {};
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;