Skip to content

Commit

Permalink
Open in discarder tab: ignore text content & Co w/o non-spaces
Browse files Browse the repository at this point in the history
(#22)
  • Loading branch information
Infocatcher committed Mar 9, 2021
1 parent 1f55eb0 commit 66902a8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions content.js
Expand Up @@ -242,6 +242,7 @@ var blacklist = {
}
};

var trim = String.prototype.trim.call.bind(String.prototype.trim);
function openURIItem(e, trg, it, inBG, loadIn, discarded) {
var uri = getItemURI(it);
if(
Expand Down Expand Up @@ -273,11 +274,11 @@ function openURIItem(e, trg, it, inBG, loadIn, discarded) {
loadURI(trg, uri);
return;
}
var title = it.textContent || it.title || it.alt || "";
var title = trim(it.textContent) || trim(it.title) || trim(it.alt) || "";
if(!title && it.children.length == 1) {
var img = it.children[0];
if(img.localName.toLowerCase() == "img")
title = img.title || img.alt || "";
title = trim(img.title) || trim(img.alt) || "";
}
openURIIn(uri, inBG, loadIn, discarded, title);
}
Expand Down

0 comments on commit 66902a8

Please sign in to comment.