// ==UserScript== // @name 腐漫之家论坛助手 // @namespace http://tampermonkey.net/ // @version 1.4 // @description 针对腐漫之家论坛,提供一键回复,评分等功能 (◕ᴗ◕✿) // @author 乃木流架 // @match http://www.fuman-8.com/* // @icon http://www.fuman-8.com/favicon.ico // @license GPL-3.0 License // @downloadURL none // ==/UserScript== (() => { "use strict"; var baseUrl = "http://www.fuman-8.com"; // /^https:\/\/.+\.fuman[5-12]\.com\/.*$/ //搜索框定位 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 = "358px"; // document.getElementById("scbar_txt").style.width = "100px"; //设定按钮样式 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 = "定位"; 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') var 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 () { console.log("button.onclick......"); if (document.getElementById("ls_username")) { toastr.info("请先登录哦凸(`0´)凸!!!"); return; } if (document.querySelector("textarea")) { document.querySelector("textarea").innerText = "谢谢大大无私的分享,炒鸡感谢鸭 (^ω^) "; document.getElementById("fastpostsubmit").click(); } }; button_.onclick = function () { document.getElementById("ak_rate").click(); console.log("开始评分。。。"); setTimeout(function () { if (document.getElementById("fwin_rate")) { var todayLeft = document.getElementsByClassName("dt mbm")[0].children[0]; var coinLeft = todayLeft.children[1].children[3].innerHTML; console.log("coinLeft:" + coinLeft); var charmLeft = todayLeft.children[2].children[3].innerHTML; console.log("charmLeft:" + charmLeft); var vitalityLeft = todayLeft.children[3].children[3].innerHTML; console.log("vitalityLeft:" + vitalityLeft); 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(); } }, 2000); }; var sa = document.querySelector("#searchArea"); sa.onclick = function (e) { e.preventDefault(); }; //定位 button1.onclick = function (e) { 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(); } }; //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"; }; // let script1 = document.createElement("script"); // script1.setAttribute("type", "text/javascript"); // script1.src = "https://apps.bdimg.com/libs/jquery/3.3.1/jquery.min.js"; // document.documentElement.appendChild(script1); // let elscript = document.createElement("script"); // elscript.setAttribute("type", "text/javascript"); // elscript.src = "https://cdn.bootcss.com/toastr.js/latest/js/toastr.min.js"; // document.documentElement.appendChild(elscript); // let link = document.createElement("link"); // link.setAttribute("rel", "stylesheet"); // // link.href = "https://unpkg.com/element-ui/lib/theme-chalk/index.css"; // link.href = "https://cdn.bootcss.com/toastr.js/latest/css/toastr.min.css"; // document.documentElement.appendChild(link); // function al() { // console.log("alert......"); // $.toastr("alert......"); // } window.onload = () => { // var toastr; // toastr.options = { // closeButton: true, //显示关闭按钮 // debug: false, // progressBar: true, //显示进度条 // positionClass: "toast-bottom-center", //位置 // onclick: null, //点击消息框自定义事件 // showDuration: "300", //显示动作时间 // hideDuration: "1000", //隐藏动作时间 // timeOut: "2000", //显示时间,0为永久显示 // extendedTimeOut: "1000", //鼠标移动过后显示显示时间 // showEasing: "swing", // hideEasing: "linear", // showMethod: "fadeIn", //显示方式 // hideMethod: "fadeOut", //隐藏方式 // }; // al(); }; // Your code here... })();