diff --git a/README.md b/README.md index 1f98e17..e7f97b1 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Please read the Features section below and issues to make sure your issue is not - [x] Filter Files - [x] Swipe Gestures (Up directory by swiping right) - [x] Search -- [x] Intro +- [x] First-run Tour - [ ] Different views (List, Icons, etc) - [ ] Share Files - [ ] Preferences diff --git a/build/main.js b/build/main.js index 270aebe..2ad3a88 100644 --- a/build/main.js +++ b/build/main.js @@ -32355,16 +32355,18 @@ exports['default'] = function () { var _loop = function () { var item = _step.value; - item.addEventListener('touchstart', function listener(e) { + var firstClass = item.className.slice(0, item.className.indexOf(' ')); + var ev = firstClass === 'drawer' ? 'touchstart' : 'click'; + + item.addEventListener(ev, function listener(e) { e.preventDefault(); e.stopPropagation(); clearTimeout(timeout); - listeners.push({ item: item, listener: listener }); + listeners.push({ item: item, listener: listener, ev: ev }); shown++; - var firstClass = item.className.slice(0, item.className.indexOf(' ')); tour.innerHTML = MESSAGES[firstClass]; timeout = setTimeout(function () { @@ -32381,9 +32383,10 @@ exports['default'] = function () { var _step2$value = _step2.value; var _item = _step2$value.item; var _listener = _step2$value.listener; + var _ev = _step2$value.ev; console.log(_item, _listener); - _item.removeEventListener('touchstart', _listener); + _item.removeEventListener(_ev, _listener); } } catch (err) { _didIteratorError2 = true; diff --git a/src/js/tour.js b/src/js/tour.js index 4431fe8..e5b0813 100644 --- a/src/js/tour.js +++ b/src/js/tour.js @@ -27,16 +27,19 @@ export default function() { let listeners = []; for (let item of items) { - item.addEventListener('touchstart', function listener(e) { + + let firstClass = item.className.slice(0, item.className.indexOf(' ')); + let ev = firstClass === 'drawer' ? 'touchstart' : 'click'; + + item.addEventListener(ev, function listener(e) { e.preventDefault(); e.stopPropagation(); clearTimeout(timeout); - listeners.push({item, listener}); + listeners.push({item, listener, ev}); shown++; - let firstClass = item.className.slice(0, item.className.indexOf(' ')); tour.innerHTML = MESSAGES[firstClass]; timeout = setTimeout(() => { @@ -44,9 +47,9 @@ export default function() { wrapper.classList.remove('tour'); localStorage.setItem('tourRan', 'true'); - for (let {item, listener} of listeners) { + for (let {item, listener, ev} of listeners) { console.log(item, listener); - item.removeEventListener('touchstart', listener); + item.removeEventListener(ev, listener); } } }, DIALOG_HIDE_DELAY);