// ==UserScript== // @name 检测图哥防止尴尬-过早客 // @namespace http://tampermonkey.net/ // @version 0.1.0 // @description 在过早客论坛的帖子中,检测图哥是否回帖。自动模糊图哥回复中的图片,并进行提示,防止尴尬。 // @author patr1ck // @match https://www.guozaoke.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=guozaoke.com // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; function showNotification() { var notification = document.createElement('div'); notification.id = 'custom-notification'; notification.style.position = 'fixed'; notification.style.bottom = '20px'; notification.style.right = '20px'; notification.style.backgroundColor = '#ED5349'; notification.style.color = '#fff'; notification.style.padding = '15px'; notification.style.borderRadius = '5px'; notification.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.1)'; notification.style.zIndex = 10000; notification.style.fontSize = '16px'; notification.style.fontWeight = 'bold'; notification.style.animation = 'shake 0.5s infinite'; notification.innerText = '图哥出没🫣'; document.body.appendChild(notification); setTimeout(function() { if (document.body.contains(notification)) { document.body.removeChild(notification); } }, 2000); } var style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = ` @keyframes shake { 0% { transform: translate(1px, 1px) rotate(0deg); } 10% { transform: translate(-1px, -2px) rotate(-1deg); } 20% { transform: translate(-3px, 0px) rotate(1deg); } 30% { transform: translate(3px, 2px) rotate(0deg); } 40% { transform: translate(1px, -1px) rotate(1deg); } 50% { transform: translate(-1px, 2px) rotate(-1deg); } 60% { transform: translate(-3px, 1px) rotate(0deg); } 70% { transform: translate(3px, 1px) rotate(-1deg); } 80% { transform: translate(-1px, -1px) rotate(1deg); } 90% { transform: translate(1px, 2px) rotate(0deg); } 100% { transform: translate(1px, -2px) rotate(-1deg); } } `; document.head.appendChild(style); function checkUser() { var usernames = document.querySelectorAll('span.username'); usernames.forEach(function(username) { if (username.innerText === 'abc_11') { showNotification(); } }); } function blurImages() { $(document).ready(function() { $('.reply-item').each(function() { var username = $(this).find('.reply-username .username').text().trim(); if (username === 'abc_11') { var imgs = $(this).find('.content img'); if (imgs.length > 0) { imgs.each(function() { var img = $(this); var link = img.parent('a'); img.css({ 'filter': 'blur(18px)', 'transition': 'filter 0.25s' }); if (link.length > 0) { link.on('click', function(e) { if (img.css('filter') !== 'none') { e.preventDefault(); // 防止跳转到href链接 img.css('filter', 'none'); } }); } else { img.on('click', function(e) { if (img.css('filter') !== 'none') { img.css('filter', 'none'); } }); } }); } } }); }); } document.addEventListener('visibilitychange', function() { if (document.visibilityState === 'visible') { checkUser(); blurImages(); } }); if (document.visibilityState === 'visible') { checkUser(); blurImages(); } })();