您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
NovelAIで生成が成功 or 失敗したら音を鳴らす
// ==UserScript== // @name NovelAI Execution Audio Notifier // @namespace http://tampermonkey.net/ // @version 2024-01-19 // @description NovelAIで生成が成功 or 失敗したら音を鳴らす // @description:en This script triggers an audible notification whenever NovelAI successfully generates an image, or fails to do so. // @author K. K. // @match https://novelai.net/* // @icon https://www.google.com/s2/favicons?sz=64&domain=novelai.net // @grant none // @require http://code.jquery.com/jquery-2.2.4.min.js // @require https://cdn.jsdelivr.net/npm/[email protected]/js/ion.sound.min.js // @license MIT // ==/UserScript== const $ = window.jQuery; // 宛先が変わった? const POST_TARGET_URL_ARRAY = [ 'https://api.novelai.net/ai/generate-image', 'https://image.novelai.net/ai/generate-image', ]; $.ionSound({ sounds: [ { name: "button_tiny", volume: 0.5 }, { name: "water_droplet_2", volume: 0.1 }, ], path: "https://cdn.jsdelivr.net/npm/[email protected]/sounds/", preload: true, multiplay: true }); (function() { 'use strict'; // 元のfetch関数を保存 let originalFetch = window.fetch; // fetch関数をオーバーライド window.fetch = function() { let fetchArgs = arguments; let fetchUrl = fetchArgs[0]; // 元のfetch関数を呼び出してプロミスを取得 let fetchPromise = originalFetch.apply(this, fetchArgs); // POST先を見て生成先のURLなら完了時に処理を実行 if (POST_TARGET_URL_ARRAY.includes(fetchUrl)) { console.log(`target url: ${fetchUrl}`); fetchPromise .then(response => { if (!response.ok) { console.error('Server Error:', response.url); $.ionSound.play("water_droplet_2"); } else { // console.log('Request Success:', response.url); $.ionSound.play("button_tiny"); } }) .catch(error => { console.error('Request Error:', error); $.ionSound.play("water_droplet_2"); }); } // オリジナルのプロミスを返す return fetchPromise; }; })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址