Ratpoison

Ah yes, spam. Terrible wherever you find it, be it some culinarily confused person's kitchen or in comments. While all hope is lost for the former, the latter can be fixed. This script will hide comments with more than 3 images / embeds, with the option to show it anyway. With 6 images or more, it gets deleted.

目前為 2021-07-01 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Ratpoison
// @description Ah yes, spam. Terrible wherever you find it, be it some culinarily confused person's kitchen or in comments. While all hope is lost for the former, the latter can be fixed. This script will hide comments with more than 3 images / embeds, with the option to show it anyway. With 6 images or more, it gets deleted.
// @match       https://www.deviantart.com/*
// @version     2.0.0
// @grant       GM_addStyle
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @namespace https://gf.qytechs.cn/users/573136
// ==/UserScript==



// looking to change the numbers or somethin? here you go.
// number of images / embeds within a comment before its content...
// gets hidden, with the option to show it anyway.
var hides = 3;

// ...gets deleted.
var yeets = 6;


// that's all, better don't touch the stuff below.

setInterval(function check(){

    var comments = document.querySelectorAll('[data-hook="comment_body"]:not(.yeeted)');

    comments.forEach(yeet);
}, 500);

GM_addStyle ( `
                .heya, .show, .show + div:after {
                    display: inline-block;
                    height: 40px;
                    font-size: 12px;
                    text-align: center;
                    opacity: .5;
                    box-sizing: border-box;
                }
                .heya {
                    font-family: "Comic Sans MS";
                    width: 100%;
                }
                .heya.more {
                    width: calc(100% - 57px);
                    border-bottom: 1px solid currentColor;
                    margin-bottom: 20px;
                }
                .show {
                    float: right;
                    width: 45px;
                    padding: 10px 0;
                    border: 1px solid currentColor;
                }
                .show + div {
                    height: 0;
                    opacity: 0;
                    overflow-y: scroll;
                    transition: all .5s;
                    transition-timing-function: ease-in-out;
                    transition-delay: .25s;
                }
                .show:hover + div,
                .show + div:hover {
                    height: 350px;
                    opacity: 1;
                    overflow: auto;
                }
                .heya i {
                    font-style: italic;
                }
                `);

function yeet(el){
    var imgs = el.querySelectorAll('div[id*="viewer-"]:not(.public-DraftStyleDefault-block-depth0)');
    var imgsnum = imgs.length;
    if (imgsnum >= yeets) {
        el.classList.add('yeeted');
        el.innerHTML = '<div class="heya">spam identified.<br>yeet!</div>';
    } else if (imgsnum >= hides) {
        el.classList.add('yeeted');
        el.insertAdjacentHTML('afterbegin', '<div class="heya more">can\'t <i>picture</i> what\'s in here.<br>wanna check?</div><div class="show">Yes</div>');
    }
};

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址