// ==UserScript== // @name anime1.me收藏番剧(交互优化+去广告版) // @namespace http://tampermonkey.net/ // @version 0.3.1 // @license MPL-2.0 // @description 添加了收藏番剧功能(来自@c4r的脚本)优化了UI和交互 // @author c4r feat.皮蛋萌 // @match *://anime1.me/* // @grant none // @require https://code.jquery.com/jquery-latest.js // @downloadURL none // ==/UserScript== (function () { 'use strict'; function getPlaylist() { let strPlaylist = localStorage.getItem('anime1Playlist') if (strPlaylist === undefined || strPlaylist === null) { strPlaylist = '' } else {} let arryPlaylist = new Array() let slotList = strPlaylist.split('\r\n').slice(0, -1) slotList.forEach(item => { let titlePos = item.indexOf("title :") let urlPos = item.indexOf('url :') if (titlePos < 0 || urlPos < 0) {} else { let title = item.slice(7, urlPos - 1) let url = item.slice(urlPos + 5) arryPlaylist.push({ 'title': title, 'url': url }) } }) return arryPlaylist } function delSub(title, url) { let strPlaylist = localStorage.getItem('anime1Playlist') let str = 'title :' + title + ' url :' + url + '\r\n' // console.log(strPlaylist) // console.log('---') // console.log(str) // console.log('include : ', strPlaylist.includes(str)) if (strPlaylist.includes(str)) { strPlaylist = strPlaylist.replace(str, '') console.log(strPlaylist) localStorage.setItem('anime1Playlist', strPlaylist) } } function addPlaylist(title, url) { let strPlaylist = localStorage.getItem('anime1Playlist') if (strPlaylist === undefined || strPlaylist === null) { strPlaylist = '' } else { } if (strPlaylist.includes('title :' + title + ' url :' + url)) { delSub(title, url) $('li[title="'+title+'"]').remove() $("#menu-subscribe").attr('value',"订阅"); } else { strPlaylist = strPlaylist + 'title :' + title + ' url :' + url + '\r\n' localStorage.setItem('anime1Playlist', strPlaylist) // location.reload() $('#subscribe > ul').append('