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

Commit b81a9cc

Browse files
committed
Final touches
1 parent df0aecf commit b81a9cc

File tree

2 files changed

+20
-26
lines changed

2 files changed

+20
-26
lines changed

javascript.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ sf.tags = [
7575
"dontshow": true,
7676
"fillers": ["[easteregg]"],
7777
"formatter": function(part1, part2) {
78-
return "<i>Yes? No. Or is it?</i>";
78+
return "<a href='http://frypup.is-great.net/'>( ͡° ͜ʖ ͡°)</a>";
7979
}
8080
},
8181
{
@@ -112,20 +112,15 @@ sf.init = function() {
112112
icon.src = sf.tags[t].src;
113113

114114
// Help icon
115-
if (sf.tags[t].help == true) {
115+
if (sf.tags[t].help) {
116116
icon.style.float = "right";
117-
icon.onclick = function() {
117+
icon.addEventListener("click", function() {
118118
// Popup message HTML got a bit out of hand here
119-
if (sf.version == 2) {
120-
smod.dialogText(
121-
"ScratchFormat Help",
122-
`<a href="https://github.com/ScratchFormat/ScratchFormat2/issues" style="color: #12b1e4;">Report issues at our Github</a> If you do not own a Github account, simply comment on my profile <a href="https://scratch.mit.edu/users/pufflegamerz/" style="color: #12b1e4;">@pufflegamerz</a>`,
123-
sf.version
124-
);
125-
} else {
126-
prompt("Go here to report bugs:", "https://github.com/ScratchFormat/ScratchFormat2/issues");
127-
}
128-
}
119+
smod.dialogText({
120+
title: "ScratchFormat Help",
121+
text: `<a href="https://github.com/ScratchFormat/ScratchFormat2/issues" style="color: #12b1e4;">Report issues at our Github</a> If you do not own a Github account, simply comment on my profile <a href="https://scratch.mit.edu/users/pufflegamerz/" style="color: #12b1e4;">@pufflegamerz</a>`
122+
});
123+
});
129124

130125
sf.formatter.appendChild(icon);
131126
continue;
@@ -220,8 +215,8 @@ sf.format = function() {
220215

221216
sf.parseMD = function(text) {
222217
// Bold, then italics
223-
text = text.replace(/\*\*(.*)\*\*/gm, "<b>$1</b>");
224-
text = text.replace(/\*(.*)\*/gm, "<b>$1</b>");
218+
text = text.replace(/\*\*(.*?)\*\*/g, "<b>$1</b>");
219+
text = text.replace(/\*(.*?)\*/g, "<i>$1</i>");
225220
return text;
226221
}
227222

smod.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
// Copyleft Daniel C 2020
2-
// GNU General Public License v2.0
3-
1+
// MIT License
42
var smod = {
53
dialog2: function(title, element) {
64
openDialogue(element, {
75
title: gettext(title),
86

97
open: function(e, t) {
10-
// Keeping for future reference
8+
// Runs once popup is opened.
119
},
1210

1311
close: function(e, t) {
@@ -34,15 +32,16 @@ var smod = {
3432
document.body.innerHTML += html;
3533
},
3634

37-
dialogText: function(title, text, version) {
38-
// A good way to check 2.0 vs 3.0 is
35+
dialogText: function(obj) {
36+
// Another good way to check 2.0 vs 3.0 is
3937
// window["openDialogue"] == undefined
40-
if (version == 3) {
41-
this.dialog3(title, text);
42-
} else {
38+
39+
if (document.body.children[0].id == "pagewrapper") {
4340
var popupContent = document.createElement("div");
44-
popupContent.innerHTML = text;
45-
this.dialog2(title, popupContent);
41+
popupContent.innerHTML = obj.text;
42+
this.dialog2(obj.title, popupContent);
43+
} else {
44+
this.dialog3(obj.title, obj.text);
4645
}
4746
}
4847
}

0 commit comments

Comments
 (0)