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.
Files changed (161) hide show
  1. package/asset/js/algolia.js +51 -10
  2. package/asset/js/google_cse.js +50 -7
  3. package/asset/js/insight.js +48 -7
  4. package/lib/hexo/filter/locals.js +2 -2
  5. package/lib/hexo/helper/cdn.js +10 -2
  6. package/lib/schema/comment/artalk.json +37 -0
  7. package/lib/schema/comment/beaudar.json +62 -0
  8. package/lib/schema/comment/cusdis.json +34 -0
  9. package/lib/schema/comment/giscus.json +7 -1
  10. package/lib/schema/comment/utterances.json +15 -1
  11. package/lib/schema/comment/valine.json +2 -2
  12. package/lib/schema/comment/waline.json +1 -1
  13. package/lib/schema/plugin/matomo.json +25 -0
  14. package/lib/schema/plugin/umami.json +25 -0
  15. package/lib/schema/plugin/waline_pageview.json +14 -0
  16. package/lib/schema/search/algolia.json +4 -0
  17. package/lib/schema/widget/archives.json +5 -0
  18. package/lib/schema/widget/categories.json +5 -0
  19. package/lib/schema/widget/tags.json +1 -1
  20. package/lib/util/appearance.js +40 -0
  21. package/lib/util/i18n.js +24 -0
  22. package/lib/util/script.js +110 -0
  23. package/lib/view/comment/artalk.js +118 -0
  24. package/lib/view/comment/beaudar.js +133 -0
  25. package/lib/view/comment/changyan.js +5 -5
  26. package/lib/view/comment/cusdis.js +119 -0
  27. package/lib/view/comment/disqus.js +1 -1
  28. package/lib/view/comment/disqusjs.js +6 -5
  29. package/lib/view/comment/facebook.js +1 -1
  30. package/lib/view/comment/giscus.js +32 -22
  31. package/lib/view/comment/gitalk.js +6 -5
  32. package/lib/view/comment/gitment.js +6 -5
  33. package/lib/view/comment/isso.js +7 -3
  34. package/lib/view/comment/livere.js +1 -1
  35. package/lib/view/comment/twikoo.js +3 -4
  36. package/lib/view/comment/utterances.js +26 -17
  37. package/lib/view/comment/valine.js +3 -6
  38. package/lib/view/comment/waline.js +16 -9
  39. package/lib/view/common/article_media.js +2 -2
  40. package/lib/view/donate/afdian.js +1 -1
  41. package/lib/view/donate/alipay.js +1 -1
  42. package/lib/view/donate/buymeacoffee.js +1 -1
  43. package/lib/view/donate/patreon.js +1 -1
  44. package/lib/view/donate/paypal.js +1 -1
  45. package/lib/view/donate/wechat.js +1 -1
  46. package/lib/view/misc/article_licensing.js +1 -1
  47. package/lib/view/misc/meta.js +1 -1
  48. package/lib/view/misc/open_graph.js +1 -1
  49. package/lib/view/misc/paginator.js +9 -5
  50. package/lib/view/misc/structured_data.js +1 -1
  51. package/lib/view/misc/web_app.js +2 -2
  52. package/lib/view/plugin/baidu_analytics.js +1 -1
  53. package/lib/view/plugin/bing_webmaster.js +1 -1
  54. package/lib/view/plugin/busuanzi.js +1 -1
  55. package/lib/view/plugin/cnzz.js +1 -1
  56. package/lib/view/plugin/cookie_consent.js +1 -1
  57. package/lib/view/plugin/gallery.js +2 -2
  58. package/lib/view/plugin/google_analytics.js +1 -1
  59. package/lib/view/plugin/hotjar.js +1 -1
  60. package/lib/view/plugin/katex.js +1 -1
  61. package/lib/view/plugin/mathjax.js +1 -1
  62. package/lib/view/plugin/matomo.js +89 -0
  63. package/lib/view/plugin/outdated_browser.js +1 -1
  64. package/lib/view/plugin/progressbar.js +1 -1
  65. package/lib/view/plugin/statcounter.js +1 -1
  66. package/lib/view/plugin/twitter_conversion_tracking.js +1 -1
  67. package/lib/view/plugin/umami.js +88 -0
  68. package/lib/view/plugin/waline_pageview.js +98 -0
  69. package/lib/view/search/algolia.js +11 -5
  70. package/lib/view/search/baidu.js +5 -3
  71. package/lib/view/search/google_cse.js +4 -2
  72. package/lib/view/search/insight.js +1 -1
  73. package/lib/view/share/addthis.js +1 -1
  74. package/lib/view/share/addtoany.js +1 -1
  75. package/lib/view/share/bdshare.js +1 -1
  76. package/lib/view/share/sharejs.js +1 -1
  77. package/lib/view/share/sharethis.js +1 -1
  78. package/lib/view/widget/adsense.js +1 -1
  79. package/lib/view/widget/archives.js +45 -12
  80. package/lib/view/widget/categories.js +23 -7
  81. package/lib/view/widget/followit.js +1 -1
  82. package/lib/view/widget/links.js +1 -1
  83. package/lib/view/widget/recent_posts.js +1 -1
  84. package/lib/view/widget/subscribe_email.js +1 -1
  85. package/lib/view/widget/tags.js +19 -6
  86. package/lib/view/widget/toc.js +1 -1
  87. package/package.json +10 -5
  88. package/lib/core/migrate.test.js +0 -48
  89. package/lib/core/schema.test.js +0 -520
  90. package/lib/core/view.test.js +0 -41
  91. package/lib/hexo/filter/locals.test.js +0 -118
  92. package/lib/hexo/generator/assets.test.js +0 -32
  93. package/lib/hexo/generator/categories.test.js +0 -41
  94. package/lib/hexo/generator/category.test.js +0 -84
  95. package/lib/hexo/generator/insight.test.js +0 -95
  96. package/lib/hexo/generator/manifest.test.js +0 -52
  97. package/lib/hexo/generator/tags.test.js +0 -41
  98. package/lib/hexo/helper/cdn.test.js +0 -128
  99. package/lib/hexo/helper/page.test.js +0 -62
  100. package/lib/hexo/tag/message.test.js +0 -72
  101. package/lib/hexo/tag/tabs.test.js +0 -98
  102. package/lib/schema/schema/comment/changyan.json +0 -21
  103. package/lib/schema/schema/comment/disqus.json +0 -17
  104. package/lib/schema/schema/comment/disqusjs.json +0 -53
  105. package/lib/schema/schema/comment/facebook.json +0 -13
  106. package/lib/schema/schema/comment/giscus.json +0 -105
  107. package/lib/schema/schema/comment/gitalk.json +0 -81
  108. package/lib/schema/schema/comment/gitment.json +0 -47
  109. package/lib/schema/schema/comment/isso.json +0 -17
  110. package/lib/schema/schema/comment/livere.json +0 -17
  111. package/lib/schema/schema/comment/twikoo.json +0 -28
  112. package/lib/schema/schema/comment/utterances.json +0 -59
  113. package/lib/schema/schema/comment/valine.json +0 -105
  114. package/lib/schema/schema/comment/waline.json +0 -176
  115. package/lib/schema/schema/donate/afdian.json +0 -17
  116. package/lib/schema/schema/donate/alipay.json +0 -17
  117. package/lib/schema/schema/donate/buymeacoffee.json +0 -17
  118. package/lib/schema/schema/donate/patreon.json +0 -17
  119. package/lib/schema/schema/donate/paypal.json +0 -22
  120. package/lib/schema/schema/donate/wechat.json +0 -17
  121. package/lib/schema/schema/misc/manifest.json +0 -66
  122. package/lib/schema/schema/misc/meta.json +0 -11
  123. package/lib/schema/schema/misc/open_graph.json +0 -78
  124. package/lib/schema/schema/misc/poly_links.json +0 -35
  125. package/lib/schema/schema/misc/structured_data.json +0 -47
  126. package/lib/schema/schema/plugin/baidu_analytics.json +0 -14
  127. package/lib/schema/schema/plugin/bing_webmaster.json +0 -14
  128. package/lib/schema/schema/plugin/busuanzi.json +0 -7
  129. package/lib/schema/schema/plugin/cnzz.json +0 -19
  130. package/lib/schema/schema/plugin/cookie_consent.json +0 -38
  131. package/lib/schema/schema/plugin/gallery.json +0 -7
  132. package/lib/schema/schema/plugin/google_analytics.json +0 -14
  133. package/lib/schema/schema/plugin/hotjar.json +0 -14
  134. package/lib/schema/schema/plugin/katex.json +0 -7
  135. package/lib/schema/schema/plugin/mathjax.json +0 -7
  136. package/lib/schema/schema/plugin/outdated_browser.json +0 -7
  137. package/lib/schema/schema/plugin/progressbar.json +0 -7
  138. package/lib/schema/schema/plugin/statcounter.json +0 -19
  139. package/lib/schema/schema/plugin/twitter_conversion_tracking.json +0 -14
  140. package/lib/schema/schema/search/algolia.json +0 -13
  141. package/lib/schema/schema/search/baidu.json +0 -13
  142. package/lib/schema/schema/search/google_cse.json +0 -17
  143. package/lib/schema/schema/search/insight.json +0 -19
  144. package/lib/schema/schema/share/addthis.json +0 -17
  145. package/lib/schema/schema/share/addtoany.json +0 -13
  146. package/lib/schema/schema/share/bdshare.json +0 -13
  147. package/lib/schema/schema/share/sharejs.json +0 -13
  148. package/lib/schema/schema/share/sharethis.json +0 -17
  149. package/lib/schema/schema/widget/adsense.json +0 -21
  150. package/lib/schema/schema/widget/archives.json +0 -13
  151. package/lib/schema/schema/widget/categories.json +0 -13
  152. package/lib/schema/schema/widget/followit.json +0 -26
  153. package/lib/schema/schema/widget/links.json +0 -47
  154. package/lib/schema/schema/widget/recent_posts.json +0 -13
  155. package/lib/schema/schema/widget/subscribe_email.json +0 -22
  156. package/lib/schema/schema/widget/tags.json +0 -30
  157. package/lib/schema/schema/widget/toc.json +0 -31
  158. package/lib/util/cache.test.js +0 -24
  159. package/lib/util/classname.test.js +0 -13
  160. package/lib/util/yaml.test.js +0 -18
  161. package/lib/view/widget/toc.test.js +0 -30
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Utility functions for translations.
3
+ * @module util/i18n
4
+ */
5
+
6
+ /**
7
+ * Translate a key with the <code>__</code> helper of Hexo, or use the fallback text when the theme has
8
+ * no translation for the key, in which case Hexo returns the key itself.
9
+ *
10
+ * @param {Function} __ The <code>__</code> helper function of Hexo.
11
+ * @param {string} key The translation key.
12
+ * @param {string} fallback The text to use without a translation.
13
+ * @returns {string} The translated text.
14
+ *
15
+ * @example
16
+ * translate(helper.__, 'widget.more', 'More');
17
+ */
18
+ function translate(__, key, fallback) {
19
+ const text = typeof __ === 'function' ? __(key) : null;
20
+ return text && text !== key ? text : fallback;
21
+ }
22
+ module.exports = {
23
+ translate
24
+ };
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Utility functions for building inline scripts that load external scripts without blocking the page.
3
+ * @module util/script
4
+ */
5
+
6
+ /**
7
+ * Build an inline script that loads external scripts asynchronously and in order, and then runs the
8
+ * given code.
9
+ * <p>
10
+ * A script that is already on the page is not added again. If it has finished loading, or it was not
11
+ * added by this function, the next one is loaded, or the code runs, right away. This lets the inline
12
+ * script be run again, for example by PJAX after switching pages, without loading the external scripts
13
+ * twice.
14
+ *
15
+ * @param {string|string[]} urls URL(s) of the external scripts to load, in order.
16
+ * @param {string} code JavaScript code to run after all external scripts are loaded.
17
+ * @param {Object} [attrs] Extra attributes to set on the external script elements.
18
+ * @returns {string} The inline JavaScript code.
19
+ *
20
+ * @example
21
+ * <script dangerouslySetInnerHTML={{ __html: loadScripts('/path/to/lib.js', 'lib.init();') }} />
22
+ */
23
+ function loadScripts(urls, code, attrs = {}) {
24
+ return `(function () {
25
+ var urls = ${JSON.stringify([].concat(urls))};
26
+ var attrs = ${JSON.stringify(attrs)};
27
+ function run() {
28
+ ${code}
29
+ }
30
+ function load(i) {
31
+ if (i >= urls.length) {
32
+ run();
33
+ return;
34
+ }
35
+ var script = null;
36
+ for (var j = 0; j < document.scripts.length; j++) {
37
+ if (document.scripts[j].getAttribute('src') === urls[i]) {
38
+ script = document.scripts[j];
39
+ break;
40
+ }
41
+ }
42
+ if (script && script.getAttribute('data-loaded') !== 'false') {
43
+ load(i + 1);
44
+ return;
45
+ }
46
+ if (!script) {
47
+ script = document.createElement('script');
48
+ script.src = urls[i];
49
+ script.async = true;
50
+ script.setAttribute('data-loaded', 'false');
51
+ for (var name in attrs) {
52
+ script.setAttribute(name, attrs[name]);
53
+ }
54
+ script.addEventListener('load', function () {
55
+ this.setAttribute('data-loaded', 'true');
56
+ });
57
+ document.head.appendChild(script);
58
+ }
59
+ script.addEventListener('load', function () {
60
+ load(i + 1);
61
+ });
62
+ }
63
+ load(0);
64
+ })();`;
65
+ }
66
+
67
+ /**
68
+ * Build an inline script that adds an external script to an element, for example the client script of
69
+ * a comment system that reads its options from the attributes of its own <code>&lt;script&gt;</code>
70
+ * tag.
71
+ * <p>
72
+ * The external script is added every time the inline script runs. Unlike a <code>&lt;script&gt;</code>
73
+ * tag in the page, which PJAX runs again without its attributes and outside of its element, it keeps
74
+ * its attributes and stays in the element. It is added after the inline script has finished, so that
75
+ * PJAX, which runs the scripts of the new page right after switching to it, does not run it again.
76
+ *
77
+ * @param {string} selector CSS selector of the element to add the external script to.
78
+ * @param {string} url URL of the external script.
79
+ * @param {Object} attrs Attributes to set on the external script element.
80
+ * @param {Object} [dynamicAttrs] More attributes, whose values are JavaScript expressions evaluated by
81
+ * the inline script, for example to choose a theme in the browser.
82
+ * @returns {string} The inline JavaScript code.
83
+ *
84
+ * @example
85
+ * appendScript('#comments-thread', 'https://comments.example.com/client.js', { repo: 'user/repo' }, {
86
+ * theme: "window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'",
87
+ * });
88
+ */
89
+ function appendScript(selector, url, attrs, dynamicAttrs = {}) {
90
+ const dynamic = Object.keys(dynamicAttrs).map(name => `attrs[${JSON.stringify(name)}] = ${dynamicAttrs[name]};`).join('\n ');
91
+ return `(function () {
92
+ var element = document.querySelector(${JSON.stringify(selector)});
93
+ if (!element) {
94
+ return;
95
+ }
96
+ var attrs = ${JSON.stringify(attrs)};
97
+ ${dynamic}
98
+ var script = document.createElement('script');
99
+ for (var name in attrs) {
100
+ script.setAttribute(name, attrs[name]);
101
+ }
102
+ script.src = ${JSON.stringify(url)};
103
+ script.async = true;
104
+ setTimeout(function () {
105
+ element.appendChild(script);
106
+ });
107
+ })();`;
108
+ }
109
+ module.exports = loadScripts;
110
+ module.exports.appendScript = appendScript;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ var _inferno = require("inferno");
5
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
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
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
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
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
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
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
13
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
14
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
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
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
17
+ /**
18
+ * Artalk comment JSX component.
19
+ * @module view/comment/artalk
20
+ */
21
+ var _require = require('inferno'),
22
+ Component = _require.Component;
23
+ var _require2 = require('../../util/cache'),
24
+ cacheComponent = _require2.cacheComponent;
25
+ var loadScripts = require('../../util/script');
26
+ var _require3 = require('../../util/appearance'),
27
+ getAppearance = _require3.getAppearance,
28
+ isDark = _require3.isDark;
29
+
30
+ /**
31
+ * Artalk comment JSX component.
32
+ *
33
+ * @see https://artalk.js.org/guide/frontend/config.html
34
+ * @example
35
+ * <Artalk
36
+ * server="https://artalk.example.com"
37
+ * site="******"
38
+ * pageKey="/path/to/page/"
39
+ * pageTitle="******"
40
+ * locale="en"
41
+ * darkMode={false}
42
+ * jsUrl="/path/to/Artalk.js"
43
+ * cssUrl="/path/to/Artalk.css" />
44
+ */
45
+ var Artalk = /*#__PURE__*/function (_Component) {
46
+ function Artalk() {
47
+ _classCallCheck(this, Artalk);
48
+ return _callSuper(this, Artalk, arguments);
49
+ }
50
+ _inherits(Artalk, _Component);
51
+ return _createClass(Artalk, [{
52
+ key: "render",
53
+ value: function render() {
54
+ var _this$props = this.props,
55
+ server = _this$props.server,
56
+ site = _this$props.site,
57
+ pageKey = _this$props.pageKey,
58
+ pageTitle = _this$props.pageTitle,
59
+ locale = _this$props.locale,
60
+ darkMode = _this$props.darkMode,
61
+ jsUrl = _this$props.jsUrl,
62
+ cssUrl = _this$props.cssUrl;
63
+ if (!server) {
64
+ return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You forgot to set the "), (0, _inferno.createVNode)(1, "code", null, "server", 16), (0, _inferno.createTextVNode)(" for Artalk. Please set it in"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 0);
65
+ }
66
+ // Without the dark_mode option, follow the appearance of the page
67
+ var darkModeOption = darkMode === null || typeof darkMode === 'undefined' ? "".concat(getAppearance(), " === 'auto' ? 'auto' : ").concat(isDark()) : JSON.stringify(darkMode);
68
+ // PJAX replaces the element of the previous instance, so destroy it before initializing again
69
+ var js = "if (window.__artalkInstance) {\n window.__artalkInstance.destroy();\n }\n window.__artalkInstance = Artalk.init({\n el: '#artalk-thread',\n server: ".concat(JSON.stringify(server), ",\n ").concat(site ? "site: ".concat(JSON.stringify(site), ",") : '', "\n ").concat(pageKey ? "pageKey: ".concat(JSON.stringify(pageKey), ",") : '', "\n ").concat(pageTitle ? "pageTitle: ".concat(JSON.stringify(pageTitle), ",") : '', "\n ").concat(locale ? "locale: ".concat(JSON.stringify(locale), ",") : '', "\n darkMode: ").concat(darkModeOption, ",\n });");
70
+ return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", null, null, 1, {
71
+ "id": "artalk-thread"
72
+ }), (0, _inferno.createVNode)(1, "link", null, null, 1, {
73
+ "rel": "stylesheet",
74
+ "href": cssUrl,
75
+ "media": "print",
76
+ "onload": "this.media='all'"
77
+ }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
78
+ "dangerouslySetInnerHTML": {
79
+ __html: loadScripts(jsUrl, js)
80
+ }
81
+ })], 4);
82
+ }
83
+ }]);
84
+ }(Component);
85
+ /**
86
+ * Cacheable Artalk comment JSX component.
87
+ * <p>
88
+ * This class is supposed to be used in combination with the <code>locals</code> hexo filter
89
+ * ({@link module:hexo/filter/locals}).
90
+ *
91
+ * @see module:util/cache.cacheComponent
92
+ * @example
93
+ * <Artalk.Cacheable
94
+ * comment={{
95
+ * server: "https://artalk.example.com",
96
+ * site: "******",
97
+ * locale: "en",
98
+ * dark_mode: false
99
+ * }}
100
+ * page={{ title: "******" }}
101
+ * helper={{ cdn: function() {...} }} />
102
+ */
103
+ Artalk.Cacheable = cacheComponent(Artalk, 'comment.artalk', function (props) {
104
+ var comment = props.comment,
105
+ helper = props.helper,
106
+ page = props.page;
107
+ return {
108
+ server: comment.server,
109
+ site: comment.site,
110
+ pageKey: comment.page_key,
111
+ pageTitle: page.title,
112
+ locale: comment.locale,
113
+ darkMode: comment.dark_mode,
114
+ jsUrl: helper.cdn('artalk', '2.9.1', 'dist/Artalk.js'),
115
+ cssUrl: helper.cdn('artalk', '2.9.1', 'dist/Artalk.css')
116
+ };
117
+ });
118
+ module.exports = Artalk;
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ var _inferno = require("inferno");
5
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
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
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
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
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
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
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
13
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
14
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
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
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
17
+ /**
18
+ * Beaudar comment JSX component.
19
+ * @module view/comment/beaudar
20
+ */
21
+ var _require = require('inferno'),
22
+ Component = _require.Component;
23
+ var _require2 = require('../../util/cache'),
24
+ cacheComponent = _require2.cacheComponent;
25
+ var _require3 = require('../../util/script'),
26
+ appendScript = _require3.appendScript;
27
+ var _require4 = require('../../util/appearance'),
28
+ isDark = _require4.isDark;
29
+
30
+ /**
31
+ * Beaudar comment JSX component.
32
+ * <p>
33
+ * Beaudar is a Chinese fork of Utterances that keeps comments in GitHub issues.
34
+ *
35
+ * @see https://github.com/beaudar/beaudar
36
+ * @example
37
+ * <Beaudar
38
+ * repo="******"
39
+ * branch="main"
40
+ * issueTerm="******"
41
+ * issueNumber={123}
42
+ * label="******"
43
+ * theme="******"
44
+ * darkTheme="******" />
45
+ */
46
+ var Beaudar = /*#__PURE__*/function (_Component) {
47
+ function Beaudar() {
48
+ _classCallCheck(this, Beaudar);
49
+ return _callSuper(this, Beaudar, arguments);
50
+ }
51
+ _inherits(Beaudar, _Component);
52
+ return _createClass(Beaudar, [{
53
+ key: "render",
54
+ value: function render() {
55
+ var _this$props = this.props,
56
+ repo = _this$props.repo,
57
+ branch = _this$props.branch,
58
+ issueTerm = _this$props.issueTerm,
59
+ issueNumber = _this$props.issueNumber,
60
+ label = _this$props.label,
61
+ theme = _this$props.theme,
62
+ darkTheme = _this$props.darkTheme;
63
+ if (!repo || !issueTerm && !issueNumber) {
64
+ return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You forgot to set the "), (0, _inferno.createVNode)(1, "code", null, "repo", 16), (0, _inferno.createTextVNode)(", "), (0, _inferno.createVNode)(1, "code", null, "issue_term", 16), (0, _inferno.createTextVNode)(", or"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "issue_number", 16), (0, _inferno.createTextVNode)(" for Beaudar. Please set it in "), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 0);
65
+ }
66
+ var config = {
67
+ repo: repo
68
+ };
69
+ if (branch) {
70
+ config.branch = branch;
71
+ }
72
+ if (issueTerm) {
73
+ config['issue-term'] = issueTerm;
74
+ } else {
75
+ config['issue-number'] = issueNumber;
76
+ }
77
+ if (label) {
78
+ config.label = label;
79
+ }
80
+ config.crossorigin = 'anonymous';
81
+ // Use the dark theme when the page looks dark
82
+ var js = appendScript('#beaudar-thread', 'https://beaudar.lipk.org/client.js', config, {
83
+ theme: "".concat(isDark(), " ? ").concat(JSON.stringify(darkTheme || 'github-dark'), " : ").concat(JSON.stringify(theme || 'github-light'))
84
+ });
85
+ return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", null, null, 1, {
86
+ "id": "beaudar-thread"
87
+ }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
88
+ "dangerouslySetInnerHTML": {
89
+ __html: js
90
+ }
91
+ })], 4);
92
+ }
93
+ }]);
94
+ }(Component);
95
+ /**
96
+ * Cacheable Beaudar comment JSX component.
97
+ * <p>
98
+ * This class is supposed to be used in combination with the <code>locals</code> hexo filter
99
+ * ({@link module:hexo/filter/locals}).
100
+ *
101
+ * @see module:util/cache.cacheComponent
102
+ * @example
103
+ * <Beaudar.Cacheable
104
+ * comment={{
105
+ * repo: "******",
106
+ * branch: "main",
107
+ * issue_term: "******",
108
+ * issue_number: {123},
109
+ * label: "******",
110
+ * theme: "******",
111
+ * dark_theme: "******"
112
+ * }} />
113
+ */
114
+ Beaudar.Cacheable = cacheComponent(Beaudar, 'comment.beaudar', function (props) {
115
+ var _props$comment = props.comment,
116
+ repo = _props$comment.repo,
117
+ branch = _props$comment.branch,
118
+ issue_term = _props$comment.issue_term,
119
+ issue_number = _props$comment.issue_number,
120
+ label = _props$comment.label,
121
+ theme = _props$comment.theme,
122
+ dark_theme = _props$comment.dark_theme;
123
+ return {
124
+ repo: repo,
125
+ branch: branch,
126
+ issueTerm: issue_term,
127
+ issueNumber: issue_number,
128
+ label: label,
129
+ theme: theme,
130
+ darkTheme: dark_theme
131
+ };
132
+ });
133
+ module.exports = Beaudar;
@@ -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, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(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,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
  * ChangYan comment JSX component.
@@ -54,12 +55,11 @@ var ChangYan = /*#__PURE__*/function (_Component) {
54
55
  return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", null, null, 1, {
55
56
  "id": "SOHUCS",
56
57
  "sid": path
57
- }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
58
- "charset": "utf-8",
59
- "src": "https://changyan.sohu.com/upload/changyan.js"
60
58
  }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
