Floating Publish Button on Greasyfork

Add a floating publish button on Greasyfork new script version page

当前为 2023-12-08 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Floating Publish Button on Greasyfork
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.1
  5. // @description Add a floating publish button on Greasyfork new script version page
  6. // @author max5555
  7. // @license MIT
  8. // @match https://greasyfork.org/uk/script_versions/new
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Create the floating button
  16. var floatingButton = document.createElement('button');
  17. floatingButton.innerText = 'Опублікувати скрипт';
  18. floatingButton.style.position = 'fixed';
  19. floatingButton.style.bottom = '20px';
  20. floatingButton.style.right = '20px';
  21. floatingButton.style.padding = '10px';
  22. floatingButton.style.backgroundColor = '#4CAF50';
  23. floatingButton.style.color = 'white';
  24. floatingButton.style.border = 'none';
  25. floatingButton.style.borderRadius = '5px';
  26. floatingButton.style.cursor = 'pointer';
  27. floatingButton.style.zIndex = '1000';
  28.  
  29. // Append the button to the body
  30. document.body.appendChild(floatingButton);
  31.  
  32. // Function to simulate the click on the actual publish button
  33. floatingButton.addEventListener('click', function() {
  34. var publishButton = document.querySelector('input[name="commit"][value="Опублікувати скрипт"]');
  35. if (publishButton) {
  36. publishButton.click();
  37. }
  38. });
  39. })();