您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Library which creates a modal for opening plugin panels.
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/527481/1540076/IdlePixel%20Dialogue%20Handler.js
- // ==UserScript==
- // @name IdlePixel Dialogue Handler
- // @namespace luxferre.dev
- // @version 1.0.0
- // @description Library which creates a modal for opening plugin panels.
- // @author Lux-Ferre
- // @license MIT
- // @match *://idle-pixel.com/login/play*
- // @grant none
- // ==/UserScript==
- (function () {
- if (window.dialoguer) {
- // already loaded
- return;
- }
- class Dialoguer {
- constructor() {
- this.original_dialogue = Modals.open_image_modal
- this.handlers = {}
- }
- register_handler(selector, handler, propagate) {
- this.handlers[selector] = {
- handler: handler,
- propagate: propagate
- }
- }
- open_image_modal(title, image_path, message, primary_button_text, secondary_button_text, command, force_unclosable) {
- const check_text = title + image_path + message
- for (const [selector, handler] of Object.entries(this.handlers)) {
- if (check_text.includes(selector)) {
- [title, image_path, message, primary_button_text, secondary_button_text, command, force_unclosable] = handler.handler(title, image_path, message, primary_button_text, secondary_button_text, command, force_unclosable)
- if (!handler.propagate) {
- return
- }
- }
- }
- this.original_dialogue(title, image_path, message, primary_button_text, secondary_button_text, command, force_unclosable)
- }
- onLogin(){
- Modals.open_image_modal = this.open_image_modal
- }
- }
- // Add to window and init
- window.dialoguer = new Dialoguer();
- })();