Hinatazaka46's Member and etc

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

Fra og med 25.12.2024. Se den nyeste version.

  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.84
  8. // @match https://www.hinatazaka46.com/s/official/media/detail/*
  9. // @match https://www.hinatazaka46.com/s/official/news/detail/*
  10. // @match https://www.hinatazaka46.com/s/official/search/*
  11. // @match https://www.hinatazaka46.com/s/official/artist/*
  12. // @match https://www.hinatazaka46.com/s/official/discography/*
  13. // @match https://www.hinatazaka46.com/s/official/page/*
  14. // @match https://www.hinatazaka46.com/s/official/diary/*
  15. // @require https://update.greasyfork.org/scripts/510022/1509450/HinatazakaStyleSetting.js
  16. // @require https://update.greasyfork.org/scripts/509934/1479509/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.  
  81. darkMode();
  82.  
  83. const PAGE_TYPE_ERROR_MSG = "Processing of out-of-scope pages. Check the settings @match.";
  84.  
  85. const pageType
  86. = (location.href).match('/formation/') ? "formation"
  87. : (location.href).match(new RegExp('\/(detail|search|artist\/00|artist|page|member|diary|aimashou|event)\/'))[1];
  88. let styleText = `
  89. .formation_image li i {
  90. color: ${DEFAULT_CL};
  91. }`;
  92.  
  93. setStyle(styleText);
  94.  
  95. if (isMobile()) {
  96.  
  97. if (pageType == "formation") {
  98. styleText = `
  99. .formation_image li:hover {
  100. height: 60px;
  101. margin: -10px 0 0 0px;
  102. width: 60px;
  103. }
  104. .formation_image li:hover i {
  105. margin: -6px 0 0 -30px;
  106. font-size: larger;
  107. }`;
  108. setStyle(styleText);
  109. }
  110. return;
  111. }
  112.  
  113. menuBarSetting();
  114. switch (pageType) {
  115.  
  116. case "detail": //news/schedule
  117. styleText = `
  118. .c-article__title, .p-article__text {
  119. color: ${DEFAULT_CL};
  120. }`;
  121. setStyle(styleText);
  122. Array.prototype.forEach.call(document.querySelectorAll('.p-article__text strong span, .p-article__text span strong'), (x) => {
  123. x.style.color ='aquamarine';
  124. x.style.backgroundColor ='crimson';
  125. });
  126. Array.prototype.forEach.call(document.querySelectorAll('.p-article__text span'), (x) => {
  127. x.style.color = DEFAULT_CL;
  128. });
  129. break;
  130. case "search": // Member
  131. break;
  132. case "artist": // Member Detail
  133. break;
  134. case "artist/00" : // Discography
  135. styleText = `
  136. .fixed {
  137. width: 12rem;
  138. position: fixed;
  139. top: 60px;
  140. left: 40px;
  141. z-index: 1;
  142. font-size:larger;
  143. }
  144. .release {
  145. line-height: 20px;
  146. }
  147. .l-container {
  148. margin-top: -280px;
  149. }
  150. .c-disco__year {
  151. padding-top: 20px;
  152. }
  153. .c-disco__year {font-size: 4rem; width: 12rem}
  154. .c-disco__title, .c-disco__date {color: ${DEFAULT_CL};}
  155. .c-disco__category {font-size: 14px;}
  156. .p-page-head-sub--first {padding-top: 10px;}
  157. `;
  158. setStyle(styleText);
  159. setReleaseYear('.c-disco__year');
  160. break;
  161.  
  162. case "page":
  163. break;
  164.  
  165. case "formation":
  166. styleText = `
  167. .l-container {
  168. margin-top: -240px;
  169. }
  170. .formation_image :not(.small_f) li:hover {
  171. height: 120px;
  172. margin: -15.5px;
  173. width: 110px;
  174. }
  175. .formation_image li:hover i {
  176. font-size: 16px;
  177. }
  178. .formation_image li i {
  179. font-size: 14px;
  180. color: ${DEFAULT_CL};
  181. }
  182. .small_f span:hover {
  183. height: 120px;
  184. margin: -16px -0;
  185. width: 116px;
  186. }
  187. .fixed {
  188. width: 12rem;
  189. position: fixed;
  190. top: 60px;
  191. left: 40px;
  192. z-index: 1;
  193. font-size:larger;
  194. }
  195. .release {
  196. line-height: 20px;
  197. }
  198. .p-page-head-sub--first {
  199. padding-top: 20px;
  200. }`;
  201. setStyle(styleText);
  202. setReleaseYear('.c-page-subtitle');
  203. break;
  204.  
  205. case "member":
  206. break;
  207.  
  208. case "diary":
  209. break;
  210.  
  211. case "aimashou":
  212. break;
  213.  
  214. case "event":
  215. break;
  216.  
  217. default:
  218. throw new Error(PAGE_TYPE_ERROR_MSG);
  219. }
  220. }, SCRIPT_NAME);