hexo-component-inferno 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -73,7 +73,7 @@
73
73
  * This is hello.
74
74
  * <!-- endtab -->
75
75
  * <!-- tab id:tab_info 'icon:fas fa-info' 'title:Info Tab' -->This is info.<!-- endtab -->
76
- * {% endmessage %}
76
+ * {% endtabs %}
77
77
  */
78
78
  module.exports = function (hexo) {
79
79
  function splitTabOptions(s) {
@@ -260,24 +260,25 @@ module.exports = function (hexo) {
260
260
  if (!location.hash) {
261
261
  return;
262
262
  }
263
- Array
264
- .from(document.querySelectorAll('.tab-content'))
265
- .forEach($tab => {
266
- $tab.classList.add('is-hidden');
267
- });
268
- Array
269
- .from(document.querySelectorAll('.tabs li'))
270
- .forEach($tab => {
271
- $tab.classList.remove('is-active');
272
- });
273
- const $activeTab = document.querySelector(location.hash);
274
- if ($activeTab) {
275
- $activeTab.classList.remove('is-hidden');
276
- }
263
+
277
264
  const $tabMenu = document.querySelector(\`a[href="\${location.hash}"]\`);
265
+ if (!$tabMenu) {
266
+ return;
267
+ }
268
+
269
+ const $tabMenuContainer = $tabMenu.parentElement.parentElement;
270
+ Array.from($tabMenuContainer.children).forEach($menu => $menu.classList.remove('is-active'));
271
+ Array.from($tabMenuContainer.querySelectorAll('a'))
272
+ .map($menu => document.getElementById($menu.getAttribute("href").substring(1)))
273
+ .forEach($content => $content.classList.add('is-hidden'));
274
+
278
275
  if ($tabMenu) {
279
276
  $tabMenu.parentElement.classList.add('is-active');
280
277
  }
278
+ const $activeTab = document.querySelector(location.hash);
279
+ if ($activeTab) {
280
+ $activeTab.classList.remove('is-hidden');
281
+ }
281
282
  }
282
283
  switchTab();
283
284
  window.addEventListener('hashchange', switchTab, false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-component-inferno",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "A collection of Inferno.js layout components and utility scripts for Hexo",
5
5
  "main": "lib/index.js",
6
6
  "repository": "https://github.com/ppoffice/hexo-component-inferno",