Skip to content
This repository was archived by the owner on Mar 23, 2018. It is now read-only.

Commit 7dabe06

Browse files
committed
1.8.0
- Fixed #468 - Fixed #464 - Added Hungarian locale - Fixed Polymer detection - Fixed incomplete Material Layout warning message
1 parent 10b795e commit 7dabe06

7 files changed

Lines changed: 1146 additions & 1130 deletions

File tree

bin/update.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"addons": {
33
"unlisted-particle@particlecore.github.io": {
44
"updates": [{
5-
"version": "1.7.9",
5+
"version": "1.8.0",
66
"update_link": "https://github.com/ParticleCore/Particle/raw/master/dist/YouTubePlus.xpi",
77
"applications": {
88
"gecko": {

dist/YouTubePlus.xpi

2.08 KB
Binary file not shown.

src/Userscript/YouTubePlus.user.js

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// ==UserScript==
2-
// @version 1.7.9
2+
// @version 1.8.0
33
// @name YouTube +
44
// @namespace https://github.com/ParticleCore
55
// @description YouTube with more freedom
6+
// @compatible chrome
7+
// @compatible firefox
68
// @icon https://raw.githubusercontent.com/ParticleCore/Particle/gh-pages/images/YT%2Bicon.png
79
// @match *://www.youtube.com/*
810
// @exclude *://www.youtube.com/tv*
@@ -594,7 +596,7 @@
594596
if (temp !== "player-api" && temp !== "upsell-video") {
595597
return original.apply(this, arguments);
596598
}
597-
/*b = */modArgs(b);
599+
modArgs(b);
598600
temp = original.apply(this, arguments);
599601
player = document.getElementById("movie_player");
600602
if (player) {
@@ -613,6 +615,9 @@
613615
function modAutoplayFullscreen(original) {
614616
return function () {
615617
var has_ended, next_button, next_clicked;
618+
if (!document.mozFullScreenElement && !document.webkitFullscreenElement) {
619+
return original.apply(this, arguments);
620+
}
616621
has_ended = api && api.getCurrentTime && Math.round(api.getCurrentTime()) >= Math.floor(api.getDuration());
617622
next_clicked = document.activeElement.classList.contains("ytp-button-next") || document.activeElement.classList.contains("ytp-next-button");
618623
if (!user_settings.plApl && !next_clicked && has_ended) {
@@ -634,24 +639,16 @@
634639
}
635640
function modPlayerCreate(original) {
636641
return function (a, b) {
637-
var i, temp, player;
642+
var temp, player;
638643
temp = a.id || a;
639644
if (temp !== "player-api" && temp !== "upsell-video") {
640645
return original.apply(this, arguments);
641646
}
642-
/*b = */modArgs(b);
647+
modArgs(b);
643648
if (a.id === "upsell-video") {
644649
original.apply(this, arguments);
645650
} else if (typeof a === "object") {
646651
player_instance = original.apply(this, arguments);
647-
temp = Object.keys(player_instance);
648-
i = temp.length;
649-
while (i--) {
650-
if (typeof player_instance[temp[i]] === "object" && player_instance[temp[i]] && player_instance[temp[i]].hasNext) {
651-
player_instance[temp[i]].hasNext = modAutoplayFullscreen(player_instance[temp[i]].hasNext);
652-
break;
653-
}
654-
}
655652
player = document.getElementById("movie_player");
656653
if (user_settings.VID_PLR_FIT) {
657654
resizePlayer();
@@ -722,6 +719,12 @@
722719
window.yt.player.Application.create = modPlayerCreate(window.yt.player.Application.create);
723720
if (window._yt_player) {
724721
temp = Object.keys(window._yt_player);
722+
for (i = 0; i < temp.length; i++) {
723+
if (typeof window._yt_player[temp[i]] === "function" && window._yt_player[temp[i]].prototype && window._yt_player[temp[i]].prototype.hasNext) {
724+
window._yt_player[temp[i]].prototype.hasNext = modAutoplayFullscreen(window._yt_player[temp[i]].prototype.hasNext);
725+
break;
726+
}
727+
}
725728
for (i = 0; i < temp.length; i++) {
726729
if (typeof window._yt_player[temp[i]] === "function" && window._yt_player[temp[i]].toString().match(/this\.adaptiveFormats/)) {
727730
key = temp[i];
@@ -1991,7 +1994,7 @@
19911994
function infiniteScroll() {
19921995
var observer, loadMore;
19931996
loadMore = document.querySelector(".load-more-button");
1994-
if (loadMore && user_settings.GEN_INF_SCRL) {
1997+
if (window.location.pathname !== "/watch" && loadMore && user_settings.GEN_INF_SCRL) {
19951998
if (!loadMore.classList.contains("infiniteScroll")) {
19961999
loadMore.classList.add("infiniteScroll");
19972000
observer = new MutationObserver(infiniteScroll);
@@ -2087,13 +2090,15 @@
20872090
}
20882091
function isMaterial() {
20892092
var temp;
2090-
temp = document.querySelector("ytd-app");
2093+
temp = document.querySelector("ytd-app, [src*='polymer'],[href*='polymer']");
20912094
if (temp && !document.getElementById("material-notice")) {
20922095
temp = document.createElement("template");
20932096
temp.innerHTML = //
2094-
`<div id='material-notice' style='border-radius:2px;color:#FFF;padding:10px;background-color:#09F;box-shadow:0 0 3px rgba(0,0,0,.5);font-size:12px;position:fixed;bottom:20px;right:20px;z-index:99999'>
2097+
`<div id='material-notice' style='border-radius:2px;color:#FFF;padding:10px;background-color:#09F;box-shadow:0 0 3px rgba(0,0,0,.5);font-size:12px;position:fixed;bottom:20px;right:50px;z-index:99999'>
20952098
YouTube Plus is not compatible with the YouTube beta Material Layout<br>
2096-
The development of YouTube Plus might end when this layout is officially launched, <a href='https://github.com/ParticleCore/Particle/issues/448' target='_blank' style='color:#FFF;font-weight:bold;'>click here</a> to read the announcement<br>
2099+
<a href='https://github.com/ParticleCore/Particle/wiki/Restore-classic-YouTube' target='_blank' style='color:#FFF;font-weight:bold;'>Click here</a> for instructions to restore classic YouTube and continue using YT+<br>
2100+
The development of YT+ might end when this layout is launched permanently,<br>
2101+
<a href='https://github.com/ParticleCore/Particle/issues/448' target='_blank' style='color:#FFF;font-weight:bold;'>click here</a> to read the announcement<br>
20972102
To keep using the current layout without this message please disable YT+
20982103
</div>`;
20992104
document.documentElement.appendChild(temp.content.firstChild);
@@ -2336,7 +2341,7 @@
23362341
holder = document.createElement("link");
23372342
holder.rel = "stylesheet";
23382343
holder.type = "text/css";
2339-
holder.href = "https://particlecore.github.io/Particle/stylesheets/YouTubePlus.css?v=1.7.9";
2344+
holder.href = "https://particlecore.github.io/Particle/stylesheets/YouTubePlus.css?v=1.8.0";
23402345
document.documentElement.appendChild(holder);
23412346
}
23422347
holder = document.createElement("script");

0 commit comments

Comments
 (0)