Greasy Fork

Greasy Fork is available in English.

Bunpro: Helpful Events

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

当前为 2018-07-26 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/370623/615684/Bunpro%3A%20Helpful%20Events.js

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// 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);
}