Archive file support

This commit is contained in:
2019-12-13 10:53:51 -05:00
parent 9778acda77
commit be23201210
40 changed files with 879 additions and 434 deletions

View File

@@ -165,12 +165,19 @@ function createDocCard(hit) {
let docCardBody = document.createElement("div");
docCardBody.setAttribute("class", "card-body document");
//Title
let title = makeTitle(hit);
let isSubDocument = false;
let link = document.createElement("a");
link.setAttribute("href", "f/" + hit["_id"]);
link.setAttribute("target", "_blank");
link.appendChild(title);
//Title
let title = makeTitle(hit);
if (hit["_source"].hasOwnProperty("parent")) {
docCard.classList.add("sub-document");
isSubDocument = true;
}
let tagContainer = document.createElement("div");
tagContainer.setAttribute("class", "card-text");
@@ -204,7 +211,7 @@ function createDocCard(hit) {
}
// Hover
if (thumbnail && hit["_source"]["videoc"] === "gif") {
if (thumbnail && hit["_source"]["videoc"] === "gif" && !isSubDocument) {
gifOver(thumbnail, hit);
}
break;
@@ -241,7 +248,7 @@ function createDocCard(hit) {
}
//Audio
if (mimeCategory === "audio" && hit["_source"].hasOwnProperty("audioc")) {
if (mimeCategory === "audio" && hit["_source"].hasOwnProperty("audioc") && !isSubDocument) {
let audio = document.createElement("audio");
audio.setAttribute("preload", "none");
@@ -267,7 +274,6 @@ function createDocCard(hit) {
docCardBody.appendChild(link);
docCard.appendChild(docCardBody);
link.appendChild(title);
docCardBody.appendChild(tagContainer);
return docCard;
@@ -275,8 +281,9 @@ function createDocCard(hit) {
function makeThumbnail(mimeCategory, hit, imgWrapper, small) {
let thumbnail;
let isSubDocument = hit["_source"].hasOwnProperty("parent");
if (mimeCategory === "video" && shouldPlayVideo(hit)) {
if (mimeCategory === "video" && shouldPlayVideo(hit) && !isSubDocument) {
thumbnail = document.createElement("video");
addVidSrc("f/" + hit["_id"], hit["_source"]["mime"], thumbnail);

View File

@@ -3,7 +3,7 @@
*/
function humanFileSize(bytes) {
if (bytes === 0) {
return "? B"
return "0 B"
}
let thresh = 1000;