Skip to content

Commit c16fcb3

Browse files
committed
loadingDot does not change in size
1 parent bf2e0b4 commit c16fcb3

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

build/nodegame-window.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4337,24 +4337,25 @@
43374337
* and a method stop, that clears the interval
43384338
*/
43394339
GameWindow.prototype.getLoadingDots = function(len, id) {
4340-
var spanDots, i, limit, intervalId;
4340+
var spanDots, counter, intervalId;
43414341
if (len & len < 0) {
43424342
throw new Error('GameWindow.getLoadingDots: len cannot be < 0. ' +
43434343
'Found: ' + len);
43444344
}
4345-
len = len || 5;
43464345
spanDots = document.createElement('span');
43474346
spanDots.id = id || 'span_dots';
4348-
limit = '';
4349-
for (i = 0; i < len; i++) {
4350-
limit = limit + '.';
4351-
}
43524347
// Refreshing the dots...
4348+
counter = 0;
4349+
len = len || 5;
4350+
// So the height does not change.
4351+
spanDots.innerHTML = '&nbsp;';
43534352
intervalId = setInterval(function() {
4354-
if (spanDots.innerHTML !== limit) {
4353+
if (counter < len) {
4354+
counter++;
43554355
spanDots.innerHTML = spanDots.innerHTML + '.';
43564356
}
43574357
else {
4358+
counter = 0;
43584359
spanDots.innerHTML = '.';
43594360
}
43604361
}, 1000);
@@ -4559,13 +4560,15 @@
45594560
// Only process strings or numbers.
45604561
if ('string' !== typeof search && 'number' !== typeof search) {
45614562
throw new TypeError('GameWindow.setInnerHTML: search must be ' +
4562-
'string or number. Found: ' + search);
4563+
'string or number. Found: ' + search +
4564+
" (replace = " + replace + ")");
45634565
}
45644566

45654567
// Only process strings or numbers.
45664568
if ('string' !== typeof replace && 'number' !== typeof replace) {
45674569
throw new TypeError('GameWindow.setInnerHTML: replace must be ' +
4568-
'string or number. Found: ' + replace);
4570+
'string or number. Found: ' + replace +
4571+
" (search = " + search + ")");
45694572
}
45704573

45714574
if ('undefined' === typeof mod) {
@@ -4574,12 +4577,14 @@
45744577
else if ('string' === typeof mod) {
45754578
if (mod !== 'g' && mod !== 'id' && mod !== 'className') {
45764579
throw new Error('GameWindow.setInnerHTML: invalid ' +
4577-
'mod value: ' + mod);
4580+
'mod value: ' + mod +
4581+
" (search = " + search + ")");
45784582
}
45794583
}
45804584
else {
45814585
throw new TypeError('GameWindow.setInnerHTML: mod must be ' +
4582-
'string or undefined. Found: ' + mod);
4586+
'string or undefined. Found: ' + mod +
4587+
" (search = " + search + ")");
45834588
}
45844589

45854590
if (mod === 'id' || mod === 'g') {

build/nodegame-window.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/modules/extra.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,24 +221,25 @@
221221
* and a method stop, that clears the interval
222222
*/
223223
GameWindow.prototype.getLoadingDots = function(len, id) {
224-
var spanDots, i, limit, intervalId;
224+
var spanDots, counter, intervalId;
225225
if (len & len < 0) {
226226
throw new Error('GameWindow.getLoadingDots: len cannot be < 0. ' +
227227
'Found: ' + len);
228228
}
229-
len = len || 5;
230229
spanDots = document.createElement('span');
231230
spanDots.id = id || 'span_dots';
232-
limit = '';
233-
for (i = 0; i < len; i++) {
234-
limit = limit + '.';
235-
}
236231
// Refreshing the dots...
232+
counter = 0;
233+
len = len || 5;
234+
// So the height does not change.
235+
spanDots.innerHTML = '&nbsp;';
237236
intervalId = setInterval(function() {
238-
if (spanDots.innerHTML !== limit) {
237+
if (counter < len) {
238+
counter++;
239239
spanDots.innerHTML = spanDots.innerHTML + '.';
240240
}
241241
else {
242+
counter = 0;
242243
spanDots.innerHTML = '.';
243244
}
244245
}, 1000);

0 commit comments

Comments
 (0)