Scratch to TurboWarp

Adds a button to Scratch projects that links to TurboWarp

  1. // ==UserScript==
  2. // @name Scratch to TurboWarp
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Adds a button to Scratch projects that links to TurboWarp
  6. // @author c00lk1dha4k3r -- a scratch user
  7. // @match https://scratch.mit.edu/projects/*
  8. // @icon https://www.turbowarp.org/favicon.ico
  9. // @grant none
  10. // @license GNU
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Function to create the TurboWarp button
  17. function createTurboWarpButton() {
  18. const projectId = window.location.pathname.split('/')[2];
  19. const turboWarpUrl = `https://www.turbowarp.org/${projectId}`;
  20.  
  21. const button = document.createElement('a');
  22. button.href = turboWarpUrl;
  23. button.innerText = 'Open in TurboWarp';
  24. button.style.position = 'absolute';
  25. button.style.top = '10px';
  26. button.style.right = '10px';
  27. button.style.padding = '10px 20px';
  28. button.style.backgroundColor = '#ff9500';
  29. button.style.color = '#fff';
  30. button.style.border = 'none';
  31. button.style.borderRadius = '5px';
  32. button.style.textDecoration = 'none';
  33. button.style.fontSize = '16px';
  34. button.style.fontWeight = 'bold';
  35. button.style.cursor = 'pointer';
  36. button.style.zIndex = '1000';
  37.  
  38. document.body.appendChild(button);
  39. }
  40.  
  41. // Wait until the page content is fully loaded
  42. window.addEventListener('load', createTurboWarpButton);
  43. })();