2020-01-28 12:51:21 +01:00
|
|
|
function FileViewer(viewer, file, next) {
|
2020-02-04 19:37:46 +01:00
|
|
|
this.viewer = viewer
|
|
|
|
this.file = file
|
|
|
|
this.next = next
|
2020-01-21 15:33:09 +01:00
|
|
|
|
2020-02-04 19:37:46 +01:00
|
|
|
this.container = document.createElement("div")
|
|
|
|
this.container.classList = "image-container"
|
|
|
|
this.container.appendChild(document.createElement("br"))
|
2020-01-21 15:33:09 +01:00
|
|
|
|
2020-06-14 16:02:15 +02:00
|
|
|
this.title = document.createElement("h1")
|
|
|
|
this.title.innerText = "You are viewing a file on pixeldrain"
|
|
|
|
this.container.appendChild(this.title)
|
|
|
|
|
2020-02-04 19:37:46 +01:00
|
|
|
this.icon = document.createElement("img")
|
2020-06-14 16:02:15 +02:00
|
|
|
this.icon.style.display = "inline-block"
|
|
|
|
this.icon.style.verticalAlign = "middle"
|
2020-02-04 19:37:46 +01:00
|
|
|
this.icon.src = this.file.icon_href
|
|
|
|
this.container.appendChild(this.icon)
|
2020-01-21 15:33:09 +01:00
|
|
|
|
2020-06-14 16:02:15 +02:00
|
|
|
this.fileDetails = document.createElement("div")
|
|
|
|
this.fileDetails.style.display = "inline-block"
|
|
|
|
this.fileDetails.style.textAlign = "left"
|
|
|
|
this.fileDetails.style.paddingLeft = "8px"
|
|
|
|
this.fileDetails.style.verticalAlign = "middle"
|
|
|
|
|
|
|
|
this.fileDetails.appendChild(document.createTextNode("Name: "+file.name))
|
|
|
|
this.fileDetails.appendChild(document.createElement("br"))
|
|
|
|
this.fileDetails.appendChild(document.createTextNode("Type: "+file.mime_type))
|
|
|
|
this.fileDetails.appendChild(document.createElement("br"))
|
|
|
|
this.fileDetails.appendChild(document.createTextNode(
|
|
|
|
"No preview is available for this file type. Download to view it locally"
|
2020-02-04 19:37:46 +01:00
|
|
|
))
|
2020-06-14 16:02:15 +02:00
|
|
|
this.fileDetails.appendChild(document.createElement("br"))
|
|
|
|
|
|
|
|
this.btnDL = document.getElementById("btn_download").cloneNode(true)
|
|
|
|
this.btnDL.addEventListener("click", () => { viewer.toolbar.download() })
|
|
|
|
this.btnDL.classList = "button_highlight"
|
|
|
|
this.fileDetails.appendChild(this.btnDL)
|
|
|
|
|
|
|
|
this.container.appendChild(this.fileDetails)
|
2020-01-27 16:56:16 +01:00
|
|
|
}
|
2020-01-21 15:33:09 +01:00
|
|
|
|
2020-01-28 12:51:21 +01:00
|
|
|
FileViewer.prototype.render = function(parent) {
|
2020-02-04 19:37:46 +01:00
|
|
|
parent.appendChild(this.container)
|
2020-01-21 15:33:09 +01:00
|
|
|
}
|