jack 10 mesi fa
parent
commit
2785f77bea

+ 17 - 25
scripts/copy_cookie.js

@@ -11,34 +11,26 @@
 (function() {
 (function() {
     'use strict';
     'use strict';
 
 
-    // 创建按钮并设置样式
-    const executeButton = document.createElement("button");
-    executeButton.textContent = "Copy Cookie";
-    executeButton.style.position = "fixed";
-    executeButton.style.top = "50%";
-    executeButton.style.left = "2%";
-    executeButton.style.transform = "translateX(-50%)";
-    executeButton.style.padding = "3px 8px";
-    executeButton.style.fontSize = "10px";
-    executeButton.style.backgroundColor = "#007baf";
-    executeButton.style.color = "#fff";
-    executeButton.style.border = "none";
-    executeButton.style.borderRadius = "5px";
-    executeButton.style.cursor = "pointer";
-    executeButton.style.zIndex = "10000";
+    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(executeButton);
+    document.body.appendChild(button);
 
 
-    // 添加点击事件
-    executeButton.addEventListener('click', () => {
-        // 获取当前页面的Cookie
+    button.addEventListener('click', () => {
         const cookies = document.cookie;
         const cookies = document.cookie;
-
-        // 将Cookie复制到剪贴板
         GM_setClipboard(cookies, { type: 'text' });
         GM_setClipboard(cookies, { type: 'text' });
-
-        // 提示用户
-        alert('Cookie已复制到剪贴板!');
+        alert(`Cookie已复制到剪贴板!\n\n${cookies}`);
     });
     });
 })();
 })();

+ 156 - 0
scripts/createButton.js

@@ -0,0 +1,156 @@
+// ==UserScript==
+// @name         创建按钮,发起带请求头和POST数据的请求
+// @namespace    http://tampermonkey.net/
+// @version      0.1
+// @description  使用自定义请求头和POST数据发起请求,并携带当前页面的Cookie
+// @author       Jack
+// @match        *://*/*
+// @grant        GM_xmlhttpRequest
+// @connect      example.com
+// ==/UserScript==
+
+(function () {
+  "use strict";
+
+  // 创建一个按钮
+  const executeButton = document.createElement("button");
+  executeButton.textContent = "执行";
+  executeButton.style.position = "fixed";
+  executeButton.style.top = "20px";
+  executeButton.style.left = "50%";
+  executeButton.style.padding = "10px 20px";
+  executeButton.style.backgroundColor = "#007bff";
+  executeButton.style.color = "#fff";
+  executeButton.style.border = "none";
+  executeButton.style.borderRadius = "5px";
+  executeButton.style.cursor = "pointer";
+  executeButton.style.zIndex = "10000";
+
+  // 添加点击事件
+  executeButton.addEventListener("click", function () {
+    // 获取当前页面的Cookie
+    const currentCookie = document.cookie;
+    console.log(currentCookie);
+
+    // 请求的目标URL
+    const targetUrl = "https://example.com/api"; // 替换为目标API地址
+
+    // POST请求的数据
+    const postData = {
+      key1: "value1",
+      key2: "value2",
+    };
+
+    // 存储请求结果的数组
+    const responses = [];
+
+    for (let i = 0; i < 1; i++) {
+      GM_xmlhttpRequest({
+        method: "POST", // 请求方法
+        url: targetUrl, // 请求URL
+        data: JSON.stringify(postData), // POST请求的数据
+        headers: {
+          "Content-Type": "application/json", // 设置请求头
+          "User-Agent": "Tampermonkey Script", // 自定义User-Agent
+          Referer: window.location.href, // 当前页面的Referer
+        },
+        cookie: currentCookie, // 使用当前页面的Cookie
+        onload: function (response) {
+          responses.push(response.responseText); // 将响应内容添加到数组
+          if (responses.length === 1) {
+            showResultDialog(responses); // 显示结果提示框
+          }
+        },
+        onerror: function (error) {
+          console.error("请求失败:", error);
+          responses.push(`请求失败:${error.status}`); // 将错误信息添加到数组
+          if (responses.length === 1) {
+            showResultDialog(responses); // 显示结果提示框
+          }
+        },
+      });
+    }
+  });
+
+  // 显示结果提示框
+  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"; // 最大高度不超过视口的 80%
+    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 = responses.join("\n\n"); // 每次请求结果之间增加换行
+    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);
+})();

+ 42 - 0
scripts/remove_all_images.js

@@ -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);
+})();

+ 16 - 14
scripts/sosovalue_execute.user.js

@@ -48,20 +48,22 @@
     }
     }
 
 
     function createCustomButtons() {
     function createCustomButtons() {
-        const executeButton = document.createElement('button');
-        executeButton.textContent = '执行';
-        executeButton.style.position = 'fixed';
-        executeButton.style.top = '20px';
-        executeButton.style.left = '50%';
-        executeButton.style.padding = '10px 20px';
-        executeButton.style.backgroundColor = '#007bff';
-        executeButton.style.color = '#fff';
-        executeButton.style.border = 'none';
-        executeButton.style.borderRadius = '5px';
-        executeButton.style.cursor = 'pointer';
-        executeButton.style.zIndex = '10000';
+        const button = document.createElement('button');
+        button.textContent = '执行';
+        button.style.position = "fixed";
+        button.style.top = "8%";
+        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";
 
 
-        executeButton.addEventListener('click', () => {
+        button.addEventListener('click', () => {
             clickButtonGroup(GroupSelectors, 1000, true, () => {
             clickButtonGroup(GroupSelectors, 1000, true, () => {
                 // 所有按钮点击完成后,等待1秒刷新页面
                 // 所有按钮点击完成后,等待1秒刷新页面
                 setTimeout(() => {
                 setTimeout(() => {
@@ -70,7 +72,7 @@
             });
             });
         });
         });
 
 
-        document.body.appendChild(executeButton);
+        document.body.appendChild(button);
     }
     }
 
 
     window.addEventListener('load', createCustomButtons);
     window.addEventListener('load', createCustomButtons);