hide top controls until UI loads completely

This commit is contained in:
Steven Hugg 2019-05-22 10:53:39 -04:00
parent d064f510bb
commit 9a19531f91
2 changed files with 18 additions and 8 deletions

View File

@ -44,6 +44,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<input type="file" id="uploadFileElem" multiple accept="*" style="display:none" onchange="handleFileUpload(this.files)">
<div id="controls_top" class="disable-select">
<div id="controls_dynamic" style="visibility:hidden">
<span class="dropdown">
<a class="btn dropdown-toggle toolbarMenuButton" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Menu">
<span class="glyphicon glyphicon-menu-hamburger" aria-hidden="true"></span>
@ -213,11 +214,10 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
</li>
</ul>
</span>
</div><!-- controls_dynamic -->
<span class="logo-gradient hidden-xs hidden-sm hidden-md pull-right" style="margin-left:auto">8bitworkshop</span>
</div><!-- controls_top -->
<span class="logo-gradient hidden-xs hidden-sm hidden-md pull-right" style="margin-left:auto">8bitworkshop</span>
<!--<span id="best_in_firefox" style="display:none;font-size:12px;font-style:italic;float:right;color:#666">Note: Works best in Firefox</span>-->
</div>
<div id="notebook">
<div id="sidebar">
<ul id="windowMenuList">

View File

@ -1720,9 +1720,14 @@ function startPlatform() {
addPageFocusHandlers();
installGAHooks();
showInstructions();
revealTopBar();
return true;
}
function revealTopBar() {
setTimeout(() => { $("#controls_dynamic").css('visibility','inherit'); }, 250);
}
export function loadScript(scriptfn, onload, onerror?) {
var script = document.createElement('script');
script.onload = onload;
@ -1831,6 +1836,7 @@ export function startUI(loadplatform : boolean) {
loadAndStartPlatform();
} else {
startPlatform();
revealTopBar();
}
});
}
@ -1838,10 +1844,14 @@ export function startUI(loadplatform : boolean) {
function loadAndStartPlatform() {
var scriptfn = 'gen/platform/' + platform_id.split(/[.-]/)[0] + '.js';
loadScript(scriptfn, () => {
console.log("loaded platform", platform_id);
startPlatform();
showWelcomeMessage();
document.title = document.title + " [" + platform_id + "] - " + (repo_id?('['+repo_id+'] - '):'') + current_project.mainPath;
console.log("starting platform", platform_id);
try {
startPlatform();
showWelcomeMessage();
document.title = document.title + " [" + platform_id + "] - " + (repo_id?('['+repo_id+'] - '):'') + current_project.mainPath;
} finally {
revealTopBar();
}
}, () => {
alertError('Platform "' + platform_id + '" not supported.');
});