Last active
January 24, 2017 11:32
-
-
Save myfreeer/d7a44d007543d127ad3c9d66f807b143 to your computer and use it in GitHub Desktop.
bilibili.com弹幕礼仪题自动答题
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name bilibili-answer-base | |
// @namespace bili | |
// @description bilibili.com弹幕礼仪题自动答题 | |
// @include *://account.bilibili.com/answer/base | |
// @version 0.2 | |
// @downloadURL https://gist.github.com/myfreeer/d7a44d007543d127ad3c9d66f807b143/raw/bilibili-answer-base.user.js | |
// @grant unsafeWindow | |
// @license GNU GPL 3.0 | |
// ==/UserScript== | |
//site: https://account.bilibili.com/answer/base | |
//Licensed GNU GPL 3.0+ | |
var $ = typeof jQuery === "undefined" ? unsafeWindow.jQuery : jQuery; | |
$.ajaxSetup({ | |
dataFilter: function (data, type) { | |
var rs = JSON.parse(data); | |
if (rs.status === true) return data; | |
else { | |
var err = rs.message, | |
len = err.length, | |
i; | |
for (i = 0; i < len; i++) { | |
$('#examListUl li[qs_id=' + err[i] + ']').addClass('error'); | |
} | |
return data; | |
} | |
} | |
}); | |
$('.solution').each(function(e) { | |
$(this.childNodes[1].childNodes[1]).addClass("currSolution"); | |
}); | |
$('.enterBut.enterButdefault').click(); | |
var t = 1 | |
var go = function() { | |
$('.d-button.d-state-highlight').click(); | |
$('.examLi.error').each(function(e) { | |
$(this).removeClass('error'); | |
$(this.childNodes[5].childNodes[1].childNodes[t]).removeClass("currSolution"); | |
$(this.childNodes[5].childNodes[1].childNodes[t + 2]).addClass("currSolution"); | |
}); | |
$('.enterBut.enterButdefault').click(); | |
t += 2; | |
if (t > 5) return; | |
setTimeout(go, 1500); | |
}; | |
setTimeout(go, 1500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment