Sleazy Fork is available in English.

Copy URL Button

Adds a button to copy the URL of the current page

  1. // ==UserScript==
  2. // @name Copy URL Button
  3. // @namespace http://yourwebsite.com
  4. // @version 1.1
  5. // @description Adds a button to copy the URL of the current page
  6. // @author FunkyJustin
  7. // @match https://gelbooru.com/*
  8. // @match https://danbooru.donmai.us/*
  9. // @match https://www.pixiv.net/en/*
  10. // @match https://twitter.com/*
  11. // @match https://x.com/*
  12. // @grant none
  13. // @license MIT
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. // Create a button element
  20. var copyButton = document.createElement('button');
  21. copyButton.textContent = 'Copy URL';
  22. copyButton.style.position = 'fixed';
  23. copyButton.style.top = '10px'; // Adjust top position as needed
  24. copyButton.style.left = '60%'; // Adjust left position as needed
  25. copyButton.style.padding = '10px';
  26. copyButton.style.border = 'none';
  27. copyButton.style.background = 'rgba(0, 0, 0, 0.5)';
  28. copyButton.style.color = '#fff';
  29. copyButton.style.cursor = 'pointer';
  30. copyButton.style.opacity = '0.3'; // Initial opacity
  31.  
  32. // Append the button to the body
  33. document.body.appendChild(copyButton);
  34.  
  35. // Function to copy the current page URL to the clipboard
  36. function copyURL() {
  37. var url = window.location.href;
  38. navigator.clipboard.writeText(url)
  39. .then(function() {
  40. console.log('URL copied to clipboard: ' + url);
  41. })
  42. .catch(function(error) {
  43. console.error('Failed to copy URL: ', error);
  44. });
  45. }
  46.  
  47. // Event listeners for mouse hover
  48. copyButton.addEventListener('mouseover', function() {
  49. copyButton.style.opacity = '1'; // Make the button opaque on hover
  50. });
  51.  
  52. copyButton.addEventListener('mouseout', function() {
  53. copyButton.style.opacity = '0.3'; // Make the button semi-transparent when not hovering
  54. });
  55.  
  56. // Event listener for click to copy URL
  57. copyButton.addEventListener('click', function() {
  58. copyURL();
  59. });
  60. })();