From 04c439057d9529f1231a6c95d311cfb3fa7174b1 Mon Sep 17 00:00:00 2001 From: julian laplace Date: Wed, 26 Oct 2022 21:20:05 +0200 Subject: initial play icon --- public/assets/js/lib/views/stream/hootfilters.js | 19 +++++++++++++++++++ public/assets/js/lib/views/stream/hootstream.js | 13 ++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 public/assets/js/lib/views/stream/hootfilters.js (limited to 'public/assets/js/lib/views/stream') diff --git a/public/assets/js/lib/views/stream/hootfilters.js b/public/assets/js/lib/views/stream/hootfilters.js new file mode 100644 index 0000000..bb060af --- /dev/null +++ b/public/assets/js/lib/views/stream/hootfilters.js @@ -0,0 +1,19 @@ +var HootFilters = View.extend({ + el: "#hootfilters", + + events: {}, + + initialize: function (opt) { + this.__super__.initialize.call(this); + }, + + show: function () { + this.$el.show(); + }, + + hide: function () { + this.$el.hide(); + }, + + load: function () {}, +}); diff --git a/public/assets/js/lib/views/stream/hootstream.js b/public/assets/js/lib/views/stream/hootstream.js index ad1fbc9..70d2b2a 100644 --- a/public/assets/js/lib/views/stream/hootstream.js +++ b/public/assets/js/lib/views/stream/hootstream.js @@ -18,11 +18,21 @@ var HootStream = View.extend({ }, onClickLink: function (event) { + if (event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) { + return; + } + if (!event.target.href) { + return; + } // console.log(event.target.className, event.target.href); const url = new URL(event.target.href); switch (event.target.className) { case "file": - // play audio? + console.log(url.pathname); + if (url.pathname.match(/(mp3|wav|ogg|opus|flac)$/i)) { + event.preventDefault(); + audio.play(event.target.dataset.index); // index set in audio.js + } break; case "userLink": case "threadLink": @@ -60,6 +70,7 @@ var HootStream = View.extend({ }.bind(this) ); this.$hootevents.append($els); + audio.init(); }, render: (template, object) => { -- cgit v1.2.3-70-g09d2