mirror of
https://github.com/Luzifer/share.git
synced 2024-10-18 21:34:23 +00:00
45 lines
1 KiB
JavaScript
45 lines
1 KiB
JavaScript
// Generated by CoffeeScript 1.12.4
|
|
(function() {
|
|
var embedFileInfo, fileURL, handleEmbed, hashLoad;
|
|
|
|
fileURL = void 0;
|
|
|
|
$(function() {
|
|
$(window).bind('hashchange', hashLoad);
|
|
return hashLoad();
|
|
});
|
|
|
|
hashLoad = function() {
|
|
var file;
|
|
file = window.location.hash.substring(1);
|
|
return embedFileInfo(file);
|
|
};
|
|
|
|
embedFileInfo = function(file) {
|
|
fileURL = file;
|
|
return $.ajax(file, {
|
|
method: 'HEAD',
|
|
success: handleEmbed
|
|
});
|
|
};
|
|
|
|
handleEmbed = function(data, status, xhr) {
|
|
var type;
|
|
type = xhr.getResponseHeader('Content-Type');
|
|
console.log(fileURL);
|
|
$('.show-loading').hide();
|
|
$('.filelink-href').attr('href', fileURL);
|
|
$('.filelink-src').attr('src', fileURL);
|
|
$('.filename').text(fileURL.substring(fileURL.lastIndexOf('/') + 1));
|
|
if (type.match(/^image\//)) {
|
|
$('.show-image').show();
|
|
return;
|
|
}
|
|
if (type.match(/^video\//)) {
|
|
$('.show-video').show();
|
|
return;
|
|
}
|
|
return $('.show-generic').show();
|
|
};
|
|
|
|
}).call(this);
|