From b27ccbe3499435efc5b96ef96dd287cca952ac77 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Thu, 29 Jan 2015 23:07:38 +0100 Subject: [PATCH] Replaced mobileBrowser() with a better test --- src/scripts/init.js | 4 ++-- src/scripts/multiselect.js | 2 -- src/scripts/photo.js | 2 +- src/scripts/view/main.js | 4 ++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/scripts/init.js b/src/scripts/init.js index 611e752..478d30d 100755 --- a/src/scripts/init.js +++ b/src/scripts/init.js @@ -6,7 +6,7 @@ $(document).ready(function() { /* Event Name */ - var eventName = (mobileBrowser()) ? 'touchend' : 'click'; + var eventName = ('ontouchend' in document.documentElement) ? 'touchend' : 'click'; /* Multiselect */ $('#content') .on('mousedown', function(e) { if (e.which===1) multiselect.show(e) }); @@ -125,7 +125,7 @@ $(document).ready(function() { }); - if (mobileBrowser()) { + if ('ontouchend' in document.documentElement) { $(document) diff --git a/src/scripts/multiselect.js b/src/scripts/multiselect.js index 2a3333e..df7cb31 100644 --- a/src/scripts/multiselect.js +++ b/src/scripts/multiselect.js @@ -16,7 +16,6 @@ multiselect.position = { multiselect.show = function(e) { - if (mobileBrowser()) return false; if (lychee.publicMode) return false; if (visible.search()) return false; if (visible.infobox()) return false; @@ -40,7 +39,6 @@ multiselect.selectAll = function() { newWidth, newHeight; - if (mobileBrowser()) return false; if (lychee.publicMode) return false; if (visible.search()) return false; if (visible.infobox()) return false; diff --git a/src/scripts/photo.js b/src/scripts/photo.js index 4c9e605..b0ab8ba 100644 --- a/src/scripts/photo.js +++ b/src/scripts/photo.js @@ -61,7 +61,7 @@ photo.preloadNext = function(photoID) { // Never preload on mobile devices with bare RAM and // mostly mobile internet - if (mobileBrowser()) return false; + // {{ code }} if (album.json && album.json.content && diff --git a/src/scripts/view/main.js b/src/scripts/view/main.js index bb44d33..ca2f74a 100644 --- a/src/scripts/view/main.js +++ b/src/scripts/view/main.js @@ -12,8 +12,8 @@ var header = $('header'), $(document).ready(function(){ /* Event Name */ - if (mobileBrowser()) event_name = 'touchend'; - else event_name = 'click'; + if ('ontouchend' in document.documentElement) event_name = 'touchend'; + else event_name = 'click'; /* Window */ $(window).keydown(key);