// ==UserScript== // @name 動畫瘋·Plus // @namespace https://home.gamer.com.tw/homeindex.php?owner=xu3u04u48 // @version 1.21.0 // @description 分級標識自動同意、自動切換至下一集、自動點此跳過廣告、影片空降座標、網頁全螢幕、子母畫面 // @author xu3u04u48 // @match *://ani.gamer.com.tw/animeVideo.php?sn=* // @icon https://i2.bahamut.com.tw/anime/baha_s.png // @require https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js // @grant GM_setValue // @grant GM_getValue // @run-at document-end // @downloadURL none // ==/UserScript== (function() { 'use strict'; blockalert("廣告"); var fun ={'ncc_warning':false,'video_next':true,'ad_skip':true}; var ncc_warning_save = GM_getValue('ncc_warning') == undefined ? fun.ncc_warning : GM_getValue('ncc_warning'); var video_next_skip = GM_getValue('video_next') == undefined ? fun.video_next : GM_getValue('video_next'); var ad_skip_save = GM_getValue('ad_skip') == undefined ? fun.ad_skip : GM_getValue('ad_skip'); var deviceid = animefun.getdeviceid(); var sn = animefun.videoSn; var token = Token(); //使用者介面 var version = GM_info.script.version; var aniplusui_html = '
X
'); $("#ani_video_html5_api").on( 'ended', function() { countdown = 5; let nextplayer = $('.playing').next().html(); let match = (nextplayer != null) ? nextplayer.match('')[1] : null; if(match != null && repeate){ video_next(); repeate = false; } }); $("#stop_video-next").click(function () { repeate = true; $("#ani_video-next").css("display", 'none'); clearInterval(window.videoend); }); } function video_next(){ window.videoend = window.setInterval(function () { let ended = $("#ani_video_html5_api")[0].ended; let nextplayer = $('.playing').next().html(); let match = (nextplayer!=null)?nextplayer.match('')[1]:null; if (ended && match != null) { $("#ani_video-next").css("display", ''); $("#video_next_countdown").text(countdown.toString().padStart(2, "0") + " 秒後切換至下一集"); if (countdown == 1){ document.location.href = "https://ani.gamer.com.tw/animeVideo.php" + match }else if (countdown < 1){ countdown = 1; $("#ani_video-next").css("display", 'none'); } countdown -= 1; } else { repeate = true; $("#ani_video-next").css("display", 'none'); clearInterval(window.videoend); } }, 1000) } //自動同意分級標識警告 $("#grading").change(function() { GM_setValue('ncc_warning',$(this).prop("checked")); $("#plussetup").css("display","block"); setTimeout(function(){$("#plussetup").css("display","none")},3000); }); if(ncc_warning_save){ let rating_img = $(".rating > img").attr("src"); let img_cut = rating_img.substr(30); $("#grading").prop("checked",true); window.ncc = setInterval(function(){ if($("#adult").length > 0){ if(img_cut != 'TW-18UP.gif'|| token[1] == 1){ setTimeout(function () {$("#adult").click();},500); } clearInterval(window.ncc); } },1000); } //自動點此跳過廣告 $("#ad_skip").change(function() { GM_setValue('ad_skip',$(this).prop("checked")); $("#plussetup").css("display","block"); setTimeout(function(){$("#plussetup").css("display","none")},3000); }); if(ad_skip_save){ $("#ad_skip").prop("checked",true); window.ad_skip_checker = setInterval(function(){ var aniad = ($(".nativeAD-skip-button,.vast-skip-button").length == 1)?$(".nativeAD-skip-button,.vast-skip-button")[0].innerText:null if($("video").length && $(".R18").length == 0 && $(".nativeAD-skip-button,.vast-skip-button,#an_skip_button").length == 0) { clearInterval(window.ad_skip_checker); }else if($("video").length && aniad == "點此跳過廣告"){ $("#adSkipButton , .nativeAD-skip-button").click(); clearInterval(window.ad_skip_checker); } },1000); } /* //倒數5秒可點此跳過廣告 var ad_skip_countdown = 5; if(ad_skip_save){ $("#ad_skip").prop("checked",true); window.ad_skip_checker = setInterval(function(){ if((ad_skip_countdown > 0 && $("#adSkipButton").length == 1 && $("#adSkipButton").hasClass("enabled") == false) || (ad_skip_countdown > 0 && $(".nativeAD-skip-button").length == 1 && $(".nativeAD-skip-button").hasClass("enable") == false)){ ad_skip_countdown -= 1; }else if(ad_skip_countdown <= 0){ if($("#adSkipButton").length == 1){ $("#adSkipButton").addClass("enabled"); $(".vast-skip-button-text").text('點此跳過廣告'); }else if($(".nativeAD-skip-button").length == 1){ $(".nativeAD-skip-button").addClass("enable"); $(".nativeAD-skip-button p:first").text('點此跳過廣告'); } }else if($(".R18").length == 0){ clearInterval(window.ad_skip_checker); } console.log(ad_skip_countdown); },1000); } */ //空降座標 $('#plus-video-fastforward-sendout').on('click', function() { var minute = $("#plus-video-fastforward-minute").val(); var second = $("#plus-video-fastforward-second").val(); $("#plus-video-fastforward-minute").val(""); $("#plus-video-fastforward-second").val(""); if($("#ani_video_html5_api")[0].paused != true){$(".vjs-play-control").click();} fastforward(minute,second); }); //改變影片時間 function fastforward(minute,second){ let video_minute = parseInt(minute) || 0; let video_second = parseInt(second) || 0; if((video_minute*60) + video_second < $("#ani_video_html5_api")[0].duration){ $("#ani_video_html5_api")[0].currentTime = (video_minute*60) + video_second; if($("#ani_video_html5_api")[0].paused == true){$(".vjs-play-control").click();} }else{ if($("#ani_video_html5_api")[0].paused == true){$(".vjs-play-control").click();} alert("未知的座標,空降失敗"); } } //空降足跡-解析影片時間 function time_parse(stringasc,array,bool){ var match = stringasc.match(/[0-9]+:[0-9]+/g); for(var id in match){ var split = match[id].split(":"); var match1 = split[0].match(/[0-9]{2,3}/g),match2 = split[1].match(/[0-9]{2,3}/g); var minute = (!match1)? "0"+split[0]:split[0], second = (!match2)? "0"+split[1]:split[1]; var addjson = {"airborne":bool,"time":minute+":"+second}; array.push(addjson); } } //空降足跡 function danmuGet(){ var array= []; var settings = { "async": true, "crossDomain": true, "url": "ajax/danmuGet.php", "method": "POST", "data": { "sn": animefun.videoSn } } $.ajax(settings).done(function (response) { $(".plus_time_body").children().remove(); for(var key in response){ let stringasc = tobig5(response[key].text); let match = stringasc.match(/[0-9]{1,3}:[0-9]{1,3}/g); if( stringasc.indexOf("空降") != "-1" || stringasc.indexOf("座標") != "-1"){ time_parse(stringasc,array,true); }else if(match){ time_parse(stringasc,array,false); } } var deduped = filter_r(array,'time'); //清除重複 var json = jsonsort(deduped,'time'); //排序 if(json.length){ for(var arrayid in json){ let airborne = (json[arrayid].airborne)?"":"background:#bbbbbb;" $(".plus_time_body").append(''+json[arrayid].time+''); } }else{ $(".plus_time_body").html('