Skip to content

Commit f6911a9

Browse files
Fixed typo error in home label and removed unwanted semi-colons (#4957)
* Fixed typo error in home label and removed unwanted semi-colons * fix only linting errors * fixed space issue * resolved merge conflict * Fixed lint errors/ run prettier on all files
1 parent cf465df commit f6911a9

File tree

14 files changed

+733
-716
lines changed

14 files changed

+733
-716
lines changed

planet/js/Converter.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,56 +9,58 @@
99
// License along with this library; if not, write to the Free Software
1010
// Foundation, 51 Franklin Street, Suite 500 Boston, MA 02110-1335 USA
1111

12-
1312
/*
1413
exported
1514
1615
Converter
1716
*/
1817

1918
class Converter {
20-
2119
constructor(Planet) {
22-
this.Planet = Planet ;
20+
this.Planet = Planet;
2321
this.ServerInterface = Planet.ServerInterface;
2422
}
2523

2624
isConnected() {
2725
return this.Planet.ConnectedToServer;
28-
};
26+
}
2927

3028
// callbacks: (success, data/error message)
3129
// Conversion Functions
3230

3331
ly2pdf(data, callback) {
34-
this.ServerInterface.convertFile("ly", "pdf", window.btoa(encodeURIComponent(data)), function(result) {
35-
this.afterly2pdf(result,callback);
36-
}.bind(this));
37-
};
38-
39-
afterly2pdf (data, callback) {
40-
(!data.success) ? callback(false, data.error) :
41-
callback(true, this.getDataURL(data.data.contenttype, data.data.blob)) ;
42-
};
32+
this.ServerInterface.convertFile(
33+
"ly",
34+
"pdf",
35+
window.btoa(encodeURIComponent(data)),
36+
function (result) {
37+
this.afterly2pdf(result, callback);
38+
}.bind(this)
39+
);
40+
}
41+
42+
afterly2pdf(data, callback) {
43+
!data.success
44+
? callback(false, data.error)
45+
: callback(true, this.getDataURL(data.data.contenttype, data.data.blob));
46+
}
4347

4448
// Ancillary Functions
45-
getDataURL (mime, data) {
46-
return `data:${mime};base64,${data}` ;
47-
};
49+
getDataURL(mime, data) {
50+
return `data:${mime};base64,${data}`;
51+
}
4852

4953
// Unused, but might be useful.
5054
getBlob(mime, data) {
5155
const rawData = window.atob(data);
5256
const len = rawData.length;
5357
const arr = new Uint8Array(len);
5458

55-
for (let i = 0; i < len; i++)
56-
arr[i] = rawData.charCodeAt(i);
59+
for (let i = 0; i < len; i++) arr[i] = rawData.charCodeAt(i);
5760

58-
const blob = new Blob([arr], {type: mime});
61+
const blob = new Blob([arr], { type: mime });
5962
return blob;
60-
};
63+
}
6164

6265
init() {}
63-
6466
}

