設定パネルのデザイン更新

設定パネルのデザインを更新しました。 機能は ver.0.8 から変化はありません。 パネルのデザインは、「音声ミュート」が全てのミュート機能の「有効 / 無効」を決める仕様だと、なるべく自然に判る様にしました。

 

 

 

また操作マニュアルを纏めて、パネルタイトル部の「   」ボタンでアクセスできる様にしました。

 

 

 

「 AmbTV OnAir」の操作マニュアル

このツールは「 AmbTV Comfy」のサブツールで、両方を同時に併用できます。

「ミュート」機能の設定方法は、以下のページを参照ください。

 

 

 

 

「 AmbTV OnAir」を利用するには

このツールは Chrome / Edge / Firefox版の拡張機能「Tampermonkey」上で動作します。 以下に、このツールの導入手順を簡単に説明します。

 

❶「Tampermonkey」を導入します

◎ 使用しているブラウザに拡張機能「Tampermonkey」を導入する事が必要です。

既に「Tampermonkey」を導入している場合は、この手順 ❶ は不要です。 

拡張機能の導入については、以下のページに簡単な説明があるので参照ください。

 

 

❷「Tampermonkey」にスクリプトを登録します

◎「Tampermonkey」の「」マークの「新規スクリプト」タブを開きます。

 

 

 

◎「新規スクリプト」には、最初からテンプレートが記入されています。 これは全て削除して、完全に空白の編集枠に 下のコードをコピー&ペーストします。

 

〔コピー方法〕 軽量シンプルなツール「PreBox Button   」を使うと

  コード枠内を「Ctrl+左Click」➔「Copy code 」を「左Click」

  の操作で、掲載コードのコピーが可能になります。

 

◎ 最後に「ファイル」メニューの「保存」を押すと、ツールが使用可能になります。

 

 

〔  AmbTV OnAir 〕 ver. 0.9

 

// ==UserScript==
// @name         AmbTV OnAir
// @namespace    http://tampermonkey.net/
// @version      0.9
// @description  AbemaTV ユーティリティ
// @author       Ameba User
// @match       https://abema.tv/*
// @icon          https://www.google.com/s2/favicons?sz=64&domain=abema.tv
// @grant        none
// ==/UserScript==


let oa_mute;
let oa_size;
let oa_opac;
let oa_delay;
let m_filter;


let target=document.querySelector('head > title');
let monitor0=new MutationObserver(tv_player_env);
monitor0.observe(target, { childList: true });

tv_player_env();

function tv_player_env(){
    let retry=0;
    let interval=setInterval(wait_target, 20);
    function wait_target(){
        retry++;
        if(retry>100){ // リトライ制限 100回 2secまで
            clearInterval(interval); }
        let TP=document.querySelector('.com-tv-TVScreen__player');
        if(TP){
            clearInterval(interval);
            player_vol(TP); }}

} // tv_player_env()



function player_vol(TP){
    m_filter=1;
    setTimeout(()=>{
        m_filter=0;
    }, 400);


    let monitor1=new MutationObserver(con_vol);
    monitor1.observe( TP, { childList: true });

    con_vol();

    function con_vol(){ // ABEMAロゴによるミュート
        let LF=document.querySelector('.com-tv-LinearFooter__feed-super');
        if(TP.querySelector('.com-tv-TVScreen__eyecatch')){
            if(LF.textContent){
                v_vol(1); }}
        else{
            if(!LF.textContent){
                v_vol(0); }}}


    let LF=document.querySelector('.com-tv-LinearFooter__feed-super');
    let monitor2=new MutationObserver(con_vol2);
    monitor2.observe( LF, { childList: true });

    function con_vol2(){ // 動画タイトルによるミュート
        if(LF.textContent){
            v_vol(1); }
        else{
            setTimeout(()=>{
                if(m_filter==0){
                    setTimeout(()=>{
                        if(!TP.querySelector('.com-tv-TVScreen__eyecatch')){
                            v_vol(0);
                        }}, delay() ); }
            }, 200); }}


    setTimeout(()=>{
        let LCLI=document.querySelector('.com-tv-LinearChannelListItem--active a');
        if(LCLI){
            let monitor3=new MutationObserver(con_vol3);
            monitor3.observe( LCLI, { attributes: true });

            con_vol3();

            function con_vol3(){
                v_vol(1); }}
    }, 200 );


    setTimeout(()=>{
        let side=document.querySelector('.com-tv-FeedSidePanel__close-button');
        if(side){
            side.click(); }
    }, 600);

    setTimeout(()=>{
        let HM=document.querySelector('.com-m-HeaderMenu');
        let SNc=document.querySelector('.c-application-SideNavigation--collapsed');
        if(HM && !SNc){
            HM.click(); }
    }, 700);


    check_cookie();
    cm_setting();

} // player_vol(TP)



