NTV Context Menu and Selection Change Remover

Remove context menu and set userSelect to 'text'

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         NTV Context Menu and Selection Change Remover
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Remove context menu and set userSelect to 'text'
// @author       Iso
// @match        https://*.ntv.co.jp/*
// @grant        none
// @run-at       document-body
// @license MIT
// ==/UserScript==

/**
 * Override the default oncontextmenu event on the document
 * to disable the context menu completely.
 */
Object.defineProperty(document, 'oncontextmenu', {
  get: function () { return null },  // Return null to indicate no context menu
  set: function() {}                  // Ignore any attempts to set the context menu
});

/**
 * Set user-select property on the document body to 'text'
 * to allow text selection.
 * This function runs when the document body loads.
 */
document.body.onload = (function() {
    'use strict';  // Enable strict mode for cleaner code

    // Initialize the body style object
    document.body.style = {};

    // Set the user-select CSS property to 'text', allowing users to select text
    document.body.style.userSelect = 'text';
})();