Skip to content

Instantly share code, notes, and snippets.

@marktaiwan
Created November 30, 2020 13:59
Show Gist options
  • Save marktaiwan/7544a45a6c18ceed4df520372893942b to your computer and use it in GitHub Desktop.
Save marktaiwan/7544a45a6c18ceed4df520372893942b to your computer and use it in GitHub Desktop.
// ==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