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

Commit df0aecf

Browse files
committed
Mainance and 2.2 prep update
1 parent 8377e84 commit df0aecf

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

javascript.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ sf.tags = [
8181
{
8282
"name": "help",
8383
"help": true,
84-
"src": "https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/icons/Development/bug-line.svg",
84+
"src": "https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/icons/Editor/question-mark.svg",
8585
"ignore": true
8686
}
8787
];
@@ -112,7 +112,7 @@ sf.init = function() {
112112
icon.src = sf.tags[t].src;
113113

114114
// Help icon
115-
if (sf.tags[t].help) {
115+
if (sf.tags[t].help == true) {
116116
icon.style.float = "right";
117117
icon.onclick = function() {
118118
// Popup message HTML got a bit out of hand here
@@ -179,6 +179,8 @@ sf.init = function() {
179179
if (event.target.parentElement.children[0].id !== "formatter") {
180180
event.target.parentElement.prepend(sf.formatter);
181181
sf.formatter.style.width = event.target.offsetWidth + "px";
182+
event.target.style.resize = "auto";
183+
182184
}
183185
}
184186
}
@@ -216,6 +218,13 @@ sf.format = function() {
216218
}
217219
}
218220

221+
sf.parseMD = function(text) {
222+
// Bold, then italics
223+
text = text.replace(/\*\*(.*)\*\*/gm, "<b>$1</b>");
224+
text = text.replace(/\*(.*)\*/gm, "<b>$1</b>");
225+
return text;
226+
}
227+
219228
// Custom regex SFML* parser. It parses differently than HTML. Instead
220229
// Of replacing [b] with <b>, it it replaces both tags with
221230
// text between them. Therefore, "[b][b]Hello[/b][/b]" will not work.
@@ -262,5 +271,7 @@ sf.parse = function(text) {
262271
// Format trailing breaklines and spaces
263272
text = text.replace(/^(\n| )+/gm, "");
264273

274+
text = sf.parseMD(text);
275+
265276
return text;
266277
}

logo.png

15 KB
Loading

popup.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<!DOCTYPE html>
2+
<html>
23
<head>
34
</head>
45
<body>
56
<center>
6-
<img src="logo.png">
7-
<h2>ScratchFormat 2.1</h2>
7+
<img src="logo.png" width="200">
8+
<h2>ScratchFormat 2.2</h2>
89
<p>
910
Thank you for using ScratchFormat. <b>To use it, go
1011
on a scratch comment editor and click on it.</b> The formatter
@@ -20,9 +21,9 @@ <h2>ScratchFormat 2.1</h2>
2021
</body>
2122
<style>
2223
html {
23-
width: 200px;
24-
height: 350px;
24+
2525
background-color: lightblue;
2626
}
2727
</style>
2828
<script type="text/javascript" src="javascript.js"></script>
29+
</html>

0 commit comments

Comments
 (0)