Gelbooru Show Tags on Hover for Saved Searches

Makes tags display on hover instead of just on failure to load thumbnail for saved searches page, like on every single other part of the site.

As of 2020-08-15. See the latest version.

// ==UserScript==
// @name         Gelbooru Show Tags on Hover for Saved Searches
// @namespace    http://tampermonkey.net/
// @version      1.1.0
// @description  Makes tags display on hover instead of just on failure to load thumbnail for saved searches page, like on every single other part of the site.
// @author       Xerodusk
// @homepage     https://greasyfork.org/en/users/460331-xerodusk
// @include      https://gelbooru.com/index.php*s=saved_search*
// @grant        none
// @icon         https://gelbooru.com/favicon.png
// ==/UserScript==
/* jshint esversion: 6 */

(function() {
    'use strict';

    // Decode encoded characters in tags for proper matching
    function htmlDecode(input){
        let tempElem = document.createElement('div');
        tempElem.innerHTML = input;
        return tempElem.childNodes.length === 0 ? "" : tempElem.childNodes[0].nodeValue;
    }

    // Get all image thumbnails on page
    let imageThumbs = [...document.getElementsByClassName('thumbnail-preview')];

    // Copy tags from alt attribute to title attribute for image thumbnails
    imageThumbs.forEach(imageThumb => {
        imageThumb.setAttribute('title', htmlDecode(imageThumb.getAttribute('alt')));
    });
})();