Version 1.7
This commit is contained in:
@@ -1,49 +1,85 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name aniSearch Enhancer
|
// @name aniSearch Enhancer
|
||||||
// @namespace http://github.com/marvinlehmann/ani-search-enhancer
|
// @namespace http://git.nivram.io/marvinlehmann/ani-search-enhancer
|
||||||
// @version 1.6
|
// @version 1.7
|
||||||
// @description Adds buttons to the info site of an anime on aniSearch which links you directly to various streaming portals.
|
// @description Adds buttons to the info site of an anime on aniSearch which links you directly to various streaming portals.
|
||||||
// @author Marvin Lehmann
|
// @author Marvin Lehmann
|
||||||
// @grant GM_xmlhttpRequest
|
// @grant GM_xmlhttpRequest
|
||||||
// @include /^https?://www.anisearch.de/anime/.*$/
|
// @include /^https?://www.anisearch.de/anime/.*$/
|
||||||
// @connect masterani.me
|
// @connect animepahe.com
|
||||||
// @require http://code.jquery.com/jquery-latest.js
|
// @require http://code.jquery.com/jquery-latest.js
|
||||||
// @downloadURL http://raw.githubusercontent.com/marvinlehmann/ani-search-enhancer/master/ani-search-enhancer.user.js
|
// @downloadURL http://git.nivram.io/marvinlehmann/ani-search-enhancer/raw/master/ani-search-enhancer.user.js
|
||||||
// @supportURL http://github.com/marvinlehmann/ani-search-enhancer/issues
|
// @supportURL http://git.nivram.io/marvinlehmann/ani-search-enhancer/issues
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
this.$ = this.jQuery = jQuery.noConflict(true);
|
this.$ = this.jQuery = jQuery.noConflict(true);
|
||||||
|
|
||||||
$(function() {
|
$(function () {
|
||||||
$('head').append('<style>.page-action-search:before{content:"\\f002";}</style>');
|
$('head').append(`
|
||||||
|
<style>
|
||||||
|
#page-action-stream:before {
|
||||||
|
content:"\\f002";
|
||||||
|
}
|
||||||
|
|
||||||
|
#stream-links {
|
||||||
|
-moz-appearance: none;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
border: none;
|
||||||
|
|
||||||
|
background-color: transparent;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
</style>`);
|
||||||
|
|
||||||
const animeTitle = $('#htitle > span[itemprop=name]').text();
|
const animeTitle = $('#htitle > span[itemprop=name]').text();
|
||||||
const animeReleaseYear = $('#htitle > span.release_year').text().replace(/\(|\)/g, '');
|
const animeReleaseYear = $('#htitle > span.release_year').text().replace(/\(|\)/g, '');
|
||||||
|
|
||||||
if (animeTitle) {
|
if (animeTitle) {
|
||||||
const encodedTitle = encodeURI(animeTitle).replace(/'/g, "%27");
|
const encodedTitle = encodeURI(animeTitle).replace(/'/g, "%27");
|
||||||
if ($('#page-action').length === 0) $('#htitle').after('<ul id="page-action" class="inline"></ul>');
|
if ($('#page-action').length === 0) {
|
||||||
$('#page-action').append('<li class="page-action-search" onclick="window.open(\'http://kissanime.ru/Search/Anime?keyword=' + encodedTitle + '\', \'_blank\');"><span>KissAnime</span></li>');
|
$('#htitle').after('<ul id="page-action" class="inline"></ul>');
|
||||||
$('#page-action').append('<li class="page-action-search" onclick="window.open(\'https://proxer.me/search?s=search&name=' + encodedTitle + '&typ=all-anime#top\', \'_blank\');"><span>Proxer</span></li>');
|
}
|
||||||
$('#page-action').append('<li class="page-action-search" onclick="window.open(\'https://9anime.to/search?keyword=' + encodedTitle + '\', \'_blank\');"><span>9Anime</span></li>');
|
|
||||||
|
$('#page-action').append(`
|
||||||
|
<li id="page-action-stream">
|
||||||
|
<span>
|
||||||
|
<select id="stream-links">
|
||||||
|
<option value="">Stream wählen</option>
|
||||||
|
</select>
|
||||||
|
</span>
|
||||||
|
</li>`);
|
||||||
|
|
||||||
|
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({
|
GM_xmlhttpRequest({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
// Masterani's search is limited to 30 chars
|
url: 'https://animepahe.com/api?m=search&l=3&q=' + encodedTitle,
|
||||||
// sb=true only returns the "best" results (?)
|
|
||||||
url: 'https://www.masterani.me/api/anime/search?search=' + encodedTitle.substring(0, 30) + '&sb=true',
|
|
||||||
responseType: 'json',
|
responseType: 'json',
|
||||||
onload: function(data) {
|
onload: function (resp) {
|
||||||
if (data.response.length > 0) {
|
if (resp.response.total > 0) {
|
||||||
const firstResult = data.response[0];
|
const firstResult = resp.response.data[0];
|
||||||
const masteraniPage = 'https://www.masterani.me/anime/info/' + firstResult.slug;
|
const targetPage = 'https://animepahe.com/anime/' + firstResult.slug;
|
||||||
const $masteraniButton = $('<li class="page-action-search" onclick="window.open(\'' + masteraniPage + '\', \'_blank\');"><span>Masterani</span></li>').appendTo($('#page-action'));
|
$stream_links.append(new Option("> AnimePahe.com", targetPage));
|
||||||
|
|
||||||
// Did we possibly get the wrong one?
|
// Did we possibly get the wrong one?
|
||||||
if (!firstResult.started_airing_date.includes(animeReleaseYear)) {
|
// if (!firstResult.started_airing_date.includes(animeReleaseYear)) {
|
||||||
$masteraniButton.prop('title', 'Target page may be incorrect.');
|
// $masteraniButton.prop('title', 'Target page may be incorrect.');
|
||||||
$masteraniButton.css('opacity', 0.5);
|
// $masteraniButton.css('opacity', 0.5);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user