Greasy Fork

Greasy Fork is available in English.

腐漫之家论坛助手

针对腐漫之家论坛,提供一键回复,评分等功能 (◕ᴗ◕✿)

当前为 2022-02-19 提交的版本,查看 最新版本

// ==UserScript==
// @name         腐漫之家论坛助手
// @namespace    http://tampermonkey.net/
// @version      1.1.5
// @description  针对腐漫之家论坛,提供一键回复,评分等功能 (◕ᴗ◕✿)
// @author       乃木流架
// @include      /^https:\/\/.+\.fuman[6-9]\.com\/.*$/
// @icon         https://www.fuman6.com/favicon.ico
// @grant        none
// @license      GPL-3.0 License
// ==/UserScript==

(() => {
    'use strict';

    //搜索框定位
    var search = document.querySelector('#scbar_txt');
    var text = document.querySelector('textarea');
    document.addEventListener('keyup', function(e){
        if(!text && (e.keyCode === 83)){
            search.focus();
        }
    })

    //清除搜索框旁原文字
    var d = document.getElementById('scbar_hot')
    if(d){
        d.remove();
    }

    //搜索条长度
    //document.getElementById('scbar_txt').style.width = '400px';
    document.getElementById('scbar_txt').style.width = '352px';

    //设定按钮样式
    var styleMap = {
        border: "3px solid #1670af",
        background: "#ffffff",
        borderRadius: "4px",
        marginLeft: '5px'
    };

    var button = document.createElement("button");
    var button_ = document.createElement("button");
    var button1 = document.createElement("button");
    var button2 = document.createElement("button");
    var button3 = document.createElement("button");
    var button4 = document.createElement("button");
    var button5 = document.createElement("button");
    var button6 = document.createElement("button");


    for (let i in styleMap) {
        button.style[i] = styleMap[i];
        button_.style[i] = styleMap[i];
        button1.style[i] = styleMap[i];
        button2.style[i] = styleMap[i];
        button3.style[i] = styleMap[i];
        button4.style[i] = styleMap[i];
        button5.style[i] = styleMap[i];
        button6.style[i] = styleMap[i];
    }

    button.innerHTML = '一键回复';
    button_.innerHTML = '一键评分';
    button1.innerHTML = '<b>定位</b>';
    button2.innerHTML = 'BL最新贴';
    button3.innerHTML = '动画最新贴';
    button4.innerHTML = 'DRAMA最新贴';
    button5.innerHTML = '文学最新贴';
    button6.innerHTML = '游戏最新贴';

    button.style.border = "3px solid #ff0000";
    button_.style.border = "3px solid #ff0000";
    // button1.style.border = "3px solid #ffff00";
    button1.style.color = "#1670af";

    //添加一键回复按钮
    var title = document.getElementsByClassName('plc ptm pbn vwthd')[0];
    if(title){
        title.appendChild(button);
        title.appendChild(button_);
    }

    //添加搜索区域的一排按钮
    var searchArea = document.createElement("div");
    searchArea.setAttribute('id', 'searchArea');
    document.getElementsByClassName('scbar_hot_td')[0].appendChild(searchArea);
    // document.getElementsByClassName('scbar_hot_td')[0].setAttribute('class', 'not_search')
    d = document.getElementById('searchArea');
    if(d){
        d.appendChild(button1);
        d.appendChild(button2);
        d.appendChild(button3);
        d.appendChild(button4);
        d.appendChild(button5);
        d.appendChild(button6);
    }

    //一键回复
    button.onclick = function(){
        if(document.getElementById('ls_username')){
            alert('请先登录哦凸(`0´)凸!!!');
            return;
        }
        if(document.querySelector('textarea')){
            document.querySelector('textarea').innerText='谢谢大大无私的分享,炒鸡感谢鸭 (^ω^) ';
            document.getElementById('fastpostsubmit').click();
        }
    }

    button_.onclick = function() {
        document.getElementById('ak_rate').click();
        setTimeout(function(){
            if(document.getElementById('fwin_rate')){
                var coinLeft = document.getElementsByClassName('dt mbm')[0].children[0].children[1].children[3].innerHTML
                var charmLeft = document.getElementsByClassName('dt mbm')[0].children[0].children[2].children[3].innerHTML
                var vitalityLeft = document.getElementsByClassName('dt mbm')[0].children[0].children[3].children[3].innerHTML

                if(coinLeft < 2){
                    alert('今日剩余金币太少辣,明天再来评分吧 ฅ•̀∀•́ฅ !!!');
                    document.getElementsByClassName('flbc')[0].click();
                    return;
                }

                var coin = document.getElementById('score2').value = 5;                           //<----------自定义评分金币个数
                var charm = document.getElementById('score4').value = 1;
                var vitality = document.getElementById('score7').value = 1;
                if(coinLeft < coin) coin = coinLeft; else coin = 5;                               //<----------自定义评分金币个数
                if(charmLeft < charm) charm = charmLeft; else charm = 1;
                if(vitalityLeft < vitality) vitality = vitalityLeft; else vitality = 1;
                document.getElementById('reason').value = '超级棒的资源,感谢楼主大大 (^▽^) '; //<----------自定义评分评分理由
                document.getElementsByClassName('pn pnc')[0].click();
            }
        }, 500)
    }

    //定位
    button1.onclick = function(e){
        e.preventDefault();
        if(document.getElementById('filter_special')){
            document.getElementById('filter_special').scrollIntoView();
        }
        if(!document.getElementById('filter_special') && document.getElementById('seccheck_fastpost')){
            document.getElementById('seccheck_fastpost').scrollIntoView();
        }
        if(document.getElementById('e_controls')){
            document.getElementById('e_controls').scrollIntoView();
        }
    }

    var baseUrl = 'https://www.fuman6.com';

    //BL最新贴
    button2.onclick = function(){
        window.location.href = baseUrl + '/forum.php?mod=forumdisplay&fid=86&filter=author&orderby=dateline';
    }

    //动画最新贴
    button3.onclick = function(){
        window.location.href = baseUrl + '/forum.php?mod=forumdisplay&fid=159&filter=author&orderby=dateline';
    }

    //DRAMA最新贴
    button4.onclick = function(){
        window.location.href = baseUrl + '/forum.php?mod=forumdisplay&fid=160&filter=author&orderby=dateline';
    }

    //文学最新贴
    button5.onclick = function(){
        window.location.href = baseUrl + '/forum.php?mod=forumdisplay&fid=179&filter=author&orderby=dateline';
    }

    //游戏最新贴
    button6.onclick = function(){
        window.location.href = baseUrl + '/forum.php?mod=forumdisplay&fid=87&filter=author&orderby=dateline';
    }


    // Your code here...
})();