Sleazy Fork is available in English.

Fix NUDE Playground Comment Paste

Fixes the issue where pasting text into comment fields is blocked on nudeplayground.com.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

Advertisement:

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

Advertisement:

// ==UserScript==
// @name         Fix NUDE Playground Comment Paste
// @name:ru      Fix NUDE Playground Comment Paste
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Fixes the issue where pasting text into comment fields is blocked on nudeplayground.com.
// @description:ru Исправляет проблему с блокировкой вставки текста в поля комментариев на nudeplayground.com.
// @author       DenParabal
// @match        https://nudeplayground.com/*
// @grant        none
// @run-at       document-start
// @license      MIT
// ==/UserScript==


(function() {
    'use strict';

    window.addEventListener('paste', function(event) {
        const target = document.activeElement;

        if (target && (target.classList.contains('commentBox') || target.classList.contains('post-area-input'))) {
            const items = event.clipboardData && event.clipboardData.items;
            let hasImage = false;

            if (items) {
                for (let i = 0; i < items.length; i++) {
                    if (items[i].type.indexOf('image') !== -1) {
                        hasImage = true;
                        break;
                    }
                }
            }

            // If no image is detected, block the site's listener from stopping the paste event.
            // This allows the browser to execute the default text paste behavior.
            if (!hasImage) {
                event.stopImmediatePropagation();
            }
        }
    }, true);
})();