您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add a gif to a comment on AO3
当前为
// ==UserScript== // @name AO3: Add gifs to comments // @description Add a gif to a comment on AO3 // @namespace // @author starrybouquet // @version 0.0.1 // @grant none // @require https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js // @include http://*archiveofourown.org/* // @include https://*archiveofourown.org/* // @namespace https://gf.qytechs.cn/users/695969 // ==/UserScript== $(document).ready(function () { var DEBUG = false; // newest more-or-less major version, for the update notice var current_version = '0.0.1'; // regex for url checking var expression = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi; var regex = new RegExp(expression); // create entry form var gif_div = $('<div id="gifentry"><form><label for="gifaddress">GIF link:</label><input type="text" name="gifaddress" id="gifaddress"><button onclick="addGIF">Add this GIF</button></form></div>'); var main = $('#main'); var work_ids = {}; // if it's the first time after an update // addNotice(); // if it's a work page if ($('#workskin').length) { // get work id var work_id = $('#kudo_commentable_id').val(); // DEBUG && console.log('work_id ' + work_id); work_ids.append(work_id); } // add a gif entry to every comment form $(".post.comment").each(function ( index ) { $(this).find("h4").append(gif_div); }); function addGIF() { var url = $(this).sibilings('#gifaddress').val(); if (url.match(regex)){ $(".post.comment").find('textarea.comment_form').val(function() { return this.value + '<img src="' + url + '"/>'; }); } } });
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址