您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Shows a confirmation before accidentally discarding a long forum post.
当前为
// ==UserScript== // @name powdertoy.co.uk Confirm Discarding A Long Post // @namespace http://boxmein.net/ // @version 1.0.0 // @description Shows a confirmation before accidentally discarding a long forum post. // @match http://powdertoy.co.uk/Discussions/* // @copyright 2015 boxmein / apache2 license // ==/UserScript== // http://wiki.greasespot.net/Content_Script_Injection function contentEval(source) { if ('function' == typeof source) { source = '(' + source + ')();'; } var script = document.createElement('script'); script.setAttribute("type", "application/javascript"); script.textContent = source; document.body.appendChild(script); document.body.removeChild(script); } contentEval(function() { console.log('attaching to onbeforeunload to confirm discarding >400-long posts'); window.onbeforeunload = function() { console.log('beforeunload!'); $ = ($||window.$||jQuery||window.jQuery); var $el = $("#AddReplyMessage"); if ($el.length == 0) { console.log("didn't find #AddReplyMessage, going to check for .EditPlain[0]"); $el = $($('.EditPlain')[0]); } if ($el === undefined) { console.error('did not find an edit box!'); } if ($el.val().length > 400) { console.log('post too long, gonna check with the user'); return "You sure you wanna leave? Seems you have a really tall post typed up."; } }; });
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址