Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
xmeroriginals committed Sep 22, 2024
1 parent 59f0ee5 commit b7f86eb
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions extensions/XmerOriginals/sweetalert.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,63 +10,63 @@
class SweetAlert {
getInfo() {
return {
id: 'sweetalert',
name: 'Sweet Alert',
color1: '#425436',
id: "sweetalert",
name: "Sweet Alert",
color1: "#425436",
blocks: [
{
opcode: 'showAlert',
opcode: "showAlert",
blockType: Scratch.BlockType.COMMAND,
text: 'show sweet alert with title [TITLE] and text [TEXT] of type [TYPE] button text [BTEXT]',
text: "show sweet alert with title [TITLE] and text [TEXT] of type [TYPE] button text [BTEXT]",
arguments: {
TITLE: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'Title',
defaultValue: "Title",
},
TEXT: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'This is a modern alert!',
defaultValue: "This is a modern alert!",
},
BTEXT: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'OK',
defaultValue: "OK",
},
TYPE: {
type: Scratch.ArgumentType.STRING,
menu: 'alertTypes',
defaultValue: 'success',
menu: "alertTypes",
defaultValue: "success",
},
},
},
{
opcode: 'showInputAlert',
opcode: "showInputAlert",
blockType: Scratch.BlockType.REPORTER,
text: 'ask [QUESTION] with default [DEFAULT_TEXT] of type [TYPE] empty text warn [EMTEXT]',
text: "ask [QUESTION] with default [DEFAULT_TEXT] of type [TYPE] empty text warn [EMTEXT]",
arguments: {
QUESTION: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'What is your name?',
defaultValue: "What is your name?",
},
DEFAULT_TEXT: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'Enter your name here...',
defaultValue: "Enter your name here...",
},
EMTEXT: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'You need to enter something!',
defaultValue: "You need to enter something!",
},
TYPE: {
type: Scratch.ArgumentType.STRING,
menu: 'alertTypes',
defaultValue: 'question',
menu: "alertTypes",
defaultValue: "question",
},
},
},
],
menus: {
alertTypes: {
acceptReporters: true,
items: ['success', 'error', 'warning', 'info', 'question'],
items: ["success", "error", "warning", "info", "question"],
},
},
};
Expand All @@ -89,7 +89,7 @@
return new Promise((resolve) => {
window.Swal.fire({
title: QUESTION,
input: 'text',
input: "text",
inputPlaceholder: DEFAULT_TEXT,
icon: TYPE,
showCancelButton: true,
Expand All @@ -109,11 +109,10 @@
}
}

const script = document.createElement('script');
script.src = 'https://cdn.jsdelivr.net/npm/sweetalert2@11';
const script = document.createElement("script");
script.src = "https://cdn.jsdelivr.net/npm/sweetalert2@11";
script.onload = () => {
Scratch.extensions.register(new SweetAlert());
};
document.head.appendChild(script);

})(Scratch);

0 comments on commit b7f86eb

Please sign in to comment.