Greasy Fork镜像 还支持 简体中文。

Bunpro: Helpful Events

A set of custom events which make it easier to detect changes on the page.

目前為 2018-07-26 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/370623/615686/Bunpro%3A%20Helpful%20Events.js

(function() {
    // Add a custom event for when BP creates a new body
    var newBody = new Event('new-body');
    waitForKeyElements('body > header', function(e) {fireEvent(newBody);});
    
    // Add a custom event for when you get a new item in reviews
    var newReviewItem = new Event('new-review-item');
    waitForKeyElements('.level_lesson_info a', function(e) {fireEvent(newReviewItem);});
    
    // Add a custom event when you go to study or cram page
    var quizPage = new Event('quiz-page');
    waitForKeyElements('#show-grammar', function(e) {fireEvent(quizPage);});
    
    // Add a custom event when you go to study page
    var studyPage = new Event('study-page');
    waitForKeyElements('#study-page #show-grammar', function(e) {fireEvent(studyPage);});
    
    // Add a custom event when you go to cram page
    var cramPage = new Event('cram-page');
    waitForKeyElements('#cram-page #show-grammar', function(e) {fireEvent(cramPage);});
    
    // Fires the given event on the body element
    function fireEvent(event) {
    		console.log('Event:', event.type);
    		$('HTML')[0].dispatchEvent(event);
    }
})();

QingJ © 2025

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