NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @license MIT // @name Anime4up // @namespace https://ww.anime4up.com/ // @version 0.1 // @description Jump to selected episode! And save last episode // @author Mohamed Fahmi Chaar // @match https://ww.anime4up.com/episode/* // @icon https://www.google.com/s2/favicons?domain=anime4up.com // @require http://code.jquery.com/jquery-3.4.1.min.js // @require https://rawcdn.githack.com/uzairfarooq/arrive/16c5691062e6a081c07882ec4d5fa08f0cdd569f/minified/arrive.min.js // @grant GM.getValue // @grant GM.setValue // ==/UserScript== (function() { 'use strict'; $(document).ready(async function(){ try { const storageKey = 'anime4upAnimesList' const top = $('.episode-active').position().top - 40 const episodeNumber = $('.episode-active').text().replace( /[^\d\.]*/g, '') const animeName = $('.anime-info-container .anime-details-title').text() var animes = JSON.parse(await GM.getValue(storageKey) || '[]') const currentAnimeIndex = animes.findIndex(a => a.name.toLowerCase() == animeName.toLowerCase()) if (currentAnimeIndex > -1) { const savedEpisode = animes[currentAnimeIndex].episode if (savedEpisode != episodeNumber) { const goToSaved = confirm("Got to episode " + savedEpisode) if (goToSaved) { var url = $(`#ULEpisodesList li:first-child a`).attr('href') url = url.substr(0, url.lastIndexOf('-')+1) + savedEpisode window.location.replace(url) } } animes[currentAnimeIndex].episode = episodeNumber }else { animes.push({name: animeName, episode: episodeNumber}) } GM.setValue(storageKey, JSON.stringify(animes)) $(document).arrive('#mCSB_1_container', function() { $(this).css({'top': -top + 'px'}) setTimeout(function() {$(document).unbindArrive()}, 10) }); }catch(e) { console.error('Custom Script error', e) } }) })();