Skip to content

Commit b8eaacc

Browse files
authored
Merge branch 'master' into refactor/code-quality-improvements
2 parents eeab664 + dacbb46 commit b8eaacc

24 files changed

+1383
-741
lines changed

CONTRIBUTING.md

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## <a name="CONTRIBUTING"></a>Contributing
22

33
We welcome contributions of all kinds — whether it’s code,
4-
documentation, music, lesson plans, artwork, or ideas. Music Blocks
4+
documentation, music, lesson plans, artwork, or ideas. Music Blocks
55
is a community-driven project, and every meaningful contribution helps
66
improve the platform for learners and educators around the world.
77

@@ -11,7 +11,6 @@ open issues or discussions to find a place to contribute.
1111

1212
- [How to set up a local server](README.md#how-to-set-up-a-local-server)
1313

14-
1514
### Special Notes
1615

1716
Music Blocks is being built from the ground-up, to address several
@@ -53,7 +52,6 @@ following resources:
5352
Programmers, please follow these general [guidelines for
5453
contributions](https://github.com/sugarlabs/sugar-docs/blob/master/src/contributing.md).
5554

56-
5755
### Before You Push
5856

5957
Run these commands locally before submitting a PR:
@@ -64,8 +62,20 @@ npx prettier --check . # Formatting
6462
npm test # Jest
6563
```
6664

65+
NOTE: Only run ```prettier``` on the files you have modified.
66+
6767
If formatting fails, run `npx prettier --write .` to fix it.
6868

69+
### After your PR is merged
70+
71+
Please note that production deployments of Music Blocks are **manual**.
72+
73+
This means that even after your pull request is merged, your changes may not immediately appear. Your update will become visible after the next official release is deployed.
74+
75+
If your changes are not visible right away, it does **not** indicate a problem with your PR or implementation.
76+
77+
This note is included to prevent contributors from spending time debugging caching or deployment issues unnecessarily.
78+
6979
### License Header
7080

7181
Music Blocks is licensed under the [AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html).
@@ -129,60 +139,60 @@ Feel free. But, please don't spam :p.
129139
### Keep in Mind
130140

131141
1. Your contributions need not necessarily have to address any
132-
discovered issue. If you encounter any, feel free to add a fix through
133-
a PR, or create a new issue ticket.
142+
discovered issue. If you encounter any, feel free to add a fix through
143+
a PR, or create a new issue ticket.
134144

135145
2. Use [labels](https://github.com/sugarlabs/musicblocks/labels) on
136-
your issues and PRs.
146+
your issues and PRs.
137147

138148
3. Please do not spam with many PRs consisting of little changes.
139149

140150
4. If you are addressing a bulk change, divide your commits across
141-
multiple PRs, and send them one at a time. The fewer the number of
142-
files addressed per PR, the better.
151+
multiple PRs, and send them one at a time. The fewer the number of
152+
files addressed per PR, the better.
143153

144154
5. Communicate effectively. Go straight to the point. You don't need
145-
to address anyone using '_sir_'. Don't write unnecessary comments;
146-
don't be over-apologetic. There is no superiority hierarchy. Every
147-
single contribution is welcome, as long as it doesn't spam or distract
148-
the flow.
155+
to address anyone using '_sir_'. Don't write unnecessary comments;
156+
don't be over-apologetic. There is no superiority hierarchy. Every
157+
single contribution is welcome, as long as it doesn't spam or distract
158+
the flow.
149159

150160
6. Write useful, brief commit messages. Add commit descriptions if
151-
necessary. PR name should speak about what it is addressing and not
152-
the issue. In case a PR fixes an issue, use `fixes #ticketno` or
153-
`closes #ticketno` in the PR's comment. Briefly explain what your PR
154-
is doing.
161+
necessary. PR name should speak about what it is addressing and not
162+
the issue. In case a PR fixes an issue, use `fixes #ticketno` or
163+
`closes #ticketno` in the PR's comment. Briefly explain what your PR
164+
is doing.
155165

156166
7. Always test your changes extensively before creating a PR. There's
157-
no sense in merging broken code. If a PR is a _work in progress
158-
(WIP)_, convert it to draft. It'll let the maintainers know it isn't
159-
ready for merging.
167+
no sense in merging broken code. If a PR is a _work in progress
168+
(WIP)_, convert it to draft. It'll let the maintainers know it isn't
169+
ready for merging.
160170

161171
8. Read and revise the concepts about programming constructs you're
162-
dealing with. You must be clear about the behavior of the language or
163-
compiler/transpiler. See [JavaScript
164-
docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript).
172+
dealing with. You must be clear about the behavior of the language or
173+
compiler/transpiler. See [JavaScript
174+
docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript).
165175

166176
9. If you have a question, do a _web search_ first. If you don't find
167-
any satisfactory answer, then ask it in a comment. If it is a general
168-
question about Music Blocks, please use the new
169-
[discussions](https://github.com/sugarlabs/musicblocks/discussions)
170-
tab on top the the repository, or the _Sugar-dev Devel
171-
<[sugar-devel@lists.sugarlabs.org](mailto:sugar-devel@lists.sugarlabs.org)>_
172-
mailing list. Don't ask silly questions (unless you don't know it is
173-
silly ;p) before searching it on the web.
177+
any satisfactory answer, then ask it in a comment. If it is a general
178+
question about Music Blocks, please use the new
179+
[discussions](https://github.com/sugarlabs/musicblocks/discussions)
180+
tab on top the the repository, or the _Sugar-dev Devel
181+
<[sugar-devel@lists.sugarlabs.org](mailto:sugar-devel@lists.sugarlabs.org)>_
182+
mailing list. Don't ask silly questions (unless you don't know it is
183+
silly ;p) before searching it on the web.
174184

175185
10. Work on things that matter. Follow three milestones: `Port Ready`,
176-
`Migration`, and `Future`. Those tagged `Port Ready` are
177-
priority. Those tagged with `Migration` will be taken care of during
178-
or after the foundation rebuild. Feel free to participate in the
179-
conversation, adding valuable comments. Those tagged with `Future`
180-
need not be addressed presently.
186+
`Migration`, and `Future`. Those tagged `Port Ready` are
187+
priority. Those tagged with `Migration` will be taken care of during
188+
or after the foundation rebuild. Feel free to participate in the
189+
conversation, adding valuable comments. Those tagged with `Future`
190+
need not be addressed presently.
181191

182192
_Please note there is no need to ask permission to work on an
183193
issue. You should check for pull requests linked to an issue you are
184194
addressing; if there are none, then assume nobody has done
185195
anything. Begin to fix the problem, test, make your commits, push your
186196
commits, then make a pull request. Mention an issue number in the pull
187197
request, but not the commit message. These practices allow the
188-
competition of ideas (Sugar Labs is a meritocracy)._
198+
competition of ideas (Sugar Labs is a meritocracy)._

index.html

Lines changed: 116 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,79 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8" />
5-
<title>Music Blocks</title>
63

7-
<meta
8-
name="description"
9-
content="Learn to code through music with Music Blocks. Arrange colorful blocks to create everything from simple melodies to interactive games."
10-
/>
11-
<meta name="mobile-web-app-capable" content="yes" />
12-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
13-
<meta id="theme-color" name="theme-color" content="#2196F3" />
14-
15-
<!-- Icons & PWA -->
16-
<link rel="icon" sizes="192x192" href="favicon.ico" />
17-
<link rel="apple-touch-icon" href="/activity/activity-icon-color-512.png" />
18-
<link rel="manifest" href="android_chrome_manifest.json" />
19-
20-
<!-- Stylesheets -->
21-
<link
22-
rel="preload"
23-
href="https://fonts.googleapis.com/icon?family=Material+Icons"
24-
as="style"
25-
onload="this.onload=null;this.rel='stylesheet'"
26-
/>
27-
<link
28-
rel="preload"
29-
href="fonts/material-icons.css"
30-
as="style"
31-
onload="this.onload=null;this.rel='stylesheet'"
32-
/>
33-
<link
34-
rel="preload"
35-
href="css/activities.css?v=fixed"
36-
as="style"
37-
onload="this.onload=null;this.rel='stylesheet'"
38-
/>
39-
<link
40-
rel="preload"
41-
href="dist/css/style.css"
42-
as="style"
43-
onload="this.onload=null;this.rel='stylesheet'"
44-
/>
45-
<link
46-
rel="preload"
47-
href="dist/css/keyboard.css"
48-
as="style"
49-
onload="this.onload=null;this.rel='stylesheet'"
50-
/>
51-
<link
52-
rel="preload"
53-
href="dist/css/windows.css"
54-
as="style"
55-
onload="this.onload=null;this.rel='stylesheet'"
56-
/>
57-
<link
58-
rel="preload"
59-
href="lib/materialize-iso.css"
60-
as="style"
61-
onload="this.onload=null;this.rel='stylesheet'"
62-
/>
63-
<link
64-
rel="preload"
65-
href="css/darkmode.css"
66-
as="style"
67-
onload="this.onload=null;this.rel='stylesheet'"
68-
/>
69-
<link rel="prefetch" as="video" href="loading-animation.webm" type="video/webm" />
70-
<link rel="prefetch" as="video" href="loading-animation.mp4" type="video/mp4" />
71-
<link rel="prefetch" as="image" href="loading-animation-ja.svg" />
72-
73-
<!-- <script src="js/utils/detectIE.js"></script> -->
74-
75-
<!-- <script src="sounds/samples/manifest.js"></script> -->
76-
77-
<!-- <script src="lib/mespeak.js"></script> -->
78-
79-
<script src="lib/reqwest.js" defer></script>
80-
81-
<script src="lib/jquery-3.7.1.min.js"></script>
82-
<script src="lib/jquery-ui.js"></script>
83-
<script src="lib/materialize.min.js"></script>
84-
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css" />
85-
<script>
86-
jQuery(document).ready(function () {
87-
if (jQuery.ui && jQuery.ui.autocomplete) {
88-
jQuery.fn.materializeAutocomplete = jQuery.fn.autocomplete;
89-
jQuery.widget.bridge("autocomplete", jQuery.ui.autocomplete);
4+
<head>
5+
<meta charset="UTF-8">
6+
<title>Music Blocks</title>
7+
8+
<meta name="description"
9+
content="Learn to code through music with Music Blocks. Arrange colorful blocks to create everything from simple melodies to interactive games.">
10+
<meta name="mobile-web-app-capable" content="yes">
11+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
12+
<meta id="theme-color" name="theme-color" content="#2196F3">
13+
14+
<!-- Icons & PWA -->
15+
<link rel="icon" sizes="192x192" href="favicon.ico">
16+
<link rel="apple-touch-icon" href="/activity/activity-icon-color-512.png">
17+
<link rel="manifest" href="android_chrome_manifest.json">
18+
19+
<!-- Stylesheets -->
20+
<link rel="preload" href="https://fonts.googleapis.com/icon?family=Material+Icons" as="style"
21+
onload="this.onload=null;this.rel='stylesheet'">
22+
<link rel="preload" href="fonts/material-icons.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
23+
<link rel="preload" href="css/activities.css?v=fixed" as="style" onload="this.onload=null;this.rel='stylesheet'">
24+
<link rel="preload" href="dist/css/style.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
25+
<link rel="preload" href="dist/css/keyboard.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
26+
<link rel="preload" href="dist/css/windows.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
27+
<link rel="preload" href="lib/materialize-iso.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
28+
<link rel="preload" href="css/darkmode.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
29+
<link rel="prefetch" as="video" href="loading-animation.webm" type="video/webm">
30+
<link rel="prefetch" as="video" href="loading-animation.mp4" type="video/mp4">
31+
32+
<!-- <script src="js/utils/detectIE.js"></script> -->
33+
34+
<!-- <script src="sounds/samples/manifest.js"></script> -->
35+
36+
<!-- <script src="lib/mespeak.js"></script> -->
37+
38+
<script src="lib/reqwest.js" defer></script>
39+
40+
<script src="lib/jquery-3.7.1.min.js"></script>
41+
<script src="lib/jquery-ui.js"></script>
42+
<script src="lib/materialize.min.js"></script>
43+
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
44+
<script>
45+
jQuery(document).ready(function () {
46+
if (jQuery.ui && jQuery.ui.autocomplete) {
47+
jQuery.fn.materializeAutocomplete = jQuery.fn.autocomplete;
48+
jQuery.widget.bridge("autocomplete", jQuery.ui.autocomplete);
49+
}
50+
});
51+
</script>
52+
<script>
53+
jQuery(document).ready(function () {
54+
const fixAutocompletePosition = function () {
55+
const $search = jQuery('#search');
56+
if ($search.length && $search.data('ui-autocomplete')) {
57+
const instance = $search.autocomplete('instance');
58+
if (instance) {
59+
const originalRenderMenu = instance._renderMenu;
60+
instance._renderMenu = function (ul, items) {
61+
originalRenderMenu.call(this, ul, items);
62+
setTimeout(() => {
63+
const searchInput = document.querySelector('#search');
64+
const dropdown = ul[0];
65+
if (searchInput && dropdown) {
66+
const rect = searchInput.getBoundingClientRect();
67+
dropdown.style.position = 'fixed';
68+
dropdown.style.left = rect.left + 'px';
69+
dropdown.style.top = (rect.bottom + 2) + 'px';
70+
dropdown.style.width = rect.width + 'px';
71+
}
72+
}, 0);
73+
};
74+
}
75+
} else {
76+
setTimeout(fixAutocompletePosition, 500);
9077
}
9178
});
9279
</script>
@@ -962,34 +949,49 @@
962949
});
963950
</script>
964951

965-
<script>
966-
$(document).ready(function () {
967-
// doSearch is a method on the Activity instance, not a global.
968-
// Wait for globalActivity to be available before calling it.
969-
function tryDoSearch() {
970-
const activity = globalActivity || window.activity;
971-
if (activity && typeof activity.doSearch === "function") {
972-
activity.doSearch();
973-
} else if (typeof doSearch === "function") {
974-
doSearch();
975-
} else {
976-
// Activity not loaded yet, retry later
977-
setTimeout(tryDoSearch, 500);
978-
}
979-
}
980-
tryDoSearch();
981-
});
982-
</script>
983-
984-
<!-- Loading Dialog Script -->
985-
<script>
986-
document.addEventListener("DOMContentLoaded", function () {
987-
let loadL10nSplashScreen = function () {
988-
console.debug("The browser is set to " + navigator.language);
989-
let lang = navigator.language;
990-
if (localStorage.languagePreference) {
991-
console.debug("Music Blocks is set to " + localStorage.languagePreference);
992-
lang = localStorage.languagePreference;
952+
const container = document.getElementById("loading-media");
953+
const content = lang.startsWith("ja")
954+
? `<img src="loading-animation-ja.png" loading="eager" fetchpriority="high" style="width: 70%; height: 90%; object-fit: contain;" alt="Loading animation">`
955+
: `<video loop autoplay muted playsinline fetchpriority="high" style="width: 90%; height: 100%; object-fit: contain;">
956+
<source src="loading-animation.webm" type="video/webm">
957+
<source src="loading-animation.mp4" type="video/mp4">
958+
</video>`;
959+
container.innerHTML = `<div class="media-wrapper" style="width: 100%; aspect-ratio: 16/9; max-height: 500px; display: flex; justify-content: center; align-items: center;">${content}</div>`;
960+
};
961+
962+
loadL10nSplashScreen();
963+
964+
setTimeout(function () {
965+
const loadingText = document.getElementById("loadingText");
966+
const texts = [_("Do, Re, Mi, Fa, Sol, La, Ti, Do"), _("Loading Music Blocks..."), _("Reading Music...")];
967+
let index = 0;
968+
969+
window.intervalId = setInterval(function () {
970+
loadingText.textContent = texts[index];
971+
index = (index + 1) % texts.length;
972+
}, 1500);
973+
}, 3000);
974+
});
975+
976+
</script>
977+
978+
<script>
979+
(function ($) {
980+
$.fn.fixMe = function () {
981+
return this.each(function () {
982+
let $this = $(this),
983+
$t_fixed;
984+
985+
function init() {
986+
$this.wrap('<div class="container" />');
987+
$t_fixed = $this.clone();
988+
$t_fixed
989+
.find("tbody")
990+
.remove()
991+
.end()
992+
.addClass("fixed")
993+
.insertBefore($this);
994+
resizeFixed();
993995
}
994996

995997
console.debug("Using " + lang);

0 commit comments

Comments
 (0)