Skip to content

Commit

Permalink
Fix telegram link problems
Browse files Browse the repository at this point in the history
  • Loading branch information
saltict committed Jun 7, 2024
1 parent a6f700e commit 8d20d1b
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/templates/webapp.pug
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,22 @@ html(lang="en")
});
}

inSubWallet = detectMob() && window.SubWallet;
isTelegramLink = '#{url}'.startsWith('https://t.me');
const fallbackImage = !{JSON.stringify(fallback_image)}
if (inSubWallet && isTelegramLink && fallbackImage) {
var inSubWallet = detectMob() && window.SubWallet;
var isTelegramLink = '#{url}'.startsWith('https://t.me');
var fallback_image = !{JSON.stringify(fallback_image)};

if (inSubWallet && isTelegramLink && fallback_image) {
// replace img in loading-placeholder > img
var img = document.getElementById('loading-img');
if (img) {
img.parentNode.removeChild(img);
var container = document.getElementById('loading-placeholder');
container.style.backgroundImage = "url(" + fallbackImage.url + ")";
container.style.backgroundSize = 'cover';
container.style.backgroundPosition = 'center';
}
if (img) {
var placeholder = img.parentNode;
placeholder.removeChild(img);


placeholder.style.backgroundImage = 'url(' + fallback_image.url + ')';
placeholder.style.backgroundPosition = 'center';
placeholder.style.backgroundSize = 'cover';
}
}
else {
window.addEventListener('load', function() {
Expand Down

0 comments on commit 8d20d1b

Please sign in to comment.