diff --git a/frontend/app.coffee b/frontend/app.coffee new file mode 100644 index 0000000..6db49be --- /dev/null +++ b/frontend/app.coffee @@ -0,0 +1,35 @@ +fileURL = undefined + +$ -> + $(window).bind 'hashchange', hashLoad + hashLoad() + +hashLoad = -> + file = window.location.hash.substring(1) + embedFileInfo(file) + +embedFileInfo = (file) -> + fileURL = file + $.ajax file, + method: 'HEAD' + success: handleEmbed + +handleEmbed = (data, status, xhr) -> + 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 + + $('.show-generic').show() diff --git a/frontend/app.js b/frontend/app.js new file mode 100644 index 0000000..ddbde07 --- /dev/null +++ b/frontend/app.js @@ -0,0 +1,45 @@ +// 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); diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..e1123ab --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,88 @@ + + + + + + + + Share @ luzifer.io + + + + + + + + + + + + + + + + +
+

+ +

+
+ +
+

+ +

+

untitled

+
+ +
+ +
+ +
+
+ +
+
+ + + + + + + + + +