+var mimeTypes = {
+ images: [ '.png', '.jpg', '.jpeg', '.tiff', '.gif' ],
+ text: [ '.txt', '.md' ],
+ pdf: [ '.pdf' ],
+ html: [ '.html', '.htm', '.php' ],
+ video: [ '.mp4', '.mpg', '.mpeg', '.ogg', '.mkv' ]
+};
+
+function getPreviewUrl(entry, basePath) {
+ var path = '/_admin/img/';
+
+ if (entry.isDirectory) return path + 'directory.png';
+ if (mimeTypes.images.some(function (e) { return entry.filePath.endsWith(e); })) return sanitize(basePath + '/' + entry.filePath);
+ if (mimeTypes.text.some(function (e) { return entry.filePath.endsWith(e); })) return path +'text.png';
+ if (mimeTypes.pdf.some(function (e) { return entry.filePath.endsWith(e); })) return path + 'pdf.png';
+ if (mimeTypes.html.some(function (e) { return entry.filePath.endsWith(e); })) return path + 'html.png';
+ if (mimeTypes.video.some(function (e) { return entry.filePath.endsWith(e); })) return path + 'video.png';
+
+ return path + 'unknown.png';
+}
+