Replace "viewed" with "download" button

Add download button to new lostfilm.tv interface

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Replace "viewed" with "download" button
// @namespace   [email protected]
// @description Add download button to new lostfilm.tv interface
// @include     http://www.lostfilm.tv/new/*
// @include     https://www.lostfilm.tv/new/*
// @include     http://www.lostfilm.tv/new
// @include     https://www.lostfilm.tv/new
// @version     4
// @grant       none
// ==/UserScript==
var serials = document.getElementsByClassName("text-block serials-list")[0];
var episodes_list = serials.getElementsByClassName("row");

for (var i in episodes_list) {
  var series = episodes_list[i].getElementsByClassName("thumb")[0].src.match(/\/(\d+)\//)[1];
  var season_episode = episodes_list[i].getElementsByClassName("comment-blue-box")[0].href.match(/season_(\d+)\/episode_(\d+)/);
  var season = season_episode[1];
  var episode = season_episode[2];
  
  // <div title="" class="external-btn" onClick="PlayEpisode('299','1','6')"></div>
  var button = document.createElement("div");
  button.setAttribute("class", "haveseen-btn");
  button.setAttribute("title", "Download episode");
  button.setAttribute("style", "border: 2px solid #ff3c2d; top: 39px; background: #ff3c2d url(\"/vision/external-link-btn3.png\") repeat scroll center center;")
  button.setAttribute("onClick", "PlayEpisode('" + series + ("00" + season).slice(-3) + ("00" + episode).slice(-3) + "')");
  episodes_list[i].appendChild(button);
}