Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
96 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"use strict"; | ||
|
||
const $ = require("jquery"); | ||
const socket = require("../socket"); | ||
const templates = require("../../views"); | ||
const options = require("../options"); | ||
|
||
socket.on("msg:preview", function(data) { | ||
data.preview.shown = | ||
(options.links && data.preview.type === "link") || | ||
(options.thumbnails && data.preview.type === "image"); | ||
|
||
const toggle = $("#msg-" + data.id); | ||
toggle.find(".text").append(templates.toggle({preview: data.preview})); | ||
|
||
toggle.parent(".messages").trigger("keepToBottom"); | ||
}); | ||
|
||
$("#chat").on("click", ".toggle-button", function() { | ||
var self = $(this); | ||
var localChat = self.closest(".chat"); | ||
var bottom = localChat.isScrollBottom(); | ||
var content = self.parent().next(".toggle-content"); | ||
if (bottom && !content.hasClass("show")) { | ||
var img = content.find("img"); | ||
if (img.length !== 0 && !img.width()) { | ||
img.on("load", function() { | ||
localChat.scrollBottom(); | ||
}); | ||
} | ||
} | ||
content.toggleClass("show"); | ||
if (bottom) { | ||
localChat.scrollBottom(); | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
{{#toggle}} | ||
<div class="toggle-content toggle-type-{{type}}"> | ||
{{#preview}} | ||
<div> | ||
<button class="toggle-button" aria-label="Toggle prefetched media"></button> | ||
</div> | ||
<a href="{{link}}" target="_blank" rel="noopener" class="toggle-content toggle-type-{{type}}{{#if shown}} show{{/if}}"> | ||
{{#equal type "image"}} | ||
<a href="{{link}}" target="_blank"> | ||
<img src="{{link}}"> | ||
</a> | ||
<img src="{{link}}"> | ||
{{else}} | ||
<a href="{{link}}" target="_blank"> | ||
{{#if thumb}} | ||
<img src="{{thumb}}" class="thumb"> | ||
{{/if}} | ||
<div class="head">{{head}}</div> | ||
<div class="body"> | ||
{{body}} | ||
</div> | ||
</a> | ||
{{#if thumb}} | ||
<img src="{{thumb}}" class="thumb"> | ||
{{/if}} | ||
<div class="head">{{head}}</div> | ||
<div class="body"> | ||
{{body}} | ||
</div> | ||
{{/equal}} | ||
</div> | ||
{{/toggle}} | ||
</a> | ||
{{/preview}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters