HJ-OTMOP / PTP Addons: Trumpable Tooltip

// ==UserScript==
// @name         PTP Addons: Trumpable Tooltip
// @namespace    http://tampermonkey.net/
// @version      0.1.3
// @description  Adds a tooltip showing the reason a torrent is trumpable on the torrent group page.
// @author       HJ-OTMOP
// @license MIT
// @match        https://passthepopcorn.me/torrents.php*
// @require      http://code.jquery.com/jquery-3.3.1.min.js
// @copyright 2018, HJ-OTMOP (https://openuserjs.org/users/HJ-OTMOP)
// ==/UserScript==


(function() {
    'use strict';
    $('head').append(`<style>
.tooltip-addon {
    opacity: 0;
    position: absolute;
    display: block;
    left: 6em !important;
    padding: 5px 10px;
    white-space: nowrap;
    top: 50% !important;
    transform: translateY(-50%);
    bottom: unset;
    right: unset;
    z-index: 9999;
    transition: opacity 100ms ease-in-out;
    pointer-events: none;
}

.tooltip-addon.show-addon-tt {
    opacity: 1;
}
</style>`);


    $('table.torrent_table').find('span.torrent-info__trumpable').each(function() {
        $(this).css('position','relative');
        var el = $(this).closest('tr').next('tr.torrent_info_row');
        var id = $(el).attr('id').split('_').pop();
        let rArray = [];
        $(el).find('div#trumpable_' + id + ' span').each(function() {
            rArray.push($(this).html());
        });
        $(el).find('div#trumpable_' + id + ' strong').each(function() {
            rArray.push($(this).html());
        });
        addReason($(this),rArray);
    });
    $('span.torrent-info__trumpable').hover(function() { 
        $(this).find('div.tooltip-addon').addClass('show-addon-tt');
    }, function() { 
        $(this).find('div.tooltip-addon').removeClass('show-addon-tt');
    });

    function addReason(el,reason) {
        $(el).append(`<div class="qtip qtip-default qtip-ptp qtip-shadow tooltip-addon">${reason.join("<br>")}</div>`);   
    }
})();