大贤者
精华
|
战斗力 鹅
|
回帖 0
注册时间 2017-9-20
|
本帖最后由 mayourt 于 2021-4-7 15:36 编辑
- // ==UserScript==
- // @name S1 vote thread revise
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description revise s1 vote thread default options
- // @author ruanz
- // @match https://bbs.saraba1st.com/2b/forum.php?mod=post*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- // Your code here...
- let button_revise = document.createElement("button");
- button_revise.id = "revise default";
- button_revise.type = "button";
- button_revise.textContent = "一键修改原始值";
- button_revise.style.width = "100px";
- button_revise.style.height = "40px";
- button_revise.style.align = "center";
- button_revise.onclick = function (){
- document.getElementById("polldatas").value=0;
- document.getElementById("overt").checked=true;
- let subject_origin = document.getElementById("subject").value;
- console.log(subject_origin)
- let option_value = "";
- if(subject_origin.includes("TV")){
- option_value = "329";
- document.getElementById("typeid").setAttribute('selecti', 1);
- } else if (subject_origin.includes("MOV")){
- option_value = "330";
- document.getElementById("typeid").setAttribute('selecti', 2);
- } else if (subject_origin.includes("OVA")){
- option_value = "331";
- document.getElementById("typeid").setAttribute('selecti', 3);
- }
- document.getElementById("typeid").innerHTML="<option value="+option_value+"></option>"
- return;
- };
- document.getElementsByClassName('pbt cl')[0].appendChild(button_revise);
- })();
复制代码
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
那个match的地址可能要改下,自动改选项那个,最后select里option执行了了一个onclick的玩意儿,我不知道怎么改了,晚上有时间再改
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
更新了下,看了下post内容,应该是对的,页面显示没变,但实际提交应该改了,这个select写的真鸡儿怪 |
|