Bing Auto Hover and Select Option

Automatically hovers over a specific element and selects an option on Bing search engine

  1. // ==UserScript==
  2. // @name Bing Auto Hover and Select Option
  3. // @description Automatically hovers over a specific element and selects an option on Bing search engine
  4. // @match *://www.bing.com/*
  5. // @version 0.0.1.20250323134455
  6. // @namespace https://gf.qytechs.cn/users/1435046
  7. // ==/UserScript==
  8.  
  9. (function() {
  10. 'use strict';
  11.  
  12. function triggerHover() {
  13. const element = document.getElementById("id_h");
  14. if (element) {
  15. const mouseOverEvent = new MouseEvent("mouseover", {
  16. bubbles: true,
  17. cancelable: true,
  18. view: window
  19. });
  20. element.dispatchEvent(mouseOverEvent);
  21. console.log("Hover triggered.");
  22. }
  23. }
  24.  
  25. function selectOption() {
  26. const radioButton = document.getElementById("rdiodef");
  27. if (radioButton) {
  28. radioButton.click();
  29. console.log("Option selected.");
  30. }
  31. }
  32.  
  33. function handleMutations() {
  34. triggerHover();
  35. selectOption();
  36. }
  37.  
  38. // Initial call on page load
  39. handleMutations();
  40.  
  41. // Mutation observer to detect dynamic changes
  42. const observer = new MutationObserver(handleMutations);
  43. observer.observe(document.body, { childList: true, subtree: true });
  44. })();

QingJ © 2025

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