// ==UserScript== // @name Sakugabooru Tag Information // @namespace https://sakugabot.pw/ // @version 0.1 // @description Add more infomation for sakugabooru wiki // @author ElnathMojo // @include /^https?://(www\.sakugabooru\.com|sakuga\.yshi\.org)/(wiki/show\?title=|artist\/create\?name=).*/ // @downloadURL https://update.greasyfork.cloud/scripts/373679/Sakugabooru%20Tag%20Information.user.js // @updateURL https://update.greasyfork.cloud/scripts/373679/Sakugabooru%20Tag%20Information.meta.js // ==/UserScript== function isURL(str) { var pattern = /^https?:\/\/.+\..+$/ return pattern.test(str) } (function () { var title = /(?<=\?(title|name)=)(.+)/.exec(window.location.href)[0] jQuery.ajax({ url: `https://sakugabot.pw/api/tags/${title}/`, type: 'GET', dataType: 'json', success: function (result) { var infoTable = "" result.detail.forEach( function (element) { let value = element.formatted_value ? element.formatted_value : element.value let valueHtml = `${value}` if (isURL(value)) { valueHtml = ` ${element.value}` } infoTable += `