diff options
| author | julian laplace <julescarbon@gmail.com> | 2022-10-27 22:03:49 +0200 |
|---|---|---|
| committer | julian laplace <julescarbon@gmail.com> | 2022-10-27 22:03:49 +0200 |
| commit | 35b9318fbf27f4025dd50be2c0a59046dfab3baf (patch) | |
| tree | 6633007600429297e5072f7eace2c3b8150f692f /public/assets | |
| parent | a785cfa3d2977e80a7419894e3767e9b8f45fe5b (diff) | |
hootform styling and fixing
Diffstat (limited to 'public/assets')
| -rw-r--r-- | public/assets/css/hootstream.css | 107 | ||||
| -rw-r--r-- | public/assets/js/lib/views/stream/hootform.js | 3 | ||||
| -rw-r--r-- | public/assets/js/lib/views/stream/hootstream.js | 52 | ||||
| -rw-r--r-- | public/assets/js/lib/views/stream/index.js | 7 |
4 files changed, 140 insertions, 29 deletions
diff --git a/public/assets/css/hootstream.css b/public/assets/css/hootstream.css index 97d1a77..c06ec13 100644 --- a/public/assets/css/hootstream.css +++ b/public/assets/css/hootstream.css @@ -9,26 +9,6 @@ #audio { display: none; } -#hootstream form { - display: flex; - width: 100%; - justify-content: space-between; - align-items: center; - flex-direction: row; - margin-bottom: 0.75rem; -} -#hootstream form input { - flex: 1; - font-size: 16px; - padding: 0.25rem; - margin-bottom: 0; -} -#hootstream form button { - margin: 0; - padding: 0.25rem; - margin-left: 0.5rem; - min-width: 2.5rem; -} #hootevents { font-size: 14px; padding-right: 3rem; @@ -54,6 +34,42 @@ .hoot:hover > .text { opacity: 1 !important; } +#hootevents .threadTitle .text { + display: flex; + flex-direction: row; + flex-flow: row wrap; + justify-content: flex-start; + align-items: center; +} +#hootevents .threadTitle .text .actions { + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + transition: opacity 0.1s; + opacity: 0.8; + user-select: none; +} +#hootevents .threadTitle:hover .text .actions { + opacity: 1; +} +#hootevents .threadTitle .text .actions div { + cursor: default; + margin-left: 0.5rem; +} +#hootevents .threadTitle .text .actions .action { + cursor: pointer; + color: #48f; + opacity: 0.9; + transition: opacity 0.1s; +} +#hootevents .threadTitle .text .actions .action:hover { + text-decoration: underline; + opacity: 1; +} +#hootevents .threadTitle .text .actions .action[data-action="play"] { + color: #8df; +} /** ImAgeS and other image lISTS!! */ #hootevents .imageList { @@ -174,8 +190,10 @@ text-shadow: 0 0 3px rgba(192, 192, 192, 0.2); } #hootevents .hoot .threadLink { - color: #38f; + color: #6bf; font-size: 16px; + text-decoration: none; + border-bottom: 1px solid; } /** DiViDErZ */ @@ -319,34 +337,70 @@ /** HOOT FORM */ #hootform { + display: flex; + flex-direction: row; + align-items: center; + justify-content: flex-start; + max-width: 100%; + width: 720px; + padding: 8px; margin-bottom: 0.5rem; padding: 0.5rem; + margin-left: 3.5rem; +} +#hootform form { + display: flex; + width: 100%; + justify-content: space-between; + align-items: center; + flex-direction: row; + margin-bottom: 0.75rem; +} +#hootform form input { + flex: 1; + font-size: 16px; + padding: 0.25rem; + margin-bottom: 0; +} +#hootform form button { + margin: 0; + padding: 0.25rem; + padding: 0.25rem; + margin-left: 0.5rem; + min-width: 3rem; + font-size: 0.75rem; + opacity: 0.6; + transition: opacity 0.1s; } #hootform input[type="text"] { border-top: 0; border-left: 0; border-right: 0; border-bottom: 1px solid rgba(127, 127, 127, 0.5); - padding-bottom: 3px; + padding: 0.5rem; font-size: 14px; font-family: "Trebuchet MS", sans-serif; background: transparent; outline: 0; - width: 270px; + flex: 1; transition: background 200ms; - background: white; + background: rgba(127, 127, 127, 0.1); + color: white; } #hootform input[type="text"]:invalid { - background: transparent; + background: rgba(127, 127, 127, 0.2); } #hootform input[type="text"]:focus { border-bottom: 1px solid rgba(40, 20, 20, 0.2); border-radius: 2px 2px 0 0; - color: #211; + /*color: #211;*/ } #hootform input[type="text"]:focus { border-bottom-color: rgba(127, 127, 127, 0.2); } +#hootform input[type="text"]:not(:invalid):focus + button { + opacity: 1; +} #hootform input[type="text"]:invalid { caret-color: #888; } @@ -480,6 +534,7 @@ } #hootform { margin-bottom: 0rem; + margin-left: 0; } #hootevents { padding-right: 0; diff --git a/public/assets/js/lib/views/stream/hootform.js b/public/assets/js/lib/views/stream/hootform.js index f13cc55..07533d5 100644 --- a/public/assets/js/lib/views/stream/hootform.js +++ b/public/assets/js/lib/views/stream/hootform.js @@ -6,7 +6,8 @@ var HootForm = FormView.extend({ action: "/api/thread/1/comment", initialize: function (opt) { - this.__super__.initialize.call(this); + this.__super__.initialize.call(this, opt); + this.parent = opt.parent; this.$comment = this.$("[name=comment]"); }, diff --git a/public/assets/js/lib/views/stream/hootstream.js b/public/assets/js/lib/views/stream/hootstream.js index 51d26ba..905f0e7 100644 --- a/public/assets/js/lib/views/stream/hootstream.js +++ b/public/assets/js/lib/views/stream/hootstream.js @@ -4,6 +4,7 @@ var HootStream = View.extend({ events: { "click a": "onClickLink", "click .filename": "onClickFilename", + "click .action": "onClickAction", }, initialize: function ({ parent }) { @@ -58,6 +59,38 @@ var HootStream = View.extend({ } }, + onClickAction: function (event) { + const action = $(event.target).data("action"); + const thread = $(event.target).closest(".threadTitle").data("thread"); + console.log(action, thread); + switch (action) { + case "play": + this.onPlay(thread); + break; + case "expand": + this.onExpand(thread); + break; + case "post": + this.onShowForm(thread); + break; + } + }, + + onPlay: function (thread) { + // + $.get(`/api/stream?thread=${thread}`).then((response) => { + console.log(response); + }); + }, + + onExpand: function (thread) { + // + }, + + onPost: function (thread) { + // + }, + load: function (data, filters) { this.state = { ...this.agglutinate(data), @@ -226,6 +259,8 @@ var HootStream = View.extend({ // console.log(hoot, comment); const age_opacity = get_age_opacity(date); return this.render(template || this.hootTemplate, { + id, + thread, username, className: className ? `hoot ${className}` : "hoot", image: profile_image(username), @@ -265,6 +300,8 @@ var HootStream = View.extend({ 1.0 ); + const hasAudio = files.some((file) => AUDIO_REGEXP.test(file.filename)); + const filteredImages = images .map((image) => [image, new RegExp(encodeURIComponent(image.filename))]) .filter( @@ -277,12 +314,27 @@ var HootStream = View.extend({ // console.log(thread); const sortedFiles = this.sortFiles(files, thread.settings?.sort); + const actions = [ + hasAudio && { action: "play", label: "Play music" }, + { action: "expand", label: "Expand" }, + { action: "post", label: "Post" }, + ] + .filter((action) => !!action) + .map( + ({ action, label }) => + "<div>·</div>" + + `<div class="action" data-action="${action}">${label}</div>` + ) + .join(""); + return [ "<div class='divider dark'></div>", this.renderHoot({ template: this.threadTemplate, + thread: thread.id, hoot: `<a class="threadLink" href="/stream/thread/${thread.id}">${thread.title}</a>`, thread_opacity, + actions, keyword_link: thread.keyword ? `<a class="keywordLink" href="/stream/keyword/${thread.keyword}">${thread.keyword}</a>` : "", diff --git a/public/assets/js/lib/views/stream/index.js b/public/assets/js/lib/views/stream/index.js index 1504554..0a2aeb9 100644 --- a/public/assets/js/lib/views/stream/index.js +++ b/public/assets/js/lib/views/stream/index.js @@ -42,8 +42,11 @@ var StreamView = View.extend({ }, onComment: function (comment) { - this.data.hootbox.comments.push(comment); - this.data.hootstream.comments.push(comment); + if (comment.thread === 1) { + this.data.hootbox.push(comment); + } else { + this.data.comments.push(comment); + } this.populate(this.data); }, |
