Remove 'My Files' tab for now - it slowed down app uploads, may have confused non-techy users, and didn't cope with StorageFile.
https://www.espruino.com/ide/ now has a shiny file loader that allows viewing, deleting, and saving along with StorageFiles Issue open for 2 weeks and no interest either way so I'm assuming this is ok - shame though as it was a really neat addition (fix #99).master
parent
cea2c9f7ba
commit
d1fe3c5c97
18
index.html
18
index.html
|
|
@ -56,9 +56,6 @@
|
||||||
<li class="tab-item" id="tab-myappscontainer">
|
<li class="tab-item" id="tab-myappscontainer">
|
||||||
<a href="javascript:showTab('myappscontainer')">My Apps</a>
|
<a href="javascript:showTab('myappscontainer')">My Apps</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="tab-item" id="tab-myfscontainer">
|
|
||||||
<a href="javascript:showTab('myfscontainer')">My files</a>
|
|
||||||
</li>
|
|
||||||
<li class="tab-item" id="tab-aboutcontainer">
|
<li class="tab-item" id="tab-aboutcontainer">
|
||||||
<a href="javascript:showTab('aboutcontainer')">About</a>
|
<a href="javascript:showTab('aboutcontainer')">About</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
@ -96,21 +93,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container bangle-tab" id="myfscontainer" style="display:none">
|
|
||||||
<div class="panel">
|
|
||||||
<div class="panel-header column col-12 container">
|
|
||||||
<div class="columns col-gapless">
|
|
||||||
<p class="column col-9">Files currently stored on the watch. Click row to download.</p>
|
|
||||||
<div class="column col-3" style="text-align:right">
|
|
||||||
<button class="btn refresh">Refresh...</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<table class="table table-striped table-hover panel-body">
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container bangle-tab" id="aboutcontainer" style="display:none">
|
<div class="container bangle-tab" id="aboutcontainer" style="display:none">
|
||||||
<div class="hero bg-gray">
|
<div class="hero bg-gray">
|
||||||
<div class="hero-body">
|
<div class="hero-body">
|
||||||
|
|
|
||||||
45
index.js
45
index.js
|
|
@ -413,7 +413,6 @@ return `<div class="tile column col-6 col-sm-12 col-xs-12">
|
||||||
|
|
||||||
function getInstalledApps() {
|
function getInstalledApps() {
|
||||||
showLoadingIndicator("myappscontainer");
|
showLoadingIndicator("myappscontainer");
|
||||||
showLoadingIndicator("myfscontainer");
|
|
||||||
// Get apps and files
|
// Get apps and files
|
||||||
return Comms.getInstalledApps()
|
return Comms.getInstalledApps()
|
||||||
.then(appJSON => {
|
.then(appJSON => {
|
||||||
|
|
@ -421,11 +420,6 @@ function getInstalledApps() {
|
||||||
refreshMyApps();
|
refreshMyApps();
|
||||||
refreshLibrary();
|
refreshLibrary();
|
||||||
})
|
})
|
||||||
.then(Comms.listFiles)
|
|
||||||
.then(list => {
|
|
||||||
files = list;
|
|
||||||
refreshMyFS();
|
|
||||||
})
|
|
||||||
.then(() => handleConnectionChange(true));
|
.then(() => handleConnectionChange(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -470,45 +464,6 @@ librarySearchInput.addEventListener('input', evt => {
|
||||||
refreshLibrary();
|
refreshLibrary();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// =========================================== My Files
|
|
||||||
|
|
||||||
function refreshMyFS() {
|
|
||||||
var panelbody = document.querySelector("#myfscontainer .panel-body");
|
|
||||||
var tab = document.querySelector("#tab-myfscontainer a");
|
|
||||||
tab.setAttribute("data-badge", files.length);
|
|
||||||
panelbody.innerHTML = `
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Type</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>${
|
|
||||||
files.map(file =>
|
|
||||||
`<tr data-name="${file}"><td>${escapeHtml(file)}</td><td>${fileType(file).name}</td></li>`
|
|
||||||
).join("")}
|
|
||||||
</tbody>`;
|
|
||||||
|
|
||||||
htmlToArray(panelbody.getElementsByTagName("tr")).forEach(row => {
|
|
||||||
row.addEventListener("click",event => {
|
|
||||||
var name = event.target.closest('tr').dataset.name;
|
|
||||||
const type = fileType(name);
|
|
||||||
Comms.readFile(name).then(content => content.length && saveAs(new Blob([content], type), name));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function fileType(file) {
|
|
||||||
switch (file[0]) {
|
|
||||||
case "+": return { name: "App descriptor", type: "application/json;charset=utf-8" };
|
|
||||||
case "*": return { name: "App icon", type: "text/plain;charset=utf-8" };
|
|
||||||
case "-": return { name: "App code", type: "application/javascript;charset=utf-8" };
|
|
||||||
case "=": return { name: "Boot-time code", type: "application/javascript;charset=utf-8" };
|
|
||||||
default: return { name: "Plain", type: "text/plain;charset=utf-8" };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// =========================================== About
|
// =========================================== About
|
||||||
|
|
||||||
document.getElementById("settime").addEventListener("click",event=>{
|
document.getElementById("settime").addEventListener("click",event=>{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue