URL.canParse dummy

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

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

(I already have a user style manager, let me install it!)

// ==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...
})();