您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
A plugin that lets you swear again :)
// ==UserScript== // @name HF - Enable Swearing // @namespace HF - Enable Swearing // @description A plugin that lets you swear again :) // @include http://* // @include https://* // @author Who Soup // @version 1.1.0 // ==/UserScript== (function () { 'use strict'; var words = { 'Clay Davis' : 'shit', 'bullsnap' : 'bullshit', 'kitten' : 'cunt', 'mommyfugger' : 'motherfucker', 'fugg' : 'fuck', '':''}; var regexs = [], replacements = [], tagsWhitelist = ['PRE', 'BLOCKQUOTE', 'CODE', 'INPUT', 'BUTTON', 'TEXTAREA'], rIsRegexp = /^\/(.+)\/([gim]+)?$/, word, text, texts, i, userRegexp; function prepareRegex(string) { return string.replace(/([\[\]\^\&\$\.\(\)\?\/\\\+\{\}\|])/g, '\\$1'); } function isTagOk(tag) { return tagsWhitelist.indexOf(tag) === -1; } delete words['']; for (word in words) { if ( typeof word === 'string' && words.hasOwnProperty(word) ) { userRegexp = word.match(rIsRegexp); if (userRegexp) { regexs.push( new RegExp(userRegexp[1], 'g') ); } else { regexs.push( new RegExp(prepareRegex(word).replace(/\\?\*/g, function (fullMatch) { return fullMatch === '\\*' ? '*' : '[^ ]*'; }), 'g') ); } replacements.push( words[word] ); } } texts = document.evaluate('//body//text()[ normalize-space(.) != "" ]', document, null, 6, null); for (i = 0; text = texts.snapshotItem(i); i += 1) { if ( isTagOk(text.parentNode.tagName) ) { regexs.forEach(function (value, index) { text.data = text.data.replace( value, replacements[index] ); }); } } }());