What.CD :: Requests Auto-Subscriber (Created/Voted)

Requests will be directly subscribed if created or voted

当前为 2015-11-20 提交的版本,查看 最新版本

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        What.CD :: Requests Auto-Subscriber (Created/Voted)
// @description Requests will be directly subscribed if created or voted
// @include     https://*what.cd/requests.php?action=view&id=*
// @require     https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @icon        https://what.cd/favicon.ico
// @version     1

// @namespace https://greasyfork.org/users/2290
// ==/UserScript==
 
/* This should automatically subscribe to your new request once the request is submitted and the resulting page has loaded */
var usernum = document.documentElement.innerHTML.match(/user\.php\?id\=[0-9]+/)[0].split("?")[1];

var pageid = document.URL.split("=")[2];
var page = 'requests';

var str1 = usernum;

// Converting the userid to only numbers from API
var userid = str1.replace(/[^0-9]/g, '');

// We get all people who have voted/created the request
var str2 = $(".layout").html();

// Extraction of all userid's possible
var number = str2.replace(/[^0-9]/g, '');

// Getting the current subscribing status
var status_subscribe = $("#subscribelink_" + page + pageid).text();

// If the userid is found and we can subscribe to the release, let's do it!
if(number.indexOf(userid) > -1 && status_subscribe == "Subscribe"){
    SubscribeComments(page, pageid);
}