From 88874750baed8bd5f2db978f0df637f3ac8a84fe Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sat, 22 Nov 2014 20:09:38 +0100 Subject: [PATCH] Front-end rewrite #275 --- dist/main.js | Bin 170197 -> 170155 bytes src/scripts/init.js | 138 ++++++++++++++++++++++---------------------- 2 files changed, 68 insertions(+), 70 deletions(-) diff --git a/dist/main.js b/dist/main.js index 48467346740ed50ec1950612fa026bb64255ec8b..5eee85d61f6364cbe75d09e5389546640e735925 100644 GIT binary patch delta 134 zcmcb*k!$rvu7)j)CcCy@+{LKEINf9ysV;icfjLekO?R)n#F6EsrewI;S`kb?jn$uIy NGOBMsbe2*0GyschHuL}h delta 120 zcmV-;0Ehppu?p3(3V^f$G`g2qy8)!PJGucK0hi9Y0SCAIy8$x+ms`963zy-<0Th=& zy#W~uW_503bZKvHC@FiF;lu$H0x2w)5L*Hjmw~+jd6#m&0g9LQy#aWa{JsH(mr7&; aAGedg0i_L>Zp{HImpIJ0) modal.close(); - else if (visible.contextMenu()) contextMenu.close(); - else if (visible.infobox()) view.infobox.hide(); - else if (visible.photo()) lychee.goto(album.getID()); - else if (visible.album()) lychee.goto(""); - else if (visible.albums()&&$("#search").val().length!==0) search.reset(); + if (visible.message()&&$(".message .close").length>0) modal.close(); + else if (visible.contextMenu()) contextMenu.close(); + else if (visible.infobox()) view.infobox.hide(); + else if (visible.photo()) lychee.goto(album.getID()); + else if (visible.album()) lychee.goto(""); + else if (visible.albums()&&$("#search").val().length!==0) search.reset(); }); @@ -129,15 +127,15 @@ $(document).ready(function(){ /* Fullscreen on mobile */ .on('touchend', '#image', function(e) { if (swipe.obj===null||(swipe.offset>=-5&&swipe.offset<=5)) { - if (visible.controls()) view.header.hide(e, 0); - else view.header.show(); + if (visible.controls()) view.header.hide(e, 0); + else view.header.show(); } }) /* Swipe on mobile */ - .swipe().on('swipeStart', function() { if (visible.photo()) swipe.start($("#image")) }) - .swipe().on('swipeMove', function(e) { if (visible.photo()) swipe.move(e.swipe) }) - .swipe().on('swipeEnd', function(e) { if (visible.photo()) swipe.stop(e.swipe, photo.previous, photo.next) }); + .swipe().on('swipeStart', function() { if (visible.photo()) swipe.start($("#image")) }) + .swipe().on('swipeMove', function(e) { if (visible.photo()) swipe.move(e.swipe) }) + .swipe().on('swipeEnd', function(e) { if (visible.photo()) swipe.stop(e.swipe, photo.previous, photo.next) }); } @@ -149,8 +147,8 @@ $(document).ready(function(){ /* Header */ .on(event_name, "#title.editable", function() { - if (visible.photo()) photo.setTitle([photo.getID()]); - else album.setTitle([album.getID()]); + if (visible.photo()) photo.setTitle([photo.getID()]); + else album.setTitle([album.getID()]); }) /* Navigation */ @@ -158,34 +156,34 @@ $(document).ready(function(){ .on("click", ".photo", function() { lychee.goto(album.getID() + "/" + $(this).attr("data-id")) }) /* Modal */ - .on(event_name, ".message .close", modal.close) - .on(event_name, ".message .button:first", function() { if (modal.fns!==null) modal.fns[0](); if (!visible.signin()) modal.close() }) - .on(event_name, ".message .button:last", function() { if (modal.fns!==null) modal.fns[1](); if (!visible.signin()) modal.close() }) + .on(event_name, ".message .close", modal.close) + .on(event_name, ".message .button:first", function() { if (modal.fns!==null) modal.fns[0](); if (!visible.signin()) modal.close() }) + .on(event_name, ".message .button:last", function() { if (modal.fns!==null) modal.fns[1](); if (!visible.signin()) modal.close() }) /* Add Dialog */ .on(event_name, ".button_add", function(e) { contextMenu.add(e) }) /* Context Menu */ - .on("contextmenu", ".photo", function(e) { contextMenu.photo(photo.getID(), e) }) - .on("contextmenu", ".album", function(e) { contextMenu.album(album.getID(), e) }) - .on(event_name, ".contextmenu_bg", contextMenu.close) - .on("contextmenu", ".contextmenu_bg", contextMenu.close) + .on("contextmenu", ".photo", function(e) { contextMenu.photo(photo.getID(), e) }) + .on("contextmenu", ".album", function(e) { contextMenu.album(album.getID(), e) }) + .on("contextmenu", ".contextmenu_bg", contextMenu.close) + .on(event_name, ".contextmenu_bg", contextMenu.close) /* Infobox */ .on(event_name, "#infobox_overlay", view.infobox.hide) /* Upload */ - .on("change", "#upload_files", function() { modal.close(); upload.start.local(this.files) }) - .on(event_name, ".upload_message a.close", upload.close) - .on("dragover", function(e) { e.preventDefault(); }, false) + .on("change", "#upload_files", function() { modal.close(); upload.start.local(this.files) }) + .on(event_name, ".upload_message a.close", upload.close) + .on("dragover", function(e) { e.preventDefault(); }, false) .on("drop", function(e) { e.stopPropagation(); e.preventDefault(); // Close open overlays or views which are correlating with the upload - if (visible.photo()) lychee.goto(album.getID()); - if (visible.contextMenu()) contextMenu.close(); + if (visible.photo()) lychee.goto(album.getID()); + if (visible.contextMenu()) contextMenu.close(); // Detect if dropped item is a file or a link if (e.originalEvent.dataTransfer.files.length>0) upload.start.local(e.originalEvent.dataTransfer.files);