// ==UserScript== // @name 動畫瘋·Plus // @namespace https://home.gamer.com.tw/homeindex.php?owner=xu3u04u48 // @version 2.2.4 // @description 分級標識自動同意、自動切換至下一集、自動點此跳過廣告、影片空降座標、網頁全螢幕、子母畫面 // @author xu3u04u48 // @match *://ani.gamer.com.tw/animeVideo.php?sn=* // @icon https://i2.bahamut.com.tw/anime/baha_s.png // @grant GM_setValue // @grant GM_getValue // @run-at document-end // @downloadURL https://update.greasyfork.icu/scripts/369990/%E5%8B%95%E7%95%AB%E7%98%8B%C2%B7Plus.user.js // @updateURL https://update.greasyfork.icu/scripts/369990/%E5%8B%95%E7%95%AB%E7%98%8B%C2%B7Plus.meta.js // ==/UserScript== var update_info = { version : GM_info.script.version, content(){ return ` ${this.version} 更新
  1. 其它小修改。
`} }, funvalue = { ncc_warning : false, video_next : true, ad_skip : true, }, Anivalue = { pass: false, regex: /sn=(\d*)/m, str:location.search, videoSn(){ return this.regex.exec(this.str)[1]; } }, Aniplus = { ui(){ var aniplusui_html = '
'; aniplusui_html += ''; aniplusui_html += '
'; $('.sub_top').append(aniplusui_html); $('.ani-tab-content').append(''); $("#setting-aniplus").click(function(e){ $(".ani-tab-content__item").css("display","none"); $("#ani-tab-content").css("display","block"); $('.ani-tabs-link').removeClass('is-active'); $(this).addClass("is-active"); }) $(".ani-tabs-link").click(function(e){ $("#ani-tab-content").css("display","none"); $('#setting-aniplus').removeClass('is-active'); }) aniplus_ui_css(); $("#ani-tab-content").append(aniplus_ui_html()); load.set(); this.ncc_warning() var Firefox = '因Firefox瀏覽器的政策【禁止自動播放聲音】,如果啟動此選項後無法正常播放影片
'; Firefox +='請在瀏覽器權限【防止網站自動播放聲音】將【ani.gamer.com.tw】加入例外網站
'; if(Tool.browser.BrowserCheck("Firefox")[0] != null )$("#firefox_w").after(Firefox); }, initial(){ let self = this; Tool.globalHotkeys(); setTimeout(function () { self.ad_skip(); window.initial = window.setInterval(function () { if (Player.video_html()[0] == null) return; if ($(".R18").length == 0 && $(".vast-skip-button").length == 0 && Player.src().indexOf("fbcdn.net") == -1 && Player.readyState() != 0) { Anivalue.pass = true; self.danmuGet.load(); self.video_next.videoisended(); $("#plus-video-skip-minute").attr("disabled",false); $("#plus-video-skip-second").attr("disabled",false); $("#plus-video-skip-sendout").attr("disabled",false); clearInterval(window.initial); } }, 1e3); }, 1e3); }, ncc_warning(){ clearInterval(window.ncc); if(load.storage.ncc_warning && $(".R18").length >= 0 && $(".agree").length == 0){ window.ncc = setInterval(function () { if ($("#adult").length > 0){ setTimeout(function () {$("#adult").click();},5e2); clearInterval(window.ncc); } }, 1e3); } }, ad_skip(){ clearInterval(window.ad_skip_checker); if(load.storage.ad_skip){ window.ad_skip_checker = setInterval(function(){ var aniad = ($(".vast-skip-button").length == 1)?$(".vast-skip-button-text")[0].innerText:null if($("video").length && $(".R18").length == 0 && aniad == null) { clearInterval(window.ad_skip_checker); }else if($("video").length && aniad == "點此跳過廣告"){ $("#adSkipButton , .vast-skip-button").click(); clearInterval(window.ad_skip_checker); } },1000); } }, video_next:{ repeate:true, countdown:5, main(){ let self = this; window.videoend = window.setInterval(function () { var nextplayer = $('.playing').next().html(); var match = (nextplayer != null) ? nextplayer.match('')[1] : null; if (Player.ended() && match != null) { $("#ani_video-next").css("display", ''); $("#video_next_countdown").text(self.countdown.toString().padStart(2, "0") + " 秒後切換至下一集"); if (self.countdown == 1){ document.location.href = "https://ani.gamer.com.tw/animeVideo.php" + match }else if (self.countdown < 1){ self.countdown = 1; $("#ani_video-next").css("display", 'none'); } self.countdown -= 1; } else { self.repeate = true; $("#ani_video-next").css("display", 'none'); clearInterval(window.videoend); } }, 1e3) }, videoisended(){ let self = this; $("#ani_video-next").html('

X

'); clearInterval(window.videoend); if(load.storage.video_next){ Player.video_html().on( 'ended', function() { self.countdown = 5; let nextplayer = $('.playing').next().html(); let match = (nextplayer != null) ? nextplayer.match('
')[1] : null; if(match != null && self.repeate){ self.main(); self.repeate = false; } }); }else{ $("#ani_video-next").css("display", 'none'); } $("#stop_video-next").click(function () { self.repeate = true; $("#ani_video-next").css("display", 'none'); clearInterval(window.videoend); }); } }, danmuGet:{ danmudata:null, main(){ let self = this; var ngkeyword = Object.values($(".ani-keyword-body").children(".ani-keyword-label").children("span")).map(item => item.innerText) if($.inArray(":",ngkeyword) != -1 || $.inArray(":",ngkeyword) != -1){ $(".plus_time_body").html(''); return; } self.datalink().then(function(response) { self.danmudata = response; self.dataload(response,function(e){ $(".plus_time_body").html(''); if (e.length) { for (var arrayid in e) { let airborne = (e[arrayid].airborne) ? "" : "background:#bbbbbb;" $(".plus_no_sub").append('
  • ' + e[arrayid].time + '
  • '); VideoTime.skip(arrayid, e[arrayid]); } } else { $(".plus_time_body").html('') } }) }) }, datalink(){ return new Promise((resolve, reject) => { var settings = { "async": true, "crossDomain": true, "url": "ajax/danmuGet.php", "method": "POST", "data": {"sn": Anivalue.videoSn()} } $.ajax(settings).done(function (response) { resolve(response); }) }); }, dataload(data,callback){ var array = []; for (var key in data) { let asc = Tool.tobig5(data[key].text); let match = asc.match(/[0-9]{1,3}:[0-9]{1,3}/g); if (asc.indexOf("空降") != "-1" || asc.indexOf("座標") != "-1") { VideoTime.parse(asc, array, true); } else if (match) { VideoTime.parse(asc, array, false); } } var json = Tool.jsonsort(Tool.filter_r(array, 'time'), 'time'); callback(json); }, load() { let self = this; setTimeout(function () { self.main(); $(".plus_refresh,#bahablack,.bluebtn,.ani-keyword-close").click(function () { setTimeout(function () { self.main() }, 1e3) }); }, 1e3) } }, fullscreen:{ click_check:false, check(){ let isFullScreen = document.fullscreenElement; Aniplus.fullscreen.hideshow(isFullScreen); }, hideshow(isFullScreen){ setTimeout(function () { if (isFullScreen) { $(".plus_Web_fullscreen_icon").css("display", "none"); $(".plus_picture_in_picture_icon").css("display", "none"); } else { $(".plus_Web_fullscreen_icon").css("display", ""); $(".plus_picture_in_picture_icon").css("display", ""); $(".vjs-fullscreen-control").css("display", ""); } },5e2); }, web:{ main(){ let self = this; var web_fullscreen = ''; window.web_fullscreen = setInterval(function () { if($(".control-bar-rightbtn").length == 1 && $("#web_fullscreen").length == 0){ $(".vjs-fullscreen-control").after(web_fullscreen); }else if($("#web_fullscreen").length == 1){ clearInterval(window.web_fullscreen); $("#web_fullscreen").click(function () { self.add(); }) } }, 5e2); }, add(){ if ($("#Web_fullscreen_style").length == 0) { $("#web_fullscreen").addClass("plus_Web_fullscreen_off"); $("#web_fullscreen").removeClass("plus_Web_fullscreen_on"); $("head").after(''); $('#Web_fullscreen_style').html(` #animeTip {bottom: -40px !important;} html {overflow-y:hidden !important; overflow-x:hidden !important;} .vjs-indent-button {display: none !important;} .container-player {max-width: unset !important;} .player {height: 100% !important;width: 100% !important;padding-top: 0 !important;margin-top: 0 !important;z-index: 999 !important;position: fixed !important;} .videoframe {height: 100% !important;width: 100% !important;margin: auto !important;max-height: unset !important;} .video {width: 100% !important;height: 100% !important;position: unset !important;padding-bottom: unset !important;} .BH_background {margin-top: unset !important;} @media (min-width: 1000px) .BH_background {margin-top: unset !important;} .top_sky{display: none !important;} .mainmenu {display: none !important;} .subtitle {display: none !important;} section:not(.player) {position: unset !important; display: none !important;} `); } else { $("#Web_fullscreen_style").remove(); $("#web_fullscreen").addClass("plus_Web_fullscreen_on"); $("#web_fullscreen").removeClass("plus_Web_fullscreen_off"); } }, hotkey(v){ let self = this; if(v == 87 || (v == 27 && $("#Web_fullscreen_style").length == 1)){ Aniplus.fullscreen.web.add(); } } } }, picture_in_picture:{ main(){ let self = this; let picture = '
    '; ui_html += ''; ui_html += ''; ui_html += '
    '; ui_html += ''; ui_html += '
    '; ui_html += ''; ui_html += ''; return ui_html; } //使用者介面CSS function aniplus_ui_css(){ $('head').append(` `); } (function() { "use strict"; Tool.blockalert("廣告"); $.each(funvalue, function (key, value) { if(GM_getValue(key) != undefined){ funvalue[key] = GM_getValue(key); }else{ GM_setValue(key,value) } }) Aniplus.ui(); Aniplus.initial(); Aniplus.fullscreen.web.main(); Aniplus.picture_in_picture.main(); Aniplus.video_danmu_copy.main(); $(document).on("mozfullscreenchange webkitfullscreenchange fullscreenchange",Aniplus.fullscreen.check); })();