Skip to content
This repository was archived by the owner on Oct 28, 2022. It is now read-only.

Commit 14884b1

Browse files
committed
Bug fixes
1 parent db616ed commit 14884b1

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.zip

javascript.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ sf.tags = [
5454
{
5555
"name": "color",
5656
"tag": "color",
57+
"sensitive": true, // Prevent exploits
5758
"src": "https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/icons/Design/paint-brush-line.svg",
5859
"fillers": ["[color=red]", "[/color]"],
5960
"formatter": function(part1, part2) {
60-
part1 = part1.replace(/[^a-zA-Z0-9\#\(\)\,]/g, ""); // Strip chars for security
61-
console.log(part1);
6261
return "<span style='color:" + part1 + "'>" + part2 + "</span>";
6362
}
6463
},
@@ -252,8 +251,8 @@ sf.parse = function(text) {
252251
// Note that the new scratchformat standard is [],
253252
// and the () is outdated, and a bit harder to type.
254253
// But, we will detect both for historical reasons
255-
var startBracket = "[\\(|\\[]";
256-
var endBracket = "[\\)|\\]]";
254+
let startBracket = "[\\(|\\[]";
255+
let endBracket = "[\\)|\\]]";
257256

258257
for (var t = 0; t < sf.tags.length; t++) {
259258
if (sf.tags[t].ignore) {
@@ -264,10 +263,15 @@ sf.parse = function(text) {
264263
var regex = "";
265264
regex += startBracket;
266265
regex += sf.tags[t].tag;
267-
regex += "[=]*([^\\]\\[\\)\\(]*)";
266+
if (sf.tags[t].sensitive) {
267+
regex += "[=]*([a-zA-Z0-9\#\(\)\,]*)";
268+
} else {
269+
regex += "[=]*([^\\]\\[\\)\\(]*)";
270+
}
271+
268272
regex += endBracket;
269273

270-
// If just 1 tag (Ex [br])
274+
// If just 1 tag (Ex [easteregg])
271275
if (sf.tags[t].fillers.length > 1) {
272276
// Lazy matching (?)
273277
// Since we can't use the s flag in Firefox,

popup.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
<style>
4343
html, body {
4444
background-color: lightblue;
45+
width: 500px;
46+
height: 500px;
4547
}
4648

4749
/*Dash*/

0 commit comments

Comments
 (0)