URL.canParse dummy

URL.canParseがnullになってurlクリックできなくなるので

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         URL.canParse dummy
// @namespace    http://tampermonkey.net/
// @version      0.1.2
// @description  URL.canParseがnullになってurlクリックできなくなるので
// @author       You
// @match        https://www.nicovideo.jp/watch/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=nicovideo.jp
// @grant        none
// @license MIT
// ==/UserScript==


window.autoHideControllerRetryCount = 0;

function AutoHideController()
{
    // 全画面表示してもコントローラーが消えないのを修正
    let fullScreenButton = document.querySelector('button[aria-label="全画面表示する"]');
    if (fullScreenButton) {
        fullScreenButton.addEventListener("click", ()=> {
            console.log("fullscreen clicked!");

            setTimeout(()=> {
                // 非表示になっていないコントローラー
                let controllerBar = document.querySelector('div[class*="op_100"]');
                if (controllerBar) {
                    console.log("コントローラーを非表示にします");

                    controllerBar.classList.remove("op_100");
                    controllerBar.classList.add("op_0");

                    let videoClickWindow = document.getElementById("nv_watch_VideoAdContainer");
                    videoClickWindow.parentElement.parentElement.addEventListener("click", ()=> {
                        console.log("コントローラーを表示する");
                        controllerBar.classList.remove("op_0");
                        controllerBar.classList.add("op_100");
                    }, { 'once': true });
                } else {
                    console.log("コントローラーは非表示済み");
                }
            }, 1000);

        });
    } else {
        console.log("fullScreenButton not found...");

        if (window.autoHideControllerRetryCount < 10) {
            window.autoHideControllerRetryCount++;
            setTimeout(AutoHideController, 1000);
        }
    }
}

(function() {
    'use strict';

    //alert("test!");

    if (!URL.canParse) {
        console.log("URL.canParse is null");

        URL.canParse = (url) => {
            console.log("URL.canParse : $(url)");
        }
    }
    AutoHideController();

    // Your code here...
})();