summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views/stream/hootstream.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/js/lib/views/stream/hootstream.js')
-rw-r--r--public/assets/js/lib/views/stream/hootstream.js82
1 files changed, 38 insertions, 44 deletions
diff --git a/public/assets/js/lib/views/stream/hootstream.js b/public/assets/js/lib/views/stream/hootstream.js
index f748417..f4e48c4 100644
--- a/public/assets/js/lib/views/stream/hootstream.js
+++ b/public/assets/js/lib/views/stream/hootstream.js
@@ -7,6 +7,7 @@ var HootStream = View.extend({
this.parent = parent;
this.$hootevents = this.$("#hootevents");
this.hootTemplate = this.$(".hootTemplate").html();
+ this.threadTemplate = this.$(".threadTemplate").html();
this.lastlogTemplate = this.$(".lastlogTemplate").html();
this.fileTemplate = this.$(".fileTemplate").html();
},
@@ -64,16 +65,20 @@ var HootStream = View.extend({
hidden,
className,
showAvatar,
+ template,
+ ...options
}) {
- console.log(hoot, comment);
- return this.render(this.hootTemplate, {
+ // console.log(hoot, comment);
+ return this.render(template || this.hootTemplate, {
username,
className: className ? `hoot ${className}` : "hoot",
image: profile_image(username),
showAvatar: showAvatar === false ? 0 : 1,
- hoot: hoot || tidy_urls(comment, true),
+ hoot:
+ hoot || "<div class='hootText'>" + tidy_urls(comment, true) + "</div>",
age: get_age(date),
age_opacity: get_age_opacity(date),
+ ...options,
});
},
@@ -88,45 +93,34 @@ var HootStream = View.extend({
renderThread: function ({ thread, comments, files, images }) {
thread = thread.shift();
// console.log(thread, comments, files, images);
- const postedToday = +new Date() / 1000 - thread.date < 86400;
-
- if (postedToday) {
- return [
- "<div class='divider dark'></div>",
- this.renderHoot({
- hoot: `<a class="threadLink" href="/details/${thread.id}">${thread.title}</a>`,
- username: thread.username,
- className: "isRecent",
- date: thread.lastmodified,
- ...this.renderFiles(files),
- ...this.renderHoots({
- hoots: comments.slice(0, 1),
- tag: "first_post",
- }),
- ...this.renderHoots({ hoots: comments.slice(1) }),
- }),
- "<div class='divider'></div>",
- ];
- // display very proud headline
- // title, avatar, first image, full file list,
- } else {
- return [
- "<div class='divider dark'></div>",
- this.renderHoot({
- hoot: `<a class="threadLink" href="/details/${thread.id}">${thread.title}</a>`,
- username: thread.username,
- className: "",
- date: thread.lastmodified,
- }),
- this.renderFiles(files.slice(0, 10)),
- ...this.renderHoots({ hoots: comments.slice(0, 1), tag: "first_post" }),
- ...this.renderHoots({ hoots: comments.slice(1).slice(-5) }),
- "<div class='divider'></div>",
- ];
- // say "in ... "
- // audio player OR recent file list
- // recent 3 comments
- }
+ const postedToday = +new Date() / 1000 - thread.lastmodified < 86400;
+ const age_opacity = get_age_opacity(thread.lastmodified);
+ return [
+ "<div class='divider dark'></div>",
+ this.renderHoot({
+ template: this.threadTemplate,
+ hoot: `<a class="threadLink" href="/details/${thread.id}">${thread.title}</a>`,
+ keyword_link: thread.keyword
+ ? `<a class="keywordLink" href="/stream/${thread.keyword}">${thread.keyword}</a>`
+ : "",
+ username: thread.username,
+ className: postedToday ? "isRecent" : "",
+ date: thread.lastmodified,
+ file_count: `${files.length || 0} f.`,
+ file_opacity: age_opacity * get_size_opacity(files.length),
+ comment_count: `${comments.length || 0} c.`,
+ comment_opacity: age_opacity * get_size_opacity(files.length),
+ }),
+ this.renderFiles(postedToday ? files : files.slice(0, 10)),
+ ...this.renderHoots({ hoots: comments.slice(0, 1), tag: "first_post" }),
+ ...this.renderHoots({
+ hoots: postedToday ? comments.slice(1) : comments.slice(1).slice(-5),
+ }),
+ "<div class='divider'></div>",
+ ];
+ // say "in ... "
+ // audio player OR recent file list
+ // recent 3 comments
},
renderFiles: function (files) {
@@ -154,9 +148,9 @@ var HootStream = View.extend({
age: get_age(file.date),
age_opacity: get_age_opacity(file.date),
date_class,
- // date: datetime[0],
+ date: datetime[0],
// time: datetime[1],
- size_class: size[0],
+ // size_class: size[0],
size: size[1],
});
},