diff options
Diffstat (limited to 'public/assets/js/lib')
| -rw-r--r-- | public/assets/js/lib/views/details/audio.js | 5 | ||||
| -rw-r--r-- | public/assets/js/lib/views/details/commentform.js | 10 | ||||
| -rw-r--r-- | public/assets/js/lib/views/details/files.js | 2 | ||||
| -rw-r--r-- | public/assets/js/lib/views/details/index.js | 4 | ||||
| -rw-r--r-- | public/assets/js/lib/views/index/index.js | 1 | ||||
| -rw-r--r-- | public/assets/js/lib/views/mail/mailbox.js | 16 | ||||
| -rw-r--r-- | public/assets/js/lib/views/mail/message.js | 1 | ||||
| -rw-r--r-- | public/assets/js/lib/views/search/results.js | 1 |
8 files changed, 26 insertions, 14 deletions
diff --git a/public/assets/js/lib/views/details/audio.js b/public/assets/js/lib/views/details/audio.js index 6a8f5ed..42f5376 100644 --- a/public/assets/js/lib/views/details/audio.js +++ b/public/assets/js/lib/views/details/audio.js @@ -3,6 +3,7 @@ var audio = (function(){ var el, music = [], current_index = -1 var links, comment, parent + var playing = false audio.init = function () { links = document.querySelectorAll("a") @@ -19,6 +20,7 @@ var audio = (function(){ audio.build = function () { el = document.createElement("audio") el.setAttribute("controls", true) + el.addEventListener("loadeddata", () => { if (playing) el.play() }) el.addEventListener("ended", audio.next) el.src = music[0] parent.appendChild(el) @@ -33,8 +35,7 @@ var audio = (function(){ audio.play = function (index) { current_index = (parseInt(index) + music.length) % music.length el.src = music[current_index].href - el.play() - var playing = document.querySelector(".playing") + playing = document.querySelector(".playing") if (playing) playing.classList.remove("playing") music[current_index].classList.add("playing") } diff --git a/public/assets/js/lib/views/details/commentform.js b/public/assets/js/lib/views/details/commentform.js index 3b82ac7..e082248 100644 --- a/public/assets/js/lib/views/details/commentform.js +++ b/public/assets/js/lib/views/details/commentform.js @@ -3,6 +3,7 @@ var CommentForm = FormView.extend({ el: "#comment_form", events: { + "focus textarea": 'focus', }, action: "", @@ -17,11 +18,16 @@ var CommentForm = FormView.extend({ this.action = "/api/thread/" + thread.id + "/comment" }, + focus: function(){ + this.$el.addClass('focused') + }, + validate: function(){ var errors = [] var comment = $("[name=comment]").val() - if (! comment || ! comment.length) { - errors.push("Please enter a comment.") + var files = this.$("[name=files]").val() + if ((! comment || ! comment.length) && ! files) { + errors.push("Please enter a comment or add some files.") } return errors.length ? errors : null }, diff --git a/public/assets/js/lib/views/details/files.js b/public/assets/js/lib/views/details/files.js index b81d20c..ad2df85 100644 --- a/public/assets/js/lib/views/details/files.js +++ b/public/assets/js/lib/views/details/files.js @@ -19,7 +19,7 @@ var FilesView = FormView.extend({ var total = 0, has_music = false files.forEach(function(file){ if (is_image(file.filename)) { - return + // return } this.appendFile(file) total += file.size diff --git a/public/assets/js/lib/views/details/index.js b/public/assets/js/lib/views/details/index.js index 25ae020..b8fa859 100644 --- a/public/assets/js/lib/views/details/index.js +++ b/public/assets/js/lib/views/details/index.js @@ -5,8 +5,7 @@ var DetailsView = View.extend({ action: "/api/thread/", keywordAction: "/api/keyword/", - - + initialize: function(opt){ this.comments = new CommentsView ({ parent: this }) this.files = new FilesView ({ parent: this }) @@ -21,6 +20,7 @@ var DetailsView = View.extend({ }, populate: function(data){ + $("body").removeClass('loading') var thread = data.thread $("h1").html(thread.title) $(".subtitle").show().html("<a href='/'>< Home</a> | " + metadata(thread)) diff --git a/public/assets/js/lib/views/index/index.js b/public/assets/js/lib/views/index/index.js index 171133b..c4d1330 100644 --- a/public/assets/js/lib/views/index/index.js +++ b/public/assets/js/lib/views/index/index.js @@ -18,6 +18,7 @@ var IndexView = View.extend({ }, populate: function(data){ + $("body").removeClass('loading') this.hootbox.load(data.hootbox) this.threadbox.load(data) this.lastlog.load(data.lastlog) diff --git a/public/assets/js/lib/views/mail/mailbox.js b/public/assets/js/lib/views/mail/mailbox.js index 199eeee..2f822aa 100644 --- a/public/assets/js/lib/views/mail/mailbox.js +++ b/public/assets/js/lib/views/mail/mailbox.js @@ -19,9 +19,16 @@ var MailboxView = View.extend({ }, populate: function(data){ + $("body").removeClass('loading') this.boxlist.load(data.boxes) - data.messages.forEach(function(message){ - this.appendMessage(message, data.user) + + var user = data.user + var max = data.messages.length-1 + data.messages.forEach(function(message, i){ + var $row = $( this.parse(message, user) ) + if (i === 0) $row.addClass("first") + if (i === max) $row.addClass("last") + this.$el.append($row) }.bind(this)) }, @@ -44,9 +51,4 @@ var MailboxView = View.extend({ return t }, - appendMessage: function(message, user){ - var $row = $( this.parse(message, user) ) - this.$el.append($row) - }, - }) diff --git a/public/assets/js/lib/views/mail/message.js b/public/assets/js/lib/views/mail/message.js index b6297d9..da5e1b4 100644 --- a/public/assets/js/lib/views/mail/message.js +++ b/public/assets/js/lib/views/mail/message.js @@ -15,6 +15,7 @@ var MessageView = View.extend({ populate: function(data){ this.parse(data) + $("body").removeClass('loading') }, parse: function(data){ diff --git a/public/assets/js/lib/views/search/results.js b/public/assets/js/lib/views/search/results.js index 89004e3..d01db96 100644 --- a/public/assets/js/lib/views/search/results.js +++ b/public/assets/js/lib/views/search/results.js @@ -53,6 +53,7 @@ var SearchResults = View.extend({ .replace(/{{file}}/, file_tag) this.$("#results").append(t) }) + $("body").removeClass('loading') }, }) |
