Don't image zoom any previews that are just links out
This commit is contained in:
parent
0f06618c1f
commit
9429f36095
|
@ -28,6 +28,7 @@ struct RedditLinkData: Codable {
|
|||
let id: String?
|
||||
let selfHTML: String?
|
||||
let selfText: String?
|
||||
let postHint: String?
|
||||
let author: String?
|
||||
let created: Double?
|
||||
let isVideo: Bool?
|
||||
|
@ -42,6 +43,7 @@ struct RedditLinkData: Codable {
|
|||
case id = "id"
|
||||
case selfHTML = "selftext_html"
|
||||
case selfText = "selftext"
|
||||
case postHint = "post_hint"
|
||||
case author = "author"
|
||||
case created = "created_utc"
|
||||
case isVideo = "is_video"
|
||||
|
@ -104,6 +106,9 @@ struct RedditLinkData: Codable {
|
|||
|
||||
if let imageSource = preview?.images?.first?.source, let imageURL = imageSource.url {
|
||||
var html = "<a href=\"\(url)\"><img src=\"\(imageURL)\" "
|
||||
if postHint == "link" {
|
||||
html += "class=\"nnw-nozoom\" "
|
||||
}
|
||||
if let width = imageSource.width, let height = imageSource.height {
|
||||
html += "width=\"\(width)\" height=\"\(height)\" "
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class ImageViewer {
|
|||
|
||||
// Add the click listener for images
|
||||
window.onclick = function(event) {
|
||||
if (event.target.matches("img")) {
|
||||
if (event.target.matches("img") && !event.target.classList.contains("nnw-nozoom")) {
|
||||
if (activeImageViewer && activeImageViewer.img === event.target) {
|
||||
cancelImageLoad();
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue