Runy69 / AnimeFLV - Show next episode

// ==UserScript==
// @name         AnimeFLV - Show next episode
// @version      1.0
// @include      *.animeflv.net/*
// @match        *.animeflv.net/*
// @noframes
// @updateURL https://openuserjs.org/meta/Runy69/AnimeFLV_-_Show_next_episode.meta.js
// @downloadURL https://openuserjs.org/install/Runy69/AnimeFLV_-_Show_next_episode.user.js
// @copyright 2019, Runy69 (https://openuserjs.org/users/Runy69)
// @license MIT
// ==/UserScript==

var url = location.toString();
$(document).ready(function() {
    //Button Rework
    $('.BtnNw').click(function(e){
        e.preventDefault();
    });
    if(url.match(/\/anime\//)){
        //Show next chapter
        var selector = '.Main .WdgtCn:has(.ListCaps)';
        if(last_seen !== episodes.length) {
            var i = episodes.length - last_seen - 1;
            if(episodes[episodes.length-1][0] == 0) i = i - 1;
            var html = '<li class="fa-play-circle" style="margin-right: 20px">' +
            '<a href="/ver/' + episodes[i][1] + '/' + anime_info[2] + '-' + episodes[i][0] + '">' +
            '<figure><img class="lazy" data-src="https://cdn.animeflv.net/screenshots/' + anime_info[0] + '/' + episodes[i][0] + '/th_3.jpg" alt=""></figure>' +
            '<h3 class="Title">' + anime_info[1] + '</h3>' +
            '<p>Episodio ' + episodes[i][0] + '</p></a>' +
            '<label for="epi' + episodes[i][0] + '" class="opivw"><input id="epi' + episodes[i][0] + '" class="mseen" data-number="' + episodes[i][0] + '" style="display: none;" type="checkbox" ' + ((episodes[i][0] <= last_seen) ? ' checked' : '') + '><span class="Stts"><span>NO</span> VISTO</span></label></li>';
            $('.Top', selector).css('margin-top', '20px');
            $(selector).prepend('<ul class="ListCaps" id="nextEpisode" style="max-height: 1000px; overflow-y: auto;">'+html+'</ul>');
            $(selector).prepend('<div class="Top"><div class="Title">Siguiente Episodio</div></div>');
            $('#nextEpisode .lazy').lazy({effect: "fadeIn"});
        }
    }
});