灭霸脚本

鼠标三击页面的时候,随机移除页面上的一半元素

  1. // ==UserScript==
  2. // @name Thanos script
  3. // @name:zh-CN 灭霸脚本
  4. // @version 0.2.1
  5. // @description random remove half elements when triple click page
  6. // @description:zh-CN 鼠标三击页面的时候,随机移除页面上的一半元素
  7. // @author tabedit
  8. // @include *
  9. // @grant none
  10. // @namespace https://gf.qytechs.cn/users/225710
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. function fingerSnap(){
  17. 'use strict'
  18. var nodeIter = document.createNodeIterator(
  19. document.body,NodeFilter.SHOW_TEXT + NodeFilter.SHOW_ELEMENT +
  20. NodeFilter.SHOW_COMMENT ,null);
  21. var leafNode = [];
  22. var nn;
  23. while (true){
  24. nn = nodeIter.nextNode();
  25. if(nn === null){
  26. break;
  27. }
  28. if (nn.childNodes.length === 0){
  29. leafNode.push(nn);
  30. }
  31. }
  32. for(var ind = 0; ind < leafNode.length; ind++){
  33. if (Math.random() < 0.5){
  34. removeLeafNode(leafNode[ind]);
  35. }
  36. }
  37. }
  38.  
  39. function removeLeafNode(aNode){
  40. var timeDurition = 2;
  41. try {
  42. if (aNode.nodeType === 1){
  43. aNode.style.transition='transform ' + timeDurition + 's' + ',opacity ' + timeDurition + 's';
  44. aNode.style.transform = 'rotate(180deg) scale(0, 0)';
  45. aNode.style.opacity = '0.3';
  46. } else if(aNode.nodeType === 3){
  47. var aNodeParent = aNode.parentNode;
  48. aNodeParent.style.transition='color ' + timeDurition + 's';
  49. var aNodeCompStyle = document.defaultView.getComputedStyle(aNodeParent);
  50. aNodeParent.style.color = aNodeCompStyle.color.replace('rgb','rgba').replace(')',',0)')
  51. }
  52.  
  53. setTimeout(function(){
  54. aNode.parentNode.removeChild(aNode);
  55. },timeDurition * 1000);
  56. }
  57. catch(e){
  58. debugger;
  59. }
  60. }
  61.  
  62.  
  63. var threeClick = function (){
  64. 'use strict'
  65. var timeSeq = [1, 100000, 200000];
  66. var MININTERVAL = 400;
  67. return function(){
  68. var now = new Date();
  69. console.log(now.getTime());
  70. timeSeq.push(now.getTime());
  71. timeSeq.shift();
  72. if(timeSeq[1] - timeSeq[0] < MININTERVAL &&
  73. timeSeq[2] - timeSeq[1] < MININTERVAL){
  74. fingerSnap()
  75. }
  76. }
  77. }();
  78.  
  79. document.addEventListener('click',threeClick);
  80. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址