diff --git a/web/static/js/BareRTC.js b/web/static/js/BareRTC.js index 4f1d585..28d2a18 100644 --- a/web/static/js/BareRTC.js +++ b/web/static/js/BareRTC.js @@ -59,6 +59,11 @@ const app = Vue.createApp({ [ "x3", "3x larger chat room text" ], [ "x4", "4x larger chat room text" ], ], + imageDisplaySettings: [ + [ "", "Always show images in chat (default)" ], + [ "collapse", "Collapse images in chat (clicking to expand)" ], + [ "hide", "Never show images shared in chat" ], + ], reportClassifications: [ "It's spam", "It's abusive (racist, homophobic, etc.)", @@ -197,6 +202,7 @@ const app = Vue.createApp({ historyScrollbox: null, autoscroll: true, // scroll to bottom on new messages fontSizeClass: "", // font size magnification + imageDisplaySetting: "", // image show/hide setting scrollback: 1000, // scrollback buffer (messages to keep per channel) DMs: {}, messageReactions: { @@ -325,6 +331,9 @@ const app = Vue.createApp({ // Store the setting persistently. localStorage.fontSizeClass = this.fontSizeClass; }, + imageDisplaySetting() { + localStorage.imageDisplaySetting = this.imageDisplaySetting; + }, scrollback() { localStorage.scrollback = this.scrollback; }, @@ -514,6 +523,10 @@ const app = Vue.createApp({ this.webcam.videoScale = localStorage.videoScale; } + if (localStorage.imageDisplaySetting != undefined) { + this.imageDisplaySetting = localStorage.imageDisplaySetting; + } + if (localStorage.scrollback != undefined) { this.scrollback = parseInt(localStorage.scrollback); } @@ -1918,6 +1931,27 @@ const app = Vue.createApp({ // Initialize this channel's history? this.initHistory(channel); + // Image handling per the user's preference. + if (message.indexOf(" -1) { + if (this.imageDisplaySetting === "hide") { + return; + } else if (this.imageDisplaySetting === "collapse") { + // Put a collapser link. + let collapseID = `collapse-${messageID}`; + message = ` + + + Image attachment - click to expand + + `; + } + } + + // Append the message. this.channels[channel].updated = new Date().getTime(); this.channels[channel].history.push({ diff --git a/web/templates/chat.html b/web/templates/chat.html index 7fe9556..f87ce79 100644 --- a/web/templates/chat.html +++ b/web/templates/chat.html @@ -137,6 +137,27 @@ +
+
+ +
+
+
+
+
+ +
+
+
+
+
+
@@ -153,35 +174,6 @@

-

- Webcam Devices -

-
- -
- -
- -
-
- -
- -
- -
-
-