(ems) update template, don't enable run button till idbfs is synced

This commit is contained in:
radius 2016-09-24 22:32:02 -05:00
parent 3e182461d9
commit c790f452e7
4 changed files with 77 additions and 60 deletions

View File

@ -53,8 +53,7 @@ function cleanupStorage()
function dropboxInit()
{
document.getElementById('btnRun').disabled = true;
//document.getElementById('btnDrop').disabled = true;
//document.getElementById("btnDrop").disabled = true;
//$('#icnDrop').removeClass('fa-dropbox');
//$('#icnDrop').addClass('fa-spinner fa-spin');
@ -87,7 +86,6 @@ function dropboxSync(dropboxClient, cb)
function dropboxSyncComplete()
{
document.getElementById('btnRun').disabled = false;
//$('#icnDrop').removeClass('fa-spinner').removeClass('fa-spin');
//$('#icnDrop').addClass('fa-check');
console.log("WEBPLAYER: Dropbox sync successful");
@ -96,17 +94,11 @@ function dropboxSyncComplete()
preLoadingComplete();
}
function preLoadingComplete()
{
/* Make the Preview image clickable to start RetroArch. */
$('.webplayer-preview').addClass('loaded').click(function () {
startRetroArch();
return false;
});
}
function idbfsInit()
{
document.getElementById("btnLocal").disabled = true;
$('#icnLocal').removeClass('fa-globe');
$('#icnLocal').addClass('fa-spinner fa-spin');
var imfs = new BrowserFS.FileSystem.InMemory();
if (BrowserFS.FileSystem.IndexedDB.isAvailable())
{
@ -117,9 +109,9 @@ function idbfsInit()
{
//fallback to imfs
afs = new BrowserFS.FileSystem.InMemory();
console.log("WEBPLAYER: error: " + e + " falling back to in-memory filesystem");
setupFileSystem("browser");
preLoadingComplete();
console.log("WEBPLAYER: error: " + e + " falling back to in-memory filesystem");
}
else
{
@ -129,15 +121,13 @@ function idbfsInit()
if (e)
{
afs = new BrowserFS.FileSystem.InMemory();
console.log("WEBPLAYER: error: " + e + " falling back to in-memory filesystem");
setupFileSystem("browser");
preLoadingComplete();
console.log("WEBPLAYER: error: " + e + " falling back to in-memory filesystem");
}
else
{
console.log("WEBPLAYER: idbfs setup successful");
setupFileSystem("browser");
preLoadingComplete();
idbfsSyncComplete();
}
});
}
@ -146,6 +136,27 @@ function idbfsInit()
}
}
function idbfsSyncComplete()
{
$('#icnLocal').removeClass('fa-spinner').removeClass('fa-spin');
$('#icnLocal').addClass('fa-check');
console.log("WEBPLAYER: idbfs setup successful");
setupFileSystem("browser");
preLoadingComplete();
}
function preLoadingComplete()
{
/* Make the Preview image clickable to start RetroArch. */
$('.webplayer-preview').addClass('loaded').click(function () {
startRetroArch();
return false;
});
document.getElementById("btnRun").disabled = false;
$('#btnRun').removeClass('disabled');
}
function setupFileSystem(backend)
{
/* create a mountable filesystem that will server as a root
@ -193,8 +204,8 @@ function startRetroArch()
{
$('.webplayer').show();
$('.webplayer-preview').hide();
//document.getElementById('btnDrop').disabled = true;
document.getElementById('btnRun').disabled = true;
//document.getElementById("btnDrop").disabled = true;
document.getElementById("btnRun").disabled = true;
$('#btnFullscreen').removeClass('disabled');
$('#btnMenu').removeClass('disabled');
@ -347,13 +358,9 @@ $(function() {
// Load the Core's related JavaScript.
$.getScript(core + '_libretro.js', function ()
{
// Activate the Start RetroArch button.
$('#btnRun').removeClass('disabled');
$('#icnRun').removeClass('fa-spinner').removeClass('fa-spin');
$('#icnRun').addClass('fa-play');
document.getElementById("btnRun").disabled = false;
if (localStorage.getItem("backend") == "dropbox")
{
$('#lblDrop').addClass('active');

View File

@ -112,7 +112,7 @@
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-warning" id="lblLocal" onclick=switchStorage("browser")>
<input type="radio" name="options" id="btnLocal" autocomplete="off" checked>
<span class="fa fa-chrome" id="icnLocal"></span> Browser
<span class="fa fa-globe" id="icnLocal"></span> Browser
</input>
</label>
<!--uncomment for dropbox support

View File

@ -97,17 +97,9 @@ function dropboxSyncComplete()
preLoadingComplete();
}
function preLoadingComplete()
{
/* Make the Preview image clickable to start RetroArch. */
$('.webplayer-preview').addClass('loaded').click(function () {
startRetroArch();
return false;
});
}
function idbfsInit()
{
document.getElementById("btnRun").disabled = true;
var imfs = new BrowserFS.FileSystem.InMemory();
if (BrowserFS.FileSystem.IndexedDB.isAvailable())
{
@ -118,9 +110,9 @@ function idbfsInit()
{
//fallback to imfs
afs = new BrowserFS.FileSystem.InMemory();
console.log("WEBPLAYER: error: " + e + " falling back to in-memory filesystem");
setupFileSystem("browser");
preLoadingComplete();
console.log("WEBPLAYER: error: " + e + " falling back to in-memory filesystem");
}
else
{
@ -130,15 +122,13 @@ function idbfsInit()
if (e)
{
afs = new BrowserFS.FileSystem.InMemory();
console.log("WEBPLAYER: error: " + e + " falling back to in-memory filesystem");
setupFileSystem("browser");
preLoadingComplete();
console.log("WEBPLAYER: error: " + e + " falling back to in-memory filesystem");
}
else
{
console.log("WEBPLAYER: idbfs setup successful");
setupFileSystem("browser");
preLoadingComplete();
idbfsSyncComplete();
}
});
}
@ -147,6 +137,27 @@ function idbfsInit()
}
}
function idbfsSyncComplete()
{
$('#icnRun').removeClass('fa-spinner').removeClass('fa-spin');
$('#icnRun').addClass('fa-play');
console.log("WEBPLAYER: idbfs setup successful");
setupFileSystem("browser");
preLoadingComplete();
}
function preLoadingComplete()
{
/* Make the Preview image clickable to start RetroArch. */
$('.webplayer-preview').addClass('loaded').click(function () {
startRetroArch();
return false;
});
document.getElementById("btnRun").disabled = false;
$('#btnRun').removeClass('disabled');
}
function setupFileSystem(backend)
{
/* create a mountable filesystem that will server as a root
@ -344,13 +355,6 @@ $(function() {
// Load the Core's related JavaScript.
$.getScript(core + '_libretro.js', function ()
{
// Activate the Start RetroArch button.
$('#btnRun').removeClass('disabled');
$('#icnRun').removeClass('fa-spinner').removeClass('fa-spin');
$('#icnRun').addClass('fa-play');
document.getElementById("btnRun").disabled = false;
if (localStorage.getItem("backend") == "dropbox")
{
//$('#icnDrop').removeClass('fa-globe');

View File

@ -53,8 +53,7 @@ function cleanupStorage()
function dropboxInit()
{
document.getElementById('btnRun').disabled = true;
document.getElementById('btnDrop').disabled = true;
document.getElementById("btnDrop").disabled = true;
$('#icnDrop').removeClass('fa-dropbox');
$('#icnDrop').addClass('fa-spinner fa-spin');
@ -87,7 +86,6 @@ function dropboxSync(dropboxClient, cb)
function dropboxSyncComplete()
{
document.getElementById('btnRun').disabled = false;
$('#icnDrop').removeClass('fa-spinner').removeClass('fa-spin');
$('#icnDrop').addClass('fa-check');
console.log("WEBPLAYER: Dropbox sync successful");
@ -98,6 +96,9 @@ function dropboxSyncComplete()
function idbfsInit()
{
document.getElementById("btnLocal").disabled = true;
$('#icnLocal').removeClass('fa-globe');
$('#icnLocal').addClass('fa-spinner fa-spin');
var imfs = new BrowserFS.FileSystem.InMemory();
if (BrowserFS.FileSystem.IndexedDB.isAvailable())
{
@ -108,9 +109,9 @@ function idbfsInit()
{
//fallback to imfs
afs = new BrowserFS.FileSystem.InMemory();
console.log("WEBPLAYER: error: " + e + " falling back to in-memory filesystem");
setupFileSystem("browser");
preLoadingComplete();
console.log("WEBPLAYER: error: " + e + " falling back to in-memory filesystem");
}
else
{
@ -120,15 +121,13 @@ function idbfsInit()
if (e)
{
afs = new BrowserFS.FileSystem.InMemory();
console.log("WEBPLAYER: error: " + e + " falling back to in-memory filesystem");
setupFileSystem("browser");
preLoadingComplete();
console.log("WEBPLAYER: error: " + e + " falling back to in-memory filesystem");
}
else
{
console.log("WEBPLAYER: idbfs setup successful");
setupFileSystem("browser");
preLoadingComplete();
idbfsSyncComplete();
}
});
}
@ -137,6 +136,16 @@ function idbfsInit()
}
}
function idbfsSyncComplete()
{
$('#icnLocal').removeClass('fa-spinner').removeClass('fa-spin');
$('#icnLocal').addClass('fa-check');
console.log("WEBPLAYER: idbfs setup successful");
setupFileSystem("browser");
preLoadingComplete();
}
function preLoadingComplete()
{
/* Make the Preview image clickable to start RetroArch. */
@ -144,9 +153,10 @@ function preLoadingComplete()
startRetroArch();
return false;
});
document.getElementById("btnRun").disabled = false;
$('#btnRun').removeClass('disabled');
}
function setupFileSystem(backend)
{
/* create a mountable filesystem that will server as a root
@ -185,8 +195,8 @@ function startRetroArch()
{
$('.webplayer').show();
$('.webplayer-preview').hide();
document.getElementById('btnDrop').disabled = true;
document.getElementById('btnRun').disabled = true;
document.getElementById("btnDrop").disabled = true;
document.getElementById("btnRun").disabled = true;
$('#btnFullscreen').removeClass('disabled');
$('#btnMenu').removeClass('disabled');
@ -339,13 +349,9 @@ $(function() {
// Load the Core's related JavaScript.
$.getScript(core + '_libretro.js', function ()
{
// Activate the Start RetroArch button.
$('#btnRun').removeClass('disabled');
$('#icnRun').removeClass('fa-spinner').removeClass('fa-spin');
$('#icnRun').addClass('fa-play');
document.getElementById("btnRun").disabled = false;
if (localStorage.getItem("backend") == "dropbox")
{
$('#lblDrop').addClass('active');