episodes dropdown for vidcloud9.com

dropdown adds a dropdown menu to navigate between episodes faster

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         episodes dropdown for vidcloud9.com
// @description  dropdown adds a dropdown menu to navigate between episodes faster
// @match        https://vidcloud9.com/videos/*
// @version 0.0.1.20210801224626
// @namespace https://greasyfork.org/users/798407
// ==/UserScript==

let vidLeft = document.querySelector(".video-info-left");
let videoElem = document.querySelector(".watch_play");
let episodesUrls = new Array();
let episodesRaw = document.querySelector(".lists").querySelectorAll("a");
episodesRaw.forEach(function (e, i) {
    episodesUrls[i] = e.href;
  });
episodesUrls.reverse();
let currentEpisode = episodesUrls.indexOf(window.location.href);
let select = document.createElement("select");
function createOptions(url, i) {
  let option = document.createElement("option");
  option.value = url;
  option.text = "Episode " + (i + 1);
  if (i === currentEpisode) option.selected = "selected";
  return option;
};
episodesUrls.forEach(function (e, i) {
  select.add(createOptions(e, i), null);
});
let br = document.createElement("br");
vidLeft.insertBefore(br, videoElem);
vidLeft.insertBefore(select, videoElem);
select.addEventListener("change", function () {
  window.location.href = select.value;
});