nvbetter

ニコニコ動画の新HTML5プレーヤーを旧HTML5プレーヤーっぽい配置にしたりします

目前为 2024-11-28 提交的版本,查看 最新版本

  1. /* ==UserStyle==
  2. @name nvbetter
  3. @namespace rinsuki.net
  4. @version 1.0.1
  5. @description ニコニコ動画の新HTML5プレーヤーを旧HTML5プレーヤーっぽい配置にしたりします
  6. @author rinsuki
  7. ==/UserStyle== */
  8.  
  9. @-moz-document url-prefix("https://www.nicovideo.jp/watch/") {
  10. /* ヘッダー追従を切る */
  11. #root > div > header.h_webHeader\.height {
  12. position: relative !important;
  13. &:hover > div:has(a[href*="/feedback/video_watch"]) {
  14. & > a {
  15. /* こんな状態で本家にフィードバック送られても困る */
  16. display: none;
  17. }
  18. &:after {
  19. content: "nvbetterにより視聴ページのスタイルが変更されているため、nvbetterによってフィードバックボタンは無効化されています。";
  20. }
  21. }
  22. }
  23. /* 動画再生部分の border-radius を無効化 */
  24. .grid-area_\[player\] > div > div.bdr_m {
  25. border-radius: unset !important;
  26. }
  27. /* 動画情報を上に持ってくる */
  28. .grid-template-areas_\[_\"player_sidebar\"_\"meta_sidebar\"_\"bottom_sidebar\"_\"\._sidebar\"_\] {
  29. grid-template-areas:
  30. "meta meta"
  31. "player sidebar"
  32. "bottom sidebar"
  33. ". sidebar" !important;
  34. }
  35.  
  36. section > .grid-area_\[meta\] {
  37. /* タグ編集行 */
  38. & > div:has(> button[data-element-name="tag_edit"]) {
  39. /* を最後に持ってくる */
  40. order: 1;
  41.  
  42. /* タグ編集ボタンを最初に持ってくる */
  43. & > button[data-element-name="tag_edit"] {
  44. order: -1;
  45. }
  46. }
  47. }
  48. /* 動画詳細を開いた状態 */
  49. section > .grid-area_\[meta\]:has(> section > header + div) {
  50. & > div:first-child {
  51. /* 動画タイトルの下の再生数とかを隠す */
  52. & > div:first-child > h1 + div {
  53. display: none;
  54. }
  55. /* 動画タイトルの右のユーザー情報を隠す */
  56. & > div:first-child:has(h1) + div {
  57. display: none;
  58. }
  59. }
  60. & > section {
  61. /* 開いたら畳ませない */
  62. & > header {
  63. display: none;
  64. }
  65. & > div {
  66. /* 動画詳細をインライン展開っぽく見せる */
  67. background: none;
  68. border-top: none;
  69. padding: 0;
  70.  
  71. /* 突然のgrid投入 */
  72. display: grid;
  73. grid-template:
  74. "desc desc" auto
  75. "user info" auto
  76. "user genre" auto
  77. / 400px 1fr;
  78.  
  79. /* 説明欄grid追従 */
  80. & > .cursor_default {
  81. grid-area: desc;
  82. }
  83.  
  84. /* ユーザー欄grid追従*/
  85. & > .pb_x2 {
  86. grid-area: user;
  87. }
  88.  
  89. /* grid で並び換えた影響でhrの意味がなくなったので消す */
  90. & > hr {
  91. display: none;
  92. }
  93.  
  94. /* 背景消したせいでボーダーが見えなくなるので再導入 */
  95. & > dl > div {
  96. border-color: var(--colors-border-high-em);
  97. }
  98.  
  99. /* ジャンル・シリーズ情報は横に並べる */
  100. & > dl + div {
  101. flex-direction: row;
  102. }
  103. }
  104. }
  105. }
  106.  
  107.  
  108. /* 下のほうにあるやつを白背景にしない */
  109. section > .grid-area_\[bottom\] > section {
  110. background: none;
  111. padding-left: 0;
  112. padding-right: 0;
  113. padding-top: var(--spacing-x2);
  114. }
  115.  
  116. /* コメントリストが開かれている時に発動する */
  117. section:has(> .grid-area_\[sidebar\] > div > div:first-child > section > header + div) {
  118. & > .grid-area_\[sidebar\] > div > .h_var\(--watch-player-height\) {
  119. /* コメントリストをプレーヤーの高さと合わせる */
  120. height: calc(var(--watch-player-height) + 60px);
  121. /* 上でコメント入力欄を右まで伸ばした分の受け入れスペースを作る */
  122. margin-bottom: calc(40px + var(--spacing-x2));
  123. }
  124. /* 動画プレーヤー下のコメント入力欄のセレクタ */
  125. & > .grid-area_\[player\] > div > div:last-child {
  126. /* 動画プレーヤー下のコメント入力欄とかを右まで伸ばす */
  127. margin-right: calc(-1 * calc(var(--spacing-x3) + var(--watch-sidebar-width)));
  128.  
  129. /* コメント入力欄の横幅をプレーヤーと合わせる */
  130. & > div.w_100\% {
  131. width: var(--watch-player-width) !important;
  132. flex-grow: 0 !important;
  133. }
  134.  
  135. /* コメント入力欄の右にあるボタン郡を伸ばす */
  136. & > div:last-child {
  137. flex: 1;
  138. & > div {
  139. /* コメント入力欄の右にあるボタン郡を伸ばす */
  140. max-width: unset !important;
  141. & > button {
  142. /* コメント入力欄の右にあるボタン郡をテキトーに伸ばす (説明消すとそれはそれで幅が余るので) */
  143. flex-grow: 1;
  144.  
  145. & > svg+span {
  146. /* コメント入力欄の右にあるボタン郡で、アイコンがあるボタンの説明は消す */
  147. display: none;
  148. }
  149. }
  150. }
  151. }
  152. }
  153. }
  154.  
  155. }