Skip to content

Commit 80d6413

Browse files
committed
Fixed scrollUp and undefined var root in generateInfoPanel
1 parent eeb765f commit 80d6413

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

build/nodegame-window.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -871,8 +871,8 @@
871871
*
872872
* @emit INFOPANEL_GENERATED
873873
*/
874-
GameWindow.prototype.generateInfoPanel = function(root, options, force) {
875-
var infoPanelDiv;
874+
GameWindow.prototype.generateInfoPanel = function(options, force) {
875+
var infoPanelDiv, root;
876876

877877
if (this.infoPanel) {
878878
if (!force) {
@@ -1562,6 +1562,7 @@
15621562
var that;
15631563
var loadCache;
15641564
var storeCacheNow, storeCacheLater;
1565+
var scrollUp;
15651566
var autoParse, autoParsePrefix, autoParseMod;
15661567
var iframe, iframeName, iframeDocument, iframeWindow;
15671568
var frameDocumentElement, frameReady;
@@ -1645,6 +1646,8 @@
16451646
}
16461647
}
16471648

1649+
// Parsing options.
1650+
16481651
if ('undefined' !== typeof opts.autoParse) {
16491652
if ('object' !== typeof opts.autoParse) {
16501653
throw new TypeError('GameWindow.loadFrame: opts.autoParse ' +
@@ -1672,6 +1675,10 @@
16721675
autoParse = opts.autoParse;
16731676
}
16741677

1678+
// Scroll Up.
1679+
1680+
scrollUp = 'undefined' === typeof opts.scrollUp ? true : opts.scrollUp;
1681+
16751682
// Store unprocessed uri parameter.
16761683
this.unprocessedUri = uri;
16771684

@@ -1742,7 +1749,8 @@
17421749
that.updateLoadFrameState(func,
17431750
autoParse,
17441751
autoParseMod,
1745-
autoParsePrefix);
1752+
autoParsePrefix,
1753+
scrollUp);
17461754
});
17471755
});
17481756
}
@@ -1763,7 +1771,8 @@
17631771
that.updateLoadFrameState(func,
17641772
autoParse,
17651773
autoParseMod,
1766-
autoParsePrefix);
1774+
autoParsePrefix,
1775+
scrollUp);
17671776
});
17681777
}
17691778
}
@@ -1814,6 +1823,8 @@
18141823
* @param {string} autoParseMod Optional. Modifier for search and replace
18151824
* @param {string} autoParsePrefix Optional. Custom prefix to add to the
18161825
* keys of the elements in autoParse object
1826+
* @param {boolean} scrollUp Optional. If TRUE, scrolls the page to the,
1827+
* top (if window.scrollTo is defined). Default: FALSE.
18171828
*
18181829
* @see GameWindow.searchReplace
18191830
* @see updateAreLoading
@@ -1823,7 +1834,8 @@
18231834
*/
18241835
GameWindow.prototype.updateLoadFrameState = function(func, autoParse,
18251836
autoParseMod,
1826-
autoParsePrefix) {
1837+
autoParsePrefix,
1838+
scrollUp) {
18271839

18281840
var loaded, stageLevel;
18291841
loaded = updateAreLoading(this, -1);
@@ -1832,6 +1844,7 @@
18321844
if (autoParse) {
18331845
this.searchReplace(autoParse, autoParseMod, autoParsePrefix);
18341846
}
1847+
if (scrollUp && window.scrollTo) window.scrollTo(0,0);
18351848

18361849
// ng event emitter is not used.
18371850
node.events.ee.game.emit('FRAME_LOADED');

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/GameWindow.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -871,8 +871,8 @@
871871
*
872872
* @emit INFOPANEL_GENERATED
873873
*/
874-
GameWindow.prototype.generateInfoPanel = function(root, options, force) {
875-
var infoPanelDiv;
874+
GameWindow.prototype.generateInfoPanel = function(options, force) {
875+
var infoPanelDiv, root;
876876

877877
if (this.infoPanel) {
878878
if (!force) {
@@ -1677,7 +1677,7 @@
16771677

16781678
// Scroll Up.
16791679

1680-
scrollUp = 'undefined' !== typeof opts.scrollUp ? true : opts.scrollUp;
1680+
scrollUp = 'undefined' === typeof opts.scrollUp ? true : opts.scrollUp;
16811681

16821682
// Store unprocessed uri parameter.
16831683
this.unprocessedUri = uri;

0 commit comments

Comments
 (0)