planet/js/GlobalCard.js

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -46,48 +46,48 @@ class GlobalCard {
4646
<div class="card-action">
4747
<div class="flexcontainer">
4848
<a class="project-icon tooltipped" data-position="bottom" data-delay="50" data-tooltip="${_(
49-
"More Details"
50-
)}" id="global-project-more-details-{ID}"><i class="material-icons">info</i></a>
49+
"More Details"
50+
)}" id="global-project-more-details-{ID}"><i class="material-icons">info</i></a>
5151
<a class="project-icon tooltipped" data-position="bottom" data-delay="50" data-tooltip="${_(
52-
"Open in Music Blocks"
53-
)}" id="global-project-open-{ID}"><i class="material-icons">launch</i></a>
52+
"Open in Music Blocks"
53+
)}" id="global-project-open-{ID}"><i class="material-icons">launch</i></a>
5454
<a class="project-icon tooltipped" data-position="bottom" data-delay="50" data-tooltip="${_(
55-
"Merge with current project"
56-
)}" id="global-project-merge-{ID}"><i class="material-icons">merge_type</i></a>
55+
"Merge with current project"
56+
)}" id="global-project-merge-{ID}"><i class="material-icons">merge_type</i></a>
5757
<a class="project-icon tooltipped" data-position="bottom" data-delay="50" data-tooltip="${`${
58-
Planet.ProjectStorage.isLiked(this.id) ? "Unlike" : "Like"
59-
} project`}"><i class="material-icons"id="global-like-icon-{ID}"></i><span class="likes-count" id="global-project-likes-{ID}"></span></a>
58+
Planet.ProjectStorage.isLiked(this.id) ? "Unlike" : "Like"
59+
} project`}"><i class="material-icons"id="global-like-icon-{ID}"></i><span class="likes-count" id="global-project-likes-{ID}"></span></a>
6060
6161
<div id="global-share-{ID}">
6262
<a class="project-icon tooltipped" data-position="bottom" data-delay="50" data-tooltip="${_(
63-
"Share project"
64-
)}" id="global-project-share-{ID}"><i class="material-icons">share</i></a>
63+
"Share project"
64+
)}" id="global-project-share-{ID}"><i class="material-icons">share</i></a>
6565
6666
<div class="card share-card" id="global-sharebox-{ID}" style="display:none;">
6767
<div class="card-content shareurltext">
6868
<div class="shareurltitle">${_("Share")}</div>
6969
<input type="text" name="shareurl" class="shareurlinput" data-originalurl="https://musicblocks.sugarlabs.org/index.html?id={ID}">
7070
<a class="copyshareurl tooltipped" onclick="copyURLToClipboard()" data-clipboard-text="https://musicblocks.sugarlabs.org/index.html?id={ID}&run=True" data-delay="50" data-tooltip="${_(
71-
"Copy link to clipboard"
72-
)}"><i class="material-icons"alt="Copy!">file_copy</i></a>
71+
"Copy link to clipboard"
72+
)}"><i class="material-icons"alt="Copy!">file_copy</i></a>
7373
<div class="shareurl-advanced" id="global-advanced-{ID}">
7474
<div class="shareurltitle">${_("Flags")}</div>
7575
<div><input type="checkbox" name="run" id="global-checkboxrun-{ID}" checked><label for="global-checkboxrun-{ID}">${_(
76-
"Run project on startup."
77-
)}</label></div>
76+
"Run project on startup."
77+
)}</label></div>
7878
<div><input type="checkbox" name="show" id="global-checkboxshow-{ID}"><label for="global-checkboxshow-{ID}">${_(
79-
"Show code blocks on startup."
80-
)}</label></div>
79+
"Show code blocks on startup."
80+
)}</label></div>
8181
<div><input type="checkbox" name="collapse" id="global-checkboxcollapse-{ID}"><label for="global-checkboxcollapse-{ID}">${_(
82-
"Collapse code blocks on startup."
83-
)}</label></div>
82+
"Collapse code blocks on startup."
83+
)}</label></div>
8484
</div>
8585
</div>
8686
8787
<div class="card-action">
8888
<a onclick="toggleExpandable('global-advanced-{ID}','shareurl-advanced');">${_(
89-
"Advanced Options"
90-
)}</a>
89+
"Advanced Options"
90+
)}</a>
9191
</div>
9292
</div>
9393
</div>
@@ -132,43 +132,45 @@ class GlobalCard {
132132
}
133133

134134
// set title text
135-
frag.getElementById(`global-project-title-${this.id}`).textContent =
136-
this.ProjectData.ProjectName;
135+
frag.getElementById(
136+
`global-project-title-${this.id}`
137+
).textContent = this.ProjectData.ProjectName;
137138

138139
// set number of likes
139-
frag.getElementById(`global-project-likes-${this.id}`).textContent =
140-
this.ProjectData.ProjectLikes.toString();
140+
frag.getElementById(
141+
`global-project-likes-${this.id}`
142+
).textContent = this.ProjectData.ProjectLikes.toString();
141143