function v_vol(n){ // 0: ミュート 1: 通常
    oa_mute=get_cookie('oa_mute');
    let button=document.querySelector('.com-playback-Volume__icon-button');
    if(button){
        let label=button.getAttribute('aria-label');
        if(n==0 && label=='音声をオフにする'){
            if(oa_mute==0){
                button.click(); }}
        else if(n==1 && label=='音声をオンにする'){
            button.click(); }

        setTimeout(()=>{
            let label_=button.getAttribute('aria-label');
            if(label_=='音声をオフにする'){ // 音声ON
                view(1); }
            else{
                view(0); }
        }, 20);


        function view(n){ // 0: ミュート  1: 通常
            oa_opac=get_cookie('oa_opac');
            oa_size=get_cookie('oa_size');
            let TVS=document.querySelector('.com-tv-TVScreen__player-container');
            if(TVS){
                if(n==0){
                    TVS.style.transition='all .5s';
                    if(oa_opac==0){
                        TVS.style.opacity='0.5'; }
                    else if(oa_opac==1){
                        TVS.style.opacity='0'; }
                    else{
                        TVS.style.opacity='1'; }
                    if(oa_size==0){
                        TVS.style.transform='scale(0.5)'; }
                    else{
                        TVS.style.transform='scale(1)'; }}
                else{
                    TVS.style.transition='';
                    TVS.style.opacity='1';
                    TVS.style.transform='scale(1)'; }}}

    } // button
} // v_vol()



function delay(){
    oa_delay=get_cookie('oa_delay');
    return oa_delay; }



function get_cookie(name){
    let cookie_req=document.cookie.split('; ').find(row=>row.startsWith(name));
    if(cookie_req){
        if(cookie_req.split('=')[1]==null){
            return 0; }
        else{
            return cookie_req.split('=')[1]; }}
    if(!cookie_req){
        return 0; }}



function check_cookie(){
    oa_mute=get_cookie('oa_mute');
    if(oa_mute!=1){
        oa_mute=0; }
    document.cookie='oa_mute='+oa_mute+'; path=/; Max-Age=2592000';

    oa_size=get_cookie('oa_size');
    if(oa_size!=1){
        oa_size=0; }
    document.cookie='oa_size='+oa_size+'; path=/; Max-Age=2592000';

    oa_opac=get_cookie('oa_opac');
    if(oa_opac!=0 && oa_opac!=1 && oa_opac!=2){
        oa_opac=0; }
    document.cookie='oa_opac='+oa_opac+'; path=/; Max-Age=2592000';

    oa_delay=get_cookie('oa_delay');
    if(oa_delay!=200 && oa_delay!=3200 && oa_delay!=8200){
        oa_delay=3200; }
    document.cookie='oa_delay='+oa_delay+'; path=/; Max-Age=2592000';

} // check_cookie()



