diff --git a/ani-search-enhancer.user.js b/ani-search-enhancer.user.js index e8c7b84..84a9f33 100644 --- a/ani-search-enhancer.user.js +++ b/ani-search-enhancer.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name aniSearch Enhancer // @namespace http://git.nivram.io/marvinlehmann/ani-search-enhancer -// @version 1.7 +// @version 1.71 // @description Adds buttons to the info site of an anime on aniSearch which links you directly to various streaming portals. // @author Marvin Lehmann // @grant GM_xmlhttpRequest @@ -50,18 +50,28 @@ $(function () { `); const $stream_links = $('#stream-links'); - $stream_links.change(function () { - const target = $(this).val(); - if (target) { - window.open(target, '_blank'); - } - }); + const $page_action_stream = $('#page-action-stream') - $stream_links.append(new Option("Stream List", "https://www.reddit.com/r/animepiracy/wiki/animestreamlist")); - $stream_links.append(new Option("> 9anime.to", "https://9anime.to/search?keyword=" + encodedTitle)); - $stream_links.append(new Option("> AnimeVibe", "https://animevibe.xyz/?s=" + encodedTitle)); - $stream_links.append(new Option("> KissAnime.ru", "http://kissanime.ru/Search/Anime?keyword=" + encodedTitle)); - $stream_links.append(new Option("> Proxer.me", "https://proxer.me/search?s=search&name=" + encodedTitle + "&typ=all-anime#top")); + const clickHandler = function (e) { + console.log(e); + if (e.target === e.currentTarget) { + console.log("test"); + const targetUrl = $stream_links.val(); + console.log(targetUrl); + if (targetUrl) { + window.open(targetUrl, '_blank'); + } + } + }; + + // $stream_links.change(clickHandler) ; + $page_action_stream.click(clickHandler); + + $stream_links.append(new Option("> Stream List", "https://www.reddit.com/r/animepiracy/wiki/animestreamlist")); + $stream_links.append(new Option("@ 9anime", "https://9anime.to/search?keyword=" + encodedTitle)); + $stream_links.append(new Option("@ AnimeVibe", "https://animevibe.xyz/?s=" + encodedTitle)); + $stream_links.append(new Option("@ KissAnime", "http://kissanime.ru/Search/Anime?keyword=" + encodedTitle)); + $stream_links.append(new Option("@ Proxer", "https://proxer.me/search?s=search&name=" + encodedTitle + "&typ=all-anime#top")); GM_xmlhttpRequest({ method: 'GET', @@ -71,7 +81,7 @@ $(function () { if (resp.response.total > 0) { const firstResult = resp.response.data[0]; const targetPage = 'https://animepahe.com/anime/' + firstResult.slug; - $stream_links.append(new Option("> AnimePahe.com", targetPage)); + $stream_links.append(new Option("@ AnimePahe", targetPage)); // Did we possibly get the wrong one? // if (!firstResult.started_airing_date.includes(animeReleaseYear)) {