Jack 11 mesiacov pred
rodič
commit
bf423f1fd3
4 zmenil súbory, kde vykonal 374 pridanie a 0 odobranie
  1. 91 0
      download_pic.js
  2. 131 0
      e-hentai-download.js
  3. 34 0
      galex_skip_mission_done.js
  4. 118 0
      sosovalue_execute.user.js

+ 91 - 0
download_pic.js

@@ -0,0 +1,91 @@
+// ==UserScript==
+// @name         图片下载器
+// @namespace    http://tampermonkey.net/ 
+// @version      1.1
+// @description  尝试在页面顶部添加一个按钮,点击后下载页面所有图片
+// @author       Jack
+// @match        *://*/*
+// @grant        GM_download
+// @grant        GM_addStyle
+// @require      https://cdnjs.cloudflare.com/ajax/libs/jszip/3.5.0/jszip.min.js 
+// ==/UserScript==
+
+(function () {
+    'use strict';
+
+    // 添加样式以确保按钮在页面加载时可见
+    GM_addStyle(`
+    .download-pic-button {
+        position: fixed;
+        top: 5%; /* 默认位置 */
+        left: 50%;
+        transform: translateX(-50%);
+        z-index: 10000;
+        border: none;
+        background-color: transparent; /* 背景颜色设置为透明 */
+        color: rgb(113, 100, 156); /* 字体颜色设置为指定的 RGB 值 */
+        cursor: pointer;
+        font-size: 15px;
+        padding: 0;
+    }
+`);
+
+    // 创建按钮并添加到页面顶部的中间
+    var downloadButton = document.createElement("button");
+    downloadButton.textContent = "New Btn";
+    downloadButton.className = 'download-pic-button';
+    document.body.appendChild(downloadButton);
+
+    // 点击按钮时执行的函数
+    downloadButton.onclick = function () {
+        // 将NodeList转换为数组
+        var images = Array.prototype.slice.call(document.querySelectorAll('img'));
+
+        var zip = new JSZip();
+        var imageDownloads = images.map(function (img, index) {
+            var src = img.src; // 获取图片的src属性
+            var filename = img.alt || 'image_' + index; // 使用alt属性作为文件名,如果没有alt则使用图片索引
+            var extensionMatch = src.match(/\.([^.]+)$/); // 正则表达式匹配文件扩展名
+            var extension = extensionMatch ? extensionMatch[1].toLowerCase() : 'jpg';
+
+            // 检查扩展名是否是图片格式
+            var validExtensions = ['jpg', 'jpeg', 'png', 'gif', 'svg', 'bmp', 'webp'];
+            if (validExtensions.includes(extension)) {
+                // 返回一个Promise,用于获取图片数据
+                return fetch(src).then(response => {
+                    if (!response.ok) {
+                        throw new Error('Network response was not ok for ' + src);
+                    }
+                    return response.blob();
+                }).then(blob => {
+                    // 将blob添加到zip文件中
+                    zip.file(filename + '.' + extension, blob);
+                }).catch(error => {
+                    console.error('Error fetching the image:', error);
+                });
+            }
+            // 如果不是图片格式或者不包含有效的src属性,不返回Promise,这样就不会影响Promise.all
+        });
+
+        // 使用filter去除那些非图片格式或不包含有效src的Promise
+        var validPromises = imageDownloads.filter(p => p);
+
+        // 等待所有有效的图片都添加到zip中
+        Promise.all(validPromises).then(() => {
+            // 生成zip文件并下载
+            zip.generateAsync({ type: 'blob' }).then(function (content) {
+                var filename = 'images_' + new Date().toISOString() + '.zip'; // 使用时间戳生成唯一的文件名
+                var eleLink = document.createElement('a');
+                eleLink.download = filename;
+                eleLink.style.display = 'none';
+                eleLink.href = URL.createObjectURL(content);
+                document.body.appendChild(eleLink);
+                eleLink.click();
+                document.body.removeChild(eleLink);
+            }).catch(error => {
+                console.error('Error generating the zip file:', error);
+            });
+        });
+    };
+}
+)();

+ 131 - 0
e-hentai-download.js

