Greasy Fork

Greasy Fork is available in English.

腐漫之家论坛助手

针对腐漫之家论坛,提供更加便捷的操作(◕ᴗ◕✿)

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

// ==UserScript==
// @name         腐漫之家论坛助手
// @namespace    http://tampermonkey.net/
// @version      0.6
// @description  针对腐漫之家论坛,提供更加便捷的操作(◕ᴗ◕✿)
// @author       乃木流架
// @include      /^https:\/\/.+\.fuman[6-9]\.com\/.*$/
// @icon         https://s4.ax1x.com/2022/02/14/HsBZgH.jpg
// @grant        none
// @license      GPL-3.0 License
// ==/UserScript==

(() => {
    'use strict';

    //清除搜索框旁原文字
    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 #e33e33",
        background: "#ffffff",
        borderRadius: "4px",
        marginLeft: '5px'
    };

    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];
        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 = '一键回复';
    button1.innerHTML = '定位';
    button2.innerHTML = 'BL最新贴';
    button3.innerHTML = '动画最新贴';
    button4.innerHTML = 'DRAMA最新贴';
    button5.innerHTML = '文学最新贴';
    button6.innerHTML = '游戏最新贴';

    button1.style.border = "3px solid #1670af";

    //添加一键回复按钮
    var title = document.getElementsByClassName('plc ptm pbn vwthd')[0];
    if(title){
        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();
        }
    }

    //定位
    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();
        }
    }

    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...
})();