Greasy Fork is available in English.

hinatazaka46-lookandfeel

日向坂46 ルックアンドフィール

بۇ قوليازمىنى بىۋاسىتە قاچىلاشقا بولمايدۇ. بۇ باشقا قوليازمىلارنىڭ ئىشلىتىشى ئۈچۈن تەمىنلەنگەن ئامبار بولۇپ، ئىشلىتىش ئۈچۈن مېتا كۆرسەتمىسىگە قىستۇرىدىغان كود: // @require https://update.greatest.deepsurf.us/scripts/532855/1588275/hinatazaka46-lookandfeel.js

  1. // ==UserScript==
  2. // @name hinatazaka46-lookandfeel
  3. // @namespace https://greatest.deepsurf.us/ja/users/1328592-naoqv
  4. // @description 日向坂46 ルックアンドフィール
  5. // @version 0.23
  6. // @require https://cdn.jsdelivr.net/npm/lz-string@1.5.0/libs/lz-string.min.js
  7. // @icon https://cdn.hinatazaka46.com/files/14/hinata/img/favicons/favicon-32x32.png
  8. // @compatible chrome
  9. // @compatible firefox
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. const PAGE_TYPE_ERROR_MSG = "Processing of out-of-scope pages. Check the settings @match.";
  15.  
  16. const isMobile = () => {
  17. const userAgent = navigator.userAgent || navigator.vendor || window.opera;
  18. const mobileRegex = /Android|iPhone|iPad|iPod|BlackBerry|Windows Phone|Opera Mini|IEMobile/i;
  19. return mobileRegex.test(userAgent) || window.matchMedia("only screen and (max-width: 768px)").matches;
  20. }
  21.  
  22. /*
  23. * inlineスタイルを適用
  24. * @param {string} styleText - スタイル定義
  25. */
  26. document.appendStyle = (styleText) => {
  27. const styleElem = document.createElement("style");
  28. styleElem.setAttribute("rel", "stylesheet");
  29. styleElem.textContent = styleText;
  30. document.head.appendChild(styleElem);
  31. };
  32.  
  33. /*
  34. * スクロールダウン時にメニューバー細める
  35. */
  36. const slimDownMenuBar = () => {
  37. const styleElem = document.createElement("style");
  38. styleElem.setAttribute("rel", "stylesheet");
  39. const styleText = `.l-header {
  40. height: 55px;
  41. }
  42. .p-header-wrap.is-fixed .p-header {
  43. height: 30px;
  44. }
  45. .c-header__logo {
  46. top: 5px;
  47. width: 155px;
  48. }
  49. .p-header.p-header__in {
  50. height: 60px;
  51. position: relative;
  52. }
  53. nav.p-menu.p-menu--pc {
  54. position: absolute;
  55. top: 50%;
  56. transform: translateY(-50%);
  57. }`;
  58. styleElem.textContent = styleText;
  59. document.head.appendChild(styleElem);
  60. };
  61.  
  62. const COLOR_MODE = {DEFAULT_COLOR: "0", DARK_COLOR: "1"};
  63.  
  64. /**
  65. * カラーモードを取得
  66. * @returns {string} カラーモード
  67. */
  68. const getColorMode = () => {
  69. const currentMode = CookieUtils.getCookie('color_mode');
  70. if (! currentMode) {
  71. CookieUtils.setCookie('color_mode', COLOR_MODE.DEFALULT_COLOR);
  72. return COLOR_MODE.DEFALULT_COLOR;
  73. }
  74. return currentMode;
  75. }
  76.  
  77. /**
  78. * カラーモードを設定
  79. * @param {string} mode - カラーモード
  80. */
  81. const setColorMode = (mode) => {
  82. if (mode !== COLOR_MODE.DEFAULT_COLOR && mode !== COLOR_MODE.DARK_COLOR) {
  83. throw new Error("Illegal parameter error. [HinatazakaSigthtStyleUtils#setColorMode]");
  84. }
  85. CookieUtils.setCookie('color_mode', mode);
  86. };
  87.  
  88. /**
  89. * カラーモードを切り替える
  90. * @returns {string} 切り替え後のカラーモード
  91. */
  92. const toggleColorMode = () => {
  93. const mode = ((parseInt(getColorMode()) + 1) % 2).toString();
  94. setColorMode(mode);
  95. return mode;
  96. };
  97.  
  98.  
  99. const DEFAULT_FONT_CL = "#8babab";
  100. const DEFAULT_TITLE_FONT_CL ="#abbaba";
  101.  
  102. const DARK_FONT_CL = "#eeeeee";
  103. const DARK_BG_CL = "#202040";
  104. const DARK_MENU_CL = "#404070";
  105. const DARK_SVG_CL = "#eeeeee";
  106. const DARK_IMG_BG_CL = "#eeeeee";
  107.  
  108. const HOVER_BG_UPPER_CL = "#5bbee4";
  109. const HOVER_BG_LOWER_CL = "#ebf4f7";
  110. const HOVER_BORDER_CL = "#5BBEE4";
  111.  
  112. const DARK_HOVER_BG_UPPER_CL = "#20cccc";
  113. const DARK_HOVER_BG_LOWER_CL = "#202050";
  114. const DARK_PAST_BG_CL = "#303040";
  115.  
  116. const DARK_TODAY_UPPER_CL = "#30aaaa";
  117. const DARK_TODAY_LOWER_CL = "#303050";
  118. const DARK_HOVER_BORDER_CL = "#79fcfc";
  119.  
  120. const DARK_STRONG_FONT_CL = 'crimson';
  121. const DARK_STRONG_BG_CL = 'aquamarine';
  122. const DARK_FC_TEXT_CL = 'rgb(99, 103, 103)';
  123.  
  124. const KEY_BACKGROUND = "backGround";
  125. const KEY_MENUBAR = "manuBar";
  126. const KEY_BREADCRUMB = "breadcrumb";
  127. const KEY_LIST = "list";
  128. const KEY_ARTICLE = "article";
  129. const KEY_PASTDAY = "pastday";
  130. const KEY_TODAY = "today";
  131. const KEY_MEMBER_PROP = "memberProp";
  132. const KEY_SVG_PATH = "svgPath";
  133. const KEY_BLOG = "blog";
  134. const KEY_STRONG = "strong";
  135. const KEY_DISCO = "disco";
  136. const KEY_AFTER = "after";
  137. const KEY_BIOGRAPHY = "biography";
  138. const KEY_FC_LOGO = "fc_logo";
  139. const KEY_FC_TEXT = "fc_text";
  140.  
  141. const KEYS = [KEY_BACKGROUND, KEY_MENUBAR, KEY_BREADCRUMB, KEY_LIST, KEY_ARTICLE,
  142. KEY_PASTDAY, KEY_TODAY, KEY_MEMBER_PROP, KEY_SVG_PATH, KEY_BLOG, KEY_STRONG, KEY_DISCO, KEY_AFTER, KEY_BIOGRAPHY, KEY_FC_LOGO, KEY_FC_TEXT];
  143.  
  144. const SELECTOR_DIC = {};
  145. SELECTOR_DIC[KEY_BACKGROUND] = '.pages, .module-modal.js-member-filter .mordal-box, .l-container, .schedule__list-future';
  146. SELECTOR_DIC[KEY_MENUBAR] = '.l-header, .p-header-wrap, .p-header-wrap.is-fixed';
  147. SELECTOR_DIC[KEY_BREADCRUMB] = '.p-page-breadcrumb__list .c-page-breadcrumb__item:last-child span';
  148. SELECTOR_DIC[KEY_LIST] = '.l-container, .p-news__list ';
  149. SELECTOR_DIC[KEY_ARTICLE] = '.c-blog-main__title, .c-blog-main__date, .c-article__title, .p-article__text, .p-article__text span, .c-blog-article__text div *, .c-blog-article__text p span, .tbcms_program-detail__inner p, .c-tv-backnumber-kiji-time, .c-tv-backnumber-kiji-text';
  150. SELECTOR_DIC[KEY_PASTDAY] = '.schedule__list-pastday';
  151. SELECTOR_DIC[KEY_TODAY] = '.schedule__list-today';
  152. SELECTOR_DIC[KEY_MEMBER_PROP] = '.c-member__name, .c-member__name--info, .c-member__info-td__text, .c-blog-member__name, .c-blog-member__info-td__text, .c-mamber__category_title span, .c-section-title--member-name';
  153. SELECTOR_DIC[KEY_SVG_PATH] = '.c-member__info-td__text a svg path';
  154. SELECTOR_DIC[KEY_BLOG] = '.l-maincontents--blog, .p-blog-entry__group, .p-blog-entry__list, .s-blog__index, .p-blog-group, .p-blog-entry__list';
  155. SELECTOR_DIC[KEY_STRONG] = '.p-article__text strong span, .p-article__text span strong';
  156. SELECTOR_DIC[KEY_DISCO] = '.formation_image li i, .c-page-breadcrumb__item, .c-disco__title, .c-disco__date, .c-video-detail__title, .formation_image li i';
  157. SELECTOR_DIC[KEY_AFTER] = '.l-other-contents--blog';
  158. SELECTOR_DIC[KEY_BIOGRAPHY] = '.p-biography__text';
  159. SELECTOR_DIC[KEY_FC_LOGO] = '.fc-logo';
  160. SELECTOR_DIC[KEY_FC_TEXT] = '.fc-contents .text';
  161.  
  162. const CSS_DIC = {};
  163. CSS_DIC[KEY_BACKGROUND] = new Array('background-color');
  164. CSS_DIC[KEY_MENUBAR] = new Array('background-color');
  165. CSS_DIC[KEY_BREADCRUMB] = new Array('color');
  166. CSS_DIC[KEY_LIST] = new Array('color');
  167. CSS_DIC[KEY_ARTICLE] = new Array('color');
  168. CSS_DIC[KEY_PASTDAY] = new Array('background-color');
  169. CSS_DIC[KEY_TODAY] = new Array('background');
  170. CSS_DIC[KEY_MEMBER_PROP] = new Array('color');
  171. CSS_DIC[KEY_SVG_PATH] = new Array('fill');
  172. CSS_DIC[KEY_BLOG] = new Array('color', 'background-color');
  173. CSS_DIC[KEY_STRONG] = new Array('color', 'background-color');
  174. CSS_DIC[KEY_DISCO] = new Array('color');
  175. CSS_DIC[KEY_AFTER] = new Array('color', '--bg-color');
  176. CSS_DIC[KEY_BIOGRAPHY] = new Array('color');
  177. CSS_DIC[KEY_FC_LOGO] = new Array('background-color');
  178. CSS_DIC[KEY_FC_TEXT] = new Array('color');
  179.  
  180. const DEFAULT_COLOR_CONFIG = {};
  181.  
  182. const DARK_COLOR_CONFIG = {};
  183. DARK_COLOR_CONFIG[KEY_BACKGROUND] = {"background-color": DARK_BG_CL};
  184. DARK_COLOR_CONFIG[KEY_MENUBAR] = {"background-color": DARK_MENU_CL};
  185. DARK_COLOR_CONFIG[KEY_BREADCRUMB] = {"color": DARK_FONT_CL};
  186. DARK_COLOR_CONFIG[KEY_LIST] = {"color": DARK_FONT_CL};
  187. DARK_COLOR_CONFIG[KEY_ARTICLE] = {"color": DARK_FONT_CL};
  188. DARK_COLOR_CONFIG[KEY_PASTDAY] = {"background-color": DARK_PAST_BG_CL};
  189. DARK_COLOR_CONFIG[KEY_TODAY] = {"background": `linear-gradient(${DARK_TODAY_UPPER_CL}, 10%, ${DARK_TODAY_LOWER_CL})`};
  190. DARK_COLOR_CONFIG[KEY_MEMBER_PROP] = {"color": DARK_FONT_CL};
  191. DARK_COLOR_CONFIG[KEY_SVG_PATH] = {"fill": DARK_SVG_CL};
  192. DARK_COLOR_CONFIG[KEY_BLOG] = {"color": DARK_FONT_CL, "background-color": DARK_BG_CL};
  193. DARK_COLOR_CONFIG[KEY_STRONG] = {"color": DARK_STRONG_FONT_CL, "background-color": DARK_STRONG_BG_CL};
  194. DARK_COLOR_CONFIG[KEY_DISCO] = {"color": DARK_FONT_CL};
  195. DARK_COLOR_CONFIG[KEY_AFTER] = {"color": DARK_FONT_CL, "--bg-color": DARK_BG_CL};
  196. DARK_COLOR_CONFIG[KEY_BIOGRAPHY] = {"color": DARK_FONT_CL};
  197. DARK_COLOR_CONFIG[KEY_FC_LOGO] = {"background-color": DARK_IMG_BG_CL};
  198. DARK_COLOR_CONFIG[KEY_FC_TEXT] = {"color": DARK_FC_TEXT_CL};
  199.  
  200. const COLOR_CONFIGS = [DEFAULT_COLOR_CONFIG, DARK_COLOR_CONFIG];
  201.  
  202. /*
  203. * cssプロパティの値を取得
  204. * @param {string} selector - cssセレクタ
  205. * @param {string} cssProperty - cssプロパティ名
  206. * @return {string} cssプロパティの値
  207. */
  208. const getSelectorStyle = (selector, cssProperty) =>
  209. (((element, cssProperty) => (element != null) ? getComputedStyle(element).getPropertyValue(cssProperty) : 'rgb(0, 0, 0)')(document.querySelector(selector), cssProperty));
  210.  
  211.  
  212. const getBeforeFirstComma = (str) => {
  213. const index = str.indexOf(",");
  214. return index !== -1 ? str.slice(0, index) : str;
  215. };
  216.  
  217. const analyzeDefaultColor = () => {
  218. Array.prototype.forEach.call(KEYS, (k) => {
  219. DEFAULT_COLOR_CONFIG[k] = {};
  220. Array.prototype.forEach.call(CSS_DIC[k], (c) => {
  221. DEFAULT_COLOR_CONFIG[k][c] = getSelectorStyle(getBeforeFirstComma(SELECTOR_DIC[k]), c);
  222. });
  223. });
  224. };
  225.  
  226.  
  227. const setMenuFontColor = (selector, originColor = '#8cc8d1') => {
  228.  
  229. Array.prototype.forEach.call(document.querySelectorAll(selector), (x) => {
  230.  
  231. x.addEventListener('mouseover', () => {
  232.  
  233. if (getColorMode() === COLOR_MODE.DARK_COLOR) {
  234. x.style.color = '#e0ffff';
  235. } else {
  236. x.style.color = '#5d5d5d';
  237. }
  238. });
  239.  
  240. x.addEventListener('mouseout', () => {
  241. x.style.color = originColor;
  242. });
  243. });
  244. };
  245.  
  246. const setHoveredFontColor = (itemSelector, titleSelector, datetimeSelector) => {
  247. Array.prototype.forEach.call(document.querySelectorAll(itemSelector), (x) => {
  248. x.addEventListener('mouseover', () => {
  249.  
  250. if (getColorMode() === COLOR_MODE.DARK_COLOR) {
  251.  
  252. x.querySelector(titleSelector).style.color = `${DARK_FONT_CL}`;
  253. const datetime = x.querySelector(datetimeSelector);
  254. if (datetime) { datetime.style.color = `${DARK_FONT_CL}`;}
  255. } else {
  256.  
  257. x.querySelector(titleSelector).style.color = `${DEFAULT_FONT_CL}`;
  258. const datetime = x.querySelector(datetimeSelector);
  259. if (datetime) { datetime.style.color = `${DEFAULT_FONT_CL}`;}
  260. }
  261. });
  262. });
  263.  
  264. Array.prototype.forEach.call(document.querySelectorAll(itemSelector), (x) => {
  265. x.addEventListener('mouseout', () => {
  266.  
  267. x.querySelector(titleSelector).style.color = `${DEFAULT_TITLE_FONT_CL}`;
  268. const datetime = x.querySelector(datetimeSelector);
  269. if (datetime) { datetime.style.color = `${DEFAULT_FONT_CL}`;}
  270. });
  271. });
  272. };
  273.  
  274. const setHoveredFontAndBgColor = (itemSelector, textSelector, doBackgroundGradient = true) => {
  275. Array.prototype.forEach.call(document.querySelectorAll(itemSelector), (x) => {
  276. x.addEventListener('mouseover', () => {
  277.  
  278. if (getColorMode() === COLOR_MODE.DARK_COLOR) {
  279. x.style.background = `linear-gradient(${DARK_HOVER_BG_UPPER_CL}, 20%, ${DARK_HOVER_BG_LOWER_CL})`;
  280. x.style.outline = `1px solid ${DARK_HOVER_BORDER_CL}`
  281.  
  282. x.style.color = `${DARK_FONT_CL}`;
  283. x.children[0].style.color = `${DARK_FONT_CL}`;
  284. const text = x.querySelector(textSelector);
  285. if (text) { text.style.color = `${DARK_FONT_CL}`;}
  286. } else {
  287. x.style.background = `linear-gradient(${HOVER_BG_UPPER_CL}, 20%, ${HOVER_BG_LOWER_CL})`;
  288. x.style.outline = `1px solid ${HOVER_BORDER_CL}`
  289.  
  290. x.style.color = `${DEFAULT_FONT_CL}`;
  291. x.children[0].style.color = `${DEFAULT_FONT_CL}`;
  292. const text = x.querySelector(textSelector);
  293. if (text) { text.style.color = `${DEFAULT_FONT_CL}`;}
  294. }
  295. });
  296. });
  297.  
  298. Array.prototype.forEach.call(document.querySelectorAll(itemSelector), (x) => {
  299. x.addEventListener('mouseout', () => {
  300. x.style.background = `transparent`;
  301. x.style.outline = `1px solid transparent`
  302. x.style.color = `${DEFAULT_FONT_CL}`;
  303. x.children[0].style.color = `${DEFAULT_FONT_CL}`;
  304. const text = x.querySelector(textSelector);
  305. if (text) { text.style.color = `${DEFAULT_FONT_CL}`;}
  306. });
  307. });
  308. };
  309.  
  310. /*
  311. * ページに対応した色設定を行う
  312. * @param {string} pageType - ページ種類
  313. * @param {string} colorMode - カラーモード
  314. */
  315. const setColor = (pageType, colorMode) => {
  316.  
  317. const configIndex = parseInt(colorMode);
  318.  
  319. Array.prototype.forEach.call(KEYS, (k) => {
  320. Array.prototype.forEach.call(document.querySelectorAll(SELECTOR_DIC[k]), (e) => {
  321. Array.prototype.forEach.call(CSS_DIC[k], (c) => {
  322. e.style.setProperty(c, COLOR_CONFIGS[configIndex][k][c]);
  323. });
  324. });
  325. });
  326.  
  327. // パンくずリスト
  328. Array.prototype.forEach.call(document.querySelectorAll('.p-page-breadcrumb__list .c-page-breadcrumb__item:not(:last-child)'), (x) => {
  329. x.addEventListener('mouseover', () => {
  330.  
  331. if (getColorMode() === COLOR_MODE.DARK_COLOR) {
  332. x.children[0].style.color = "lightcyan";
  333. } else {
  334. x.children[0].style.color = '#5d5d5d';
  335. }
  336. });
  337.  
  338. x.addEventListener('mouseout', () => {
  339.  
  340. if (getColorMode() === COLOR_MODE.DARK_COLOR) {
  341. x.children[0].style.color = "lightcyan";
  342. } else {
  343. x.children[0].style.color = '#a9a9a9';
  344. }
  345. });
  346. });
  347.  
  348. switch (pageType) {
  349. case "news":
  350. case "media":
  351. setMenuFontColor('.cale_prev a, .cale_month a, .cale_next a, .cale_table tbody tr td a');
  352. setHoveredFontAndBgColor('.p-news__item, .p-other__item, .p-schedule__item', 'time');
  353. break;
  354. case "artist":
  355. setHoveredFontAndBgColor('.p-news__item', '.c-news__date');
  356. break;
  357. case "diary/member":
  358. shortenYear('.c-blog-main__date, .c-blog-top__date');
  359. setHoveredFontColor('.p-blog-top__item', '.c-blog-top__title', '.c-blog-top__date');
  360. break;
  361. case "diary/detail":
  362. case "diary/member/list":
  363. setMenuFontColor('.cale_prev a, .cale_month a, .cale_next a, .cale_table tbody tr td a');
  364. setHoveredFontAndBgColor('.p-blog-entry__item', '.c-blog-entry__title');
  365. setHoveredFontAndBgColor('.d-article', '.s-article-title');
  366. setHoveredFontAndBgColor('.c-pager__item__text', 'time');
  367. break;
  368.  
  369. // 動画
  370. case "video":
  371. case "contents":
  372.  
  373. // 動画タイトル
  374. Array.prototype.forEach.call(document.querySelectorAll('.p-video__item.p-video__item--medium'), (x) => {
  375.  
  376.  
  377. x.addEventListener('mouseover', () => {
  378.  
  379. if (getColorMode() === COLOR_MODE.DARK_COLOR) {
  380.  
  381. x.children[1].children[0].style.color = "lightcyan";
  382. } else {
  383. x.children[1].children[0].style.color = '#5d5d5d';
  384. }
  385. });
  386.  
  387. x.addEventListener('mouseout', () => {
  388.  
  389. x.children[1].children[0].style.color = '#a9a9a9';
  390. });
  391. });
  392. break;
  393. case "event":
  394. Array.prototype.forEach.call(document.querySelectorAll('.p-shakehands__item'), (x) => {
  395. x.addEventListener('mouseover', () => {
  396.  
  397. if (getColorMode() === COLOR_MODE.DARK_COLOR) {
  398. x.children[1].children[1].style.color = "lightcyan";
  399. x.children[1].children[2].style.color = "lightcyan";
  400. } else {
  401. x.children[1].children[1].style.color = '#5d5d5d';
  402. x.children[1].children[2].style.color = '#5d5d5d';
  403. }
  404. });
  405.  
  406. x.addEventListener('mouseout', () => {
  407.  
  408. x.children[1].children[1].style.color = '#8babab';
  409. x.children[1].children[2].style.color = '#8babab';
  410. });
  411. });
  412. Array.prototype.forEach.call(document.querySelectorAll('.p-other__item'), (x) => {
  413. x.addEventListener('mouseover', () => {
  414.  
  415. if (getColorMode() === COLOR_MODE.DARK_COLOR) {
  416. x.children[0].style.color = "lightcyan";
  417. } else {
  418. x.children[0].style.color = '#5d5d5d';
  419. }
  420. });
  421.  
  422. x.addEventListener('mouseout', () => {
  423.  
  424. x.children[0].style.color = '#8babab';
  425. });
  426. });
  427. Array.prototype.forEach.call(document.querySelectorAll('.c-pager__item--count a'), (x) => {
  428. x.addEventListener('mouseover', () => {
  429.  
  430. if (getColorMode() === COLOR_MODE.DARK_COLOR) {
  431. x.style.color = "lightcyan";
  432. } else {
  433. x.style.color = '#5d5d5d';
  434. }
  435. });
  436.  
  437. x.addEventListener('mouseout', () => {
  438.  
  439. x.style.color = '#8babab';
  440. });
  441. });
  442. break;
  443. default:
  444. ;
  445. }
  446. };
  447.  
  448.  
  449. const leftPosition = (colorMode) => (colorMode === COLOR_MODE.DEFAULT_COLOR) ? "-3px" : "36px";
  450.  
  451. /**
  452. * カラーモードトグルのスイッチボタンを生成
  453. * @param {COLOR_MODE} colorMode
  454. * @returns
  455. */
  456. const createSwitchButton = (colorMode) => {
  457. const switchButton = document.createElement('div');
  458. switchButton.classList.add("switch_button");
  459. const left = leftPosition(colorMode);
  460.  
  461. switchButton.style.cssText
  462. = `left: ${left};
  463. margin-top: -5px;
  464. width: 24px;
  465. height: 24px;
  466. border-radius: 50%;
  467. position: absolute;
  468. background-color: white;
  469. box-shadow: 1px 1px 7px #B7B7B7, -1px -1px 4px #CECECE inset;
  470. transition: left .3s ease-in-out;`;
  471.  
  472. return switchButton;
  473. };
  474.  
  475.  
  476. const initializeColorToggle = (colorMode) => {
  477.  
  478. const menuList = document.querySelector('.p-menu__list');
  479.  
  480. if (menuList && !document.querySelector('.color_toggle')) {
  481. const colorToggle = document.createElement('div');
  482. colorToggle.classList.add("color_toggle");
  483. menuList.appendChild(colorToggle);
  484.  
  485. colorToggle.style.cssText
  486. = `margin-top: 2px;
  487. margin-left: 16px;
  488. width: 60px;
  489. height: 18px;
  490. border: solid 2px gray;
  491. border-radius: calc(infinity * 1px);
  492. background: linear-gradient(to right, #fff 0%, #fefefe 30%, #606080 70%, #404060 80%, #202040 100%);
  493. position: relative;
  494. cursor: pointer;
  495. transition: background-color .2s ease-in-out;`;
  496.  
  497. const switchButton = createSwitchButton(colorMode);
  498. colorToggle.appendChild(switchButton);
  499. colorToggle.addEventListener("click", () => {
  500. const colorMode = toggleColorMode();
  501. switchButton.style.left = leftPosition(colorMode);
  502. setColor(getPageType(), colorMode);
  503. });
  504. return true;
  505. } else {
  506.  
  507. return false;
  508. }
  509. };
  510.  
  511.  
  512. const doProcessList = (func) => {
  513. const isDetail = ((location.href).match(new RegExp('\/detail\/')) != null);
  514. if (isDetail) {
  515. return;
  516. }
  517.  
  518. const PAGE_TYPE_ERROR_MSG = "Processing of out-of-scope pages. Check the settings @match.";
  519.  
  520. const pageType = (location.href).match(new RegExp('\/(media|news)\/'))[1];
  521. if (! pageType) {
  522. throw new Error(PAGE_TYPE_ERROR_MSG);
  523. }
  524.  
  525. const SELECTORS = ((x) => {
  526. switch (x) {
  527. case "news":
  528. return {"pArrow": ".p-news__pager-arrow",
  529. "cArrowLeft": ".c-news_pager-arrow--left",
  530. "cArrowRight" : ".c-news_pager-arrow--right",
  531. "cPageMonth": ".c-news__page_month",
  532. "cPageYear": ".c-news__page_year",
  533. "lMainContentsUl": ".l-maincontents--news ul",
  534. "pDate": ".p-news__page_date",
  535. "lSubContents": ".l-sub-contents--news"};
  536. case "media":
  537. return {"pArrow": ".p-schedule__pager-arrow",
  538. "cArrowLeft": ".c-schedule_pager-arrow--left",
  539. "cArrowRight" : ".c-schedule_pager-arrow--right",
  540. "cPageMonth": ".c-schedule__page_month",
  541. "cPageYear": ".c-schedule__page_year",
  542. "lMainContentsUl": ".l-maincontents--schedule ul",
  543. "pDate": ".p-schedule__page_date",
  544. "lSubContents": ".l-sub-contents--schedule"};
  545. default:
  546. throw new Error(PAGE_TYPE_ERROR_MSG);
  547. }
  548. })(pageType);
  549.  
  550. const pageYear = ((y) => {return (y === null || y === undefined) ? null : y.innerText;})(document.querySelector(SELECTORS['cPageYear']));
  551.  
  552. const now = new Date();
  553.  
  554. // "年"の表示がない場合
  555. if (pageYear !== "年") {
  556.  
  557. const daysOfWeek = ['Su', 'M', 'Tu', 'W', 'Th', 'F', 'Sa'];
  558. const year = now.getFullYear();
  559. const month = now.getMonth() + 1;
  560. // 月初
  561. const first = new Date(year, month - 1, 1);
  562. // 月末
  563. const end = new Date(year, month, 0);
  564. // 月末の日
  565. const endDate = end.getDate();
  566. // 前月末
  567. const endPrevMonth = new Date(year, month - 1, 0);
  568. // 前月末の日
  569. const endDatePrevMonth = endPrevMonth.getDate();
  570. // 月初の曜日
  571. const firstDayOfWeek = first.getDay();
  572.  
  573. let numOfDay = 1;
  574. let calendarHtml = '';
  575.  
  576. const pageMonth = ((m) => {return m !== null ? m.innerText : "";})(document.querySelector(SELECTORS['cPageMonth']));
  577.  
  578. const leftArrowHref = document.querySelector(SELECTORS['cArrowLeft']).children[0].href;
  579. const rightArrowHref = document.querySelector(SELECTORS['cArrowRight']).children[0].href;
  580.  
  581. calendarHtml += '<table class="cale_table" style="width: 210px; margin: -130px 0 20px -50px;">';
  582. calendarHtml += `<tr><td></td><td class="cale_prev"><a id="cale_prev" href="${leftArrowHref}"><</a></td>
  583. <td class="cale_month" colspan="3">${pageYear}&#160;${pageMonth}</td><td class="cale_next"><a href="${rightArrowHref}">></a></td><td></td></tr>`;
  584.  
  585. calendarHtml += '<tr>';
  586.  
  587. for (let i = 0; i < daysOfWeek.length; i++) {
  588. calendarHtml += '<td class="cale_wek' + i + '">' + daysOfWeek[i] + '</td>';
  589. }
  590.  
  591. calendarHtml += '</tr>';
  592.  
  593. for (let w = 0; w < 6; w++) {
  594. calendarHtml += '<tr>'
  595.  
  596. for (let d = 0; d < 7; d++) {
  597. if (w == 0 && d < firstDayOfWeek) {
  598. // 前月
  599. let num = endDatePrevMonth - firstDayOfWeek + d + 1;
  600. calendarHtml += '<td class="cale_day' + d + ' is-disabled">' + num + '</td>';
  601. } else if (numOfDay > endDate) {
  602. // 次月
  603. let num = numOfDay - endDate;
  604. calendarHtml += '<td class="cale_day' + d + ' is-disabled">' + num + '</td>';
  605. numOfDay++;
  606. w = 99; // カレンダーの最下端が次月の日付のみになるのを防止
  607. } else {
  608. calendarHtml += '<td class="cale_day' + d + '">' + numOfDay + '</td>';
  609. numOfDay++;
  610. }
  611. }
  612. calendarHtml += '</tr>'
  613. }
  614.  
  615. calendarHtml += '</table>';
  616.  
  617. document.querySelector(SELECTORS["lSubContents"]).insertAdjacentHTML('afterbegin', calendarHtml);
  618. }
  619.  
  620. // 選択カテゴリ(ALL / 握手会・・・)
  621. const categorySelectorSuffix
  622. = ((c) => {
  623. let value = "";
  624. if (c.length == 0) {
  625. value = "all";
  626. } else {
  627. const tempValue = c[0].value;
  628.  
  629. switch (tempValue) {
  630. case "birthday":
  631. value = "birth";
  632. break;
  633.  
  634. case "fanclub":
  635. value = "fanclubonly";
  636. break;
  637.  
  638. default:
  639. value = tempValue;
  640. }
  641. }
  642.  
  643. return value;
  644. })(document.getElementsByName("cd"));
  645.  
  646. const categoryElem = document.querySelector('.c-button-category.category_' + categorySelectorSuffix);
  647. const categoryStyles = window.getComputedStyle(categoryElem);
  648. const categoryParent = categoryElem.parentElement;
  649. categoryParent.style.marginLeft = "-5px";
  650. categoryParent.style.paddingLeft = "4.5px";
  651. categoryParent.style.marginRight = "40px";
  652. categoryElem.style.color = `rgb(from ${categoryStyles.color} calc(r - 64) calc(g - 64) calc(b - 64))`;
  653. categoryParent.style.backgroundColor = `rgb(from ${categoryStyles.color} calc(r + 64) calc(g + 64) calc(b + 64))`;
  654. categoryParent.style.border = `solid 0.5px ${categoryElem.style.color}`;
  655.  
  656. // 詳細ページの場合 処理を終了 
  657. if (isDetail) {
  658. return;
  659. }
  660.  
  661. /*
  662. * フルブラウザ上ではNEWS/スケジュールが多い月は見づらいため
  663. * 自動スクロール、表示色を追加設定
  664. */
  665.  
  666. const PAGER_MARGIN_TOP = 20;
  667. const PASTDAY_BG_CL = "#ededf0";
  668. const TODAY_DATE_CL = "orange";
  669. const TODAY_BG_CL = "#fafeff";
  670. const TODAY_BORDER_CL_UPPER = "#d7eeff";
  671. const TODAY_BORDER_CL_LOWER = "#5bbee5";
  672.  
  673. let styleText = `
  674. .is-disabled {
  675. color: silver;
  676. }
  677. .p-page-head {
  678. padding-top: 20px;
  679. }
  680. .c-pager__item a svg {
  681. fill: #7ab6db;
  682. }
  683. .schedule__list-pastday {
  684. background-color: ${PASTDAY_BG_CL};
  685. }
  686. .schedule__list-today {
  687. background-color: ${TODAY_BG_CL};
  688. border: 2px solid;
  689. border-image: linear-gradient(to right bottom, ${TODAY_BORDER_CL_UPPER}, ${TODAY_BORDER_CL_LOWER}) 1;
  690. }
  691. .schedule__date-today {
  692. color: ${TODAY_DATE_CL};
  693. }
  694. .p-news__item, .p-schedule__item {
  695. outline-offset: 1px;
  696. }
  697. .module-modal.js-member-filter .mordal-box .member-box ul li p.check input[type=checkbox]:checked+label:before {
  698. background-color:#6bcaea;
  699. border:1px solid #6bcaea;
  700. }`;
  701.  
  702. document.appendStyle(styleText);
  703.  
  704. // リスト上方 "xxxx年 yy月" 行
  705. const pDate = document.querySelector(SELECTORS["pDate"]);
  706.  
  707. // "xxxx年" ではなく "年"のみの場合
  708. if (pageYear === "年") {
  709. const cPageYear = document.querySelector(SELECTORS["cPageYear"]);
  710. cPageYear.innerText = String(now.getFullYear()) + "年";
  711. cPageYear.style.fontSize = "4.8rem";
  712. document.querySelector(SELECTORS["cPageMonth"]).remove();
  713. document.querySelector(SELECTORS["pArrow"]).remove();
  714. }
  715.  
  716. pDate.style.marginBottom = "5px";
  717.  
  718. // ニュース/スケジュール リスト
  719. const lMainContentsUl = document.querySelector(SELECTORS["lMainContentsUl"]);
  720.  
  721. const lMainContentsUlTop = lMainContentsUl.getBoundingClientRect().top;
  722.  
  723. const pDateHeight = pDate.offsetHeight;
  724.  
  725. // リスト下方 前月/次月ページャ
  726. const pPager = document.querySelector(".p-pager");
  727.  
  728. // "xxxx年" ではなく "年"のみの場合
  729. if (pageYear === "年") {
  730. pPager.innerText = "";
  731.  
  732. pPager.style.marginTop = "0px";
  733. } else {
  734.  
  735. pPager.style.marginTop = `${PAGER_MARGIN_TOP}px`;
  736. }
  737.  
  738. const pPagerHeight = PAGER_MARGIN_TOP + pPager.offsetHeight;
  739. const lMainContentsUlHeight = document.documentElement.clientHeight - pDateHeight - pPagerHeight;
  740.  
  741. // スクロール表示
  742. lMainContentsUl.setAttribute("style", `height:${lMainContentsUlHeight}px; overflow: scroll; border: solid 1px #32a1ce;`);
  743.  
  744. const scrollTop = lMainContentsUlTop - pDateHeight;
  745.  
  746. // スクロール位置リセット 〜「再読み込み」ボタン押下時の位置ズレ対応
  747. scrollTo(0, 0);
  748.  
  749. // リスト位置までページ内で縦スクロール
  750. scrollTo({
  751. top: scrollTop,
  752. behavior: "smooth"
  753. });
  754.  
  755. const nowYearMonth = String(now.getFullYear()) + String(now.getMonth() + 1).padStart( 2, '0');
  756. const dispYear = document.querySelector(SELECTORS['cPageYear']);
  757. const dispMonth = document.querySelector(SELECTORS['cPageMonth']);
  758.  
  759. // 表示対象の年月(ex.202404)を取得。設定がなければ当月
  760. const dispYearMonth
  761. = ((y, m) => {return (y == null || m == null) ? nowYearMonth : y.innerText.replace('年', '') + m.innerText.replace('月', '')})(dispYear, dispMonth);
  762.  
  763. // NEWS/スケジュールが当月以前の月の場合
  764. if (dispYearMonth < nowYearMonth) {
  765.  
  766. lMainContentsUl.classList.add('schedule__list-pastday');
  767. }
  768. const createAnchor = (y, d) => `<a href="javascript:document.querySelector('${SELECTORS['lMainContentsUl']}').scroll({top:${y}, behavior: 'smooth'});">${d}</a>`;
  769. if (pageType === "news") {
  770. doProcessNews(lMainContentsUlTop, createAnchor);
  771. } else {
  772. doProcessMedia(lMainContentsUl, lMainContentsUlTop, dispYearMonth, now, nowYearMonth, createAnchor);
  773. }
  774. };
  775.  
  776.  
  777. const COMPRESSED = `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`;
  778.  
  779. const HINATAZAKA46 = JSON.parse(LZString.decompressFromBase64(COMPRESSED));
  780.  
  781. HTMLElement.prototype.setPenlightColor = function(color_01, color_02, thickness, intensity) {
  782.  
  783. this.style.borderLeftColor = "#" + color_01;
  784. this.style.borderTopColor = "#" + color_01;
  785. this.style.borderRightColor = "#" + color_02;
  786. this.style.borderBottomColor = "#" + color_02;
  787.  
  788. this.style.boxShadow = `
  789. -${thickness} 0px ${thickness} -4px #${color_01},
  790. 0px -${thickness} ${thickness} -4px #${color_01},
  791. ${thickness} 0px ${thickness} -4px #${color_02},
  792. 0px ${thickness} ${thickness} -4px #${color_02},
  793.  
  794. inset 0px 2px 4px white,
  795. inset 2px 0px 4px white,
  796. inset 0px -2px 4px white,
  797. inset -2px 0px 4px white,
  798. inset 0px 4px 4px #${color_01},
  799. inset 4px 0px 4px #${color_01},
  800. inset 0px -4px 4px #${color_02},
  801. inset -4px 0px 4px #${color_02},
  802. inset 0px ${thickness} 4px rgb(from #${color_01} calc(r + ${intensity}) calc(g + ${intensity}) calc(b + ${intensity})),
  803. inset ${thickness} 0px 4px rgb(from #${color_01} calc(r + ${intensity}) calc(g + ${intensity}) calc(b + ${intensity})),
  804. inset 0px -${thickness} 4px rgb(from #${color_02} calc(r + ${intensity}) calc(g + ${intensity}) calc(b + ${intensity})),
  805. inset -${thickness} 0px 4px rgb(from #${color_02} calc(r + ${intensity}) calc(g + ${intensity}) calc(b + ${intensity})),
  806.  
  807. -4px 0px 4px -4px white,
  808. 0px -4px 4px -4px white,
  809. 4px 0px 4px -4px white,
  810. 0px 4px 4px -4px white,
  811. -4px 0px 4px -4px rgb(from #${color_01} calc(r + ${intensity}) calc(g + ${intensity}) calc(b + ${intensity})),
  812. 0px -4px 4px -4px rgb(from #${color_01} calc(r + ${intensity}) calc(g + ${intensity}) calc(b + ${intensity})),
  813. 4px 0px 4px -4px rgb(from #${color_02} calc(r + ${intensity}) calc(g + ${intensity}) calc(b + ${intensity})),
  814. 0px 4px 4px -4px rgb(from #${color_02} calc(r + ${intensity}) calc(g + ${intensity}) calc(b + ${intensity}))
  815. `;
  816. };
  817.  
  818.  
  819. const doProcessMember = () => {
  820. document.appendStyle(`
  821. .p-member__item a div img {
  822. border: 1px solid;
  823. border-radius: 8px;
  824. padding: 0.2rem;
  825. transition: transform 0.3s ease, z-index 0.3s ease;
  826. transform-origin: center center;
  827. }
  828. .p-member__item:hover a div img {
  829. transform:scale(1.1, 1.1);
  830. }`
  831. );
  832. Array.prototype.forEach.call(document.querySelectorAll('.p-member__item'), (m) => {
  833.  
  834. const color_set = HINATAZAKA46.DATA[m.dataset.member]['color'];
  835.  
  836. const code_01 = HINATAZAKA46.PENLIGHT[color_set[0]]["code"];
  837. const code_02 = HINATAZAKA46.PENLIGHT[color_set[1]]["code"];
  838.  
  839. const img = m.children[0].children[0].children[0];
  840.  
  841. img.setPenlightColor(code_01, code_02, "4px", 64);
  842.  
  843. m.addEventListener('mouseover', () => {img.setPenlightColor(code_01, code_02, "12px", 128);});
  844. m.addEventListener('mouseout', () =>{img.setPenlightColor(code_01, code_02, "4px", 64);});
  845. });
  846. }
  847.  
  848. const doProcessMemberDetail = () => {
  849. document.appendStyle(`
  850. .p-member__box {
  851. padding-top: 40px;
  852. }
  853. .c-member__thumb img {
  854. border: 3px solid;
  855. border-radius: 8px;
  856. padding: 0.2rem;
  857. position: relative;
  858. }
  859. .c-mamber__category_title {
  860. margin-bottom: 0;
  861. }
  862. .p-section {
  863. z-index: 100;
  864. }
  865. .p-button--center {
  866. padding-top: 0;
  867. }
  868. .p-contents.p-contents--news {
  869. padding-bottom: 0px;
  870. }
  871. .c-btn-member-greeting-popup-close {
  872. --color: black;
  873. }
  874. .c-btn-member-greeting-popup-close:before {
  875. border: solid 1px;
  876. background-color: var(--color);
  877. }
  878. .c-btn-member-greeting-popup-close:after {
  879. border: solid 1px;
  880. background-color: var(--color);
  881. }`);
  882. const close_button = document.querySelector('.c-btn-member-greeting-popup-close');
  883. close_button.style.setProperty("--color", DEFAULT_FONT_CL);
  884. const img = document.querySelector('.c-member__thumb > img:nth-child(1)');
  885.  
  886. if (img) {
  887. const ct = (location.href).match(/artist\/([0-9]{1,2})/)[1];
  888. const color_set = HINATAZAKA46.DATA[ct]['color'];
  889. const color_01 = HINATAZAKA46.PENLIGHT[color_set[0]];
  890. const color_02 = HINATAZAKA46.PENLIGHT[color_set[1]];
  891.  
  892. img.setPenlightColor(color_01['code'], color_02['code'], "8px", 64);
  893. }
  894. };
  895.  
  896. const doProcessGreeting = () => {
  897. document.appendStyle(`
  898. .card, .member_thumb {
  899. cursor: pointer;
  900. }
  901. div.card {
  902. transition: transform 0.3s ease, z-index 0.3s ease;
  903. transform-origin: center center;
  904. }
  905. div.card:hover {
  906. transform: scale(1.05) translateZ(10px);
  907. z-index: 10; /* 前面に出す */
  908. }`
  909. );
  910. Array.prototype.forEach.call(document.querySelectorAll('[class^="card_"]'), (c) => {
  911. const cardNo = c.classList[0].match(/[0-9]{1,2}/)[0];
  912.  
  913. const member = c.querySelector('.member_thumb');
  914. member.addEventListener('click', () => {
  915. location.href = "https://www.hinatazaka46.com/s/official/artist/" + cardNo + "?ima=0000";
  916. });
  917. c.addEventListener('mouseover', () => {
  918. const menberName = c.querySelector('.name');
  919.  
  920. if (getColorMode() === COLOR_MODE.DARK_COLOR) {
  921.  
  922. menberName.style.color = `${DARK_FONT_CL}`;
  923. } else {
  924. menberName.children[0].style.color = `${DEFAULT_FONT_CL}`;
  925. }
  926. });
  927.  
  928. c.addEventListener('mouseout', () => {
  929. const menberName = c.querySelector('.name');
  930. menberName.style.color = `${DEFAULT_FONT_CL}`;
  931. });
  932.  
  933. const card = c.querySelector('.card');
  934. const btn = c.querySelector('a.btn01');
  935. card.addEventListener('click', (e) => {
  936. btn.click();
  937. });
  938. });
  939. };
  940.  
  941. const DELTA = 2;
  942.  
  943. const doProcessNews = (lMainContentsUlTop, createAnchor) => {
  944. const newsList = Array.prototype.map.call(document.getElementsByClassName("c-news__date"),
  945. (x) => [parseInt(x.innerText.match(new RegExp(/\d{4}\.\d{2}\.(\d{2})/))[1]), x.getBoundingClientRect().top] );
  946.  
  947. const dayMap = new Map();
  948.  
  949. Array.prototype.forEach.call(newsList, (x) => {
  950.  
  951. if (! dayMap.has(x[0]) || x[1] < dayMap.get(x[0])) {
  952. // Map(day, top)
  953. dayMap.set(x[0], x[1]);
  954. }
  955. });
  956. Map.prototype.forEach.call(dayMap, (top, day) => {
  957.  
  958. Array.prototype.some.call(document.querySelectorAll("table.cale_table tbody tr td"), (td) => {
  959.  
  960. if (!td.classList.contains("is-disabled") && day === parseInt(td.innerText)) {
  961.  
  962. td.innerHTML = createAnchor((top - lMainContentsUlTop - DELTA), day);
  963.  
  964. return true;
  965. }
  966. });
  967. });
  968. };
  969.  
  970.  
  971. // SCHEDULE
  972. const doProcessMedia = (lMainContentsUl, lMainContentsUlTop, dispYearMonth, now, nowYearMonth, createAnchor) => {
  973.  
  974. const today = now.getDate();
  975.  
  976. lMainContentsUl.scroll(0, 0);
  977.  
  978. let isScrolled = false;
  979.  
  980. Array.prototype.forEach.call(document.getElementsByClassName("c-schedule__date--list"), (dayElem) => {
  981.  
  982. // 日付(innerText)の文字列 '(日付)\n(曜日)' から日付を抽出
  983. let day = ((x) => {return parseInt(x.substr(0, x.indexOf(`\n`)));})(dayElem.innerText);
  984.  
  985. Array.prototype.some.call(document.querySelectorAll("table.cale_table tbody tr td"), (td) => {
  986.  
  987. if ( !td.classList.contains("is-disabled") && day === parseInt(td.innerText)) {
  988.  
  989. td.innerHTML = createAnchor((dayElem.getBoundingClientRect().top - lMainContentsUlTop - DELTA), day);
  990.  
  991. return true;
  992. }
  993. });
  994.  
  995. // 表示スケジュールが当月の場合
  996. if (dispYearMonth === nowYearMonth) {
  997. // 過去日
  998. if (day < today) {
  999.  
  1000. dayElem.parentElement.classList.add("schedule__list-pastday");
  1001.  
  1002. // 「今日」(ページを表示した日付)
  1003. } else if (day === today) {
  1004.  
  1005. dayElem.classList.add("schedule__date-today");
  1006. dayElem.parentElement.classList.add("schedule__list-today");
  1007. }
  1008.  
  1009. if (day >= today) {
  1010.  
  1011. dayElem.parentElement.classList.add("schedule__list-future");
  1012.  
  1013. if (!isScrolled) {
  1014. // 「今日」以降(「今日」を含めて)で最早のスケジュール日要素にスクロール
  1015. lMainContentsUl.scroll({
  1016.  
  1017. top: dayElem.getBoundingClientRect().top - lMainContentsUlTop - DELTA,
  1018. behavior: "smooth"
  1019. });
  1020.  
  1021. isScrolled = true;
  1022. }
  1023. }
  1024. }
  1025. });
  1026. };
  1027.  
  1028. /*
  1029. * "ディスコグラフィー"向けリリース年リストを画面に配置する
  1030. */
  1031. const setReleaseYear4Disco = () => {
  1032. const releaseYearSelector = '.c-disco__year';
  1033.  
  1034. let navText = `<header class="header" role="banner" style="z-index: 1000;">
  1035. <nav class="nav">
  1036. <div class="release">RELEASE<br/>YEAR</div>
  1037. <ul class="nav-list">`;
  1038.  
  1039. Array.prototype.forEach.call(document.querySelectorAll(releaseYearSelector), (x) => {
  1040.  
  1041. const year = x.innerText;
  1042. const id_year = "y_" + year;
  1043. x.parentNode.setAttribute("id", id_year);
  1044. navText += `<li><a class="rel_year">${year}</a></li>`;
  1045. });
  1046.  
  1047. navText += `</ul>
  1048. </nav>
  1049. </header>`;
  1050.  
  1051. const main = document.querySelector('.l-main');
  1052. main.setAttribute("style", 'padding-top:0; margin: 20px 0 0 40px; font-size: larger;');
  1053. main.insertAdjacentHTML('afterbegin', navText);
  1054. setTimeout(() => {
  1055. const header = document.querySelector('header');
  1056. const nav = document.querySelector('.nav');
  1057. const navHeight = nav.clientHeight;
  1058.  
  1059. window.onscroll = () => {
  1060.  
  1061. if (window.pageYOffset >= header.clientHeight) {
  1062. nav.classList.add('fixed');
  1063. main.setAttribute('style', 'padding-top:' + navHeight + 'px');
  1064. } else {
  1065. nav.classList.remove('fixed');
  1066. main.setAttribute('style', 'padding-top:0; margin: 20px 0 0 40px; font-size: larger;');
  1067. }
  1068. };
  1069.  
  1070. const latestYear = document.querySelector(releaseYearSelector);
  1071.  
  1072. const scrollTop = latestYear.parentNode.getBoundingClientRect().top;
  1073.  
  1074. // スクロール位置リセット 〜「再読み込み」ボタン押下時の位置ズレ対応
  1075. scrollTo(0, 0);
  1076.  
  1077. // リスト位置までページ内で縦スクロール
  1078. scrollTo({
  1079. top: scrollTop,
  1080. behavior: "smooth"
  1081. });
  1082.  
  1083. Array.prototype.forEach.call(document.querySelectorAll('.rel_year'), (x, i) => {
  1084. const year = x.innerText;
  1085.  
  1086. const yearElement = document.getElementById("y_" + year);
  1087. const top = yearElement.getBoundingClientRect().top;
  1088. x.setAttribute("href", `javascript:scrollTo({top:${top}, behavior:'smooth'});`);
  1089. });
  1090.  
  1091. }, 100);
  1092. };
  1093.  
  1094. const doProcessDiscography = () => {
  1095. styleText = `
  1096. .fixed {
  1097. width: 12rem;
  1098. position: fixed;
  1099. top: 60px;
  1100. left: 40px;
  1101. z-index: 1;
  1102. font-size:larger;
  1103. }
  1104. .release {
  1105. line-height: 20px;
  1106. }
  1107. .l-container {
  1108. margin-top: -280px;
  1109. }
  1110. .c-disco__year {
  1111. padding-top: 20px;
  1112. }
  1113. .c-disco__year {font-size: 4rem; width: 12rem;}
  1114. .c-disco__category {font-size: 14px;}
  1115. .p-page-head-sub--first {padding-top: 10px;}
  1116. `;
  1117. document.appendStyle(styleText);
  1118.  
  1119. setReleaseYear4Disco();
  1120. };
  1121.  
  1122. /*
  1123. * "フォーメーション"向けリリース年リストを画面に配置する
  1124. */
  1125. const setReleaseYear4Formation = () => {
  1126. const releaseYearSelector = '.c-page-subtitle';
  1127.  
  1128. let navText = `<header class="header" role="banner" style="z-index: 1000;">
  1129. <nav class="nav">
  1130. <div class="release">RELEASE<br/>YEAR</div>
  1131. <ul class="nav-list">`;
  1132. Array.prototype.forEach.call(document.querySelectorAll(releaseYearSelector), (x) => {
  1133.  
  1134. const year = x.innerText;
  1135. const id_year = "y_" + year;
  1136. x.parentNode.setAttribute("id", id_year);
  1137. navText += `<li><a href="#${id_year}">${year}</a></li>`;
  1138. });
  1139.  
  1140. navText += `</ul>
  1141. </nav>
  1142. </header>`;
  1143. const main = document.querySelector('.l-main');
  1144. main.setAttribute("style", 'padding-top:0; margin: 20px 0 0 40px; font-size: larger;');
  1145. main.insertAdjacentHTML('afterbegin', navText);
  1146. const header = document.querySelector('header');
  1147. const nav = document.querySelector('.nav');
  1148. const navHeight = nav.clientHeight;
  1149.  
  1150. window.onscroll = () => {
  1151.  
  1152. if (window.pageYOffset >= header.clientHeight) {
  1153. nav.classList.add('fixed');
  1154. main.setAttribute('style', 'padding-top:' + navHeight + 'px');
  1155. } else {
  1156. nav.classList.remove('fixed');
  1157. main.setAttribute('style', 'padding-top:0; margin: 20px 0 0 40px; font-size: larger;');
  1158. }
  1159. };
  1160. const latestYear = document.querySelector(releaseYearSelector);
  1161. const scrollTop = latestYear.parentNode.getBoundingClientRect().top;
  1162.  
  1163. // スクロール位置リセット 〜「再読み込み」ボタン押下時の位置ズレ対応
  1164. scrollTo(0, 0);
  1165.  
  1166. // リスト位置までページ内で縦スクロール
  1167. scrollTo({
  1168. top: scrollTop,
  1169. behavior: "smooth"
  1170. });
  1171. };
  1172.  
  1173.  
  1174. const doProcessFormation = () => {
  1175.  
  1176. const styleText = `
  1177. .l-container {
  1178. margin-top: -280px;
  1179. }
  1180. .formation_image :not(.small_f) li, small_f span {
  1181. transition: transform 0.3s ease, z-index 0.3s ease;
  1182. transform-origin: center center;
  1183. }
  1184. .formation_image :not(.small_f) li:hover, .small_f span:hover {
  1185. transform: scale(1.4, 1.4) translateZ(10px);
  1186. z-index: 10;
  1187. }
  1188. .formation_image li:hover i {
  1189. font-size: 16px;
  1190. }
  1191. .formation_image li i {
  1192. font-size: 14px;
  1193. }
  1194. .fixed {
  1195. width: 12rem;
  1196. position: fixed;
  1197. top: 60px;
  1198. left: 40px;
  1199. z-index: 1;
  1200. font-size:larger;
  1201. }
  1202. .release {
  1203. line-height: 20px;
  1204. }
  1205. .p-page-head-sub--first {
  1206. padding-top: 20px;
  1207. }
  1208. .p-page-head-sub {
  1209. margin: 0px auto 0px auto;
  1210. }`;
  1211.  
  1212. document.appendStyle(styleText);
  1213.  
  1214. setReleaseYear4Formation();
  1215. };
  1216.  
  1217.  
  1218. // Blog
  1219.  
  1220. /** yyyy → 'yy */
  1221. const shortenYear = (x) => {
  1222. Array.prototype.forEach.call(document.querySelectorAll(x), (y) => {
  1223. const text = y.innerText;
  1224. y.innerText = "'" + text.replace(/\d{2}(\d{2}\.)/, '$1');
  1225. });
  1226. };
  1227.  
  1228.  
  1229. const getBackgroundImageUrl = (el) => {
  1230. const bg = window.getComputedStyle(el).backgroundImage;
  1231. const urlMatch = bg.match(/url\(["']?(.*?)["']?\)/);
  1232. return urlMatch ? urlMatch[1] : null;
  1233. }
  1234.  
  1235. /*
  1236. * パタメータのrgb要素から補色を生成して返す
  1237. * ただしパラメータの色が白に近い場合は#202040(青)、黒に近い場合は#eeeeeeを返す
  1238. * @param {number} r - red
  1239. * @param {number} g - green
  1240. * @param {number} b - blue
  1241. * @param {number} threshold - 閾値
  1242. */
  1243. const getComplementaryColor = (r, g, b, threshold = 30) => {
  1244.  
  1245. const isNearlyWhite = r >= 255 - threshold && g >= 255 - threshold && b >= 255 - threshold;
  1246.  
  1247. if (isNearlyWhite) {
  1248. return '#202040';
  1249. }
  1250.  
  1251. const isNearlyBlack = r <= threshold && g <= threshold && b <= threshold;
  1252.  
  1253. if (isNearlyBlack) {
  1254. return '#eeeeee';
  1255. }
  1256.  
  1257. // 通常の補色
  1258. const compR = 255 - r;
  1259. const compG = 255 - g;
  1260. const compB = 255 - b;
  1261. return `rgb(${compR}, ${compG}, ${compB})`;
  1262. };
  1263.  
  1264. const updateFontColorOnImage = (selector, imageUrl) => {
  1265. const img = new Image();
  1266. img.crossOrigin = "anonymous"; // CORS対策(必要)
  1267. img.src = imageUrl;
  1268.  
  1269. img.onload = () => {
  1270. const canvas = document.createElement('canvas');
  1271. canvas.width = img.naturalWidth;
  1272. canvas.height = img.naturalHeight;
  1273. const ctx = canvas.getContext('2d');
  1274. ctx.drawImage(img, 0, 0);
  1275.  
  1276. const data = ctx.getImageData(0, 0, canvas.width, canvas.height).data;
  1277.  
  1278. let r = 0, g = 0, b = 0, count = 0;
  1279. for (let i = 0; i < data.length; i += 4) {
  1280. r += data[i];
  1281. g += data[i + 1];
  1282. b += data[i + 2];
  1283. count++;
  1284. }
  1285.  
  1286. r = Math.round(r / count);
  1287. g = Math.round(g / count);
  1288. b = Math.round(b / count);
  1289.  
  1290. Array.prototype.forEach.call(document.querySelectorAll(selector), (e) => {
  1291. e.style.color = getComplementaryColor(r, g, b);
  1292. });
  1293. };
  1294.  
  1295. img.onerror = () => {
  1296. console.error("画像の読み込みに失敗しました");
  1297. };
  1298. };
  1299.  
  1300. const updateHeaderFontColor = (imgSelector, textSelector) => {
  1301. const blogContainer = document.querySelector(imgSelector);
  1302. const imageUrl = getBackgroundImageUrl(blogContainer);
  1303.  
  1304. if (imageUrl) {
  1305. updateFontColorOnImage(textSelector, imageUrl);
  1306. }
  1307. }
  1308.  
  1309.  
  1310. const create5thRelayPhoto = () => {
  1311.  
  1312. const relayPhoto = document.createElement('div');
  1313. relayPhoto.classList.add("c-blog-member__icon");
  1314. relayPhoto.style.backgroundImage = "url(https://cdn.hinatazaka46.com/images/14/fa2/dcd3c79b9d66efeed5a13af038129.jpg)";
  1315. relayPhoto.style.backgroundSize = "cover";
  1316. relayPhoto.style.backgroundPosition = "center";
  1317. relayPhoto.style.backgroundRepeat = "no-repeat";
  1318. relayPhoto.style.width = "220px";
  1319. relayPhoto.style.height = "122px";
  1320. relayPhoto.style.position = "relative";
  1321. relayPhoto.style.zIndex = "2";
  1322.  
  1323. return relayPhoto;
  1324. };
  1325.  
  1326. const scrollOnLoad = () => {
  1327. // 半透明ヘッダーメニュー 高さ
  1328. const headerHeight = document.querySelector(".p-header-wrap").offsetHeight;
  1329.  
  1330. // スクロール位置リセット リロード時のズレ対応
  1331. scrollTo(0, 0);
  1332.  
  1333. // 文頭までスクロール
  1334. scrollTo({
  1335. top: document.querySelector(".p-blog-article__head").getBoundingClientRect().top - headerHeight,
  1336. behavior: "smooth"
  1337. });
  1338. }
  1339.  
  1340. /** ブログ */
  1341. const blogDetail = () => {
  1342. const pBlogArticleHead = document.querySelector('.p-blog-article__head');
  1343.  
  1344. const styleElem = document.createElement("style");
  1345. styleElem.setAttribute("rel", "stylesheet");
  1346. styleElem.textContent = `
  1347. .p-blog-article {
  1348. border-bottom: none;
  1349. }
  1350. .c-blog-article__title {
  1351. --height: auto;
  1352. height: var(--height);
  1353. transition: height .3s ease-out;
  1354. }
  1355. .c-blog-article__title.open {
  1356. height: var(--height);
  1357. overflow: visible;
  1358. white-space: wrap;
  1359. }
  1360. .c-blog-article__title.hidden {
  1361. height: 58px;
  1362. overflow: hidden;
  1363. white-space: nowrap;
  1364. text-overflow: ellipsis "… 🔽";
  1365. }
  1366. .c-blog-article__text {
  1367. padding: 0 10px;
  1368. overflow: scroll;
  1369. border: none;
  1370. }
  1371. .p-pager {
  1372. margin-top: 10px;
  1373. }
  1374. .p-button--center {
  1375. padding-top: 0;
  1376. margin-top: -20px;
  1377. }
  1378. .c-button-grad.c-button-grad--big {
  1379. min-width: 280px;
  1380. }`;
  1381. document.head.appendChild(styleElem);
  1382. const articleTitleDiv = document.querySelector('.c-blog-article__title');
  1383. const height = articleTitleDiv.scrollHeight + 'px';
  1384. articleTitleDiv.style.setProperty("--height", height);
  1385. articleTitleDiv.style.marginBottom = "0px";
  1386. articleTitleDiv.classList.add("hidden");
  1387. setTimeout(() => {
  1388. const articleHeight = document.documentElement.clientHeight - pBlogArticleHead.getBoundingClientRect().bottom;
  1389.  
  1390. document.querySelector('.c-blog-article__text').style.height = articleHeight + "px";
  1391.  
  1392. if (articleTitleDiv.offsetWidth < articleTitleDiv.scrollWidth) {
  1393.  
  1394. const articleTitle = articleTitleDiv.innerText;
  1395. articleTitleDiv.innerText = articleTitle + "🔼";
  1396. articleTitleDiv.style.cursor = "pointer";
  1397.  
  1398. articleTitleDiv.addEventListener('click', function() {
  1399. articleTitleDiv.classList.toggle("hidden");
  1400. articleTitleDiv.classList.toggle("open");
  1401. });
  1402. }
  1403.  
  1404. scrollOnLoad();
  1405. }, 100);
  1406. };
  1407.  
  1408. /** 記事一覧 */
  1409. const blogList = () => {
  1410.  
  1411. const blogGroupHeight = document.documentElement.clientHeight;
  1412.  
  1413. const styleText = `
  1414. .c-blog-member__icon--all {
  1415. height: 60px;
  1416. }
  1417. .p-button {
  1418. padding-top: 0;
  1419. }
  1420. .d-article {
  1421. line-height: 20px;
  1422. margin-bottom: 8px;
  1423. }
  1424. .s-member-icon {
  1425. font-size: larger
  1426. }
  1427. .s-article-title {
  1428. font-size: smaller;
  1429. }
  1430. .s-datetime {
  1431. font-size: smaller;
  1432. }
  1433. .p-blog-group {
  1434. height: ${blogGroupHeight - 60}px;
  1435. overflow: scroll;
  1436. .l-maincontents--blog {
  1437. border: none;
  1438. }
  1439. .c-blog-article__title {
  1440. margin-bottom: 0px;
  1441. }`;
  1442.  
  1443. document.appendStyle(styleText);
  1444. shortenYear('.c-blog-article__date');
  1445.  
  1446. const titleList = document.createElement('div');
  1447. titleList.setAttribute("class", "s-blog__index");
  1448.  
  1449. const memberName = document.querySelector('.c-blog-member__name');
  1450. if (memberName) {
  1451. if (memberName.innerText == "ポカ") {
  1452. const profileTable = document.querySelector('.p-blog-member__info-table');
  1453. profileTable.after(titleList);
  1454. } else {
  1455. const profileButton = document.querySelector('.p-button');
  1456. profileButton.after(titleList);
  1457. }
  1458. // リレーブログ
  1459. } else {
  1460. const info = document.querySelector('.p-blog-member__info');
  1461. info.after(titleList);
  1462. }
  1463.  
  1464. const createAnchor = (idx, datetime, icon, articleTitle) => `<div class="d-article"><a href="#article${idx}">
  1465. <span class="s-member-icon">${icon}</span>
  1466. <span class="s-article-title">${articleTitle}</span><br/><span class="s-datetime">${datetime}</span>
  1467. </a></div>`;
  1468. const lMainContentsBlogTop = document.querySelector('.l-maincontents--blog').getBoundingClientRect().top;
  1469. Array.prototype.forEach.call(document.querySelectorAll('.p-blog-article'), (x, i) => {
  1470. x.setAttribute('id', "article" + i);
  1471. const datetimeDiv = x.childNodes[1].childNodes[3].childNodes[1];
  1472. const datetime = datetimeDiv.firstChild.textContent.trim();
  1473. const articleTitleDiv = x.childNodes[1].childNodes[1];
  1474. const articleTitle = articleTitleDiv.firstChild.textContent.trim();
  1475. // メンバー混合リストの場合があるので名前を取得
  1476. const memberName = x.childNodes[1].childNodes[3].childNodes[3].innerText;
  1477. const icon = HINATAZAKA46.DATA[HINATAZAKA46.MEMBER[memberName]]['icon'];
  1478. titleList.insertAdjacentHTML('beforeend', createAnchor(i, datetime, icon, articleTitle));
  1479. });
  1480.  
  1481. setTimeout(() => {
  1482. document.querySelector('.p-blog-group').style.hight = "px";
  1483. scrollOnLoad();
  1484. }, 100);
  1485. };
  1486.  
  1487.  
  1488. const doProcessBlog = (blogPageType) => {
  1489.  
  1490. const body = document.querySelector('body');
  1491.  
  1492. // 内容が空のページ(卒業メンバーのブログなど)
  1493. if (body.getElementsByTagName('*').length === 0) {
  1494. body.innerHTML = 'This page is no longer available';
  1495. return;
  1496. }
  1497.  
  1498. // ひなたフェス/握手会 は非メンバーブログ
  1499. const isNotMemberBlog = (location.search).match(/(cd=hinafes_blog|cd=event)/g);
  1500.  
  1501. if (isNotMemberBlog) {
  1502. return;
  1503. }
  1504.  
  1505. if (isMobile()) {
  1506. return;
  1507. }
  1508.  
  1509. updateHeaderFontColor('.p-blog-head-container', '.c-blog-page__title, .c-blog-page__subtitle, .c-blog-main__name, .c-blog__profilelink');
  1510.  
  1511. const faceSelector = '.p-blog-face__list';
  1512.  
  1513. // 画面下部の顔写真
  1514. Array.prototype.forEach.call(document.querySelectorAll(faceSelector), (x) => {
  1515. x.addEventListener('mouseover', () => {
  1516.  
  1517. x.children[1].style.color = getColorMode() === COLOR_MODE.DARK_COLOR ? `${DARK_FONT_CL}` : `${DEFAULT_FONT_CL}`;
  1518. });
  1519. });
  1520.  
  1521. Array.prototype.forEach.call(document.querySelectorAll(faceSelector), (x) => {
  1522. x.addEventListener('mouseout', () => {
  1523.  
  1524. x.children[1].style.color = `${DEFAULT_FONT_CL}`;
  1525. });
  1526. });
  1527.  
  1528. if (blogPageType == "blog_top") {
  1529.  
  1530. ((x) => { if (x) { x.style.cursor = "pointer"; } })(document.querySelector('.js-select.sort'));
  1531. document.appendStyle(`
  1532. .l-contents {
  1533. padding-bottom: 20px;
  1534. }
  1535. .c-blog-face__item {
  1536. transition: transform 0.3s ease, z-index 0.3s ease;
  1537. transform-origin: center center;
  1538. }
  1539. .c-blog-face__item:hover {
  1540. transform: scale(1.2, 1.2) translateZ(10px);
  1541. }`);
  1542. return;
  1543. }
  1544.  
  1545. const blogEntryItem = document.querySelector('.p-blog-entry__item');
  1546. const blogEntryItemStyles = window.getComputedStyle(blogEntryItem, null);
  1547. const blogEntryItemHeight = parseInt(blogEntryItemStyles["height"].replace('px', ''));
  1548. const blogEntryItemMarginBottom = parseInt(blogEntryItemStyles["margin-bottom"].replace('px', ''));
  1549. const blogEntryItemHeightWithMargin = blogEntryItemHeight + blogEntryItemMarginBottom;
  1550.  
  1551. const styleText = `
  1552. .l-other-contents--blog {
  1553. margin-top: -160px;
  1554. padding-top: 20px;
  1555. --bg-color: #ffffff;
  1556. background-color: var(--bg-color);
  1557. }
  1558. .c-button-grad {
  1559. padding: 6px 40px 6px 32px;
  1560. }
  1561. .l-other-contents--blog::after, .c-button-grad.c-button-grad--big::after {
  1562. background-color: var(--bg-color);
  1563. }
  1564. .p-blog-head {
  1565. padding-top: 0;
  1566. }
  1567. .c-blog-page__title {
  1568. margin-bottom: 0;
  1569. }
  1570. .c-blog-member__icon {
  1571. margin-bottom: 10px;
  1572. }
  1573. .p-blog-member__head {
  1574. margin-bottom: 5px;
  1575. }
  1576. .c-blog-member__info-td__name {
  1577. padding-bottom: 5px;
  1578. }
  1579. .s-blog__index {
  1580. position: relative;
  1581. z-index: 50;
  1582. margin: 0 0 0 -50px;
  1583. height: 160px;
  1584. width: 290px;
  1585. overflow: scroll;
  1586. }
  1587. .cale_table {
  1588. margin-top: 0px;
  1589. }
  1590. .p-blog-article__head {
  1591. background-color: #f6ffff;
  1592. border: 1px solid #a0d8ef ;
  1593. border-radius: 10px;
  1594. }
  1595. .c-blog-article__title {
  1596. font-size: 2.5rem;
  1597. line-height: 58px;
  1598. color: #636767;
  1599. background-color: #e0ffff;
  1600. border-radius: 10px;
  1601. }
  1602. .c-blog-article__title, .c-blog-article__date {
  1603. text-indent: 5px;
  1604. }
  1605. .l-maincontents--blog {
  1606. margin-top:-160px;
  1607. padding: 20px;
  1608. }
  1609. .l-contents--blog-list {
  1610. padding-bottom: 0;
  1611. }
  1612. .c-blog-entry_area__title {
  1613. margin-bottom: 2px;
  1614. }
  1615. .p-blog-group {
  1616. border: solid 1px #32a1ce;
  1617. }
  1618. .p-blog-article {
  1619. padding-bottom: 0;
  1620. margin-bottom: 0;
  1621. }
  1622. .p-blog-article__info {
  1623. margin-bottom: 10px;
  1624. }
  1625. .c-pager__item__text time {
  1626. font-size: 1.4rem;
  1627. }
  1628. .p-button--center {
  1629. padding: 0;
  1630. }
  1631. .p-blog-face__title {
  1632. margin-bottom: 10px;
  1633. }
  1634. .p-blog-face__group {
  1635. padding-top: 20px;
  1636. }
  1637. .p-blog-face__list {
  1638. width: 122px;
  1639. height: 162px;
  1640. }
  1641. .c-blog-face__item {
  1642. transition: transform 0.3s ease, z-index 0.3s ease;
  1643. transform-origin: center center;
  1644. }
  1645. .c-blog-face__item:hover {
  1646. transform: scale(1.2, 1.2) translateZ(10px);
  1647. }
  1648. .p-blog-entry__group {
  1649. padding-bottom: 0;
  1650. }
  1651. .p-blog-entry__list {
  1652. height: ${blogEntryItemHeightWithMargin * 3}px;
  1653. width: 230px;
  1654. overflow: scroll;
  1655. border: none;
  1656. margin-bottom: 20px;
  1657. }
  1658. .c-blog-entry__name {
  1659. font-size: 1.3rem;
  1660. }`;
  1661.  
  1662. document.appendStyle(styleText);
  1663.  
  1664. shortenYear('.c-blog-article__date time');
  1665. shortenYear('.c-blog-entry__name');
  1666. shortenYear('.c-pager__item__text time');
  1667.  
  1668. const memberIcon = document.querySelector('.c-blog-member__icon');
  1669.  
  1670. if (! memberIcon) {
  1671. const info = document.querySelector('.p-blog-member__info');
  1672. const relayPhoto = create5thRelayPhoto();
  1673. info.prepend(relayPhoto);
  1674. }
  1675.  
  1676. switch (blogPageType) {
  1677. case "blog_detail":
  1678. blogDetail();
  1679. break;
  1680. case "blog_list":
  1681. blogList();
  1682. break;
  1683. default:
  1684. throw new Error(PAGE_TYPE_ERROR_MSG);
  1685. }
  1686. };
  1687.  
  1688. const doProcessEvent = () => {
  1689. updateHeaderFontColor('.p-section--shakehands', '.c-shakehands-calender.pc, .c-shakehands-calender.pc a');
  1690. };
  1691.  
  1692. const doProcessFc = () => {
  1693. const styleText = `
  1694. .fc-logo {
  1695. padding: 15px;
  1696. }`;
  1697. document.appendStyle(styleText);
  1698. };