// ==UserScript== // @name Scratch Custom GUI and Enhancements // @namespace http://tampermonkey.net/ // @version 0.1 // @description Add custom GUI and functionality enhancements to Scratch // @match https://scratch.mit.edu/* // @grant GM_addStyle // @run-at document-end // @downloadURL https://update.greasyfork.icu/scripts/505469/Scratch%20Custom%20GUI%20and%20Enhancements.user.js // @updateURL https://update.greasyfork.icu/scripts/505469/Scratch%20Custom%20GUI%20and%20Enhancements.meta.js // ==/UserScript== (function() { 'use strict'; // Function to create a page function createPage(id, title, content) { const page = document.createElement('div'); page.id = id; page.style.display = 'none'; page.style.position = 'fixed'; page.style.top = '10px'; page.style.left = '10px'; page.style.backgroundColor = '#ffffff'; page.style.border = '1px solid #ddd'; page.style.padding = '10px'; page.style.zIndex = 1000; page.style.borderRadius = '5px'; page.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.3)'; page.style.fontFamily = 'Arial, sans-serif'; page.innerHTML = `

${title}

${content}`; document.body.appendChild(page); } // Function to create the main GUI function createMainGUI() { const mainGUI = document.createElement('div'); mainGUI.id = 'main-gui'; mainGUI.style.position = 'fixed'; mainGUI.style.top = '10px'; mainGUI.style.right = '10px'; mainGUI.style.backgroundColor = '#ffffff'; mainGUI.style.border = '1px solid #ddd'; mainGUI.style.padding = '10px'; mainGUI.style.zIndex = 1000; mainGUI.style.borderRadius = '5px'; mainGUI.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.3)'; mainGUI.style.fontFamily = 'Arial, sans-serif'; document.body.appendChild(mainGUI); const pages = ['block-editor', 'block-color-changer', 'custom-block-maker', 'theme-changer', 'modifiers']; pages.forEach(pageId => { const button = document.createElement('button'); button.innerText = pageId.replace(/-/g, ' ').toUpperCase(); button.style.margin = '5px'; button.style.padding = '5px 10px'; button.style.border = 'none'; button.style.borderRadius = '3px'; button.style.cursor = 'pointer'; button.style.backgroundColor = '#007bff'; button.style.color = '#fff'; button.onclick = function() { pages.forEach(id => { document.getElementById(id).style.display = (id === pageId) ? 'block' : 'none'; }); }; mainGUI.appendChild(button); }); const closeButton = document.createElement('button'); closeButton.innerText = 'Close GUI'; closeButton.style.margin = '5px'; closeButton.style.padding = '5px 10px'; closeButton.style.border = 'none'; closeButton.style.borderRadius = '3px'; closeButton.style.cursor = 'pointer'; closeButton.style.backgroundColor = '#dc3545'; closeButton.style.color = '#fff'; closeButton.onclick = function() { mainGUI.style.display = (mainGUI.style.display === 'none') ? 'block' : 'none'; }; mainGUI.appendChild(closeButton); } // Function to create the Block Editor page function createBlockEditorPage() { createPage('block-editor', 'Block Editor', `





`); window.createCustomBlock = function() { const blockName = document.getElementById('block-name').value; const blockColor = document.getElementById('block-color').value; const blockInsideColor = document.getElementById('block-inside-color').value; console.log('Creating custom block:', blockName, blockColor, blockInsideColor); // Implement logic to create a custom block in Scratch // Use Scratch API or tools to add the block to the Scratch project }; } // Function to create the Block Color Changer page function createBlockColorChangerPage() { createPage('block-color-changer', 'Block Color Changer', `



`); window.changeBlockColor = function() { const block = document.getElementById('block-select-color').value; const newColor = document.getElementById('block-new-color').value; console.log('Changing block color to:', newColor); // Implement logic to change the color of the selected block // Use Scratch API or tools to modify the color of the block in the Scratch project }; } // Function to create the Custom Block Maker page function createCustomBlockMakerPage() { createPage('custom-block-maker', 'Custom Block Maker', `





`); window.createNewCustomBlock = function() { const blockName = document.getElementById('block-name-new').value; const blockColor = document.getElementById('block-color-new').value; const blockInsideColor = document.getElementById('block-inside-color-new').value; console.log('Creating new custom block:', blockName, blockColor, blockInsideColor); // Implement logic to create a new custom block with the specified properties // Integrate with Scratch API or tools to add this block to Scratch }; } // Function to create the Theme Changer page function createThemeChangerPage() { createPage('theme-changer', 'Theme Changer', `



`); window.applyTheme = function() { const theme = document.getElementById('theme-select').value; const imageUrl = document.getElementById('theme-image-url').value; const themes = { 'cupcake': ` body { background-color: #fbe8e8; color: #6a1b29; } .stage { background: #fcdada; } .backdrop { background: #f6a7b1; } `, 'candy': ` body { background-color: #f7e7e0; color: #ff4f5a; } .stage { background: #e5c7c3; } .backdrop { background: #fddfdd; } `, 'dark': ` body { background-color: #333; color: #f5f5f5; } .stage { background: #555; } .backdrop { background: #444; } `, 'marshmallow': ` body { background-color: #fff; color: #000; } .stage { background: #f5f5f5; } .backdrop { background: #e0e0e0; } `, 'bloody': ` body { background-color: #3e0d0d; color: #f5f5f5; } .stage { background: #6a0b0b; } .backdrop { background: #9e0f0f; } `, 'image': ` body { background-image: url('${imageUrl}'); color: #ffffff; } .stage { background: rgba(0, 0, 0, 0.5); } .backdrop { background: rgba(0, 0, 0, 0.5); } ` }; if (theme === 'image') { document.getElementById('image-url-label').style.display = 'block'; document.getElementById('theme-image-url').style.display = 'block'; } else { document.getElementById('image-url-label').style.display = 'none'; document.getElementById('theme-image-url').style.display = 'none'; applyThemeStyles(themes[theme]); } }; function applyThemeStyles(css) { let existingStyle = document.getElementById('theme-style'); if (existingStyle) { existingStyle.remove(); } const style = document.createElement('style'); style.id = 'theme-style'; style.innerHTML = css; document.head.appendChild(style); } } // Function to create the Modifiers tab page function createModifiersPage() { createPage('modifiers', 'Modifiers', `



`); window.addModifier = function() { const modifierName = document.getElementById('modifier-name').value; console.log('Adding modifier:', modifierName); // Implement logic to add a modifier to Scratch blocks // This could involve creating new functions or altering existing ones const modifiersList = document.getElementById('modifiers-list'); const modifierItem = document.createElement('div'); modifierItem.textContent = modifierName; modifiersList.appendChild(modifierItem); }; } // Initialize GUI and pages createMainGUI(); createBlockEditorPage(); createBlockColorChangerPage(); createCustomBlockMakerPage(); createThemeChangerPage(); createModifiersPage(); })();