Watchseries

Make watchseries great by removing one step to get to the streams

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Watchseries
// @version      1.3
// @homepage https://github.com/bahhax404
// @description  Make watchseries great by removing one step to get to the streams
// @include      *https://www1.watch-series.la/episode/*
// @icon https://static.watch-series.la/templates/default/images/logo-hover.png
// @copyright    GNU General Public License v3.0
// @run-at       document-body
// @author       Bahha 
// @namespace https://greasyfork.org/users/186498
// ==/UserScript==


//remove useless links. temporary solution for now
document.getElementsByClassName('watchlink')[0].remove();
document.getElementsByClassName('watchlink')[5].remove();

// retrieve watch links 
var watchlinks = document.getElementsByClassName('watchlink');

//get td elements that contain the actual links and unhide them
td_elements = document.querySelectorAll('td.deletelinks');
for( var i = 0; i < td_elements.length;i++){
    td_elements[i].style.display = "block";
    
}

//get the real links from the report link feature
var reportlinks = document.getElementsByClassName('btn btn-danger btn-sm');

//get the real links from onclick attribute of reportlinks
var sloppy_links = [];
for(var i = 0; i < reportlinks.length;i++){
    sloppy_links[i] = reportlinks[i].getAttribute('onclick');
}

//regex to extract the final link from the string stored in sloppy_links
urlregex = /(https?:\/\/[^\']*)/;

//store the actual final links in an array
var actual_links = [];
for(var i = 0; i < sloppy_links.length; i++){
    actual_links[i] = sloppy_links[i].match(urlregex)[1];
 }

//replace the redirecting links with actual links
for (var i = 0; i < watchlinks.length; i++) {
    watchlinks[i].setAttribute("href", actual_links[i]);
}

//Done !

//TODO remove useless links dynamically