diff --git a/ani-search-enhancer.user.js b/ani-search-enhancer.user.js index 6f193a3..e8c7b84 100644 --- a/ani-search-enhancer.user.js +++ b/ani-search-enhancer.user.js @@ -1,49 +1,85 @@ // ==UserScript== // @name aniSearch Enhancer -// @namespace http://github.com/marvinlehmann/ani-search-enhancer -// @version 1.6 +// @namespace http://git.nivram.io/marvinlehmann/ani-search-enhancer +// @version 1.7 // @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 // @include /^https?://www.anisearch.de/anime/.*$/ -// @connect masterani.me +// @connect animepahe.com // @require http://code.jquery.com/jquery-latest.js -// @downloadURL http://raw.githubusercontent.com/marvinlehmann/ani-search-enhancer/master/ani-search-enhancer.user.js -// @supportURL http://github.com/marvinlehmann/ani-search-enhancer/issues +// @downloadURL http://git.nivram.io/marvinlehmann/ani-search-enhancer/raw/master/ani-search-enhancer.user.js +// @supportURL http://git.nivram.io/marvinlehmann/ani-search-enhancer/issues // ==/UserScript== this.$ = this.jQuery = jQuery.noConflict(true); -$(function() { - $('head').append(''); +$(function () { + $('head').append(` + `); + const animeTitle = $('#htitle > span[itemprop=name]').text(); const animeReleaseYear = $('#htitle > span.release_year').text().replace(/\(|\)/g, ''); + if (animeTitle) { const encodedTitle = encodeURI(animeTitle).replace(/'/g, "%27"); - if ($('#page-action').length === 0) $('#htitle').after(''); - $('#page-action').append(''); - $('#page-action').append(''); - $('#page-action').append(''); + if ($('#page-action').length === 0) { + $('#htitle').after(''); + } + + $('#page-action').append(` +
  • + + + +
  • `); + + const $stream_links = $('#stream-links'); + $stream_links.change(function () { + const target = $(this).val(); + if (target) { + window.open(target, '_blank'); + } + }); + + $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")); - // Search for the anime on masterani.me - possibly returns url to wrong anime GM_xmlhttpRequest({ method: 'GET', - // Masterani's search is limited to 30 chars - // sb=true only returns the "best" results (?) - url: 'https://www.masterani.me/api/anime/search?search=' + encodedTitle.substring(0, 30) + '&sb=true', + url: 'https://animepahe.com/api?m=search&l=3&q=' + encodedTitle, responseType: 'json', - onload: function(data) { - if (data.response.length > 0) { - const firstResult = data.response[0]; - const masteraniPage = 'https://www.masterani.me/anime/info/' + firstResult.slug; - const $masteraniButton = $('').appendTo($('#page-action')); + onload: function (resp) { + 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)); // Did we possibly get the wrong one? - if (!firstResult.started_airing_date.includes(animeReleaseYear)) { - $masteraniButton.prop('title', 'Target page may be incorrect.'); - $masteraniButton.css('opacity', 0.5); - } + // if (!firstResult.started_airing_date.includes(animeReleaseYear)) { + // $masteraniButton.prop('title', 'Target page may be incorrect.'); + // $masteraniButton.css('opacity', 0.5); + // } } } }); } -}); +}); \ No newline at end of file