Files
fnx_web/res/static/script/DetailsWindow.js

49 lines
1.7 KiB
JavaScript
Raw Normal View History

2017-11-10 12:39:55 +01:00
var DetailsWindow = {
visible: false,
toggle: function () {
if (this.visible) {
2018-09-11 21:35:44 +02:00
$("#info_popup").fadeOut(500);
2018-01-07 21:42:19 +01:00
$("#btnDetails").removeClass("button_highlight");
2017-11-10 12:39:55 +01:00
this.visible = false;
} else {
2018-09-11 21:35:44 +02:00
$("#info_popup").fadeIn(500);
2018-01-07 21:42:19 +01:00
$("#btnDetails").addClass("button_highlight");
2017-11-10 12:39:55 +01:00
this.visible = true;
}
},
setDetails: function (file) {
2018-09-11 21:35:44 +02:00
if (Viewer.isList) {
// Lists give incomplete file information, so we have to request
// more details in the background. File descriptions only exist in
// lists, so for that we use the data provided in the page source
2018-09-11 21:35:44 +02:00
$.ajax({
dataType: "json",
url: apiEndpoint + "/file/" + file.id + "/info",
success: function(data){
$("#info_file_details").html(
"<table>"
2018-10-04 23:36:34 +02:00
+ "<tr><td>Name<td><td>" + escapeHTML(data.name) + "</td></tr>"
2018-09-11 21:35:44 +02:00
+ "<tr><td>Url<td><td><a href=\"/u/" + data.id + "\">/u/" + data.id + "</a></td></tr>"
+ "<tr><td>Mime Type<td><td>" + escapeHTML(data.mime_type) + "</td></tr>"
+ "<tr><td>IS<td><td>" + data.id + "</td></tr>"
2018-10-04 23:36:34 +02:00
+ "<tr><td>Size<td><td class=\"bytecounter\">" + data.size + "</td></tr>"
2018-09-11 21:35:44 +02:00
+ "<tr><td>Upload Date<td><td>" + data.date_upload + "</td></tr>"
+ "<tr><td>Description<td><td>" + escapeHTML(file.description) + "</td></tr>"
+ "</table>"
);
}
});
} else {
$("#info_file_details").html(
"<table>"
2018-10-04 23:36:34 +02:00
+ "<tr><td>Name<td><td>" + escapeHTML(file.name) + "</td></tr>"
2018-09-11 21:35:44 +02:00
+ "<tr><td>Mime Type<td><td>" + escapeHTML(file.mime_type) + "</td></tr>"
+ "<tr><td>ID<td><td>" + file.id + "</td></tr>"
2018-10-04 23:36:34 +02:00
+ "<tr><td>Size<td><td class=\"bytecounter\">" + file.size + "</td></tr>"
2018-09-11 21:35:44 +02:00
+ "<tr><td>Upload Date<td><td>" + file.date_upload + "</td></tr>"
+ "</table>"
);
}
2017-11-10 12:39:55 +01:00
}
2018-09-11 21:35:44 +02:00
};