[ARCHIVED]Youtube SuBar

Puts the action buttons in one line with the 'Subscribe' button. Reveals the number of subscriptions. Turns Theater mode on player.

  1. // ==UserScript==
  2. // @name [ARCHIVED]Youtube SuBar
  3. // @namespace https://gist.github.com/look997/9ad33fc1ee4fa18d7e06#file-readme-md
  4. // @description Puts the action buttons in one line with the 'Subscribe' button. Reveals the number of subscriptions. Turns Theater mode on player.
  5. // @version 5.04.105 beta
  6. // @author look997
  7. // @resource metadata https://gist.github.com/look997/9ad33fc1ee4fa18d7e06/raw/youtube.subar.user.js
  8. // @include *youtube.com/*
  9. // @date 2015-04-30
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. "use strict";
  14.  
  15. function addStyle (idStyle,styles) {
  16. if(document.getElementById(idStyle)){ document.getElementsByTagName("head")[0].removeChild(document.getElementById(idStyle)); }
  17. let css = document.createElement('style'); css.type = 'text/css'; css.id = idStyle;
  18. css.styleSheet ? css.styleSheet.cssText = styles : css.appendChild( document.createTextNode(styles) );
  19. document.getElementsByTagName("head")[0].appendChild(css);
  20. }
  21.  
  22. function suBar () {
  23. addStyle('subar-styles',
  24. `
  25. /* Puts the action buttons in one line with the 'Subscribe' button. */
  26. #watch8-secondary-actions .yt-uix-button-content { display: none; } // hide buttons labels
  27. /* Uncover long string - video views counts - Update 5.03.090. */
  28. #watch-headline-title { margin-bottom: 0px !important; }
  29. #watch7-user-header { padding-top: 10px !important; }
  30. #watch8-secondary-actions { position: relative; } /* Wyrównanie 3-przycisków z przyciskiem subskrybcji. */
  31. /*+"#watch7-views-info { top: -8px !important; bottom: auto !important; right: 0px !important; }*/
  32. #watch7-views-info { bottom: 31px !important; width: 192px !important; } /* Obniżenie i wyrównanie prawej strony panelu. */
  33. #watch7-user-header { padding-bottom: 3px !important; } /* Margines dolny panelu i między niebieksim paskiem. */
  34. #watch8-action-buttons { display: inline; padding-top: 0px; border-top: none; } /* Umieszczenie paska akcji w jednej linii. */
  35. #watch8-action-buttons:after,
  36. #watch8-action-buttons:before { content: none !important; } /* Umieszczenie paska akcji w jednej linii. */
  37. #watch8-secondary-actions .yt-uix-button { padding: 0px 0px !important; } /* Zmniejszenie odstępów między przyciskami. */
  38. #watch8-secondary-actions { left: 5px !important; } /* Odstęp przycisku subskrybcji od przycisków akcji. */
  39. #watch-header { min-height: auto; } /* Height panel. */
  40. /* Auto hide. */
  41. /*#watch7-user-header:hover #watch8-action-buttons { visibility: visible !important; }
  42. #watch8-action-buttons { visibility: hidden !important; }*/
  43. .concurrent-viewers.watch-view-count { /* Count live stream views. */
  44. font-size: 11px;
  45. }
  46. /* Reveals the number of subscriptions. */
  47. .yt-subscription-button-subscriber-count-branded-horizontal, .html5-text-button, .yt-subscription-button-subscriber-count-unbranded { display: inline-block !important; }
  48. /* Skok do aktualnie odtwarzanego elementu na playliście.
  49. .watch-wide #watch-appbar-playlist .playlist-videos-list {
  50. height: 490px !important;
  51. }
  52. .watch-wide #watch-appbar-playlist {
  53. min-height: 592px !important;
  54. }
  55. #watch-appbar-playlist .playlist-videos-list {
  56. max-height: 490px !important;
  57. }*/
  58. `
  59. );
  60. /* Przeniesienie przycisków akcji. */
  61. document.querySelector("#watch7-user-header").appendChild(document.querySelector("#watch8-action-buttons"));
  62. document.querySelector("#watch7-user-header").appendChild(document.querySelector("#watch8-sentiment-actions"));
  63. document.querySelector("#watch7-user-header").appendChild(document.querySelector("#watch7-views-info"));
  64. var addBut = document.querySelector("#watch8-secondary-actions .addto-button .yt-uix-button-content").textContent;
  65. var shareBut = document.querySelector('#watch8-secondary-actions [data-trigger-for="action-panel-share"] .yt-uix-button-content').textContent;
  66. var moreBut = document.querySelector('#action-panel-overflow-button .yt-uix-button-content').textContent;
  67. var addBut = document.querySelector("#watch8-secondary-actions .addto-button").title = addBut;
  68. var shareBut = document.querySelector('#watch8-secondary-actions [data-trigger-for="action-panel-share"]').title = shareBut;
  69. var shareBut = document.querySelector('#action-panel-overflow-button').title = moreBut;
  70. }
  71.  
  72.  
  73. function theaterMode () {
  74. document.cookie = "wide=1; domain=.youtube.com";
  75. document.querySelector("#page").classList.remove("watch-non-stage-mode");
  76. document.querySelector("#page").classList.add("watch-stage-mode");
  77. document.querySelector("#player").classList.remove("watch-small");
  78. document.querySelector("#player").classList.add("watch-medium");
  79. document.querySelector("#placeholder-player").classList.remove("watch-small");
  80. document.querySelector("#placeholder-player").classList.add("watch-medium");
  81.  
  82. document.querySelector("#watch7-container").classList.add("watch-wide");
  83.  
  84. }
  85.  
  86.  
  87. function setTOFun () {
  88. setTimeout( function () {
  89. if (document.querySelector("#progress") == undefined) {
  90. suBar();
  91. }
  92. else {
  93. setTOFun();
  94. }
  95. }, 100);
  96. }
  97.  
  98. function progressBar () {
  99. document.querySelector("html").addEventListener("click", setTOFun, false); // Kliknięcie linka. Dodatkowo funkcja odświeżająca skrypt.
  100. window.addEventListener("popstate", function(e) { // Do przycisków 'wstecz' i 'do przodu'.
  101. setTOFun();
  102. suBar();
  103. });
  104. }
  105.  
  106. document.addEventListener("DOMContentLoaded", function () {
  107. suBar();
  108. theaterMode();
  109. progressBar();
  110. });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址