您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Does evil things to wikipedia articles
当前为
// ==UserScript== // @name Interesting Wikipedia userscript // @namespace roxwize // @match *://*.wikipedia.org/* // @grant none // @version 1.3.1 // @author roxwize // @description Does evil things to wikipedia articles // @license GPL-3.0-or-later // @homepageURL https://greasyfork.org/en/scripts/479665-interesting-wikipedia-userscript // ==/UserScript== const images = [ "https://cdn.discordapp.com/attachments/862154953295396884/1173367948249927720/anim9.gif", "https://media.tenor.com/MBkt9DXPaUYAAAAd/ddostumka%C3%A7.gif", "https://media.discordapp.net/attachments/836622752735690792/892543216514117662/ezgif.com-gif-maker.gif", "https://media.discordapp.net/attachments/203413905865834496/625861266988335115/flanders_fucking_dies.gif", "https://media.discordapp.net/attachments/1114953713153486968/1166939127942500523/vivaldi10807_1698290357.gif", "https://media.discordapp.net/attachments/816133227508662292/1172693664171040829/anim2.gif", "https://media.discordapp.net/attachments/972366344983031838/1028865879343120454/Ut3Yx38fp4.gif", "https://media.discordapp.net/attachments/600630338795995136/1144468663467003924/Untitled-2.gif", "https://media.tenor.com/C8aEDgYC1y4AAAAd/aphex-twin-come-to-daddy.gif", "https://cdn.discordapp.com/attachments/1099111307380277331/1125686366668341298/download_8.gif", "https://media.discordapp.net/attachments/846920921599836180/983072664023363655/FILE0319.gif", "https://media.tenor.com/4i00_7OrisUAAAAC/sandoz-canu-sandoz.gif", "https://media.tenor.com/hrNDlz8yD3UAAAAC/harley-quinn-margot-robbie.gif", "https://cdn.discordapp.com/attachments/800044401501798403/942883938978914354/caption-17-1.gif", "https://media.tenor.com/s1w-Sc5ahpEAAAAd/paz-pazzin.gif", "https://media.discordapp.net/attachments/907403580011601931/908189601888354384/image0-2.gif", "https://media.discordapp.net/attachments/862154953295396884/1168344353014562816/anim8.gif", "https://cdn.discordapp.com/attachments/862154953295396884/1173407665305690172/1D1cW2Ntai.gif", "https://media.tenor.com/dWS427mpAZAAAAAd/secu-rity-meme.gif", "https://media.tenor.com/XUFDsSt48GYAAAAd/eminem.gif", "https://media.tenor.com/QgphpoWrjaAAAAAd/retro-retro-dev.gif", "https://media.tenor.com/uSo4lQu9dVgAAAAC/homer-smile.gif", "https://media.tenor.com/QMpyBmPBlhoAAAAC/wtf-roblox.gif", "https://media.tenor.com/47hdAGX-uAwAAAAC/charjabug-weegee.gif", "https://cdn.discordapp.com/attachments/862154953295396884/1176264387883974716/IMG_7766.gif", "https://cdn.discordapp.com/attachments/862154953295396884/1176264385795207300/5D5A47EA-FD2A-4F96-AAE0-EC24DFF85E9E.gif", "https://cdn.discordapp.com/attachments/862154953295396884/1176264384977326221/253mof.gif", "https://media.discordapp.net/attachments/847904283142651964/910315898575917076/allo_balling.gif", "https://media.tenor.com/HcQ44DFmPccAAAAC/video-gaming.gif", "https://media.tenor.com/79djON9nNhMAAAAC/0001.gif", "https://media.tenor.com/U2ilbVQ-DAwAAAAC/jameis-winston-crab.gif", "https://media.discordapp.net/attachments/810597667091644427/1023288366059499620/ezgif.com-gif-maker.gif", "https://media.discordapp.net/attachments/862154953295396884/1188233304370065509/GwvzAonc89.gif", "https://media.discordapp.net/attachments/831015313365270528/1146956684707762197/sad.gif", "https://media.discordapp.net/attachments/862154953295396884/1186850455419101244/farmer.gif", "https://media.discordapp.net/attachments/862154953295396884/1177824053713703013/CiEIEGrarE.gif", "https://media.discordapp.net/attachments/862154953295396884/1183912305885466767/KADLBkzqrL.gif", "https://media.discordapp.net/attachments/1054852621191610499/1055176904153497631/1671563280861164.gif", "https://cdn.discordapp.com/attachments/862154953295396884/1200958970924384266/markiplier-dancing.gif", "https://cdn.discordapp.com/attachments/862154953295396884/1200958971352195245/mechanic.gif", "https://cdn.discordapp.com/attachments/862154953295396884/1200958970173604052/gotohell.gif", "https://cdn.discordapp.com/attachments/862154953295396884/1200958971788406834/not_cooking_shit.gif", "https://cdn.discordapp.com/attachments/862154953295396884/1200958968655261818/kitty_kitty_cat_cat.gif", "https://media.discordapp.net/attachments/1082130348143562823/1156916220663189564/62CF58C8-B646-4E87-A197-46F168459DB7.gif", "https://c.tenor.com/jZlLTydic2UAAAAd/tenor.gif", "https://media.discordapp.net/attachments/1167563705299501126/1200199638486110338/90rSldDEdY.gif", "https://media.discordapp.net/attachments/936813623538499595/955285532152311878/speed.gif", "https://c.tenor.com/KE0dcwJ1VS4AAAAC/tenor.gif" ]; const imageWhitelist = new Array(images.length).fill(-1).map((_, i) => i); const style = ` #god{position:fixed;bottom:1em;left:1em;background:rgba(50,40,80,0.8);padding:1em;color:white;} #gantzgraf{position:fixed;bottom:1em;right:1em;background:rgba(50,40,80,0.8);padding:1em;color:white;text-align:right;} #gantzgraf .option{display:flex;align-items:center;gap:1em;} #gantzgraf .option label{flex-grow:1;text-align:right;} #giflist-root{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(245,248,242,0.85);padding:1rem;overflow-y:auto;box-sizing:border-box;} #giflist-root-header{height:10%;border-bottom:1px solid rgba(0,0,0,0.2);overflow-x:hidden;margin-bottom:1rem;} #giflist-root-header h1{font-size:300%;border-bottom:0;margin:0;font-weight:bold;} #giflist-root-list{display:grid;grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr;grid-auto-rows:minmax(120px,1fr);gap:2%;} #giflist-root-list div{display:flex;align-items:center;justify-content:center;background-color:rgba(255,255,255,0.7);border:1px solid rgba(0,0,0,0.25);border-radius:10px;padding:6px;} #giflist-root-list div:hover{background-color:rgba(180,180,180,0.7);cursor:pointer;} #giflist-root-list div img{width:80%;max-height:80%;} #giflist-root-list div:hover img{filter:grayscale(1);} span.small{display:block;font-size:smaller;} span.sub{display:block;color:rgba(0,0,0,0.7);font-style:italic;} .iwusbox a{color:white;font-weight:bold;text-decoration:underline;} `; let words = []; const config = { styleModifications: { label: "Modify page style", current: false }, linkModifications: { label: "Modify links", current: true }, figCaptions: { label: "Modify image captions", current: false }, textualModifications: { label: "Screw up text nodes", current: true } }; function modify(e, f) { const n = e.childNodes; for (let d of n) { if (d.nodeType === Node.TEXT_NODE) f(d); else modify(d, f); } } const chance = () => Math.random() * 100; const rand = (a) => a[Math.floor(Math.random() * a.length)]; const screwup = (str) => { const s = str.split(""); let o = ""; let i = 0; for (let l of s) { if (chance() > 60) continue; if (chance() < 20 && s[i+1]) o += s[i+1]; if (chance() > 80 && s[i-1]) o += s[i-1]; if (chance() < 80) o += l; if (chance() > 90) o += l; i++; } return o; } (function() { // Add userscript styles const stylesheet = document.createElement("style"); stylesheet.innerHTML = style; document.head.appendChild(stylesheet); // Root element. const rootEl = document.createElement("div"); rootEl.id = "god"; rootEl.classList.add("iwusbox"); rootEl.innerHTML = `<span class="small">iwus v${GM.info.script.version} | <a href="https://greasyfork.org/en/scripts/479665-interesting-wikipedia-userscript" data-immune="true">greasyfork</a></span><input type="text" id="bregex" placeholder="regex" /><br/><input type="text" id="breplacement" placeholder="replacement" /><br/><button id="bok" style="cursor:pointer;">ok</button>`; document.body.appendChild(rootEl); document.getElementById("bok").addEventListener("click", () => { words = []; const regexp = new RegExp(document.getElementById("bregex").value, "g"); const replce = document.getElementById("breplacement").value; document.querySelectorAll(`p, ${config.figCaptions.current ? "figcaption," : ""} th, td, li, h1, h2, h3, h4, h5, h6`).forEach((e) => { modify(e, (node) => { node.textContent = node.textContent.replaceAll(regexp, replce); words.push(node.textContent); // == TEXTUAL MODIFICATIONS == // if (config.textualModifications.current) { if (chance() > 90) { node.textContent = node.textContent.replaceAll(/[aeiou]/g, ""); } else if (chance() > 90) { node.textContent = screwup(node.textContent); } } }); // == STYLE MODIFICATIONS == // if (config.styleModifications.current) { e.style.color = `hsl(${Math.round(Math.random()*360)} 50% 50%)`; if (chance() > 75) e.style.backgroundColor = `hsl(${Math.round(Math.random()*360)} 50% 50%)`; e.style.textDecoration = chance() > 70 ? "underline" : "normal"; e.style.fontStyle = chance() > 70 ? "italic" : "normal"; if (chance() > 30) { e.style.transform = `translate(${Math.random()*25}px, ${Math.random()*50}px)`; } else { e.style.transform = `rotate(${Math.random()*5-2.5}deg)`; if (chance() > 45) { e.style.transform += ` scale(${Math.random()*2+0.5})`; } } e.style.fontSize = `${9 + Math.floor(Math.random()*10)}pt`; } }); document.querySelectorAll("img").forEach((e) => { e.src = images[rand(imageWhitelist)]; }); // == LINK MODIFICATIONS == // if (config.linkModifications.current) { document.querySelectorAll("a").forEach((e) => { if (e.dataset.immune === "true") return; e.setAttribute("href", "https://en.wikipedia.org/wiki/Special:Random"); modify(e, (node) => { e.dataset.original = node.textContent; node.textContent = rand(words); let _t; e.addEventListener("mouseover", () => { _t = document.createElement("div"); _t.innerHTML = `<a href="https://en.wikipedia.org/wiki/${e.dataset.original.replaceAll(/ /g,'_')}">${e.dataset.original}</a>`; _t.style = "display:inline;font-size:smaller;background-color:rgba(0,0,0,0.3);padding:0.25rem;margin:0.25rem;"; e.appendChild(_t); }); e.addEventListener("mouseout", () => { if (_t) _t.remove(); }); }); }); } }); // Config options const configEl = document.createElement("div"); configEl.id = "gantzgraf"; configEl.classList.add("iwusbox"); for (let [k, v] of Object.entries(config)) { const e = document.createElement("div"); e.classList.add("option"); e.innerHTML = `<label for="bo-${k}">${v.label}</label>`; let o; if (typeof v.current === "number" && v.vals != undefined) { o = document.createElement("div"); o.style = "display:block;" v.vals.forEach((el, i) => { const vO = document.createElement("input"); vO.type = "radio"; vO.name = `bo-${k}`; vO.id = `ro-${k}-${i}`; vO.value = i.toString(); o.appendChild(vO); const vL = document.createElement("label"); vL.setAttribute("for", vO.id); vL.innerHTML = el; vL.style.display = "block"; o.appendChild(vL); }); } else { o = document.createElement("input"); o.type = "checkbox"; o.checked = config[k].current; o.addEventListener("input", () => { config[k].current = o.checked; }); } o.name = `bo-${k}`; o.id = o.name; e.appendChild(o); configEl.appendChild(e); } // Giflist opener const openGifListLink = document.createElement("a"); openGifListLink.innerHTML = "open the gif list"; openGifListLink.href = "javascript:void(0);" openGifListLink.onclick = renderGifList; openGifListLink.dataset.immune = true; configEl.appendChild(openGifListLink); document.body.appendChild(configEl); })(); // Maybe run automatically on page load function renderGifList() { // Root div const rootDiv = document.createElement("div"); rootDiv.id = "giflist-root"; rootDiv.innerHTML = ` <div id="giflist-root-header"> <h1>Giflist</h1><span class="sub">Click on a gif to remove it | <a href="javascript:document.getElementById('giflist-root').remove()" data-immune="true">close</a></span> </div> `; const rootList = document.createElement("div"); rootList.id = "giflist-root-list"; // Individual gif elements let i = 0; for (let gif of images) { const gifDiv = document.createElement("div"); gifDiv.id = `iwusdiv-${i}`; gifDiv.dataset.index = i; gifDiv.innerHTML = `<img src="${gif}" alt="no.${i}">`; gifDiv.addEventListener("click", () => { if (imageWhitelist.length === 1) { alert("No"); return; } imageWhitelist.splice(imageWhitelist.indexOf(parseInt(gifDiv.dataset.index)), 1); gifDiv.remove(); }); rootList.appendChild(gifDiv); i++; } rootDiv.appendChild(rootList); document.body.appendChild(rootDiv); }