Hinatazaka46's Member and etc

Hinatazaka46's Member/Formation/Discography/TV/Video/What's Hinatazaka46?/fanclub

2024-10-06 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

  1. // ==UserScript==
  2. // @name Hinatazaka46's Member and etc
  3. // @name:ja 日向坂46 メンバー その他
  4. // @namespace naoqv.hinatazaka
  5. // @description Hinatazaka46's Member/Formation/Discography/TV/Video/What's Hinatazaka46?/fanclub
  6. // @description:ja 日向坂46 メンバー/フォーメーション/ディスコグラフィー/TV/動画/日向坂46とは?/ファンクラブ
  7. // @version 1.1
  8. // @match https://www.hinatazaka46.com/s/official/search/*
  9. // @match https://www.hinatazaka46.com/s/official/artist/*
  10. // @match https://www.hinatazaka46.com/s/official/discography/*
  11. // @match https://www.hinatazaka46.com/s/official/page/*
  12. // @match https://www.hinatazaka46.com/s/official/diary/formation/*
  13. // @match https://www.hinatazaka46.com/s/official/diary/aimashou/*
  14. // @match https://www.hinatazaka46.com/s/official/diary/event/*
  15. // @require https://update.greasyfork.org/scripts/510022/1459768/HinatazakaStyleSetting.js
  16. // @require https://update.greasyfork.org/scripts/509934/1453163/HinatazakaExceptionHandlingWrapper.js
  17. // @icon https://cdn.hinatazaka46.com/files/14/hinata/img/favicons/favicon-32x32.png
  18. // @compatible chrome
  19. // @compatible firefox
  20. // @license MIT
  21. // ==/UserScript==
  22.  
  23. const SCRIPT_NAME = "日向坂46 ディスコグラフィー その他";
  24.  
  25. const setStyle = (styleText) => {
  26. const styleElem = document.createElement("style");
  27. styleElem.setAttribute("rel", "stylesheet");
  28. styleElem.textContent = styleText;
  29. document.head.appendChild(styleElem);
  30. };
  31.  
  32. const setReleaseYear = (releaseYearSelector) => {
  33. let navText = `<header class="header" role="banner">
  34. <nav class="nav">
  35. <div class="release">RELEASE<br/>YEAR</div>
  36. <ul class="nav-list">`;
  37. Array.prototype.forEach.call(document.querySelectorAll(releaseYearSelector), (x) => {
  38.  
  39. const year = x.innerText;
  40. const id_year = "y_" + year;
  41. x.parentNode.setAttribute("id", id_year);
  42. navText += `<li><a href="#${id_year}">${year}</a></li>`;
  43. });
  44.  
  45. navText += `</ul>
  46. </nav>
  47. </header>`;
  48. const main = document.querySelector('.l-main');
  49. main.setAttribute("style", 'padding-top:0; margin: 20px 0 0 40px; font-size: larger;');
  50. main.insertAdjacentHTML('afterbegin', navText);
  51.  
  52. const header = document.querySelector('header');
  53. const nav = document.querySelector('.nav');
  54. const navHeight = nav.clientHeight;
  55.  
  56. window.onscroll = () => {
  57.  
  58. if (window.pageYOffset >= header.clientHeight) {
  59. nav.classList.add('fixed');
  60. main.setAttribute('style', 'padding-top:' + navHeight + 'px');
  61. } else {
  62. nav.classList.remove('fixed');
  63. main.setAttribute('style', 'padding-top:0; margin: 20px 0 0 40px; font-size: larger;');
  64. }
  65. };
  66. const latestYear = document.querySelector(releaseYearSelector);
  67. const scrollTop = latestYear.parentNode.getBoundingClientRect().top - 30;
  68.  
  69. // スクロール位置リセット 〜「再読み込み」ボタン押下時の位置ズレ対応
  70. scrollTo(0, 0);
  71.  
  72. // リスト位置までページ内で縦スクロール
  73. scrollTo({
  74. top: scrollTop,
  75. behavior: "smooth"
  76. });
  77. };
  78.  
  79. handleException(()=> {
  80. darkMode();
  81. menuBarSetting();
  82.  
  83. const PAGE_TYPE_ERROR_MSG = "Processing of out-of-scope pages. Check the settings @match.";
  84.  
  85. const pageType = (location.href).match(new RegExp('\/(search|artist|page|formation|aimashou|event)\/'))[1];
  86.  
  87. let styleText;
  88.  
  89. switch (pageType) {
  90. case "search":
  91. break;
  92. case "artist":
  93. styleText = `
  94. .fixed {
  95. width: 12rem;
  96. position: fixed;
  97. top: 60px;
  98. left: 40px;
  99. z-index: 1;
  100. font-size:larger;
  101. }
  102. .release {
  103. line-height: 20px;
  104. }
  105. .l-container {
  106. margin-top: -280px;
  107. }
  108. .c-disco__year {
  109. padding-top: 20px;
  110. }
  111. .c-disco__year {font-size: 4rem; width: 12rem}
  112. .c-disco__title, .c-disco__date {color: ${DEFAULT_CL};}
  113. .c-disco__category {font-size: 14px;}
  114. .p-page-head-sub--first {padding-top: 10px;}
  115. `;
  116. setStyle(styleText);
  117. setReleaseYear('.c-disco__year');
  118. break;
  119.  
  120. case "page":
  121. break;
  122.  
  123. case "formation":
  124. styleText = `
  125. .l-container {
  126. margin-top: -240px;
  127. }
  128. .formation_image :not(.small_f) li:hover {
  129. height: 120px;
  130. margin: -15.5px;
  131. width: 110px;
  132. }
  133. .formation_image li:hover i {
  134. font-size: 16px;
  135. }
  136. .formation_image li i {
  137. font-size: 14px;
  138. color: ${DEFAULT_CL};
  139. }
  140. .small_f span:hover {
  141. height: 120px;
  142. margin: -16px -0;
  143. width: 116px;
  144. }
  145. .fixed {
  146. width: 12rem;
  147. position: fixed;
  148. top: 60px;
  149. left: 40px;
  150. z-index: 1;
  151. font-size:larger;
  152. }
  153. .release {
  154. line-height: 20px;
  155. }
  156. .p-page-head-sub--first {
  157. padding-top: 20px;
  158. }`;
  159. setStyle(styleText);
  160. setReleaseYear('.c-page-subtitle');
  161. break;
  162.  
  163. case "aimashou":
  164. break;
  165.  
  166. case "event":
  167. break;
  168.  
  169. default:
  170. throw new Error(PAGE_TYPE_ERROR_MSG);
  171. }
  172. }, SCRIPT_NAME);