navigator.share

This commit is contained in:
2019-06-04 20:14:25 +02:00
parent 1261563f31
commit 0b8d67a8eb
4 changed files with 17 additions and 6 deletions

View File

@@ -110,10 +110,20 @@ var Toolbar = {
}
};
var Sharebar = {
visible: false,
toggle: function(){
if (navigator.share) {
navigator.share({
title: Viewer.title,
text: "Get this file from Pixeldrain!",
url: window.location.href
});
return;
}
if (!Toolbar.visible){
Toolbar.toggle();
}

View File

@@ -2,6 +2,7 @@
var Viewer = {
currentFile: "",
title: "", // Contains either the file name or list title
listId: "",
isList: false,
isFile: false,
@@ -14,18 +15,18 @@ var Viewer = {
// On small screens the toolbar takes too much space, so it collapses automatically
if($("#filepreview").width() < 400 && Toolbar.visible){
window.setTimeout(function(){
Toolbar.toggle();
}, 800);
Toolbar.toggle();
}
if(type === "file"){
this.isFile = true;
this.currentFile = data.id;
this.title = data.name;
this.setFile(data);
} else if (type === "list") {
this.isList = true;
this.listId = data.id;
this.title = data.title;
ListNavigator.init(data.data);
}

View File

@@ -314,7 +314,7 @@ var UploadWorker = /** @class */ (function () {
};
UploadWorker.prototype.newFile = function () {
var file = this.manager.grabFile();
if (file === undefined) { // No more files in the queue. We're finished
if (file === undefined) {
this.uploading = false;
console.debug("No files left in queue");
return; // Stop the thread