// ==UserScript== // @name 動畫瘋·Plus // @namespace https://home.gamer.com.tw/homeindex.php?owner=xu3u04u48 // @version 1.16.9 // @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'; //檢查Beta播放器是否開啟 if(Cookies.get('playerBeta_8') == 'new') { return //不執行以下程式碼 } var ncc_warning_save = (GM_getValue("ncc_warning") != null )?GM_getValue("ncc_warning"): GM_setValue('ncc_warning','false'); var grading_save = (GM_getValue('grading_save') != null )?GM_getValue('grading_save'):GM_setValue('grading_save','none'); var video_next_skip = (GM_getValue('video_next') != null )?GM_getValue('video_next'):GM_setValue('video_next','false'); var password_save = GM_getValue('password_save'); var grading_bool = false,video_next_bool = false; var deviceid = animefun.getdeviceid(); var sn = animefun.videoSn; //使用者介面 var aniplusui_html = '
'; aniplusui_html+='
'; $('.sub_top').append(aniplusui_html); $('.ani-tab-content').append(''); $.fn.plus_ui = function(){ $(".ani-tab-content__item").css("display","none"); $("#ani-tab-content").css("display","block"); $('.ani-tabs-link').removeClass('is-active'); $(this).addClass("is-active"); }; //使用者介面CSS $('head').append(` `); //使用者介面HTML var ui_html = '
'; ui_html += ''; ui_html += '

動畫瘋·Plus
此插件設計是為了給短時間大量補番的人使用的,並加入一些沒用的功能
如果您覺得此插件好用,請付費支持動畫瘋讓此插件能持續為本平台服務

'; ui_html += '

在Chrome線上應用店中已發布相同的插件

'; ui_html += '
'; ui_html += '
'; ui_html += '自動同意分級標識警告'; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += ''; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += '自動切換至下一集'; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += ''; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += '影片速度'; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += ''; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += '空降座標'; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += ':'; ui_html += ''; ui_html += ''; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += '空降足跡(點擊降落)'; ui_html += '說明:
運作原理是取所有彈幕文字並利用關鍵字篩選
如果有在自訂過濾關鍵字新增"空降"or"座標"和開啟自動過濾
結果會不同
'; ui_html += '
'; ui_html += '確認座標說明:已回報的座標'; ui_html += '其它座標說明:
其它座標又稱未確定座標,有可能的原因是紀念觀賞時間
或未放入"空降"or"座標"關鍵字
'; ui_html += ''; ui_html += '
'; ui_html += '
'; ui_html += '
'; ui_html += '

    正在努力尋找中···
