Acfun自动5蕉

Acfun自动投5蕉

目前為 2016-09-02 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Acfun自动5蕉
// @namespace    http://zhihaofans.com
// @version      0.0.2
// @description  Acfun自动投5蕉
// @author       zhihaofans
// @match        http://www.acfun.tv/v/*
// @grant        none
// @note         V0.0.2:加入了已扔过香蕉的提醒
// @icon         http://cdn.aixifan.com/ico/favicon.ico
// ==/UserScript==
function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + '=');
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(';', c_start);
            if (c_end == -1) {
                c_end = document.cookie.length;
            }
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return '';
}
function acPostBananas(_cid, _uid) {
    $.post("/banana/throwBanana.aspx", {
        count: "5",
        contentId: _cid,
        userId: _uid
    },
    function(data, status) {
        console.log("自动5蕉(status:" + status+")");
        if (status == "success") {
            if (data.success === true) {
                $.info("success", "已自动投5蕉");
            } else {
                if (data.info != "该稿件已扔过香蕉") {
                    $.info("error", "自动5蕉:" + data.info);
                }
				else{
					$.info("warning", "自动5蕉:该稿件已扔过香蕉");
				}
            }
        } else {
            $.info("error", "自动5蕉:网络错误");
        }

    });
}
$(document).ready(function() {
    if (getCookie('auth_key') !== "") {
        var url = location.pathname;
        var nowcid = url.replace("/v/ac", "");
        if (url.substr(0, 5) == "/v/ac") {
            acPostBananas(nowcid, getCookie('auth_key'));
        }
    }
});