HuangQS

自用,一些页面的优化

当前为 2024-03-20 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name HuangQS
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.1
  5. // @description 自用,一些页面的优化
  6. // @author You
  7. // @match *://*/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // 获取当前页面的URL
  16. const currentURL = window.location.href;
  17.  
  18. // 亡灵增量
  19. if (currentURL.includes('www.mhhf.com') || currentURL.includes('www.json1.cn')) {
  20. document.title = '测试-Canvas绘制展示';
  21.  
  22. setInterval(()=>{
  23. // 找到包含所有按钮的父元素
  24. let spellsContainer = document.querySelector('.spells');
  25.  
  26. // 找到所有按钮元素
  27. let spellButtons = spellsContainer? spellsContainer.querySelectorAll('.spell') : undefined;
  28.  
  29. // 循环点击每个按钮
  30. if(spellButtons){
  31. for(let i =0 ; i<spellButtons.length ; i++){
  32. //仅点击前两个
  33. if(i>=2)break;
  34. let button = spellButtons[i];
  35. // 触发点击事件
  36. button.dispatchEvent( new MouseEvent('click', { bubbles: true,cancelable: true, view: window }));
  37. }
  38.  
  39. }
  40. },1000)
  41.  
  42. }
  43.  
  44. //json在线解析去广告 进入后全屏
  45. else if (currentURL.includes('www.json.cn')) {
  46. document.title = 'JSON';
  47.  
  48. // 找到对应的按钮元素 触发点击事件
  49. let clickEvent = new MouseEvent('click', { bubbles: true, cancelable: true, view: window });
  50. document.getElementById('formatFullScreen').dispatchEvent(clickEvent);
  51. }
  52. //文本比对 进入后全屏
  53. else if(currentURL.includes('https://tool.lu/diff')){
  54. let clickEvent = new MouseEvent('click', { bubbles: true, cancelable: true, view: window });
  55. document.getElementById('js-webfullscreen').dispatchEvent(clickEvent);
  56. }
  57.  
  58. })();
  59.