galex_skip_mission_done.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. // ==UserScript==
  2. // @name 银河任务完成自动跳过
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description 自动跳过银河任务完成弹出的页面
  6. // @author Jack
  7. // @match https://app.galxe.com/*
  8. // @grant none
  9. // ==/UserScript==
  10. (function() {
  11. 'use strict';
  12. // 定义CSS选择器
  13. 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';
  14. // 监测页面元素
  15. const observer = new MutationObserver(mutations => {
  16. mutations.forEach(mutation => {
  17. Array.from(mutation.addedNodes).forEach(node => {
  18. if(node.matches && node.matches(selector)) {
  19. // 点击按钮
  20. node.click();
  21. }
  22. });
  23. });
  24. });
  25. // 配置observer,观察子节点的变动
  26. observer.observe(document.body, {
  27. childList: true,
  28. subtree: true
  29. });
  30. })();