61
59
  "dangerouslySetInnerHTML": {
62
- __html: js
60
+ __html: loadScripts('https://changyan.sohu.com/upload/changyan.js', js, {
61
+ charset: 'utf-8'
62
+ })
63
63
  }
64
64
  })], 4);
65
65
  /* eslint-enable react/no-unknown-property */
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ var _inferno = require("inferno");
5
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
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
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
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
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
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
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
13
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
14
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
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
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
17
+ /**
18
+ * Cusdis comment JSX component.
19
+ * @module view/comment/cusdis
20
+ */
21
+ var _require = require('inferno'),
22
+ Component = _require.Component;
23
+ var _require2 = require('../../util/cache'),
24
+ cacheComponent = _require2.cacheComponent;
25
+ var loadScripts = require('../../util/script');
26
+ var _require3 = require('../../util/appearance'),
27
+ getAppearance = _require3.getAppearance;
28
+
29
+ /**
30
+ * Cusdis comment JSX component.
31
+ *
32
+ * @see https://cusdis.com/doc
33
+ * @example
34
+ * <Cusdis
35
+ * host="https://cusdis.com"
36
+ * appId="******"
37
+ * pageId="/path/to/page/"
38
+ * pageUrl="https://example.com/path/to/page/"
39
+ * pageTitle="******"
40
+ * theme="auto"
41
+ * lang="zh-cn" />
42
+ */
43
+ var Cusdis = /*#__PURE__*/function (_Component) {
44
+ function Cusdis() {
45
+ _classCallCheck(this, Cusdis);
46
+ return _callSuper(this, Cusdis, arguments);
47
+ }
48
+ _inherits(Cusdis, _Component);
49
+ return _createClass(Cusdis, [{
50
+ key: "render",
51
+ value: function render() {
52
+ var _this$props = this.props,
53
+ _this$props$host = _this$props.host,
54
+ host = _this$props$host === void 0 ? 'https://cusdis.com' : _this$props$host,
55
+ appId = _this$props.appId,
56
+ pageId = _this$props.pageId,
57
+ pageUrl = _this$props.pageUrl,
58
+ pageTitle = _this$props.pageTitle,
59
+ theme = _this$props.theme,
60
+ lang = _this$props.lang;
61
+ if (!appId) {
62
+ return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You forgot to set the "), (0, _inferno.createVNode)(1, "code", null, "app_id", 16), (0, _inferno.createTextVNode)(" for Cusdis. Please set it in"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 0);
63
+ }
64
+ var urls = ["".concat(host, "/js/cusdis.es.js")];
65
+ if (lang) {
66
+ urls.unshift("".concat(host, "/js/widget/lang/").concat(lang, ".js"));
67
+ }
68
+ // Without the theme option, follow the appearance of the page (light, dark, or auto, the same values
69
+ // as the themes of Cusdis). The Cusdis script renders #cusdis_thread when it loads, so render it
70
+ // directly only when the script is already loaded, e.g., when PJAX runs this code again.
71
+ var js = "(function () {\n var element = document.getElementById('cusdis_thread');\n if (!element) {\n return;\n }\n element.setAttribute('data-theme', ".concat(theme ? JSON.stringify(theme) : getAppearance(), ");\n if (window.renderCusdis) {\n window.renderCusdis(element);\n return;\n }\n ").concat(loadScripts(urls, ''), "\n })();");
72
+ return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", null, null, 1, {
73
+ "id": "cusdis_thread",
74
+ "data-host": host,
75
+ "data-app-id": appId,
76
+ "data-page-id": pageId,
77
+ "data-page-url": pageUrl,
78
+ "data-page-title": pageTitle
79
+ }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
80
+ "dangerouslySetInnerHTML": {
81
+ __html: js
82
+ }
83
+ })], 4);
84
+ }
85
+ }]);
86
+ }(Component);
87
+ /**
88
+ * Cacheable Cusdis comment JSX component.
89
+ * <p>
90
+ * This class is supposed to be used in combination with the <code>locals</code> hexo filter
91
+ * ({@link module:hexo/filter/locals}).
92
+ *
93
+ * @see module:util/cache.cacheComponent
94
+ * @example
95
+ * <Cusdis.Cacheable
96
+ * comment={{
97
+ * host: "https://cusdis.com",
98
+ * app_id: "******",
99
+ * theme: "auto",
100
+ * lang: "zh-cn"
101
+ * }}
102
+ * page={{ path: "/path/to/page/", permalink: "******", title: "******" }}
103
+ * helper={{ url_for: function() {...} }} />
104
+ */
105
+ Cusdis.Cacheable = cacheComponent(Cusdis, 'comment.cusdis', function (props) {
106
+ var comment = props.comment,
107
+ helper = props.helper,
108
+ page = props.page;
109
+ return {
110
+ host: comment.host ? comment.host.replace(/\/+$/, '') : undefined,
111
+ appId: comment.app_id,
112
+ pageId: helper.url_for(page.path),
113
+ pageUrl: page.permalink,
114
+ pageTitle: page.title,
115
+ theme: comment.theme,
116
+ lang: comment.lang
117
+ };
118
+ });
119
+ module.exports = Cusdis;
@@ -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, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(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, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(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,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
  * DisqusJS comment JSX component.
@@ -74,16 +75,16 @@ var DisqusJs = /*#__PURE__*/function (_Component) {
74
75
  var js = "new DisqusJS({\n shortname: '".concat(shortname, "',\n apikey: ").concat(JSON.stringify(apiKey), ",\n ").concat(siteTitle ? "siteName: ".concat(JSON.stringify(siteTitle), ",") : '', "\n ").concat(identifier ? "identifier: ".concat(JSON.stringify(identifier), ",") : '', "\n ").concat(url ? "url: ".concat(JSON.stringify(url), ",") : '', "\n ").concat(pageTitle ? "title: ".concat(JSON.stringify(pageTitle), ",") : '', "\n ").concat(api ? "api: ".concat(JSON.stringify(api), ",") : '', "\n ").concat(admin ? "admin: ".concat(JSON.stringify(admin), ",") : '', "\n ").concat(adminLabel ? "adminLabel: ".concat(JSON.stringify(adminLabel), ",") : '', "\n ").concat(nesting ? "nesting: ".concat(JSON.stringify(nesting), ",") : '', "\n });");
75
76
  return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "link", null, null, 1, {
76
77
  "rel": "stylesheet",
77
- "href": cssUrl
78
+ "href": cssUrl,
79
+ "media": "print",
80
+ "onload": "this.media='all'"
78
81
  }), (0, _inferno.createVNode)(1, "div", null, (0, _inferno.createVNode)(1, "noscript", null, [(0, _inferno.createTextVNode)("Please enable JavaScript to view the"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "a", null, "comments powered by Disqus.", 16, {
79
82
  "href": "//disqus.com/?ref_noscript"
80
83
  })], 0), 2, {
81
84
  "id": "disqus_thread"
82
- }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
83
- "src": jsUrl
84
85
  }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
85
86
  "dangerouslySetInnerHTML": {
86
- __html: js
87
+ __html: loadScripts(jsUrl, js)
87
88
  }
88
89
  })], 4);
89
90
  }
@@ -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, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(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; }