GEE任务取消

根据输入框里的关键词,将任务列表中匹配关键词的任务批量删除(通常这个关键词是日期)

  1. // ==UserScript==
  2. // @name GEE任务取消
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 根据输入框里的关键词,将任务列表中匹配关键词的任务批量删除(通常这个关键词是日期)
  6. // @author You
  7. // @match https://code.earthengine.google.com/
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. 'use strict';
  14.  
  15. // Your code here...
  16. function findStringInDiv(div, searchString) {
  17. // 获取 div 内容的文本
  18. const divText = div.textContent || div.innerText;
  19.  
  20. // 在 div 文本中搜索指定字符串
  21. if (divText.includes(searchString)) {
  22. return true;
  23. } else {
  24. return false;
  25. }
  26. }
  27. $("body")
  28. .append("<div style='position:fixed;z-index:999;width:250px;heigh:90px;top:15px;right:260px;display:flex'id='cancel_muti'><input type='text' class='search' style='width:130px' placeholder='Type keywords' id='keyword_of_del'></input><button class='goog-button link-button' style='color:#4888ef;margin-left: 5px;' id='muti-cancel'>Muti-Cancel</button></div>")
  29. var list_box = $('div > div.content > ee-remote-task-list');
  30. $("#muti-cancel").click(function(){
  31. var keywords = $('#keyword_of_del').val();
  32. console.log(keywords)
  33. document.querySelector("#task-pane").shadowRoot.querySelector("div > ee-remote-task-list").shadowRoot.querySelector("div.remote-tasks").querySelectorAll('div').forEach(childDiv => {
  34. // 在这里对每个子 div 进行操作
  35. //console.log(childDiv);
  36. childDiv.click();
  37. if(findStringInDiv(childDiv,keywords)){
  38. try{
  39. childDiv.querySelector("div.info > div.links > button").click()
  40. }catch(err){
  41. console.log("er")
  42. }
  43.  
  44. }
  45.  
  46. })
  47. })
  48. console.log(list_box)
  49. })();

QingJ © 2025

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