nicoeg / Followshows TPH injection

// ==UserScript==
// @name         Followshows TPH injection
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Adds The Pirate Bay search as a source for each show!
// @author       Nico
// @match        followshows.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    
    $('body').append('<div id="temp"></div>');

    $('.video-wrapper').each(function() {
        var title = $(this).find('.title').text().toLowerCase();
        var number = $(this).find('.video-infos .description a').attr('href').split("/");
        
        number = number[number.length - 1];
        
        $('#temp').html($(this).find('.video-tile').attr('data-content'));
        
        if ($('#temp .video-links').length === 0) {
            $('#temp').append('<div class="video-links"></div>');
        }
        $('#temp .video-links').prepend("<a href='https://thepiratebay.org/search/"+title+"%20"+number+"/0/99/0' target='_blank' class='btn btn-default video-link'>The Pirate Bay</a>");
        
        $(this).find('.video-tile').attr('data-content', $('#temp').html());
    });
})();