巴哈姆特動漫電玩通解答顯示小工具

在巴哈姆特哈拉區右側的動漫電玩通顯示答案

当前为 2018-03-19 提交的版本,查看 最新版本

// ==UserScript==
// @name         巴哈姆特動漫電玩通解答顯示小工具
// @namespace    https://blog.maple3142.net/
// @version      0.2
// @description  在巴哈姆特哈拉區右側的動漫電玩通顯示答案
// @author       You
// @match        https://forum.gamer.com.tw/B.php*
// @grant        none
// ==/UserScript==

(function() {
    'use strict'

    const getCSRF=()=>jQuery.ajax({url: '/ajax/getCSRFToken.php',cache: false})
    const answer=sn=>o=>getCSRF().then(token=>jQuery.get('/ajax/quiz_answer.php',{sn,o,token}).then(html=>html.includes('答對了')))
    const getAnswerOf=sn=>Promise.all([1,2,3,4].map(answer(sn))).then(r=>r.indexOf(true)+1)

    if(!egg.cookie.get('BAHAID'))return

    const $ansbox=jQuery('.BH-rbox.BH-qabox1')
    const sn=$ansbox.data('quiz-sn')

    getAnswerOf(sn).then(x=>$ansbox.find('li')[x-1]).then(el=>$(el).css('font-size','120%').css('color','red'))
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址