Hinatazaka46's Member and etc

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

  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.92
  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/contents/*
  15. // @match https://www.hinatazaka46.com/s/official/contents_list*
  16. // @match https://www.hinatazaka46.com/s/official/diary/aimashou/*
  17. // @match https://www.hinatazaka46.com/s/official/diary/event/*
  18. // @match https://www.hinatazaka46.com/s/official/diary/member?*
  19.  
  20. // @require https://update.greasyfork.org/scripts/531768/1568599/HinatazakaSigthtStyleUtils.js
  21. // @require https://update.greasyfork.org/scripts/531764/1566566/HinatazakaExceptionHandler.js
  22. // @require https://update.greasyfork.org/scripts/531797/1566626/HinatazakaCookieUtils.js
  23. // @require https://update.greasyfork.org/scripts/531769/1567070/HinatazakaBaseProcessor.js
  24.  
  25. // @icon https://cdn.hinatazaka46.com/files/14/hinata/img/favicons/favicon-32x32.png
  26. // @compatible chrome
  27. // @compatible firefox
  28. // @license MIT
  29. // ==/UserScript==
  30.  
  31. const SCRIPT_NAME = "日向坂46 メンバー その他";
  32.  
  33.  
  34. const setReleaseYear = (releaseYearSelector) => {
  35. let navText = `<header class="header" role="banner" style="z-index: 1000;">
  36. <nav class="nav">
  37. <div class="release">RELEASE<br/>YEAR</div>
  38. <ul class="nav-list">`;
  39. Array.prototype.forEach.call(document.querySelectorAll(releaseYearSelector), (x) => {
  40.  
  41. const year = x.innerText;
  42. const id_year = "y_" + year;
  43. x.parentNode.setAttribute("id", id_year);
  44. navText += `<li><a href="#${id_year}">${year}</a></li>`;
  45. });
  46.  
  47. navText += `</ul>
  48. </nav>
  49. </header>`;
  50. const main = document.querySelector('.l-main');
  51. main.setAttribute("style", 'padding-top:0; margin: 20px 0 0 40px; font-size: larger;');
  52. main.insertAdjacentHTML('afterbegin', navText);
  53.  
  54. const header = document.querySelector('header');
  55. const nav = document.querySelector('.nav');
  56. const navHeight = nav.clientHeight;
  57.  
  58. window.onscroll = () => {
  59.  
  60. if (window.pageYOffset >= header.clientHeight) {
  61. nav.classList.add('fixed');
  62. main.setAttribute('style', 'padding-top:' + navHeight + 'px');
  63. } else {
  64. nav.classList.remove('fixed');
  65. main.setAttribute('style', 'padding-top:0; margin: 20px 0 0 40px; font-size: larger;');
  66. }
  67. };
  68. const latestYear = document.querySelector(releaseYearSelector);
  69. const scrollTop = latestYear.parentNode.getBoundingClientRect().top - 30;
  70.  
  71. // スクロール位置リセット 〜「再読み込み」ボタン押下時の位置ズレ対応
  72. scrollTo(0, 0);
  73.  
  74. // リスト位置までページ内で縦スクロール
  75. scrollTo({
  76. top: scrollTop,
  77. behavior: "smooth"
  78. });
  79. };
  80.  
  81.  
  82.  
  83. doProcess(()=> {
  84.  
  85. const PAGE_TYPE_ERROR_MSG = "Processing of out-of-scope pages. Check the settings @match.";
  86.  
  87. const pageType = getPageType();
  88.  
  89. let styleText;
  90.  
  91. if (isMobile()) {
  92.  
  93. if (pageType == "formation") {
  94. styleText = `
  95. .formation_image li:hover {
  96. height: 60px;
  97. margin: -10px 0 0 0px;
  98. width: 60px;
  99. }
  100. .formation_image li:hover i {
  101. margin: -6px 0 0 -30px;
  102. font-size: larger;
  103. }`;
  104. document.appendStyle(styleText);
  105. }
  106. return;
  107. }
  108.  
  109. slimDownMenuBar();
  110.  
  111. switch (pageType) {
  112.  
  113. case "news":
  114. case "media":
  115. case "detail": //news/schedule
  116. break;
  117. case "search": // Member
  118. break;
  119. case "artist": // Member Detail
  120. break;
  121. case "artist/00" : // Discography
  122. styleText += `
  123. .fixed {
  124. width: 12rem;
  125. position: fixed;
  126. top: 60px;
  127. left: 40px;
  128. z-index: 1;
  129. font-size:larger;
  130. }
  131. .release {
  132. line-height: 20px;
  133. }
  134. .l-container {
  135. margin-top: -280px;
  136. }
  137. .c-disco__year {
  138. padding-top: 20px;
  139. }
  140. .c-disco__year {font-size: 4rem; width: 12rem}
  141. .c-disco__category {font-size: 14px;}
  142. .p-page-head-sub--first {padding-top: 10px;}
  143. `;
  144. setReleaseYear('.c-disco__year');
  145. break;
  146.  
  147. case "page":
  148. break;
  149. case "contents":
  150. break;
  151.  
  152. case "formation":
  153. styleText += `
  154. .l-container {
  155. margin-top: -240px;
  156. }
  157. .formation_image :not(.small_f) li:hover {
  158. height: 120px;
  159. margin: -15.5px;
  160. width: 110px;
  161. }
  162. .formation_image li:hover i {
  163. font-size: 16px;
  164. }
  165. .formation_image li i {
  166. font-size: 14px;
  167. }
  168. .small_f span:hover {
  169. height: 120px;
  170. margin: -16px -0;
  171. width: 116px;
  172. }
  173. .fixed {
  174. width: 12rem;
  175. position: fixed;
  176. top: 60px;
  177. left: 40px;
  178. z-index: 1;
  179. font-size:larger;
  180. }
  181. .release {
  182. line-height: 20px;
  183. }
  184. .p-page-head-sub--first {
  185. padding-top: 20px;
  186. }`;
  187. setReleaseYear('.c-page-subtitle');
  188. break;
  189.  
  190. case "member":
  191. break;
  192.  
  193. case "diary":
  194. break;
  195.  
  196. case "discography":
  197. break;
  198.  
  199. case "aimashou":
  200. break;
  201.  
  202. case "event":
  203. break;
  204.  
  205. default:
  206. throw new Error(PAGE_TYPE_ERROR_MSG);
  207. }
  208.  
  209. document.appendStyle(styleText);
  210. }, SCRIPT_NAME);