Skip to content

Commit

Permalink
fix all lint + Base64Encode errors (sugarlabs#4015)
Browse files Browse the repository at this point in the history
  • Loading branch information
retrogtx authored Sep 27, 2024
1 parent 1db603d commit 92c09d7
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions js/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
DISABLEDFILLCOLOR, DISABLEDSTROKECOLOR, docById, DOUBLEFLAT,
DOUBLESHARP, DRUMNAMES, EASTINDIANSOLFNOTES, EFFECTSNAMES,
EXPANDBUTTON, FILTERTYPES, FLAT, getDrumName, getDrumSynthName,
getModeNumbers, getNoiseName, getNoiseSynthName, getTemperament,
getTemperamentKeys, getTemperamentsList, getTextWidth,
getVoiceSynthName, hideDOMLabel, HIGHLIGHTSTROKECOLORS,
getModeNumbers, getNoiseName, getTemperament,
getTemperamentKeys, getTemperamentsList, getTextWidth, hideDOMLabel, HIGHLIGHTSTROKECOLORS,
i18nSolfege, INVERTMODES, isCustomTemperament, last, MEDIASAFEAREA,
NATURAL, NOISENAMES, NSYMBOLS, NUMBERBLOCKDEFAULT, OSCTYPES,
PALETTEFILLCOLORS, PALETTEHIGHLIGHTCOLORS, PALETTESTROKECOLORS,
Expand Down Expand Up @@ -225,7 +224,7 @@ const _blockMakeBitmap = (data, callback, args) => {
callback(bitmap, args);
};

img.src = "data:image/svg+xml;base64," + window.btoa(base64Encode(data));
img.src = "data:image/svg+xml;base64," + window.btoa(COLLAPSEBUTTON);
};

/**
Expand Down Expand Up @@ -963,8 +962,7 @@ class Block {

if (this.image.search("xmlns") !== -1) {
image.src =
"data:image/svg+xml;base64," +
window.btoa(base64Encode(this.image));
"data:image/svg+xml;base64," + window.btoa(this.image);
} else {
image.src = this.image;
}
Expand Down Expand Up @@ -1516,7 +1514,7 @@ class Block {

image.src =
"data:image/svg+xml;base64," +
window.btoa(base64Encode(COLLAPSEBUTTON));
window.btoa(COLLAPSEBUTTON);
};

/**
Expand Down Expand Up @@ -1549,7 +1547,7 @@ class Block {

image.src =
"data:image/svg+xml;base64," +
window.btoa(base64Encode(EXPANDBUTTON));
window.btoa(EXPANDBUTTON);
};

/**
Expand Down Expand Up @@ -2939,9 +2937,9 @@ class Block {
if (
that?.name === "vspace" &&
that.blocks.blockList[that.connections[1]]?.name === "rest2"
) {
) {
return;
}
}

// Do not allow a stack of blocks to be dragged if the stack contains a silence block.
let block = that.blocks.blockList[that.connections[1]];
Expand Down Expand Up @@ -3379,21 +3377,20 @@ class Block {

const labelElem = docById("labelDiv");

var safetext = function(text){
const safetext = (text) => {
// Best to avoid using these special characters in text strings
// without first converting them to their "safe" form.
var table = {
'<': 'lt',
'>': 'gt',
'"': 'quot',
'\'': 'apos',
'&': 'amp',
'\r': '#10',
'\n': '#13'
const table = {
"<": "lt",
">": "gt",
'"': "quot",
"'": "apos",
"&": "amp",
"\r": "#10",
"\n": "#13"
};

return text.toString().replace(/[<>"'\r\n&]/g, function(chr){
return '&' + table[chr] + ';';
return text.toString().replace(/[<>"'\r\n&]/g, (chr) => {
return "&" + table[chr] + ";";
});
};

Expand Down

0 comments on commit 92c09d7

Please sign in to comment.