Created
November 30, 2020 13:59
-
-
Save marktaiwan/7544a45a6c18ceed4df520372893942b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Twibooru Favoriters | |
// @description Restore the favoriters tab on image pages | |
// @version 1.0.0 | |
// @author Marker | |
// @license MIT | |
// @namespace https://github.com/marktaiwan/ | |
// @match https://*.twibooru.org/* | |
// @inject-into content | |
// @noframes | |
// ==/UserScript== | |
(function () { | |
'use strict'; | |
function $(selector, parent = document) { | |
return parent.querySelector(selector); | |
} | |
const imageTarget = $('#image_target'); | |
const imageContainer = imageTarget?.closest('.image-show-container'); | |
if (!imageTarget || !imageContainer ) return; | |
const imageId = imageContainer.dataset.imageId; | |
const imageOptionsArea = $('#image_options_area'); | |
const header = $('.block__header', imageOptionsArea); | |
const anchor = document.createElement('a'); | |
anchor.href = '#'; | |
anchor.dataset.clickTab = 'favoriters'; | |
anchor.dataset.loadTab = `/images/${imageId}/favorites`; | |
anchor.innerHTML = '<i class="fa fa-star"></i> List favoriters'; | |
header.appendChild(anchor); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment