// ==UserScript==
// @name 動畫瘋·Plus
// @namespace none
// @version 1.7.1
// @description 修改彈幕字型、分級標識自動同意、自動點擊按此跳過廣告、分級鎖定、可在全螢幕環境下發送彈幕
// @author xu3u04u48
// @match *://ani.gamer.com.tw/animeVideo.php?sn=*
// @grant none
// @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
// @downloadURL none
// ==/UserScript==
$('head').append(`
`);
//實體化使用者介面
$("#ani-tab-content-2").prepend(`
動畫瘋·Plus設定(外掛插件)
彈幕字型
分級鎖定
`);
$('.video').append(`
`);
$('head').append(`
`);
$('head').append(`
`);
$(".cmt").addClass("cmt");
$(document).on("mozfullscreenchange webkitfullscreenchange fullscreenchange", fullscreenChange);
function fullscreenChange(){
var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
var fullScreen_bullet_send = '
';
if(isFullScreen){
plus_bullet_control();
plus_bullet_save();
$(".vjs-res-button").after(fullScreen_bullet_send);
$(".bullet-send").draggable({
containment: "html",
stop: function () {
var top = $("#plus_bullet-send").css("top");
var win_height = $(window).height();
if(parseInt(top) > (win_height - 100)){
$("#plus_bullet-send").css("top",(win_height - 100));
}
var top_save = $("#plus_bullet-send").css("top");
var left_save = $("#plus_bullet-send").css("left");
localStorage.setItem('top_save',top_save);
localStorage.setItem('left_save',left_save);
}
});
$("input[type='button']").click(function(){
$("#plus_bullet-control").css("display","none");
});
}else{
$("#plus_bullet-send").remove();
$("#plus_bullet-control").remove();
$(".bullet-control").css("display","none");
$("#plus_fullScreen-bullet-send").remove();
}
}
function plus_bullet_control(){
var bullet_send = '
'+$(".bullet-send").html()+'
';
var bullet_control = '
'+$(".bullet-control").html()+'
';
$("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(){
var top_save = localStorage.getItem('top_save');
var left_save = localStorage.getItem('left_save');
if(top_save == null || left_save == null ){
$("#plus_bullet-send").css("top","538px");
$("#plus_bullet-send").css("left","805px");
var top_setup = "538px";
var left_setup = "805px";
localStorage.setItem('top_save',top_setup);
localStorage.setItem('left_save',left_setup);
}else{
$("#plus_bullet-send").css("top",top_save);
$("#plus_bullet-send").css("left",left_save);
}
}
var ncc_warning_save = localStorage.getItem("ncc_warning");
var ad_skip_save = localStorage.getItem('ad_skip');
var acceleration_save = localStorage.getItem('acceleration');
var font_save = localStorage.getItem('font');
var password_save = localStorage.getItem('password_save');//密碼
var grading_save = localStorage.getItem('grading_save');//分級
//如果沒有先前的儲存值,設定預設值
if(ncc_warning_save == null){ncc_warning_save = localStorage.setItem('ncc_warning','false');}
if(ad_skip_save == null){ad_skip_save = localStorage.setItem('ad_skip','false');}
if(font_save == null){font_save = localStorage.setItem('font','none');}
if(grading_save == null){grading_save = localStorage.setItem('grading_save','none');}
if(acceleration_save == null){acceleration_save = localStorage.setItem('acceleration','false');}
//載入偵測是否有password_save
if(password_save != null ){
$("#plus-value").remove();
$("#plus-value2").css("display",'');
}
if(grading_save == null){
$(".plus-frame").remove();
}
var grading_selected = $('#grading-password').val(grading_save);//載入時預設分級選單的值
var grading = $("#grading-password").find(":selected").val();//載入時取分級選單的值
if($('#grading-password').val() != "none"){ //分級選單
var rating_img = $(".rating > img").attr("src");//取動畫標題旁邊的圖片連結
var rating_img_cut = rating_img.substr(30);//切割圖片連結字串
switch (grading_save) {
case '6':
if(rating_img_cut == "TW-ALL.gif"){
$(".plus-frame").remove();
}
break;
case '12':
if(rating_img_cut == "TW-ALL.gif" || rating_img_cut == "TW-6TO12.gif"){
$(".plus-frame").remove();
}
break;
case '15':
if(rating_img_cut == "TW-ALL.gif" || rating_img_cut == "TW-6TO12.gif" || rating_img_cut == "TW-12TO18.gif"){
$(".plus-frame").remove();
}
break;
case '18':
if(rating_img_cut != "TW-18UP.gif"){
$(".plus-frame").remove();
}
break;
}
}else{
$(".plus-frame").remove();
}
$("#grading-password").change(function(){
grading = $("#grading-password").find(":selected").val();//取