您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Migliora AnimeWorld
当前为
// ==UserScript== // @name BetterAnimeWorld // @namespace https://pizidavi.altervista.org/ // @icon https://static.animeworld.tv/assets/images/favicon/android-icon-192x192.png // @description Migliora AnimeWorld // @author pizidavi // @version 1.7.7 // @copyright 2021, PIZIDAVI // @license MIT // @require https://cdn.jsdelivr.net/gh/soufianesakhi/node-creation-observer-js@edabdee1caaee6af701333a527a0afd95240aa3b/release/node-creation-observer-latest.min.js // @match https://www.animeworld.tv/* // @run-at document-body // @grant GM_addStyle // @grant GM_xmlhttpRequest // @grant window.onurlchange // ==/UserScript== (function() { 'use strict'; const PAGE_TITLE = document.title; const PAGE_ANIME_TITLE = '{{title}} Ep. {{episode}} - AnimeWorld' const PAGE_ANIME_TITLE_NO_EP = '{{title}} - AnimeWorld' NodeCreationObserver.onCreation('#sign > div.signed ul', function (element) { addStyle('#header .head #sign .signed, #header .head #sign .signin { width: unset !important; }'); element.querySelector('li:nth-child(3) > a').href += '?folder=1&sort=2'; element.querySelector('li:nth-child(4) > a').textContent = 'Notifiche'; element.querySelector('li:nth-child(4) > a').href = '/notifications'; }); NodeCreationObserver.onCreation('#notification', function (element) { setNotify(); setInterval(function() { getNotify(); }, 2*60*1000); // 2 minuti if (location.pathname.includes('/play/')) window.addEventListener('urlchange', (info) => { setNotify(); }); }); NodeCreationObserver.onCreation('div.menu-profile', function (element) { element.querySelector('a.pulsante-profilo-tabs:nth-child(2)').href += '?folder=1&sort=2'; if(location.pathname.includes('/watchlist')) document.querySelector('.cover-profilo-aw').style.display = 'none'; }); if(location.pathname.includes('/play/')) { NodeCreationObserver.onCreation('#player .cover, div.server ul a, #controls > div.prevnext', function (element) { element.addEventListener('click', function() { window.scrollTo(0, 133); const r = document.querySelector('#controls .resize'); if(r.textContent.includes('Espandi')) r.click(); setTimeout(function() { document.querySelector('#controls .light').click(); document.cookie = 'expandedPlayer=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; }, 700); }); }); NodeCreationObserver.onCreation('#player iframe', function (element) { const button = document.createElement('button'); button.id = 'skip-intro'; button.textContent = 'Salta Intro'; button.title = 'Click destro per nascondere'; button.style = 'position: absolute; bottom: 6em; right: 2em; padding: 0.5em 1em 0.4em; font-size: 14px; border: 1px solid #bdc3c7; border-radius: 2px; color: #bdc3c7; background-color: rgba(0,0,0,0.7); opacity: 0.25; z-index:2147483648;'; element.addEventListener('load', function(e) { if (!this.contentDocument) return; const video = this.contentDocument?.querySelector('video'); if (!video) return; video.oncanplay = function(e) { this.play(); this.focus(); }; video.ontimeupdate = function(e) { if (this.currentTime > this.duration / 3) button.remove(); }; button.onclick = function(e) { e.preventDefault(); e.stopPropagation(); video.currentTime += 87; video.focus(); this.remove(); }; button.oncontextmenu = function(e) { e.preventDefault(); e.stopPropagation(); video.focus(); this.remove(); }; video.parentNode.append(button); }); }); } else if(location.pathname.includes('/notifications')) { NodeCreationObserver.onCreation('#delete-all', function (element) { const parentDiv = element.parentElement; const button = element.cloneNode(); button.id = 'delete-read-all'; button.innerHTML = '<i class="fas fa-trash"></i> Cancella tutte le notifiche "lette"'; button.onclick = function() { Swal.fire({ title: 'Vuoi davvero cancellare tutte le notifiche lette?', icon: 'question', showCancelButton: true, confirmButtonColor: 'rgb(165, 220, 134)', cancelButtonColor: 'rgb(221, 51, 51)', confirmButtonText: 'Si', cancelButtonText: 'No', }).then((result) => { if (result.value) { document.querySelectorAll('.profile-page .row .widget:nth-child(2) li.is-notification-read').forEach(function(e, i) { e.querySelector('.actions i.delete-clickable-icon').click(); }); } }); }; parentDiv.appendChild(button); element.remove(); }); } // ------- Function ------- function getNotify() { request({ url: '/request-serie', success: function(data) { const html = document.createElement('html'); html.innerHTML = data; document.querySelector('#notification > ul').innerHTML = html.querySelector('#notification > ul').innerHTML; setNotify(); document.querySelectorAll('#notification > ul > li[data-id]').forEach(function(li, index) { const span = li.querySelector('.header-notification-read'); span.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); request({ url: '/api/notifications/open/'+li.getAttribute('data-id'), success: function(data) { li.remove(); setNotify(); } }); }); }); } }); } function setNotify() { const number = document.querySelectorAll('ul.notification > li[data-id]').length || '0'; document.querySelectorAll('.notifications-number').forEach((value, index) => { value.textContent = number; }); if(location.pathname.includes('/play/')) { const title = document.querySelector('#anime-title').textContent; const episode = document.querySelector('div.server ul a.active')?.getAttribute('data-base'); if (episode) document.title = (parseInt(number) ? number + ' - ' : '') + PAGE_ANIME_TITLE.replace('{{title}}', title).replace('{{episode}}', episode); else document.title = (parseInt(number) ? number + ' - ' : '') + PAGE_ANIME_TITLE_NO_EP.replace('{{title}}', title); } else document.title = (parseInt(number) ? number + ' - ' : '') + PAGE_TITLE; } function request(options) { const onreadystatechange = function() { if (this.readyState === 4 && (this.status == 200 || this.status == 201)) { options.success(this.responseText); } else if (this.readyState === 4) { console.warn('%cBetterAnimeWorld%c - Errore nella richiesta', 'color:red;font-size:14px;', ''); } }; if (typeof GM_xmlhttpRequest != 'undefined') { options.onload = onreadystatechange; GM_xmlhttpRequest(options); } else { const xhttp = new XMLHttpRequest(); xhttp.open(options.method || 'GET', options.url); xhttp.onreadystatechange = onreadystatechange; xhttp.send(); } } function addStyle(CSS) { if (typeof GM_addStyle != 'undefined') { GM_addStyle(CSS); } else { const style = document.createElement('style'); style.innerText = CSS; document.head.appendChild(style); } } })();