// ==UserScript== // @name Sakugabooru Tag Translation // @namespace https://sakugabot.pw/ // @version 0.1 // @description Translate tags on sakugabooru.com // @author ElnathMojo // @include /^https?://(www\.sakugabooru\.com|sakuga\.yshi\.org)/post(/|\?)?.*/ // @downloadURL none // ==/UserScript== (function getTagInfo() { var tags = [] var tagElements = jQuery('#tag-sidebar > li').each( function () { tags.push(jQuery(this).attr("data-name")) }) if (tags) { jQuery.ajax({ url: 'https://sakugabot.pw/api/tags/?name=' + tags.join(), type: 'GET', dataType: 'json', success: function (result) { for (var i = 0; i < result.results.length; i++) { jQuery(`#tag-sidebar > li[data-name='${result.results[i].name}'] > a:eq(1)`).text( function (j, origText) { console.log(result.results[i].main_name) return `${origText}(${result.results[i].main_name})` }) } } }) } })()