diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-03-10 13:20:28 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-03-10 13:20:28 +0100 |
| commit | 555fb6c8d95caa4349922c23818fc9e115226057 (patch) | |
| tree | f9426e071c1d3a87b434dd7cc1b127baf3593baa /public/assets/js/lib | |
| parent | fd896111e5d045dccc3b6568229b3b9191a2b921 (diff) | |
new router, handle opus, eslintrc
Diffstat (limited to 'public/assets/js/lib')
| -rw-r--r-- | public/assets/js/lib/sdk/auth.js | 4 | ||||
| -rw-r--r-- | public/assets/js/lib/views/details/audio.js | 2 | ||||
| -rw-r--r-- | public/assets/js/lib/views/details/files.js | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/public/assets/js/lib/sdk/auth.js b/public/assets/js/lib/sdk/auth.js index 0b49449..63a903c 100644 --- a/public/assets/js/lib/sdk/auth.js +++ b/public/assets/js/lib/sdk/auth.js @@ -64,7 +64,7 @@ var auth = (function(){ auth.clear_user() } auth.logged_in = function(){ - return (auth.user.id && auth.user.id !== -1 && auth.user.id !== "undefined") + return (auth.user && auth.user.id && auth.user.id !== -1 && auth.user.id !== "undefined") } auth.checkin = function(opt){ $.ajax({ @@ -72,7 +72,7 @@ var auth = (function(){ url: '/api/checkin', headers: { "csrf-token": $("[name=_csrf]").attr("value") }, success: function(data){ - if (data && data.user && data.user.id !== -1) { + if (data && data.user && data.user.id && data.user.id !== -1) { auth.set_user(data.user) opt.success(data.user) return diff --git a/public/assets/js/lib/views/details/audio.js b/public/assets/js/lib/views/details/audio.js index 0f16dc7..c876520 100644 --- a/public/assets/js/lib/views/details/audio.js +++ b/public/assets/js/lib/views/details/audio.js @@ -17,7 +17,7 @@ var audio = (function(){ music = [] var links = document.querySelectorAll("a") Array.prototype.slice.apply(links).forEach(function(link){ - if (! link.href.match(/\.(mp3|wav|ogg)$/)) return + if (! link.href.match(/\.(mp3|wav|ogg|opus)$/)) return link.dataset.index = music.length music.push(link) if (playing && link.href === el.src) { diff --git a/public/assets/js/lib/views/details/files.js b/public/assets/js/lib/views/details/files.js index b6f1794..3c7f84f 100644 --- a/public/assets/js/lib/views/details/files.js +++ b/public/assets/js/lib/views/details/files.js @@ -25,7 +25,7 @@ var FilesView = FormView.extend({ // return } total += file.size - has_music = has_music || file.filename.match(/(mp3|wav|ogg)/i) + has_music = has_music || file.filename.match(/(mp3|wav|ogg|opus)$/i) }.bind(this)) this.total = total @@ -137,7 +137,7 @@ var FilesView = FormView.extend({ pick: function(e){ if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey) return - if (! e.target.href || ! e.target.href.match(/(mp3|wav|ogg)/i)) return + if (! e.target.href || ! e.target.href.match(/(mp3|wav|ogg|opus)$/i)) return e.preventDefault() audio.play( e.target.dataset.index ) // index set in audio.js }, |
