first commit
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
// ==UserScript==
|
||||
// @name 赌狗骰子
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 0.1
|
||||
// @description 使用自定义请求头和POST数据发起请求,并携带当前页面的Cookie
|
||||
// @author Jack
|
||||
// @match https://www.magicnewton.com/*
|
||||
// @grant GM_xmlhttpRequest
|
||||
// @connect www.magicnewton.com
|
||||
// ==/UserScript==
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
const executeButton = document.createElement("button");
|
||||
executeButton.textContent = "买定离手 6666 起机";
|
||||
button.style.position = "fixed";
|
||||
button.style.top = "10%";
|
||||
button.style.left = "2%";
|
||||
button.style.transform = "translateY(-50%)";
|
||||
button.style.padding = "3px 8px";
|
||||
button.style.fontSize = "10px";
|
||||
button.style.backgroundColor = "#007baf";
|
||||
button.style.color = "#fff";
|
||||
button.style.border = "none";
|
||||
button.style.borderRadius = "5px";
|
||||
button.style.cursor = "pointer";
|
||||
button.style.zIndex = "10000";
|
||||
|
||||
executeButton.addEventListener("click", function () {
|
||||
const currentCookie = document.cookie;
|
||||
const targetUrl = "https://www.magicnewton.com/portal/api/userQuests";
|
||||
const postData = {
|
||||
questId: "f56c760b-2186-40cb-9cbc-3af4a3dc20e2",
|
||||
metadata: { action: "ROLL" }
|
||||
};
|
||||
const responses = [];
|
||||
|
||||
function makeRequest(retryCount) {
|
||||
GM_xmlhttpRequest({
|
||||
method: "POST",
|
||||
url: targetUrl,
|
||||
data: JSON.stringify(postData),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
|
||||
Referer: window.location.href,
|
||||
Origin: "https://www.magicnewton.com",
|
||||
"Sec-Fetch-Site": "same-origin",
|
||||
"Sec-Fetch-Mode": "cors",
|
||||
"Sec-Fetch-Dest": "empty",
|
||||
Accept: "*/*",
|
||||
"Accept-Encoding": "gzip, deflate, br, zstd",
|
||||
"Accept-Language": "zh-CN,zh;q=0.9",
|
||||
Cookie: currentCookie
|
||||
},
|
||||
onload: function (response) {
|
||||
try {
|
||||
const responseJson = JSON.parse(response.responseText);
|
||||
responses.push(responseJson);
|
||||
|
||||
if (responseJson.message === "Quest already completed") {
|
||||
responses.push("任务已完成,不再继续请求");
|
||||
showResultDialog(responses);
|
||||
return;
|
||||
}
|
||||
|
||||
if (retryCount < 5) {
|
||||
makeRequest(retryCount + 1);
|
||||
} else {
|
||||
responses.push("请求完成,已达到最大尝试次数");
|
||||
showResultDialog(responses);
|
||||
}
|
||||
} catch (e) {
|
||||
responses.push(`解析响应失败:${e.message}`);
|
||||
showResultDialog(responses);
|
||||
}
|
||||
},
|
||||
onerror: function (error) {
|
||||
responses.push(`请求失败:${error.status}`);
|
||||
showResultDialog(responses);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
makeRequest(0);
|
||||
|
||||
function showResultDialog(responses) {
|
||||
const dialog = document.createElement("div");
|
||||
dialog.style.position = "fixed";
|
||||
dialog.style.top = "50%";
|
||||
dialog.style.left = "50%";
|
||||
dialog.style.transform = "translate(-50%, -50%)";
|
||||
dialog.style.padding = "20px";
|
||||
dialog.style.backgroundColor = "#f9f9f9";
|
||||
dialog.style.border = "1px solid #ddd";
|
||||
dialog.style.borderRadius = "10px";
|
||||
dialog.style.boxShadow = "0 4px 10px rgba(0, 0, 0, 0.1)";
|
||||
dialog.style.zIndex = "10001";
|
||||
dialog.style.width = "800px";
|
||||
dialog.style.textAlign = "center";
|
||||
dialog.style.maxHeight = "80vh";
|
||||
dialog.style.overflowY = "auto";
|
||||
|
||||
const title = document.createElement("h3");
|
||||
title.textContent = "操作完成";
|
||||
title.style.color = "#333";
|
||||
title.style.marginBottom = "10px";
|
||||
dialog.appendChild(title);
|
||||
|
||||
const resultText = document.createElement("pre");
|
||||
resultText.textContent = JSON.stringify(responses, null, 2);
|
||||
resultText.style.whiteSpace = "pre-wrap";
|
||||
resultText.style.overflowX = "auto";
|
||||
resultText.style.maxHeight = "300px";
|
||||
resultText.style.marginBottom = "15px";
|
||||
resultText.style.padding = "10px";
|
||||
resultText.style.border = "1px solid #eee";
|
||||
resultText.style.borderRadius = "5px";
|
||||
resultText.style.backgroundColor = "#fff";
|
||||
resultText.style.width = "100%";
|
||||
dialog.appendChild(resultText);
|
||||
|
||||
const buttonContainer = document.createElement("div");
|
||||
buttonContainer.style.display = "flex";
|
||||
buttonContainer.style.justifyContent = "center";
|
||||
buttonContainer.style.gap = "10px";
|
||||
buttonContainer.style.marginTop = "15px";
|
||||
dialog.appendChild(buttonContainer);
|
||||
|
||||
const refreshButton = document.createElement("button");
|
||||
refreshButton.textContent = "刷新";
|
||||
refreshButton.style.padding = "8px 16px";
|
||||
refreshButton.style.backgroundColor = "#007bff";
|
||||
refreshButton.style.color = "#fff";
|
||||
refreshButton.style.border = "none";
|
||||
refreshButton.style.borderRadius = "5px";
|
||||
refreshButton.style.cursor = "pointer";
|
||||
refreshButton.addEventListener("click", function () {
|
||||
location.reload();
|
||||
});
|
||||
buttonContainer.appendChild(refreshButton);
|
||||
|
||||
const cancelButton = document.createElement("button");
|
||||
cancelButton.textContent = "取消";
|
||||
cancelButton.style.padding = "8px 16px";
|
||||
cancelButton.style.backgroundColor = "#ccc";
|
||||
cancelButton.style.color = "#333";
|
||||
cancelButton.style.border = "none";
|
||||
cancelButton.style.borderRadius = "5px";
|
||||
cancelButton.style.cursor = "pointer";
|
||||
cancelButton.addEventListener("click", function () {
|
||||
dialog.remove();
|
||||
});
|
||||
buttonContainer.appendChild(cancelButton);
|
||||
|
||||
document.body.appendChild(dialog);
|
||||
}
|
||||
});
|
||||
|
||||
document.body.appendChild(executeButton);
|
||||
})();
|
||||
@@ -0,0 +1,36 @@
|
||||
// ==UserScript==
|
||||
// @name 获取并复制Cookie
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 1.0
|
||||
// @description 点击复制当前页面Cookie
|
||||
// @author Jack
|
||||
// @match *://*/*
|
||||
// @grant GM_setClipboard
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
const button = document.createElement("button");
|
||||
button.textContent = "Copy Cookie";
|
||||
button.style.position = "fixed";
|
||||
button.style.top = "10%";
|
||||
button.style.right = "1%";
|
||||
button.style.transform = "translateY(-50%)";
|
||||
button.style.padding = "3px 8px";
|
||||
button.style.fontSize = "10px";
|
||||
button.style.backgroundColor = "#007baf";
|
||||
button.style.color = "#fff";
|
||||
button.style.border = "none";
|
||||
button.style.borderRadius = "5px";
|
||||
button.style.cursor = "pointer";
|
||||
button.style.zIndex = "10000";
|
||||
|
||||
document.body.appendChild(button);
|
||||
|
||||
button.addEventListener('click', () => {
|
||||
const cookies = document.cookie;
|
||||
GM_setClipboard(cookies, { type: 'text' });
|
||||
alert(`Cookie已复制到剪贴板!\n\n${cookies}`);
|
||||
});
|
||||
})();
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
// ==UserScript==
|
||||
// @name Disable Pop-ups Button
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 1.0
|
||||
// @description 在任意页面添加按钮,点击后禁用 window.open 弹窗行为
|
||||
// @author Jack
|
||||
// @match *://*/*
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// 创建按钮
|
||||
const button = document.createElement('button');
|
||||
button.textContent = "Disable Pop-ups";
|
||||
|
||||
// 按钮样式
|
||||
button.style.position = "fixed";
|
||||
button.style.top = "12.5%";
|
||||
button.style.right = "1%";
|
||||
button.style.transform = "translateY(-50%)";
|
||||
button.style.padding = "3px 8px";
|
||||
button.style.fontSize = "10px";
|
||||
button.style.backgroundColor = "#007baf";
|
||||
button.style.color = "#fff";
|
||||
button.style.border = "none";
|
||||
button.style.borderRadius = "5px";
|
||||
button.style.cursor = "pointer";
|
||||
button.style.zIndex = "10000";
|
||||
|
||||
// 点击事件,覆盖 window.open
|
||||
button.addEventListener('click', () => {
|
||||
const originalOpen = window.open;
|
||||
window.open = function() {
|
||||
return originalOpen('', '_self');
|
||||
};
|
||||
// 可选:点击后提示用户已禁用弹窗
|
||||
alert('Pop-ups have been disabled for this page.');
|
||||
});
|
||||
|
||||
// 挂载按钮到页面
|
||||
document.body.appendChild(button);
|
||||
})();
|
||||
@@ -0,0 +1,42 @@
|
||||
// ==UserScript==
|
||||
// @name Remove All Images
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 0.1
|
||||
// @description Add a button to remove all images on the page
|
||||
// @author You
|
||||
// @match *://*/*
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// 创建按钮元素
|
||||
const button = document.createElement('button');
|
||||
button.textContent = "Remove Img";
|
||||
button.style.position = "fixed";
|
||||
button.style.top = "12.5%";
|
||||
button.style.right = "1%";
|
||||
button.style.transform = "translateY(-50%)";
|
||||
button.style.padding = "3px 8px";
|
||||
button.style.fontSize = "10px";
|
||||
button.style.backgroundColor = "#007baf";
|
||||
button.style.color = "#fff";
|
||||
button.style.border = "none";
|
||||
button.style.borderRadius = "5px";
|
||||
button.style.cursor = "pointer";
|
||||
button.style.zIndex = "10000";
|
||||
|
||||
// 为按钮添加点击事件监听器
|
||||
button.addEventListener('click', function() {
|
||||
// 获取页面上的所有图片元素
|
||||
const images = document.querySelectorAll('img');
|
||||
// 遍历所有图片元素并移除它们
|
||||
images.forEach(image => {
|
||||
image.parentNode.removeChild(image);
|
||||
});
|
||||
});
|
||||
|
||||
// 将按钮添加到页面的 body 元素中
|
||||
document.body.appendChild(button);
|
||||
})();
|
||||
@@ -0,0 +1,85 @@
|
||||
// ==UserScript==
|
||||
// @name sosovalue 半自动点击
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 1.6
|
||||
// @description 检测并点击页面中的 5 组按钮,并关闭新弹出的页面
|
||||
// @author Jack
|
||||
// @match https://sosovalue.com/*/*
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
const GroupSelectors = [
|
||||
"#\\:rf\\: > span.transition-opacity.font-medium",
|
||||
"#\\:rh\\: > span.transition-opacity.font-medium",
|
||||
"#\\:ri\\: > span.transition-opacity.font-medium",
|
||||
"#\\:rj\\: > span.transition-opacity.font-medium",
|
||||
"#\\:rk\\: > span.transition-opacity.font-medium",
|
||||
"#\\:rg\\: > span.transition-opacity.font-medium",
|
||||
];
|
||||
|
||||
let newWindow = null;
|
||||
|
||||
const originalOpen = window.open;
|
||||
window.open = function (url, name, features) {
|
||||
newWindow = originalOpen(url, name, features);
|
||||
return newWindow;
|
||||
};
|
||||
|
||||
function clickButtonGroup(group, delay, closeWindow = false, callback) {
|
||||
let completed = 0;
|
||||
group.forEach((selector, index) => {
|
||||
setTimeout(() => {
|
||||
const button = document.querySelector(selector);
|
||||
if (button) {
|
||||
button.click();
|
||||
if (closeWindow && newWindow) {
|
||||
newWindow.close();
|
||||
}
|
||||
}
|
||||
completed++;
|
||||
if (completed === group.length && callback) {
|
||||
callback();
|
||||
}
|
||||
}, index * delay);
|
||||
});
|
||||
}
|
||||
|
||||
function createCustomButtons() {
|
||||
const button = document.createElement("button");
|
||||
button.textContent = "执行";
|
||||
button.style.position = "fixed";
|
||||
button.style.top = "10%";
|
||||
button.style.left = "2%";
|
||||
button.style.transform = "translateY(-50%)";
|
||||
button.style.padding = "3px 8px";
|
||||
button.style.fontSize = "10px";
|
||||
button.style.backgroundColor = "#007baf";
|
||||
button.style.color = "#fff";
|
||||
button.style.border = "none";
|
||||
button.style.borderRadius = "5px";
|
||||
button.style.cursor = "pointer";
|
||||
button.style.zIndex = "10000";
|
||||
|
||||
button.addEventListener("click", () => {
|
||||
clickButtonGroup(GroupSelectors, 1000, true, () => {
|
||||
// 所有按钮点击完成后,等待1秒刷新页面
|
||||
setTimeout(() => {
|
||||
location.reload();
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
|
||||
document.body.appendChild(button);
|
||||
}
|
||||
|
||||
window.addEventListener("load", createCustomButtons);
|
||||
|
||||
setInterval(() => {
|
||||
if (newWindow && !newWindow.closed) {
|
||||
newWindow.close();
|
||||
}
|
||||
}, 1000);
|
||||
})();
|
||||
Executable
+253
@@ -0,0 +1,253 @@
|
||||
// ==UserScript==
|
||||
// @name Web3网络快速切换器
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 1.1
|
||||
// @description 在页面上添加下拉框快速切换Web3钱包网络
|
||||
// @author You
|
||||
// @match *://*/*
|
||||
// @grant GM_notification
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// 配置:预设的网络列表(目前只有Monad测试网,您可以自行添加)
|
||||
const networks = [
|
||||
{ name: "Monad Testnet", chainId: "0x4a", rpcUrls: ["https://testnet.monad.xyz"] }
|
||||
// 您可以在这里添加其他网络,格式如下:
|
||||
// { name: "网络名称", chainId: "网络ID", rpcUrls: ["RPC URL"] },
|
||||
];
|
||||
|
||||
// 创建样式
|
||||
const style = document.createElement('style');
|
||||
style.textContent = `
|
||||
.web3-network-switcher {
|
||||
position: fixed;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
z-index: 9999;
|
||||
padding: 10px;
|
||||
background-color: rgba(255, 255, 255, 0.95);
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
font-family: Arial, sans-serif;
|
||||
min-width: 200px;
|
||||
}
|
||||
.web3-network-switcher label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
.web3-network-switcher select {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #ddd;
|
||||
background-color: white;
|
||||
font-size: 14px;
|
||||
}
|
||||
.web3-network-switcher select:focus {
|
||||
outline: none;
|
||||
border-color: #4a90e2;
|
||||
box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
|
||||
}
|
||||
.web3-network-switcher .status {
|
||||
margin-top: 8px;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
.web3-network-switcher .toggle {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
color: #999;
|
||||
}
|
||||
.web3-network-switcher.collapsed {
|
||||
width: auto;
|
||||
min-width: auto;
|
||||
padding: 5px;
|
||||
}
|
||||
.web3-network-switcher.collapsed select,
|
||||
.web3-network-switcher.collapsed label,
|
||||
.web3-network-switcher.collapsed .status {
|
||||
display: none;
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
// 等待页面加载完成后执行
|
||||
setTimeout(init, 2000);
|
||||
|
||||
function init() {
|
||||
// 如果页面已存在切换器,先移除
|
||||
const existing = document.getElementById('web3-network-switcher');
|
||||
if (existing) existing.remove();
|
||||
|
||||
// 重新初始化
|
||||
if (typeof window.ethereum !== 'undefined') {
|
||||
// 这里需要执行createNetworkSelector函数
|
||||
// 可能需要将函数改为全局可访问
|
||||
console.log('Web3钱包已检测到');
|
||||
} else {
|
||||
console.log('未检测到Web3钱包');
|
||||
}
|
||||
|
||||
// 创建网络选择器
|
||||
createNetworkSelector();
|
||||
}
|
||||
|
||||
function createNetworkSelector() {
|
||||
// 如果已存在,先移除
|
||||
const existing = document.getElementById('web3-network-switcher');
|
||||
if (existing) existing.remove();
|
||||
|
||||
// 创建容器
|
||||
const container = document.createElement('div');
|
||||
container.className = 'web3-network-switcher';
|
||||
container.id = 'web3-network-switcher';
|
||||
|
||||
// 创建折叠按钮
|
||||
const toggleBtn = document.createElement('div');
|
||||
toggleBtn.className = 'toggle';
|
||||
toggleBtn.textContent = '−';
|
||||
toggleBtn.title = '折叠/展开';
|
||||
toggleBtn.onclick = function() {
|
||||
container.classList.toggle('collapsed');
|
||||
toggleBtn.textContent = container.classList.contains('collapsed') ? '+' : '−';
|
||||
};
|
||||
|
||||
// 创建标签
|
||||
const label = document.createElement('label');
|
||||
label.textContent = '切换到Monad:';
|
||||
label.htmlFor = 'web3-network-select';
|
||||
|
||||
// 创建下拉选择框
|
||||
const select = document.createElement('select');
|
||||
select.id = 'web3-network-select';
|
||||
|
||||
// 添加网络选项
|
||||
networks.forEach(network => {
|
||||
const option = document.createElement('option');
|
||||
option.value = network.chainId;
|
||||
option.textContent = network.name;
|
||||
select.appendChild(option);
|
||||
});
|
||||
|
||||
// 添加状态显示
|
||||
const status = document.createElement('div');
|
||||
status.className = 'status';
|
||||
status.textContent = '就绪';
|
||||
status.id = 'web3-network-status';
|
||||
|
||||
// 添加事件监听器
|
||||
select.addEventListener('change', function() {
|
||||
const selectedChainId = this.value;
|
||||
const selectedNetwork = networks.find(net => net.chainId === selectedChainId);
|
||||
|
||||
if (selectedNetwork) {
|
||||
status.textContent = `切换中: ${selectedNetwork.name}...`;
|
||||
status.style.color = '#4a90e2';
|
||||
switchNetwork(selectedNetwork);
|
||||
}
|
||||
});
|
||||
|
||||
// 添加到容器
|
||||
container.appendChild(toggleBtn);
|
||||
container.appendChild(label);
|
||||
container.appendChild(select);
|
||||
container.appendChild(status);
|
||||
|
||||
// 添加到页面
|
||||
document.body.appendChild(container);
|
||||
|
||||
// 添加拖动功能
|
||||
makeDraggable(container);
|
||||
}
|
||||
|
||||
async function switchNetwork(network) {
|
||||
const status = document.getElementById('web3-network-status');
|
||||
|
||||
try {
|
||||
// 尝试切换到指定网络
|
||||
await window.ethereum.request({
|
||||
method: 'wallet_switchEthereumChain',
|
||||
params: [{ chainId: network.chainId }],
|
||||
});
|
||||
|
||||
status.textContent = `已切换到 ${network.name}`;
|
||||
status.style.color = 'green';
|
||||
|
||||
} catch (switchError) {
|
||||
// 如果网络未添加,尝试添加它
|
||||
if (switchError.code === 4902) {
|
||||
status.textContent = '添加新网络中...';
|
||||
status.style.color = '#4a90e2';
|
||||
|
||||
try {
|
||||
await window.ethereum.request({
|
||||
method: 'wallet_addEthereumChain',
|
||||
params: [{
|
||||
chainId: network.chainId,
|
||||
chainName: network.name,
|
||||
rpcUrls: network.rpcUrls,
|
||||
nativeCurrency: {
|
||||
name: 'MON',
|
||||
symbol: 'MON',
|
||||
decimals: 18
|
||||
},
|
||||
blockExplorerUrls: ['https://explorer.monad.xyz']
|
||||
}],
|
||||
});
|
||||
|
||||
status.textContent = `已添加并切换到 ${network.name}`;
|
||||
status.style.color = 'green';
|
||||
|
||||
} catch (addError) {
|
||||
status.textContent = `添加失败: ${addError.message}`;
|
||||
status.style.color = 'red';
|
||||
}
|
||||
} else {
|
||||
status.textContent = `切换失败: ${switchError.message}`;
|
||||
status.style.color = 'red';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function makeDraggable(element) {
|
||||
let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
||||
|
||||
element.onmousedown = dragMouseDown;
|
||||
|
||||
function dragMouseDown(e) {
|
||||
if (e.target.tagName === 'SELECT' || e.target.tagName === 'OPTION') return;
|
||||
|
||||
e = e || window.event;
|
||||
e.preventDefault();
|
||||
pos3 = e.clientX;
|
||||
pos4 = e.clientY;
|
||||
document.onmouseup = closeDragElement;
|
||||
document.onmousemove = elementDrag;
|
||||
}
|
||||
|
||||
function elementDrag(e) {
|
||||
e = e || window.event;
|
||||
e.preventDefault();
|
||||
pos1 = pos3 - e.clientX;
|
||||
pos2 = pos4 - e.clientY;
|
||||
pos3 = e.clientX;
|
||||
pos4 = e.clientY;
|
||||
element.style.top = (element.offsetTop - pos2) + "px";
|
||||
element.style.right = "unset";
|
||||
element.style.left = (element.offsetLeft - pos1) + "px";
|
||||
}
|
||||
|
||||
function closeDragElement() {
|
||||
document.onmouseup = null;
|
||||
document.onmousemove = null;
|
||||
}
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user