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.

当前为 2015-04-30 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name           Przeróbka nowego YouTube
// @description    Podnosi pasek akcji na pasek przycisku subskrypcji, stale wyświetla ilość subskrypcji a do daty dodaje pełną nazwą miesiąca.
// @version        5.04.096 beta
// @author         look997
// @license        MIT License
// @resource       metadata https://github.com/look997/PNYT/raw/master/pnyt.user.js
// @include        *youtube.com/*
// @date           2014-11-08
// @grant		   none
// @namespace https://greasyfork.org/users/4353
// ==/UserScript==
"use strict";

document.cookie = "wide=1; domain=.youtube.com";
function $(a) {return document.getElementById(a);}
if ($("watch7-container")) {
	$("watch7-container").className = "watch-wide";
}

function wymFun () {
	document.querySelector("#watch7-user-header").appendChild(document.querySelector("#watch8-action-buttons"));
	document.querySelector("#watch7-user-header").appendChild(document.querySelector("#watch8-sentiment-actions"));
	document.querySelector("#watch7-user-header").appendChild(document.querySelector("#watch7-views-info"));
	
	/*var docFrag = document.createDocumentFragment();
	docFrag.appendChild(document.querySelector("#watch8-action-buttons"));
	docFrag.appendChild(document.querySelector("#watch8-sentiment-actions"));
	docFrag.appendChild(document.querySelector("#watch7-views-info"));
	
	document.querySelector("#watch7-user-header").appendChild(docFrag);*/
	
	var addBut = document.querySelector("#watch8-secondary-actions .addto-button .yt-uix-button-content").textContent;
	var shareBut = document.querySelector('#watch8-secondary-actions [data-trigger-for="action-panel-share"] .yt-uix-button-content').textContent;
	var moreBut = document.querySelector('#action-panel-overflow-button .yt-uix-button-content').textContent;
	
	
	var addBut = document.querySelector("#watch8-secondary-actions .addto-button").title = addBut;
	var shareBut = document.querySelector('#watch8-secondary-actions [data-trigger-for="action-panel-share"]').title = shareBut;
	var shareBut = document.querySelector('#action-panel-overflow-button').title = moreBut;
	
 // Pełna nazwa miesiąca dodania filmu
	var infoDate = document.querySelector("#watch-uploader-info strong");
	var datfilm = infoDate.textContent;
	var odatmies = datfilm.substring(datfilm.length-8, datfilm.length-5);
	
	switch (odatmies){
		case 'sty':	var datmies = "stycznia"; break;
		case 'lut':	var datmies = "lutego"; break;
		case 'mar':	var datmies = "marca"; break;
		case 'kwi':	var datmies = "kwietnia"; break;
		case 'maj':	var datmies = "maja"; break;
		case 'cze':	var datmies = "czerwca"; break;
		case 'lip':	var datmies = "lipca"; break;
		case 'sie':	var datmies = "sierpnia"; break;
		case 'wrz':	var datmies = "września"; break;
		case 'paź':	var datmies = "października"; break;
		case 'lis':	var datmies = "listopada"; break;
		case 'gru':	var datmies = "grudnia"; break;
		default: var datmies = odatmies;
	}
	infoDate.textContent = datfilm.replace(odatmies, datmies);
	
}

function glFun () { // GŁÓWNA FUNKCJA
	
	dodajStyl('dataDodSId',''
		+"#watch8-secondary-actions .yt-uix-button-content { display: none; }"
		
		//Poprawka 5.03.090
		+"#watch-headline-title { margin-bottom: 0px !important; }"
		+"#watch7-user-header { padding-top: 10px !important; }"
		
		// auto hide
		+"#watch7-user-header:hover #watch8-action-buttons { visibility: visible !important; }"
		+"#watch8-action-buttons { visibility: hidden !important; }" // Domyślnie ukryty pasek akcji
		
		 // Podniesienie i dopasowanie paska akcji
		+"#watch8-secondary-actions { position: relative; }"
		//+"#watch7-views-info { top: -8px !important; bottom: auto !important; right: 0px !important; }"
		+"#watch7-views-info { bottom: 31px !important; width: 192px !important; }"
		+"#watch7-user-header { padding-bottom: 3px !important; }"
		+"#watch8-action-buttons { display: inline; padding-top: 0px; border-top: none; }"
		+"#watch8-action-buttons:after,"
		+"#watch8-action-buttons:before { content: none !important; }"
		+"#watch8-secondary-actions .yt-uix-button { padding: 0px 0px !important; }"
		+"#watch8-secondary-actions { left: 5px !important; }"
		
		 // Stałe wyświetlanie liczby subskrybcji kanału autora filmu
		+".yt-subscription-button-subscriber-count-branded-horizontal, .html5-text-button, .yt-subscription-button-subscriber-count-unbranded { display: inline-block !important; }"
		
		// Skok do aktualnie odtwarzanego elementu na playliście
		+" .watch-wide #watch-appbar-playlist .playlist-videos-list { "
		+"    height: 490px !important; "
		+" } "
		+" .watch-wide #watch-appbar-playlist { "
		+"    min-height: 592px !important; "
		+" } "
		+" #watch-appbar-playlist .playlist-videos-list { "
		+" 		max-height: 490px !important; "
		+" } "
	);
	
}


function dodajStyl (idStyle,styles) { // Dodanie stylu
        if(document.getElementById(idStyle)){ document.getElementsByTagName("head")[0].removeChild(document.getElementById(idStyle)); }
        var css = document.createElement('style'); css.type = 'text/css'; css.id = idStyle;
        css.styleSheet ? css.styleSheet.cssText = styles : css.appendChild( document.createTextNode(styles) );
        document.getElementsByTagName("head")[0].appendChild(css);
}


function readCookie (name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function setTOFun() {
	setTimeout( function () {
		console.log("setTOFun");
		if (document.querySelector("#progress") == undefined) {
			wymFun();
		}
		else {
			setTOFun();
		}
	}, 100);
}

function miedzyFun () {
	glFun();
	wymFun();
	//window.alert("muędzy");
	console.log("miedzyFun");
	
	/*(function(history){
		var pushState = history.pushState;
		history.pushState = function(state) {
			if (typeof history.onpushstate == "function") {
				history.onpushstate({state: state});
			}
			// ... whatever else you want to do
			// maybe call onhashchange e.handler
			return pushState.apply(history, arguments);
		}
	})(window.history);
	
	history.onpopstate = history.onpushstate = function(e) { console.log("pushstate"); glFun(); }
	*/
	
	
	window.addEventListener("popstate", function(e) {
		console.log("popstate"); //popstate
		setTOFun();
	});
}

document.addEventListener("DOMContentLoaded", miedzyFun);