Skip to content

Commit

Permalink
links to show in photostream - prevent dublet-links
Browse files Browse the repository at this point in the history
  • Loading branch information
StigNygaard committed Jul 13, 2024
1 parent d027f8e commit 2814d37
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions WebExtension/Stigs_Flickr_Fixr.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,21 +479,24 @@ function insertShowInPhotostream() {
if (fixr.context.photographerName === '') {
fixr.initPhotographerName();
}
const et = document.querySelector('div.height-controller a.entry-type');
if (et && !photostreamContext(et.href)) {
const psHref = `/photos/${fixr.context.photographerAlias || fixr.context.photographerId}/with/${fixr.context.photoId}/`;
const psLeft = 20 + (et.offsetLeft || 20) + (et.offsetWidth || 200);
const psLink = createRichElement(
'a',
{
class: 'entry-type do-not-evict',
href: psHref
},
createRichElement('div', {class: 'icon upstream'}),
'Show in photostream'
);
psLink.style.left = `${psLeft}px`;
et.insertAdjacentElement('afterend', psLink);
const ets = document.querySelectorAll('div.height-controller a.entry-type');
if (ets.length === 1) {
const et = ets.item(0);
if (!photostreamContext(et.href)) {
const psHref = `/photos/${fixr.context.photographerAlias || fixr.context.photographerId}/with/${fixr.context.photoId}/`;
const psLeft = 20 + (et.offsetLeft || 20) + (et.offsetWidth || 200);
const psLink = createRichElement(
'a',
{
class: 'entry-type do-not-evict',
href: psHref
},
createRichElement('div', {class: 'icon upstream'}),
'Show in photostream'
);
psLink.style.left = `${psLeft}px`;
et.insertAdjacentElement('afterend', psLink);
}
}
}
}
Expand Down

0 comments on commit 2814d37

Please sign in to comment.