Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/debugger/timing/ui-components/TableRows.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class TableRows extends LogView {
const root = document.createElement("div");
root.className = "sa-timing-timer";

let labelElem = null;
let labelElem;
if (timer.targetId !== null && timer.blockId !== null) {
const preview = this.debug.createBlockPreview(timer.targetId, timer.blockId);
labelElem = this.debug.createBlockLink(this.debug.getTargetInfoById(timer.targetId), timer.blockId);
Expand Down
2 changes: 1 addition & 1 deletion addons/editor-searchable-dropdowns/userscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export default async function ({ addon, console, msg }) {
}

const lastIndex = items.length - 1;
let newIndex = 0;
let newIndex;
if (event.key === "ArrowDown") {
if (selectedIndex === -1 || selectedIndex === lastIndex) {
newIndex = 0;
Expand Down
2 changes: 1 addition & 1 deletion addons/editor-theme3/theme3.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ export default async function ({ addon, console, msg }) {

let FieldNote;
if (Blockly.registry) FieldNote = Blockly.registry.getClass(Blockly.registry.Type.FIELD, "field_note");
FieldNote = Blockly.FieldNote;
else FieldNote = Blockly.FieldNote;
const oldFieldNoteAddOctaveButton = FieldNote.prototype.addOctaveButton_;
FieldNote.prototype.addOctaveButton_ = function (...args) {
// Octave buttons in "play note" dropdown
Expand Down
4 changes: 2 additions & 2 deletions addons/find-bar/userscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default async function ({ addon, msg, console }) {
// https://github.com/google/blockly/blob/089179b/core/inject.ts#L294
// KeyboardShortcutsHOC.handleKeyPress:
// https://github.com/scratchfoundation/scratch-paint/blob/8119055/src/hocs/keyboard-shortcuts-hoc.jsx#L29
let isTargetInput = false;
let isTargetInput;
if (Blockly.registry)
isTargetInput = Blockly.browserEvents.isTargetInput(e); // new Blockly
else isTargetInput = Blockly.utils.isTargetInput(e);
Expand Down Expand Up @@ -408,7 +408,7 @@ export default async function ({ addon, msg, console }) {
continue;
}

let eventName = "";
let eventName;
if (broadcastInput.type === "event_broadcast_menu") {
eventName = broadcastInput.inputList[0].fieldRow[0].getText();
} else {
Expand Down
2 changes: 1 addition & 1 deletion addons/gamepad/userscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default async function ({ addon, console, msg }) {
return null;
}
const jsonText = lineWithMagic.substr(0, lineWithMagic.length - GAMEPAD_CONFIG_MAGIC.length);
let storedSettingsMap = null;
let storedSettingsMap;
try {
const parsed = JSON.parse(jsonText);
if (!parsed || typeof parsed !== "object") {
Expand Down
1 change: 0 additions & 1 deletion addons/opacity-slider/userscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ export default async function ({ addon, console, msg }) {
addon.tab.redux.initialize();
if (typeof prevEventHandler === "function") {
addon.tab.redux.removeEventListener("statechanged", prevEventHandler);
prevEventHandler = null;
}

const containerWrapper = document.createElement("div");
Expand Down
6 changes: 2 additions & 4 deletions addons/search-my-stuff/userscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@ export default async function ({ addon, console, msg }) {
statusTip.innerText = msg("progress-tip", { number: (currentPage - 2) * 40 });
// Detect if the next page of projects exists
let fetchUrl;
let ascSort,
descSort = "";
let sort = document.querySelectorAll(".dropdown.button.grey.small");
if (window.location.href.includes("galleries")) {
// Ignore "hosted/curated by me" because the API endpoints are broken
Expand All @@ -247,8 +245,8 @@ export default async function ({ addon, console, msg }) {
fetchUrl = "projects/all";
}
}
ascSort = sort.getAttribute("data-ascsort") || "";
descSort = sort.getAttribute("data-descsort") || "";
const ascSort = sort.getAttribute("data-ascsort") || "";
const descSort = sort.getAttribute("data-descsort") || "";
fetchUrl = `https://scratch.mit.edu/site-api/${fetchUrl}/?page=${currentPage}&ascsort=${ascSort}&descsort=${descSort}`;
await fetch(fetchUrl)
.then(async (response) => {
Expand Down
2 changes: 1 addition & 1 deletion addons/variable-manager/userscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default async function ({ addon, console, msg }) {
}
}

let nameAlreadyUsed = false;
let nameAlreadyUsed;
if (this.target.isStage) {
// Global variables must not conflict with any global variables or local variables in any sprite.
const existingNames = vm.runtime.getAllVarNamesOfType(this.scratchVariable.type);
Expand Down
9 changes: 3 additions & 6 deletions background/l10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,14 @@ export default class BackgroundLocalizationProvider extends LocalizationProvider

localeLoop: for (const locale of locales) {
for (const addonId of addonIds) {
let resp;
let messages = {};
const url = `/addons-l10n/${locale}/${addonId}.json`;
try {
resp = await fetch(url);
messages = await resp.json();
const resp = await fetch(url);
const messages = await resp.json();
this.messages = Object.assign(messages, this.messages);
} catch (_) {
if (addonId === "_general") continue localeLoop;
continue;
}
this.messages = Object.assign(messages, this.messages);
}
}
this._reconfigure();
Expand Down
11 changes: 4 additions & 7 deletions content-scripts/inject/l10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@ export default class UserscriptLocalizationProvider extends LocalizationProvider
}
let addonMessages = {};
for (const dir of this._urls) {
let resp;
let messages = {};
const url = `${dir}/${addonId}.json`;
try {
resp = await fetch(url);
messages = await resp.json();
const resp = await fetch(url);
const messages = await resp.json();
addonMessages = Object.assign(messages, addonMessages);
this.messages = Object.assign(messages, this.messages);
} catch (_) {
if (addonId === "_general") {
this._urls.delete(dir);
}
continue;
}
addonMessages = Object.assign(messages, addonMessages);
this.messages = Object.assign(messages, this.messages);
}
if (addonId === "_general") {
this._reconfigure();
Expand Down
5 changes: 3 additions & 2 deletions content-scripts/inject/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,15 @@ function editorClassCheck() {
const pathname = location.pathname.toLowerCase();
const split = pathname.split("/").filter(Boolean);
if (!isScratchGui && split[0] !== "projects") return;
let isInEditor = false;
let isFullScreen = false;
let isInEditor;
let isFullScreen;
const state = __scratchAddonsRedux.state;
if (state) {
isInEditor = !state.scratchGui.mode.isPlayerOnly;
isFullScreen = state.scratchGui.mode.isFullScreen;
} else if (isScratchGui) {
isInEditor = true;
isFullScreen = false;
} else {
isInEditor = split.includes("editor");
isFullScreen = split.includes("fullscreen");
Expand Down
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default [
"no-loss-of-precision": 2,
"no-nonoctal-decimal-escape": 2,
"no-unsafe-optional-chaining": 2,
"no-useless-assignment": 2,
"no-useless-backreference": 2,
"no-unused-vars": 0,
"no-useless-escape": 0,
Expand Down