function cm_setting(){
    let help_url="https://ameblo.jp/personwritep/entry-12856628930.html";

    let help_SVG=
        '<svg class="oa_help" width="20"  height="20" viewBox="0 0 150 150">'+
        '<path  fill="#fff" d="M66 13C56 15 47 18 39 24C-12 60 18 146 82 137C92 '+
        '135 102 131 110 126C162 90 128 4 66 13M68 25C131 17 145 117 81 '+
        '125C16 133 3 34 68 25M69 40C61 41 39 58 58 61C66 63 73 47 82 57C84 '+
        '60 83 62 81 65C77 70 52 90 76 89C82 89 82 84 86 81C92 76 98 74 100 66'+
        'C105 48 84 37 69 40M70 94C58 99 66 118 78 112C90 107 82 89 70 94z">'+
        '</path></svg>';

    let TVS=document.querySelector('.com-tv-TVScreen__player-container');
    if(TVS){
        TVS.onclick=function(event){
            if(event.ctrlKey){
                let panel=
                    '<div id="amboa">'+
                    '<div id="oa_head">  CMのミュート設定   '+
                    '<a href="'+ help_url +'" rel="noopener noreferrer" target="_blank">'+
                    help_SVG +'</a> '+
                    '<input type="button" id="oa_close" value="×"></div>'+

                    '<div class="oa_p">ミュート機能の有効 / 無効</div>'+
                    '<div> ミュート機能(音声): '+
                    '<input name="mute" type="radio" id="m0">有効 '+
                    '<input name="mute" type="radio" id="m1">無効'+
                    '</div>'+

                    '<div class="oa_p">ミュート時の画面の設定</div>'+
                    '<div> 画面サイズ: '+
                    '<input name="size" type="radio" id="s0">縮小 '+
                    '<input name="size" type="radio" id="s1">通常'+
                    '</div>'+
                    '<div> 画面の明度: '+
                    '<input name="opacity" type="radio" id="o0">0 '+
                    '<input name="opacity" type="radio" id="o1">50 '+
                    '<input name="opacity" type="radio" id="o2">100'+
                    '</div>'+

                    '<div class="oa_p">ロゴ表示のないCM移行のミュート適用</div>'+
                    '<div> 遅延時間: '+
                    '<input name="delay" type="radio" id="d0">0sec '+
                    '<input name="delay" type="radio" id="d1">3sec '+
                    '<input name="delay" type="radio" id="d2">8sec'+
                    '</div>'+
                    '<div></div>'+

                    '<style>#amboa { position: fixed; top: 60px; left: calc(50% - 180px); '+
                    'font: 16px/24px Meiryo; color: #000; padding: 16px 16px 8px; width: 360px; '+
                    'border: 1px solid #aaa; border-radius: 6px; background: #fff; z-index: 100; } '+
                    '#oa_head { margin: 0 0 15px; padding: 5px 15px 3px; '+
                    'font-weight: bold; color: #fff; background: #2196f3; text-align: center; } '+
                    '.oa_help { vertical-align: -5px; } '+
                    '#oa_close { padding: 0 2px; height: 20px; line-height: 16px; } '+
                    '.oa_p { padding: 2px 8px 0; margin: 8px 0 4px; border: 1px solid #aaa; '+
                    'line-height: 22px; } '+
                    'input[type="radio"]{ margin: 0 .2em; }'+
                    '</style>'+
                    '</div>';
                if(!document.querySelector('#amboa')){
                    document.body.insertAdjacentHTML('beforeend', panel); }

                set_radio();

                function set_radio(){
                    oa_mute=get_cookie('oa_mute');
                    let m0=document.querySelector('#m0');
                    let m1=document.querySelector('#m1');
                    if(oa_mute==0){
                        m0.checked=true;
                        mute(0); }
                    else{
                        oa_mute=1;
                        m1.checked=true;
                        mute(1); }
                    document.cookie='oa_mute='+oa_mute+'; path=/; Max-Age=2592000';

                    m0.onchange=function(){
                        mute(0);
                        document.cookie='oa_mute=0; path=/; Max-Age=2592000'; }

                    m1.onchange=function(){
                        mute(1);
                        document.cookie='oa_mute=1; path=/; Max-Age=2592000'; }


                    oa_size=get_cookie('oa_size');
                    let s0=document.querySelector('#s0');
                    let s1=document.querySelector('#s1');
                    if(oa_size==0){
                        s0.checked=true; }
                    else{
                        oa_size=1;
                        s1.checked=true; }
                    document.cookie='oa_size='+oa_size+'; path=/; Max-Age=2592000';

                    s0.onchange=function(){
                        document.cookie='oa_size=0; path=/; Max-Age=2592000'; }

                    s1.onchange=function(){
                        document.cookie='oa_size=1; path=/; Max-Age=2592000'; }


                    oa_opac=get_cookie('oa_opac');
                    let o0=document.querySelector('#o0');
                    let o1=document.querySelector('#o1');
                    let o2=document.querySelector('#o2');
                    if(oa_opac==0){
                        o1.checked=true; }
                    else if(oa_opac==1){
                        o0.checked=true; }
                    else{
                        oa_opac=2;
                        o2.checked=true; }
                    document.cookie='oa_opac='+oa_opac+'; path=/; Max-Age=2592000';

                    o0.onchange=function(){
                        document.cookie='oa_opac=1; path=/; Max-Age=2592000'; }

                    o1.onchange=function(){
                        document.cookie='oa_opac=0; path=/; Max-Age=2592000'; }

                    o2.onchange=function(){
                        document.cookie='oa_opac=2; path=/; Max-Age=2592000'; }


                    oa_delay=get_cookie('oa_delay');
                    let d0=document.querySelector('#d0');
                    let d1=document.querySelector('#d1');
                    let d2=document.querySelector('#d2');
                    if(oa_delay==200){
                        d0.checked=true; }
                    else if(oa_delay==3200){
                        d1.checked=true; }
                    else if(oa_delay==8200){
                        d2.checked=true; }
                    document.cookie='oa_delay='+oa_delay+'; path=/; Max-Age=2592000';

                    d0.onchange=function(){
                        document.cookie='oa_delay=200; path=/; Max-Age=2592000'; }

                    d1.onchange=function(){
                        document.cookie='oa_delay=3200; path=/; Max-Age=2592000'; }

                    d2.onchange=function(){
                        document.cookie='oa_delay=8200; path=/; Max-Age=2592000'; }


                    function mute(n){
                        let s0=document.querySelector('#s0');
                        let s1=document.querySelector('#s1');
                        let o0=document.querySelector('#o0');
                        let o1=document.querySelector('#o1');
                        let o2=document.querySelector('#o2');
                        let d0=document.querySelector('#d0');
                        let d1=document.querySelector('#d1');
                        let d2=document.querySelector('#d2');
                        if(n==0){
                            s0.disabled=false;
                            s1.disabled=false;
                            o0.disabled=false;
                            o1.disabled=false;
                            o2.disabled=false;
                            d0.disabled=false;
                            d1.disabled=false;
                            d2.disabled=false; }
                        else{
                            s0.disabled=true;
                            s1.disabled=true;
                            o0.disabled=true;
                            o1.disabled=true;
                            o2.disabled=true;
                            d0.disabled=true;
                            d1.disabled=true;
                            d2.disabled=true; }}

                } // set_radio()


                let amboa=document.querySelector('#amboa');
                let oa_close=document.querySelector('#oa_close');
                if(amboa && oa_close){
                    oa_close.onclick=function(event){
                        event.preventDefault();
                        amboa.remove(); }}

            }}}

} // cm_setting()





 

 

 

「AmbTV OnAir」最新版について 

旧いバージョンの JavaScriptツールは、アメーバのページ構成の変更で動作しない場合があり、導入する場合は最新バージョンをお勧めします。

 

●「AmbTV OnAir 」の最新バージョンへのリンクは、以下のページのリンクリストから探せます。