RapidGator Premium Downloader

Downloads from RapidGator account

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/4179/13236/RapidGator%20Premium%20Downloader.js

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name RapidGator Premium Downloader
// @version 0.3
// @description Downloads from RapidGator account
// @namespace https://github.com/ohec/RapidGator-Premium-Downloader
// @downloadURL https://github.com/ohec/RapidGator-Premium-Downloader/raw/master/RapidGator_Premium_Downloader.user.js
// @include http://rapidgator.net/file/*
// @include http://www.rapidgator.net/file/*
// ==/UserScript==
(function () {
var gm_plugin = function () {
var options = {
debug: false,
openLink: true, // Open by clicking the link
openUrl: false // Open by setting the window href
};
return {
/**
* Do the click
*/
init: function () {
if (document.title == 'File not found') {
this.log('File not found - Closing');
unsafeWindow.close();
} else {
var downloadLinks;
downloadLinks = document.evaluate('//div[@class="btm"]/p/a', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < downloadLinks.snapshotLength; i++) {
var link = downloadLinks.snapshotItem(i);
var url = link.href;
if(options.openUrl == 1) {
unsafeWindow.location.href = url;
} else if(options.openLink == 1) {
link.click();
} else {
this.log('Opening ' + url);
}
//unsafeWindow.location.href = link.href;
//link.click();
}
}
},
/**
* Log message
*
* @param message
*/
log: function (message) {
if (options.debug > 0) {
console.log(message);
}
}
};
}
var gm = new gm_plugin();
gm.init();
})();