Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -1730,7 +1730,7 @@ class Activity {
const start = document.getElementById("record"),
recInside = document.getElementById("rec_inside");
let mediaRecorder;
var clickEvent = new Event("click");
const clickEvent = new Event("click");
let flag = 0;

/**
Expand Down
4 changes: 2 additions & 2 deletions js/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ requirejs.config({

requirejs(["i18next", "i18nextHttpBackend"], function (i18next, i18nextHttpBackend) {
// Use globally-loaded jQuery and Materialize (avoids AMD conflicts)
var $ = window.jQuery;
const $ = window.jQuery;
// Materialize v0.100.2 (bundled) uses 'Materialize' as global, not 'M'
var M = window.Materialize || window.M;
const M = window.Materialize || window.M;

// Ensure both M and Materialize are available for compatibility
if (typeof M !== "undefined") {
Expand Down
4 changes: 2 additions & 2 deletions js/p5-sound-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ define(["p5.sound.min"], function () {
// and sometimes the reference check fails (e.g. if p5.sound wraps it in a way that preserves identity or if we missed the timing).
// The error "s.connect(...) is undefined" confirms we MUST ensure a return value.
if (window.AudioNode && window.AudioNode.prototype) {
var currentConnect = window.AudioNode.prototype.connect;
const currentConnect = window.AudioNode.prototype.connect;

// Avoid double-patching if we already did it
if (!currentConnect.isP5AdapterPatched) {
Expand All @@ -41,7 +41,7 @@ define(["p5.sound.min"], function () {
);

window.AudioNode.prototype.connect = function () {
var result = currentConnect.apply(this, arguments);
const result = currentConnect.apply(this, arguments);
// If the result is undefined (which breaks Tone.js chaining), return the destination (arguments[0])
if (result === undefined) {
return arguments[0];
Expand Down
2 changes: 1 addition & 1 deletion js/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ class Toolbar {
}
}

var tempClick = (playIcon.onclick = () => {
const tempClick = (playIcon.onclick = () => {
const hideMsgs = () => {
this.activity.hideMsgs();
};
Expand Down
4 changes: 2 additions & 2 deletions js/turtleactions/DictActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ function setupDictActions(activity) {
*/
static getValue(dict, key, turtle, blk) {
if (!(dict in activity.logo.turtleDicts[turtle])) {
var msg = _("Dictionary with this name does not exist");
const msg = _("Dictionary with this name does not exist");
return msg;
} else if (!(key in activity.logo.turtleDicts[turtle][dict])) {
var msg = _("Key with this name does not exist in ") + dict;
const msg = _("Key with this name does not exist in ") + dict;
return msg;
}

Expand Down
10 changes: 5 additions & 5 deletions js/turtles.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,11 +704,11 @@ Turtles.TurtlesView = class {
}

// Call the updateDimensions function when resizing occurs
var screenWidth =
const screenWidth =
window.innerWidth ||
document.documentElement.clientWidth ||
document.body.clientWidth;
var screenHeight =
const screenHeight =
window.innerHeight ||
document.documentElement.clientHeight ||
document.body.clientHeight;
Expand All @@ -719,11 +719,11 @@ Turtles.TurtlesView = class {
}

// Set a scaling factor to adjust the dimensions based on the screen size
var scale = Math.min(screenWidth / 1200, screenHeight / 900);
const scale = Math.min(screenWidth / 1200, screenHeight / 900);

// Calculate the new dimensions
var newWidth = Math.round(1200 * scale);
var newHeight = Math.round(900 * scale);
const newWidth = Math.round(1200 * scale);
const newHeight = Math.round(900 * scale);

// Update the dimensions
this._w = newWidth;
Expand Down
33 changes: 14 additions & 19 deletions js/widgets/aiwidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function AIWidget() {
const SAMPLEANALYSERSIZE = 8192;
const SAMPLEOSCCOLORS = ["#3030FF", "#FF3050"];
let abcNotationSong = "";
var midiBuffer;
let midiBuffer;
/**
* Reference to the timbre block.
* @type {number | null}
Expand Down Expand Up @@ -665,9 +665,8 @@ function AIWidget() {
staffBlocksMap[staffIndex].repeatBlock[prevrepeatnameddo][4][3] = blockId;
}
if (afternamedo != -1) {
staffBlocksMap[staffIndex].baseBlocks[repeatId.end][0][
afternamedo
][4][1] = null;
staffBlocksMap[staffIndex].baseBlocks[repeatId.end][0][afternamedo][4][1] =
null;
}

staffBlocksMap[staffIndex].baseBlocks[repeatId.start][0][
Expand Down Expand Up @@ -834,21 +833,17 @@ function AIWidget() {
};

this._save_lock = false;
widgetWindow.addButton(
"export-chunk.svg",
ICONSIZE,
_("Save sample"),
""
).onclick = function () {
// Debounce button
if (!that._get_save_lock()) {
that._save_lock = true;
that._saveSample();
setTimeout(function () {
that._save_lock = false;
}, 1000);
}
};
widgetWindow.addButton("export-chunk.svg", ICONSIZE, _("Save sample"), "").onclick =
function () {
// Debounce button
if (!that._get_save_lock()) {
that._save_lock = true;
that._saveSample();
setTimeout(function () {
that._save_lock = false;
}, 1000);
}
};

widgetWindow.sendToCenter();
this.widgetWindow = widgetWindow;
Expand Down
2 changes: 0 additions & 2 deletions js/widgets/legobricks.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,6 @@ function LegoWidget() {
widgetWindow.clear();
widgetWindow.show();

var that = this;

widgetWindow.onclose = () => {
this._stopWebcam();
this._deactivateEyeDropper(); // Clean up eye dropper mode
Expand Down
2 changes: 1 addition & 1 deletion js/widgets/musickeyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3072,7 +3072,7 @@ function MusicKeyboard(activity) {
return ans;
};
const actionGroupInterval = 50;
var actionGroups = parseInt(selectedNotes.length / actionGroupInterval) + 1;
const actionGroups = parseInt(selectedNotes.length / actionGroupInterval) + 1;

for (let actionGroup = 0; actionGroup < actionGroups; actionGroup++) {
const currentSelectedNotes = selectedNotes.slice(
Expand Down
2 changes: 1 addition & 1 deletion js/widgets/temperament.js
Original file line number Diff line number Diff line change
Expand Up @@ -2221,7 +2221,7 @@ function TemperamentWidget() {
that._save();
};

var noteCell = widgetWindow.addButton("play-button.svg", ICONSIZE, _("Table"));
const noteCell = widgetWindow.addButton("play-button.svg", ICONSIZE, _("Table"));

let t = getTemperament(this.inTemperament);
this.pitchNumber = t.pitchNumber;
Expand Down
Loading