Fixed navigation bugs and more improvements

This commit is contained in:
Bofh 2021-01-04 22:40:19 +01:00
parent d8da16a0ef
commit e9154610ee
3 changed files with 25 additions and 8 deletions

View File

@ -217,6 +217,10 @@ export async function setupTimeline () {
currentTimeline currentTimeline
} = store.get() } = store.get()
console.log({ timelineItemSummaries, timelineItemSummariesAreStale, currentTimeline }) console.log({ timelineItemSummaries, timelineItemSummariesAreStale, currentTimeline })
if (currentTimeline.startsWith('account/') &&
timelineItemSummaries !== null && timelineItemSummaries.length === 0) {
setTimeout(function() { window.fediloveData.currentAccountIsEmpty = true }, 250);
}
if (!timelineItemSummaries || if (!timelineItemSummaries ||
timelineItemSummariesAreStale || timelineItemSummariesAreStale ||
currentTimeline.startsWith('status/')) { currentTimeline.startsWith('status/')) {

View File

@ -161,7 +161,7 @@ body.meet, body.account {
} }
div#prev { div#prev {
padding-right: 10%; padding-right: 5%;
svg { svg {
left: -.8em; left: -.8em;
@ -172,7 +172,7 @@ body.meet, body.account {
} }
div#next { div#next {
padding-left: 10%; padding-left: 5%;
right: 0; right: 0;
svg { svg {
@ -346,6 +346,11 @@ div.main-content.account {
max-width: 100em; max-width: 100em;
margin: auto; margin: auto;
div.nothing-to-show, div.virtual-list-footer {
visibility: collapse;
display: none;
}
div.no-images-account { div.no-images-account {
height: 100vh; height: 100vh;
display: flex; display: flex;

View File

@ -358,8 +358,10 @@ function fedilove_customization() {
}); });
// add some animations ( i can't with sass D: ) // add some animations ( i can't with sass D: )
var style = document.createElement('style'); if (document.getElementById('fedilove-animations') === null) {
style.innerHTML = ` var style = document.createElement('style');
style.id = 'fedilove-animations';
style.innerHTML = `
@keyframes spin2 { @keyframes spin2 {
100% { transform:rotate(-360deg); } 100% { transform:rotate(-360deg); }
} }
@ -376,7 +378,8 @@ function fedilove_customization() {
100% {position: relative; left: 95%} 100% {position: relative; left: 95%}
} }
`; `;
document.body.appendChild(style); document.body.appendChild(style);
}
if (window.location.pathname === '/notifications') { if (window.location.pathname === '/notifications') {
$('nav#main-nav li.main-nav-li svg')[1].classList += ' active'; $('nav#main-nav li.main-nav-li svg')[1].classList += ' active';
@ -517,6 +520,12 @@ function fedilove_customization() {
}, 300); }, 300);
}; };
const _this = setInterval(function() { const _this = setInterval(function() {
if (!window.location.pathname.startsWith('/accounts')) {
clearInterval(_this);
return;
}
// max interval time: 10 seconds // max interval time: 10 seconds
if (countmax > 50 || $('div.virtual-list > div.virtual-list-item').length > 0) { if (countmax > 50 || $('div.virtual-list > div.virtual-list-item').length > 0) {
if ($('div.virtual-list > div.virtual-list-item').length > 0) { if ($('div.virtual-list > div.virtual-list-item').length > 0) {
@ -528,12 +537,11 @@ function fedilove_customization() {
clearInterval(_this); clearInterval(_this);
} else if (fediloveData.currentAccountIsEmpty && window.fediloveData.currentAccount != null) { } else if (fediloveData.currentAccountIsEmpty && window.fediloveData.currentAccount != null) {
$('div.virtual-list').html('<div class="no-images-account"><img class="fixed-size-img"/></div>'); if ($('div.virtual-list > div.no-images-account').length === 0)
$('div.virtual-list').append('<div class="no-images-account"><img class="fixed-size-img"/></div>');
_applyImageTo('div.virtual-list > div.no-images-account > img.fixed-size-img'); _applyImageTo('div.virtual-list > div.no-images-account > img.fixed-size-img');
$('#meet-navigation > #profile-nav > #next')[0].style = 'display: none !important'; $('#meet-navigation > #profile-nav > #next')[0].style = 'display: none !important';
clearInterval(_this);
} else if (!window.location.pathname.startsWith('/accounts')) {
clearInterval(_this); clearInterval(_this);
} }
countmax++; countmax++;