您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds logograin emote to the WaniKani forum
当前为
// ==UserScript== // @name Wanikani Forums: Logograin emote // @namespace http://tampermonkey.net/ // @version 0.1 // @description Adds logograin emote to the WaniKani forum // @author latepotato // @include https://community.wanikani.com/* // @grant GM.xmlHttpRequest // ==/UserScript== // Just write :logograin: ;(function () { let rng_timestamp // Wait until the save function is defined const i = setInterval(tryInject, 100) // Inject if the save function is defined function tryInject() { const old_save = unsafeWindow.require('discourse/controllers/composer').default.prototype.save if (old_save) { clearInterval(i) inject(old_save) } } // Wrap the save function with our own function function inject(old_save) { const new_save = async function (t) { const composer = document.querySelector('textarea.d-editor-input') // Reply box composer.value = await replace_logograin_emotes(composer.value) composer.dispatchEvent(new Event('change', { bubbles: true, cancelable: true })) // Let Discourse know old_save.call(this, t) // Call regular save function } unsafeWindow.require('discourse/controllers/composer').default.prototype.save = new_save // Inject } // Grabs the text then returns the POLL async function replace_logograin_emotes(text) { return text.replace(/\:logograin\:/gis, ':ear_of_rice: :ship: :smiling_face_with_three_hearts:') } })()
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址