Confirm Pyong Button

Show a confirmation alert before clicking the pyong button

  1. // ==UserScript==
  2. // @name Confirm Pyong Button
  3. // @version 1.0
  4. // @description Show a confirmation alert before clicking the pyong button
  5. // @license MIT
  6. // @author Fri
  7. // @match https://genius.com/*
  8. // @grant none
  9. // @namespace https://gf.qytechs.cn/users/944448
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. console.log('Tampermonkey script loaded and running.');
  16.  
  17. const buttons = document.querySelectorAll('.pyong_button.header_with_cover_art-pyong_button, .LabelWithIcon__Container-hjli77-0.hrQuZg');
  18.  
  19. if (buttons.length > 0) {
  20. console.log(`Found ${buttons.length} button(s).`);
  21.  
  22. buttons.forEach(button => {
  23. let isConfirmationHandled = false;
  24.  
  25. button.addEventListener('click', function(event) {
  26. if (!isConfirmationHandled) {
  27. event.preventDefault();
  28. event.stopPropagation();
  29.  
  30. const userConfirmed = confirm('Are you sure you want to perform this action?');
  31.  
  32. if (userConfirmed) {
  33. isConfirmationHandled = true;
  34. button.click();
  35. }
  36. } else {
  37. isConfirmationHandled = false;
  38. }
  39. }, true);
  40. });
  41. } else {
  42. console.log('No buttons found.');
  43. }
  44. })();

QingJ © 2025

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