142144
// set view button listener
143145
// eslint-disable-next-line no-unused-vars
144146
frag.getElementById(`global-project-more-details-${this.id}`).addEventListener(
145147
"click",
146-
(evt) => {
148+
evt => {
147149
Planet.GlobalPlanet.ProjectViewer.open(this.id);
148150
}
149151
);
150152

151153
// set open button listener
152154
// eslint-disable-next-line no-unused-vars
153-
frag.getElementById(`global-project-open-${this.id}`).addEventListener("click", (evt) => {
155+
frag.getElementById(`global-project-open-${this.id}`).addEventListener("click", evt => {
154156
Planet.GlobalPlanet.openGlobalProject(this.id);
155157
});
156158

157159
// set image listener
158160
// eslint-disable-next-line no-unused-vars
159-
frag.getElementById(`global-project-image-${this.id}`).addEventListener("click", (evt) => {
161+
frag.getElementById(`global-project-image-${this.id}`).addEventListener("click", evt => {
160162
Planet.GlobalPlanet.ProjectViewer.open(this.id);
161163
});
162164

163165
// set merge modify listener
164166
// eslint-disable-next-line no-unused-vars
165-
frag.getElementById(`global-project-merge-${this.id}`).addEventListener("click", (evt) => {
167+
frag.getElementById(`global-project-merge-${this.id}`).addEventListener("click", evt => {
166168
Planet.GlobalPlanet.mergeGlobalProject(this.id);
167169
});
168170

169171
// set share button listener
170172
// eslint-disable-next-line no-unused-vars
171-
frag.getElementById(`global-project-share-${this.id}`).addEventListener("click", (evt) => {
173+
frag.getElementById(`global-project-share-${this.id}`).addEventListener("click", evt => {
172174
const s = document.getElementById(`global-sharebox-${this.id}`);
173175

174176
if (s.style.display == "none") {
@@ -182,20 +184,17 @@ class GlobalCard {
182184

183185
// set share checkbox listener
184186
// eslint-disable-next-line no-unused-vars
185-
frag.getElementById(`global-checkboxrun-${this.id}`).addEventListener("click", (evt) => {
187+
frag.getElementById(`global-checkboxrun-${this.id}`).addEventListener("click", evt => {
186188
updateCheckboxes(`global-sharebox-${this.id}`);
187189
});
188190
// eslint-disable-next-line no-unused-vars
189-
frag.getElementById(`global-checkboxshow-${this.id}`).addEventListener("click", (evt) => {
191+
frag.getElementById(`global-checkboxshow-${this.id}`).addEventListener("click", evt => {
190192
updateCheckboxes(`global-sharebox-${this.id}`);
191193
});
192194
// eslint-disable-next-line no-unused-vars
193-
frag.getElementById(`global-checkboxcollapse-${this.id}`).addEventListener(
194-
"click",
195-
(evt) => {
196-
updateCheckboxes(`global-sharebox-${this.id}`);
197-
}
198-
);
195+
frag.getElementById(`global-checkboxcollapse-${this.id}`).addEventListener("click", evt => {
196+
updateCheckboxes(`global-sharebox-${this.id}`);
197+
});
199198

200199
// set like icon
201200
const likeIconId = `global-like-icon-${this.id}`;
@@ -205,7 +204,7 @@ class GlobalCard {
205204
: "favorite_border";
206205

207206
// eslint-disable-next-line no-unused-vars
208-
frag.getElementById(`global-like-icon-${this.id}`).addEventListener("click", (evt) => {
207+
frag.getElementById(`global-like-icon-${this.id}`).addEventListener("click", evt => {
209208
this.like();
210209
});
211210

@@ -219,7 +218,7 @@ class GlobalCard {
219218
let like = true;
220219
if (Planet.ProjectStorage.isLiked(this.id)) like = false;
221220
this.likeTimeout = setTimeout(() => {
222-
Planet.ServerInterface.likeProject(this.id, like, (data) => {
221+
Planet.ServerInterface.likeProject(this.id, like, data => {
223222
this.afterLike(data, like);
224223
});
225224
}, 500);
@@ -255,13 +254,13 @@ class GlobalCard {
255254
function copyURLToClipboard() {
256255
const clipboard = new ClipboardJS(".copyshareurl");
257256

258-
clipboard.on("success", (e) => {
257+
clipboard.on("success", e => {
259258
// eslint-disable-next-line no-console
260259
console.info("Copied:", e.text);
261260
e.clearSelection();
262261
});
263262

264-
clipboard.on("error", (e) => {
263+
clipboard.on("error", e => {
265264
alert("Failed to copy!");
266265
// eslint-disable-next-line no-console
267266
console.error("Failed to copy:", e.action);

0 commit comments

Comments
 (0)