Przeróbka nowego YouTube

Podnosi pasek akcji na pasek przycisku subskrypcji, stale wyświetla ilość subskrypcji a do daty dodaje pełną nazwą miesiąca.

当前为 2014-09-12 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Przeróbka nowego YouTube
  3. // @description Podnosi pasek akcji na pasek przycisku subskrypcji, stale wyświetla ilość subskrypcji a do daty dodaje pełną nazwą miesiąca.
  4. // @version 5.03.091
  5. // @author look997
  6. // @license MIT License
  7. // @resource metadata https://github.com/look997/PNYT/raw/master/pnyt.user.js
  8. // @include *youtube.com/*
  9. // @date 2014-09-12
  10. // @grant none
  11. // @namespace https://greasyfork.org/users/4353
  12. // ==/UserScript==
  13. "use strict";
  14.  
  15. document.cookie = "wide=1; domain=.youtube.com";
  16. function $(a) {return document.getElementById(a);}
  17. $("watch7-container").className = "watch-wide";
  18.  
  19.  
  20. function glFun () { // GŁÓWNA FUNKCJA
  21. dodajStyl('dataDodSId',''
  22. +"#watch8-secondary-actions .yt-uix-button-content { display: none; }"
  23. //Poprawka 5.03.090
  24. +"#watch-headline-title { margin-bottom: 0px !important; }"
  25. +"#watch7-user-header { padding-top: 10px !important; }"
  26. // auto hide
  27. +"#watch7-user-header:hover #watch8-action-buttons { visibility: visible !important; }"
  28. +"#watch8-action-buttons { visibility: hidden !important; }" // Domyślnie ukryty pasek akcji
  29. // Podniesienie i dopasowanie paska akcji
  30. +"#watch8-secondary-actions { position: relative; }"
  31. //+"#watch7-views-info { top: -8px !important; bottom: auto !important; right: 0px !important; }"
  32. +"#watch7-views-info { bottom: 31px !important; width: 192px !important; }"
  33. +"#watch7-user-header { padding-bottom: 3px !important; }"
  34. +"#watch8-action-buttons { display: inline; padding-top: 0px; border-top: none; }"
  35. +"#watch8-action-buttons:after,"
  36. +"#watch8-action-buttons:before { content: none !important; }"
  37. +"#watch8-secondary-actions .yt-uix-button { padding: 0px 0px !important; }"
  38. +"#watch8-secondary-actions { left: 5px !important; }"
  39. // Stałe wyświetlanie liczby subskrybcji kanału autora filmu
  40. +".yt-subscription-button-subscriber-count-branded-horizontal, .html5-text-button, .yt-subscription-button-subscriber-count-unbranded { display: inline-block !important; }"
  41. // Skok do aktualnie odtwarzanego elementu na playliście
  42. +" .watch-wide #watch-appbar-playlist .playlist-videos-list { "
  43. +" height: 490px !important; "
  44. +" } "
  45. +" .watch-wide #watch-appbar-playlist { "
  46. +" min-height: 592px !important; "
  47. +" } "
  48. +" #watch-appbar-playlist .playlist-videos-list { "
  49. +" max-height: 490px !important; "
  50. +" } "
  51. );
  52. document.querySelector("#watch7-user-header").appendChild(document.querySelector("#watch8-action-buttons"));
  53. document.querySelector("#watch7-user-header").appendChild(document.querySelector("#watch8-sentiment-actions"));
  54. document.querySelector("#watch7-user-header").appendChild(document.querySelector("#watch7-views-info"));
  55. var addBut = document.querySelector("#watch8-secondary-actions .addto-button .yt-uix-button-content").textContent;
  56. var shareBut = document.querySelector('#watch8-secondary-actions [data-trigger-for="action-panel-share"] .yt-uix-button-content').textContent;
  57. var moreBut = document.querySelector('#action-panel-overflow-button .yt-uix-button-content').textContent;
  58. var addBut = document.querySelector("#watch8-secondary-actions .addto-button").title = addBut;
  59. var shareBut = document.querySelector('#watch8-secondary-actions [data-trigger-for="action-panel-share"]').title = shareBut;
  60. var shareBut = document.querySelector('#action-panel-overflow-button').title = moreBut;
  61. // Pełna nazwa miesiąca dodania filmu
  62. var infoDate = document.querySelector("#watch-uploader-info strong");
  63. var datfilm = infoDate.textContent;
  64. var odatmies = datfilm.substring(datfilm.length-8, datfilm.length-5);
  65. switch (odatmies){
  66. case 'sty': var datmies = "stycznia"; break;
  67. case 'lut': var datmies = "lutego"; break;
  68. case 'mar': var datmies = "marca"; break;
  69. case 'kwi': var datmies = "kwietnia"; break;
  70. case 'maj': var datmies = "maja"; break;
  71. case 'cze': var datmies = "czerwca"; break;
  72. case 'lip': var datmies = "lipca"; break;
  73. case 'sie': var datmies = "sierpnia"; break;
  74. case 'wrz': var datmies = "września"; break;
  75. case 'paź': var datmies = "października"; break;
  76. case 'lis': var datmies = "listopada"; break;
  77. case 'gru': var datmies = "grudnia"; break;
  78. default: var datmies = odatmies;
  79. }
  80. infoDate.textContent = datfilm.replace(odatmies, datmies);
  81. // Playlista
  82. // ...
  83. }
  84.  
  85.  
  86. function dodajStyl (idStyle,styles) { // Dodanie stylu
  87. if(document.getElementById(idStyle)){ document.getElementsByTagName("head")[0].removeChild(document.getElementById(idStyle)); }
  88. var css = document.createElement('style'); css.type = 'text/css'; css.id = idStyle;
  89. css.styleSheet ? css.styleSheet.cssText = styles : css.appendChild( document.createTextNode(styles) );
  90. document.getElementsByTagName("head")[0].appendChild(css);
  91. }
  92.  
  93.  
  94. function readCookie (name) {
  95. var nameEQ = name + "=";
  96. var ca = document.cookie.split(';');
  97. for(var i=0;i < ca.length;i++) {
  98. var c = ca[i];
  99. while (c.charAt(0)==' ') c = c.substring(1,c.length);
  100. if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  101. }
  102. return null;
  103. }
  104.  
  105. document.addEventListener("DOMContentLoaded", glFun);