diff options
| author | julian laplace <julescarbon@gmail.com> | 2022-10-25 23:26:31 +0200 |
|---|---|---|
| committer | julian laplace <julescarbon@gmail.com> | 2022-10-25 23:26:31 +0200 |
| commit | 1cfed2612fd1042a15d470a44ec87588c966dc12 (patch) | |
| tree | ba850f589194a21fd1587dd71dfcd056a242e4ac /public/assets/js/lib/views/stream/index.js | |
| parent | ae311b71cccf5df9e0e19e276615cc32426d9de1 (diff) | |
hootstream... dark mode only
Diffstat (limited to 'public/assets/js/lib/views/stream/index.js')
| -rw-r--r-- | public/assets/js/lib/views/stream/index.js | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/public/assets/js/lib/views/stream/index.js b/public/assets/js/lib/views/stream/index.js new file mode 100644 index 0000000..d55a9c3 --- /dev/null +++ b/public/assets/js/lib/views/stream/index.js @@ -0,0 +1,69 @@ +var StreamView = View.extend({ + events: {}, + + action: "/api/stream", + keywordAction: "/api/keyword/", + + initialize: function (opt) { + // opt.parent = parent + // this.hootbox = new HootBox({ parent: this }); + this.hootform = new HootForm({ parent: this }); + this.hootstream = new HootStream({ parent: this }); + // this.threadbox = new ThreadBox({ parent: this }); + // this.lastlog = new LastLog({ parent: this }); + // this.countdown = new Countdown({ parent: this }); + }, + + load: function (keyword) { + $("body").addClass("index"); + // if (keyword) { + // $(".subtitle").html( + // '<a href="/">< Home</a> · <a href="/keywords">Keywords</a>' + // ); + // this.threadbox.options.latest = false; + // this.threadbox.options.welcome = false; + // $.get(this.keywordAction + keyword, this.populate.bind(this)); + // } else { + // this.hootbox.options.required = true; + // this.threadbox.options.latest = true; + // this.threadbox.options.welcome = true; + // } + $.get(this.action, this.populate.bind(this)); + }, + + populate: function (data) { + $("body").removeClass("loading"); + this.data = data; + this.hootstream.load(data); + // this.hootbox.load(data.hootbox); + // this.hootbox.hide(); + // this.threadbox.load(data); + // this.lastlog.load(data.lastlog); + if (data.mail.count) { + $(".alert") + .show() + .html( + "<a href='/mail'>" + + "You have " + + data.mail.count + + " new message" + + courtesy_s(data.mail.count) + + "!</a>" + ); + if (is_mobile) { + $("#content").prepend($(".alert")); + } + } + $(".search_form input").focus(); + }, + + onComment: function (comment) { + this.data.hootbox.comments.push(comment); + this.data.hootstream.comments.push(comment); + this.populate(this.data); + }, + + success: function () { + window.location.href = "/index"; + }, +}); |
