YT - Watch Later

Adds all your unwatched subscriptions to Watch Later

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         YT - Watch Later
// @version      0.3.2
// @description  Adds all your unwatched subscriptions to Watch Later
// @author       Cáno
// @match        https://www.youtube.com/feed/subscriptions
// @require      http://code.jquery.com/jquery-latest.js
// @grant        none
// @namespace http://tampermonkey.net/
// ==/UserScript==

(function() {
    'use strict';

    var delay = 0;

    setTimeout(function () {
        var els = document.getElementsByClassName("addto-watch-later-button");

        Array.prototype.forEach.call(els, function(el) {
            delay += 500;
            var elem = $(el).parent().parent();
            //console.log(elem.find('.yt-uix-livereminder').length);
            setTimeout(function () {
                if (el.parentElement.getElementsByClassName("yt-uix-sessionlink")[0].getElementsByClassName("watched-badge")[0] === undefined &&
                    el.parentElement.getElementsByClassName("resume-playback-progress-bar")[0] === undefined &&
                    elem.find('.yt-lockup-meta-info li:last-child').text().substr(0, 10) !== "Transmisja" &&
                    elem.find('.yt-uix-livereminder').length === 0 &&
                    elem.find('span[title="Requires payment to watch"]').length === 0 &&
                    elem.find('.yt-badge').length === 0
                   ) {
                    el.click();
                }
            }, delay);
        });
    }, 3200);

})();