nvbetter

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

目前为 2025-04-12 提交的版本,查看 最新版本

  1. /* ==UserStyle==
  2. @name nvbetter
  3. @namespace rinsuki.net
  4. @version 1.0.6
  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. .grid-template-areas_\[_\"player_sidebar\"_\"meta_sidebar\"_\"bottom_sidebar\"_\"\._sidebar\"_\] {
  28. /* 動画情報を上に持ってくる */
  29. grid-template-areas:
  30. "meta meta"
  31. "player sidebar"
  32. "bottom sidebar"
  33. ". sidebar" !important;
  34. /* 旧プレーヤーのようにリサイズ時にガタガタさせる */
  35. --watch-player-max-width: 640px !important;
  36.  
  37. /* 854pxの動画が入るなら 854px まで大きくする */
  38. @media screen and (min-width: calc(854px + 440px + calc(24px * 3) + 15px)) {
  39. & {
  40. --watch-player-max-width: 854px !important;
  41. }
  42. }
  43. /* 960pxの動画が入るなら 960px まで大きくする */
  44. @media screen and (min-width: calc(960px + 440px + calc(24px * 3) + 15px)) {
  45. & {
  46. --watch-player-max-width: 960px !important;
  47. }
  48. }
  49. /* 1280pxの動画が入るなら 1280px まで大きくする */
  50. @media screen and (min-width: calc(1280px + 440px + calc(24px * 3) + 15px)) {
  51. & {
  52. --watch-player-max-width: 1280px !important;
  53. }
  54. }
  55. /* 1920pxの動画が入るなら 1920px まで大きくする */
  56. @media screen and (min-width: calc(1920px + 440px + calc(24px * 3) + 15px)) {
  57. & {
  58. --watch-player-max-width: 1920px !important;
  59. }
  60. }
  61. }
  62.  
  63. section > .grid-area_\[meta\] {
  64. /* タグ編集行 */
  65. & > div:has(> button[data-element-name="tag_edit"]) {
  66. /* を最後に持ってくる */
  67. order: 1;
  68.  
  69. /* タグ編集ボタンを最初に持ってくる */
  70. & > button[data-element-name="tag_edit"] {
  71. order: -1;
  72. }
  73. }
  74. }
  75. /* 動画詳細を開いた状態 */
  76. section > .grid-area_\[meta\]:has(> section > header + div) {
  77. & > div:first-child {
  78. /* 動画タイトルの下の再生数とかを隠す */
  79. & > div:first-child > h1 + div {
  80. display: none;
  81. }
  82. /* 動画タイトルの右のユーザー情報を隠す */
  83. & > div:first-child:has(h1) + div {
  84. display: none;
  85. }
  86. }
  87. & > section {
  88. /* 開いたら畳ませない */
  89. & > header {
  90. display: none;
  91. }
  92. & > div {
  93. /* 動画詳細をインライン展開っぽく見せる */
  94. background: none;
  95. border-top: none;
  96. padding: 0;
  97.  
  98. /* 突然のgrid投入 */
  99. display: grid;
  100. grid-template:
  101. "desc desc" auto
  102. "user info" auto
  103. "user genre" auto
  104. / 400px 1fr;
  105.  
  106. /* 説明欄grid追従 */
  107. & > .cursor_default {
  108. grid-area: desc;
  109. }
  110.  
  111. /* ユーザー欄grid追従*/
  112. & > .pb_x2 {
  113. grid-area: user;
  114. }
  115.  
  116. /* grid で並び換えた影響でhrの意味がなくなったので消す */
  117. & > hr {
  118. display: none;
  119. }
  120.  
  121. /* 背景消したせいでボーダーが見えなくなるので再導入 */
  122. & > dl > div {
  123. border-color: var(--colors-border-high-em);
  124. }
  125.  
  126. /* ジャンル・シリーズ情報は横に並べる */
  127. & > dl + div {
  128. flex-direction: row;
  129. }
  130. }
  131. }
  132. }
  133.  
  134.  
  135. /* 下のほうにあるやつを白背景にしない */
  136. section > .grid-area_\[bottom\] > section {
  137. background: none;
  138. padding-left: 0;
  139. padding-right: 0;
  140. padding-top: var(--spacing-x2);
  141. }
  142.  
  143. /* コメントリストが開かれている時に発動する */
  144. section:has(> .grid-area_\[sidebar\] > div > div:first-child > section > header + div) {
  145. & > .grid-area_\[sidebar\] > div > .h_var\(--watch-player-height\) {
  146. /* コメントリストをプレーヤーの高さと合わせる */
  147. height: var(--watch-player-height);
  148. /* 上でコメント入力欄を右まで伸ばした分の受け入れスペースを作る */
  149. margin-bottom: calc(40px + var(--watch-player-actionbar-gap-height) - var(--spacing-x0_5));
  150. }
  151. /* 動画プレーヤー下のコメント入力欄のセレクタ */
  152. & > .grid-area_\[player\] > div:not(.w_\[100dvw\]) > div:last-child {
  153. /* 動画プレーヤー下のコメント入力欄とかを右まで伸ばす */
  154. margin-right: calc(-1 * calc(var(--spacing-x3) + var(--watch-sidebar-width)));
  155.  
  156. /* コメント入力欄の横幅をプレーヤーと合わせる */
  157. & > div.w_100\% {
  158. width: var(--watch-player-width) !important;
  159. flex-grow: 0 !important;
  160. }
  161.  
  162. /* コメント入力欄の右にあるボタン郡を伸ばす */
  163. & > div:last-child {
  164. flex: 1;
  165. & > div {
  166. /* コメント入力欄の右にあるボタン郡を伸ばす */
  167. max-width: unset !important;
  168. & > button {
  169. /* コメント入力欄の右にあるボタン郡をテキトーに伸ばす (説明消すとそれはそれで幅が余るので) */
  170. flex-grow: 1;
  171.  
  172. & > svg+span {
  173. /* コメント入力欄の右にあるボタン郡で、アイコンがあるボタンの説明は消す */
  174. display: none;
  175. }
  176. }
  177. }
  178. }
  179. }
  180. }
  181. /* フルスクリーン時にコメント入力欄の透過をする */
  182. section > .grid-area_\[player\] > div.w_\[100dvw\] > div:only-child > div:only-child > div:last-child > div:last-child {
  183. background: none;
  184. & > div > div > button {
  185. background: var(--colors-layer-background);
  186. }
  187. }
  188. }