New Userscript

try to take over the world!

当前为 2020-08-20 提交的版本,查看 最新版本

// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.tampermonkey.net/scripts.php
// @grant        none
// ==/UserScript==


// 油管自动单曲循环,用来听歌挺爽的
(function () {
  "use strict";

  const timer = setInterval(function () {
    const button = document.getElementsByClassName(
      "ytp-play-button ytp-button ytp-play-button-playlist"
    )[0];
    var date = new Date();
    let cutime = date.getHours() + "-" + date.getMinutes();

    if (button) {
      if (button.getAttribute("title") === "重放") {
        button.click();
      }
      console.log("find the button");
      console.log("video is playing");
    } else {
      console.log(cutime + "不存在");
    }
  }, 1000);
})();