'; ui_html += '
'; ui_html += '
'; ui_html += '
'; $("#ani-tab-content").append(ui_html); var Firefox_w = '因Firefox瀏覽器的政策【禁止自動播放聲音】,如果啟動此選項後無法正常播放影片
'; Firefox_w +='請在瀏覽器權限【防止網站自動播放聲音】將【ani.gamer.com.tw】加入例外網站
'; if(BrowserCheck("Firefox")[0] != null )$("#firefox_w").after(Firefox_w); //網頁全螢幕 window.Webfullscreen = setInterval(function(){ let webfullscreen_h = ''; if($(".plus_Web_fullscreen_icon").length == 0){ $(".vjs-fullscreen-control").after(webfullscreen_h); }else{ clearInterval(window.web_fullscreen); } },500); var webfullscreen_s = true; $.fn.web_fullscreen = function(){ let win_height = $(window).height(); let win_width = $(window).width(); if(webfullscreen_s){ webfullscreen_s = false; $("body").after('
'); $("#animeTip").css("bottom","-40px"); $("html").css({"overflow-y":"hidden","overflow-x":"hidden"}); $(".vjs-indent-button").css("display","none"); $(".plus_Web_fullscreen_icon").css({"color":"#fff","background":"#333"}); $(".vjs-danmu").css("perspective","805.536px"); }else{ webfullscreen_s = true; $("#Web_fullscreen_style").remove(); $("#animeTip").css("bottom","0px"); $("html").css({"overflow-y":"unset","overflow-x":"unset"}); $(".videoframe").css({"height":"","width":"","margin":""}); $(".vjs-indent-button").css("display","unset"); $(".plus_Web_fullscreen_icon").css({"color":"","background":""}); $(".vjs-danmu").css("perspective","401.09px"); } $(document).keydown(function(e) { if(e.keyCode == 27 && !webfullscreen_s){ webfullscreen_s = true; $("#Web_fullscreen_style").remove(); $("#animeTip").css("bottom","0px"); $("html").css({"overflow-y":"unset","overflow-x":"unset"}); $(".videoframe").css({"height":"","width":"","margin":""}); $(".vjs-indent-button").css("display","unset"); $(".plus_Web_fullscreen_icon").css({"color":"","background":""}); $(".vjs-danmu").css("perspective",""); } }); $(window).resize(function() { if(!webfullscreen_s){ let win_height = $(window).height(); $(".videoframe").css("height",(win_height-40)+"px"); } }); //網頁全螢幕CSS $('#Web_fullscreen_style').append(` `); }; //在全螢幕環境下發送彈幕 $(document).on("mozfullscreenchange webkitfullscreenchange fullscreenchange", fullscreenChange); function fullscreenChange(){ let isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen; let fullScreen_bullet_send = ''; if(isFullScreen){ plus_bullet_control(); plus_bullet_save(); $('#danmutxt').keydown(function(event){ event.stopPropagation(); }); $(".vjs-danmu-button").after(fullScreen_bullet_send); $(".plus_Web_fullscreen_icon").css("display","none"); $(".plus_picture_in_picture_icon").css("display","none"); $(".bullet-send").draggable({ containment: "html", stop: function () { let top = $("#plus_bullet-send").css("top"); let win_height = $(window).height(); if(parseInt(top) > (win_height - 100)){ $("#plus_bullet-send").css("top",(win_height - 100)); } let top_save = $("#plus_bullet-send").css("top"); let left_save = $("#plus_bullet-send").css("left"); GM_setValue('top_save',top_save); GM_setValue('left_save',left_save); } }); $("input[type='button']").click(function(){ $("#plus_bullet-control").css("display","none"); $("#danmutxt").focus(); }); }else{ $("#plus_bullet-send").remove(); $("#plus_bullet-control").remove(); $(".bullet-control").css("display","none"); $(".plus_Web_fullscreen_icon").css("display",""); $(".plus_picture_in_picture_icon").css("display",""); $("#plus_fullScreen-bullet-send").remove(); } } function plus_bullet_control(){ let bullet_send = ''; let bullet_control = ''; $("video").after(bullet_send); $("video").after(bullet_control); $("#plus_bullet-send").addClass("plus_bullet-send"); $("#plus_bullet-control").addClass("plus_bullet-control"); } function plus_bullet_save(){ let top_save = GM_getValue("top_save") let left_save = GM_getValue("left_save") if(top_save == null || left_save == null ){ $("#plus_bullet-send").css("top","0px"); $("#plus_bullet-send").css("left","0px"); GM_setValue('top_save',"0px"); GM_setValue('left_save',"0px"); }else{ $("#plus_bullet-send").css("top",top_save); $("#plus_bullet-send").css("left",left_save); } } //偵測分級標識警告&廣告狀態 setTimeout(function(){ window.initial = setInterval(function(){ let src = $("#ani_video_html5_api").attr("src"); let readyState = $("#ani_video_html5_api")[0].readyState; if($(".R18").length == 0 && $(".vast-skip-button").length == 0 && src.indexOf("fbcdn.net") == -1 && readyState != 0){ if(video_next_skip){ window.videoend = setInterval(function(){ let ended = $("#ani_video_html5_api")[0].ended; let nextplayer = $('.playing').next().html(); let match = (nextplayer!=null)?nextplayer.match('')[1]:null; if(match != null){video_next();}else{clearInterval(window.videoend);} },1000) } $("#plus-video-fastforward-minute").attr("disabled",false); $("#plus-video-fastforward-second").attr("disabled",false); $("#plus-video-fastforward-sendout").attr("disabled",false); $("#void_speed").attr("disabled",false); $(".plus_keyword-label").css("cursor","pointer"); danmuGetload(); clearInterval(window.initial); }else{ $(".plus_keyword-label").css("cursor","no-drop"); } },1000); },1000); //影片速度 $("#void_speed").change(function () { var void_speed = $("#void_speed").find(":selected").val(); $("#ani_video_html5_api").get(0).playbackRate = void_speed; }); //自動切換至下一集 $("#video_next_skip").change(function() { video_next_bool = !video_next_bool; GM_setValue('video_next',video_next_bool); $("#plussetup").css("display","block"); setTimeout(function(){$("#plussetup").css("display","none")},3000); }); if(video_next_skip){ video_next_bool = true; $("#video_next_skip").prop("checked",true); setTimeout(function(){$("#ani_video").append('')},1000); } var countdown = 5; function video_next(){ 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){ if(countdown == 1)document.location.href="https://ani.gamer.com.tw/animeVideo.php"+match $("#ani_video-next").css("display",""); $("#ani_video-next").html('0'+countdown+' 秒後切換至下一集 X'); countdown -= 1; }else{ $("#ani_video-next").css("display","none"); countdown = 5; } $("#stop_video-next").click(function(){$("#ani_video-next").remove();clearInterval(window.videoend);}); } //自動同意分級標識警告 $("#grading").change(function() { grading_bool = !grading_bool; GM_setValue('ncc_warning',grading_bool); $("#plussetup").css("display","block"); setTimeout(function(){$("#plussetup").css("display","none")},3000); }); if(ncc_warning_save){ grading_bool = true; let rating_img = $(".rating > img").attr("src"); let img_cut = rating_img.substr(30); $("#grading").prop("checked",true); window.ncc = setInterval(function(){ if($(".R18").length > 0 && $(".plus-frame").length == 0){ if(img_cut != 'TW-18UP.gif'|| token()[1] == 1){ setTimeout(function () {$("#adult").click();},500); } clearInterval(window.ncc); } },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('') } }); } //空降足跡-改變影片時間 $.fn.fastforward_skip = function (match){ let src = $("#ani_video_html5_api").attr("src"); let readyState = $("#ani_video_html5_api")[0].readyState; if($(".R18").length == 0 && $(".vast-skip-button").length == 0 && src.indexOf("fbcdn.net") == -1 && readyState != 0){ if($("#ani_video_html5_api")[0].paused != true){$(".vjs-play-control").click();} let split = match.split(":"); fastforward(split[0],split[1]); } } function danmuGetload() { setTimeout(function () { danmuGet();//載入空降足跡 //空降足跡重整 $(".plus_refresh,#bahablack,.bluebtn").click(function () { setTimeout(function () { danmuGet() }, 1000) }); }, 1000) } //子母畫面 window.picture = setInterval(function () { let picture = '