色差检验趣味小游戏作弊脚本
本帖最后由 YWQ8 于 2023-11-25 01:17 编辑游戏网页:https://www.webhek.com/post/color-test/
朋友在玩这个小游戏,看到颜色块是单独的标签,所以很容易可以作弊让分数超过他,写了这个js脚本。
用油猴安装,安装后网页上出现三个按钮,对应三种作弊模式。
原理比较简单,遍历所有标签,找到rgb值不同的块即可。
// ==UserScript==
// @name 染色
// @namespace *://www.webhek.com/post/color-test/
// @version 0.1
// @descriptiontry to take over the world!
// @AuThor YWQ
// @match *://www.webhek.com/post/color-test/
// @Icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
'use strict';
function yyy()
{
setTimeout(yyy,100);
var ans;
for(var i=1;i<=3;i++){
var a=document.querySelector("#box > span:nth-child("+i+")").style.backgroundColor;
var b=document.querySelector("#box > span:nth-child("+(i+1)+")").style.backgroundColor
if(a==b)
{
ans=a;
break;
}
}
var res=1;
while(document.querySelector("#box > span:nth-child("+res+")").style.backgroundColor==ans)res++;
document.querySelector("#box > span:nth-child("+res+")").click();
}
function yao()
{
setTimeout(yao,100);
ywq();
}
function ywq(){
//setTimeout(ywq,100);
var ans;
for(var i=1;i<=3;i++){
var a=document.querySelector("#box > span:nth-child("+i+")").style.backgroundColor;
var b=document.querySelector("#box > span:nth-child("+(i+1)+")").style.backgroundColor
if(a==b)
{
ans=a;
break;
}
}
var res=1;
while(document.querySelector("#box > span:nth-child("+res+")").style.backgroundColor==ans)res++;
document.querySelector("#box > span:nth-child("+res+")").style.backgroundColor='rgb(255,255,255)';
}
// 添加按钮
document.querySelector("#overlay99").remove();//去广告
var btn = document.createElement('button');
btn.innerHTML = '单次提示';
btn.style.position = 'fixed';
btn.style.top = '50';
btn.style.left = '570';
btn.style.zIndex = '9999';
btn.addEventListener('click', function() {
// 在这里编写按钮点击后的操作
ywq();
});
document.body.appendChild(btn);
var btn1 = document.createElement('button');
btn1.innerHTML = '连续模式';
btn1.style.position = 'fixed';
btn1.style.top = '50';
btn1.style.left = '500';
btn1.style.zIndex = '9999';
btn1.addEventListener('click', function() {
// 在这里编写按钮点击后的操作
yao();
});
document.body.appendChild(btn1);
let wx=document.createElement('span');
wx.innerHTML='妖_';
wx.style.position = 'fixed';
wx.style.top = '50';
wx.style.left = '450';
wx.style.zIndex = '9999';
document.body.appendChild(wx);
var btn2 = document.createElement('button');
btn2.innerHTML = '疯狂模式';
btn2.style.position = 'fixed';
btn2.style.top = '75';
btn2.style.left = '500';
btn2.style.zIndex = '9999';
btn2.addEventListener('click', function() {
// 在这里编写按钮点击后的操作
yyy();
});
document.body.appendChild(btn2);
})(); 这不是JS吗?你选java原创分类? {:1_926:}强词夺理,可以选其他原创 {:301_986:} JavaScript 里面有 Java 确实没毛病。。。 手机,电脑都可以么? 挺好玩的写了一个
setInterval(function () {
let boxa = document.getElementById("box");
let spanList = boxa.querySelectorAll("span");
let newColor = "";
if (
spanList.style.backgroundColor !=
spanList.style.backgroundColor &&
spanList.style.backgroundColor == spanList.style.backgroundColor
) {
spanList.click();
} else {
spanList.forEach((e, v) => {
if (newColor == "") {
newColor = e.style.backgroundColor;
} else {
e.click();
}
});
}
}, 1);
人才呀,这都可以 本帖最后由 cn005897 于 2023-11-24 08:26 编辑
function checkAndClickUniqueColor() {
const box = document.getElementById('box');
const spans = box.getElementsByTagName('span');
const colorCounts = {};
for (let span of spans) {
const color = span.style.backgroundColor;
colorCounts = (colorCounts || 0) + 1;
}
const uniqueColor = Object.keys(colorCounts).find(color => colorCounts === 1);
if (uniqueColor) {
for (let span of spans) {
if (span.style.backgroundColor === uniqueColor) {
span.click(); // 执行点击操作
break;
}
}
}
}
setInterval(checkAndClickUniqueColor, 1);
色弱人士表示只过了24关{:1_908:}
页:
[1]
2