@@ -0,0 +1,131 @@
+// ==UserScript==
+// @name         图片下载器
+// @namespace    http://tampermonkey.net/
+// @version      1.1
+// @description  尝试在页面顶部添加一个按钮,点击后下载页面所有图片
+// @author       Jack
+// @match        *://*/*
+// @grant        GM_download
+// @grant        GM_addStyle
+// @require      https://cdnjs.cloudflare.com/ajax/libs/jszip/3.5.0/jszip.min.js
+// ==/UserScript==
+
+(function () {
+  'use strict';
+
+  // 添加样式以确保按钮在页面加载时可见
+  GM_addStyle(`
+  .download-pic-button {
+      position: fixed;
+      top: 5%; /* 默认位置 */
+      left: 50%;
+      transform: translateX(-50%);
+      z-index: 10000;
+      border: none;
+      background-color: transparent; /* 背景颜色设置为透明 */
+      color: rgb(113, 100, 156); /* 字体颜色设置为指定的 RGB 值 */
+      cursor: pointer;
+      font-size: 15px;
+      padding: 0;
+  }
+`);
+
+  // 创建按钮并添加到页面顶部的中间
+  var downloadButton = document.createElement("button");
+  downloadButton.textContent = "New Btn";
+  downloadButton.className = 'download-pic-button';
+  document.body.appendChild(downloadButton);
+
+  // 检查特定元素是否存在,并设置按钮位置
+  function checkElementAndSetButtonPosition() {
+    var targetElement = document.querySelector("body > div.o_action_manager > div > div.o_control_panel > div.o_cp_bottom > div.o_cp_bottom_left > div > div > button.btn.btn-secondary.fa.fa-download.o_list_export_xlsx");
+
+    if (targetElement) {
+      // 如果元素存在,获取元素的位置和尺寸
+      var targetRect = targetElement.getBoundingClientRect();
+      // 设置按钮的 top 值,使其与目标元素顶部对齐
+      downloadButton.style.top = `${targetRect.top + window.scrollY}px`;
+      // 设置按钮的 left 值,使其在目标元素右侧偏移量为 targetElementWidth + offset
+      var targetElementWidth = targetRect.width;
+      var offset = 10; // 你可以根据需要调整这个偏移量
+      downloadButton.style.left = `${targetRect.right + offset}px`; // 偏移量在目标元素右侧
+      downloadButton.style.transform = 'none';
+    } else {
+      // 如果元素不存在,恢复按钮的默认位置
+      downloadButton.style.top = '5%';
+      downloadButton.style.left = '50%';
+      downloadButton.style.transform = 'translateX(-50%)';
+    }
+  }
+
+  // 初始检查
+  checkElementAndSetButtonPosition();
+
+  // 监听滚动事件,以便在滚动时更新按钮位置
+  window.addEventListener('scroll', function () {
+    checkElementAndSetButtonPosition();
+  });
+
+  // 监听 DOM 变化,以便在元素被添加到页面时更新按钮位置
+  var observer = new MutationObserver(function (mutations) {
+    mutations.forEach(function (mutation) {
+      if (mutation.type === 'childList') {
+        checkElementAndSetButtonPosition();
+      }
+    });
+  });
+
+  observer.observe(document.body, { childList: true, subtree: true });
+
+  // 点击按钮时执行的函数
+  // 点击按钮时执行的函数
+  downloadButton.onclick = function () {
+    var images = document.querySelectorAll('img'); // 获取页面上所有的<img>元素
+    var zip = new JSZip();
+
+    console.log(images);
+    images.forEach(function (img) {
+      var src = img.src; // 获取图片的src属性
+      var filename = img.alt || 'image'; // 使用alt属性作为文件名,如果没有alt则默认为'image'
+
+      // 获取文件扩展名,如果没有扩展名则默认为 'jpg'
+      var extensionMatch = src.match(/\.([^.\/\?]+)$/); // 正则表达式匹配文件扩展名
+      var extension = extensionMatch ? extensionMatch[1].toLowerCase() : 'jpg';
+
+      // 检查扩展名是否是图片格式
+      var validExtensions = ['jpg', 'jpeg', 'png', 'gif', 'svg', 'bmp', 'webp'];
+      if (validExtensions.includes(extension)) {
+        // 异步获取图片数据
+        fetch(src)
+          .then(response => {
+            if (response.ok) return response.blob();
+            throw new Error('Network response was not ok.');
+          })
+          .then(blob => {
+            // 将blob添加到zip文件中
+            zip.file(filename + '.' + extension, blob);
+          })
+          .catch(error => {
+            console.error('There was a problem with the fetch operation:', error);
+          });
+      } else {
+        // 如果不是图片格式,跳过这个文件
+        console.log('Skipped non-image file:', src);
+      }
+    });
+
+    // 当所有图片都添加到zip中后,生成并下载zip文件
+    Promise.all(zip.files).then(() => {
+      zip.generateAsync({ type: 'blob' }).then(function (content) {
+        var filename = 'images_' + new Date().toISOString() + '.zip'; // 使用时间戳生成唯一的文件名
+        var eleLink = document.createElement('a');
+        eleLink.download = filename;
+        eleLink.style.display = 'none';
+        eleLink.href = URL.createObjectURL(content);
+        document.body.appendChild(eleLink);
+        eleLink.click();
+        document.body.removeChild(eleLink);
+      });
+    });
+  };
+})();

