add compat file viewer

This commit is contained in:
2020-01-28 12:51:21 +01:00
parent cb4082fd44
commit 8151aaa18e
23 changed files with 552 additions and 702 deletions

View File

@@ -1,33 +1,33 @@
function AudioViewer(viewer, file, next) {let v = this;
v.viewer = viewer;
v.file = file;
v.next = next;
function AudioViewer(viewer, file, next) {
this.viewer = viewer;
this.file = file;
this.next = next;
v.container = document.createElement("div");
v.container.classList = "image-container";
v.container.appendChild(document.createElement("br"));
this.container = document.createElement("div");
this.container.classList = "image-container";
this.container.appendChild(document.createElement("br"));
v.icon = document.createElement("img");
v.icon.src = "/res/img/mime/audio.png";
v.container.appendChild(v.icon);
this.icon = document.createElement("img");
this.icon.src = "/res/img/mime/audio.png";
this.container.appendChild(this.icon);
v.container.appendChild(document.createElement("br"));
v.container.appendChild(document.createTextNode(file.name));
v.container.appendChild(document.createElement("br"));
v.container.appendChild(document.createElement("br"));
this.container.appendChild(document.createElement("br"));
this.container.appendChild(document.createTextNode(file.name));
this.container.appendChild(document.createElement("br"));
this.container.appendChild(document.createElement("br"));
v.element = document.createElement("audio");
v.element.autoplay = "autoplay";
v.element.controls = "controls";
v.element.style.width = "90%";
v.element.addEventListener("ended", () => { v.next(); }, false);
this.element = document.createElement("audio");
this.element.autoplay = "autoplay";
this.element.controls = "controls";
this.element.style.width = "90%";
this.element.addEventListener("ended", () => { this.next(); }, false);
v.source = document.createElement("source");
v.source.src = apiEndpoint+"/file/"+v.file.id;
v.element.appendChild(v.source);
v.container.appendChild(v.element);
this.source = document.createElement("source");
this.source.src = apiEndpoint+"/file/"+this.file.id;
this.element.appendChild(this.source);
this.container.appendChild(this.element);
}
AudioViewer.prototype.render = function(parent) {let v = this;
parent.appendChild(v.container);
AudioViewer.prototype.render = function(parent) {
parent.appendChild(this.container);
}