+ 34 - 0
galex_skip_mission_done.js

@@ -0,0 +1,34 @@
+// ==UserScript==
+// @name         银河任务完成自动跳过
+// @namespace    http://tampermonkey.net/
+// @version      1.0
+// @description  自动跳过银河任务完成弹出的页面
+// @author       Jack
+// @match        https://app.galxe.com/*
+// @grant        none
+// ==/UserScript==
+
+(function() {
+    'use strict';
+
+    // 定义CSS选择器
+    const selector = '#radix-:r35: > button > span.[&_svg]:text-inherit.[&_svg_path]:fill-current.[&_svg]:h-[1em].h-[1em].[&_svg]:w-[1em].w-[1em].text-base.cursor-pointer.text-common-white.sm:block.sm:text-size-24.block > svg';
+
+    // 监测页面元素
+    const observer = new MutationObserver(mutations => {
+        mutations.forEach(mutation => {
+            Array.from(mutation.addedNodes).forEach(node => {
+                if(node.matches && node.matches(selector)) {
+                    // 点击按钮
+                    node.click();
+                }
+            });
+        });
+    });
+
+    // 配置observer,观察子节点的变动
+    observer.observe(document.body, {
+        childList: true,
+        subtree: true
+    });
+})();

+ 118 - 0
sosovalue_execute.user.js

@@ -0,0 +1,118 @@
+// ==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 firstGroupSelectors = [
+        '#\\:ro\\: > span.transition-opacity.font-medium',
+        '#\\:rp\\: > span.transition-opacity.font-medium',
+        '#\\:rq\\: > span.transition-opacity.font-medium',
+        '#\\:rr\\: > span.transition-opacity.font-medium',
+        '#\\:rs\\: > span.transition-opacity.font-medium',
+        '#\\:r8\\: > span.transition-opacity.font-medium',
+        '#\\:rh\\: > span.transition-opacity.font-medium',
+        '#\\:rg\\: > span.transition-opacity.font-medium',
+        '#\\:r7\\: > span.transition-opacity.font-medium',
+        '#\\:r6\\: > span.transition-opacity.font-medium',
+        '#\\:r10\\: > span.transition-opacity.font-medium',
+        '#\\:ri\\: > span.transition-opacity.font-medium'
+    ];
+
+    const secondGroupSelectors = [
+        '#\\: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'
+    ];
+
+    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 button1 = document.createElement('button');
+        button1.textContent = '验证';
+        button1.style.position = 'fixed';
+        button1.style.top = '20px';
+        button1.style.left = '40%';
+        button1.style.padding = '10px 20px';
+        button1.style.backgroundColor = '#007bff';
+        button1.style.color = '#fff';
+        button1.style.border = 'none';
+        button1.style.borderRadius = '5px';
+        button1.style.cursor = 'pointer';
+        button1.style.zIndex = '10000';
+
+        button1.addEventListener('click', () => {
+            clickButtonGroup(firstGroupSelectors, 100, false, () => {
+                setTimeout(() => {
+                    location.reload();
+                }, 1000);
+            });
+        });
+
+        const button2 = document.createElement('button');
+        button2.textContent = '执行';
+        button2.style.position = 'fixed';
+        button2.style.top = '20px';
+        button2.style.left = '60%';
+        button2.style.padding = '10px 20px';
+        button2.style.backgroundColor = '#007bff';
+        button2.style.color = '#fff';
+        button2.style.border = 'none';
+        button2.style.borderRadius = '5px';
+        button2.style.cursor = 'pointer';
+        button2.style.zIndex = '10000';
+
+        button2.addEventListener('click', () => {
+            clickButtonGroup(secondGroupSelectors, 500, true, () => {
+                setTimeout(() => {
+                    location.reload();
+                }, 1000);
+            });
+        });
+
+        document.body.appendChild(button1);
+        document.body.appendChild(button2);
+    }
+
+    window.addEventListener('load', createCustomButtons);
+
+    setInterval(() => {
+        if (newWindow && !newWindow.closed) {
+            newWindow.close();
+        }
+    }, 1000);
+})();