Implemented account images indexes controlling on fedilove.js

This commit is contained in:
Bofh 2021-01-03 02:44:11 +01:00
parent 276c6e3b6e
commit d46cf454b3
3 changed files with 26 additions and 2 deletions

View File

@ -7,8 +7,8 @@
</a>
<div id="anim-swipe" onclick="return window.fediloveUI.meetPageGoToCurrentAccount();"></div>
<div id="profile-nav" style="display: none">
<div id="prev"></div>
<div id="next"></div>
<div id="prev" style="display: none" onclick="return window.fediloveUI.meetAccountImageDirection('prev')"></div>
<div id="next" onclick="return window.fediloveUI.meetAccountImageDirection('next')"></div>
</div>
</div>

View File

@ -311,6 +311,7 @@ div.main-content.account {
margin: auto;
article.status-article {
cursor: initial !important;
background: none !important;
padding: 0;

View File

@ -73,6 +73,26 @@ var fediloveUI = {
cbackFunc(swiperightBol); e.preventDefault();
}, false);
},
meetAccountImageDirection: function(direction) {
if (direction === 'prev')
fediloveData.meetAccountCurrentImg -= 1;
else if (direction === 'next')
fediloveData.meetAccountCurrentImg += 1;
const last = $('div.virtual-list > div.virtual-list-item').length - 1;
if (fediloveData.meetAccountCurrentImg > last)
fediloveData.meetAccountCurrentImg = last;
else if (fediloveData.meetAccountCurrentImg < 0)
fediloveData.meetAccountCurrentImg = 0;
if (fediloveData.meetAccountCurrentImg === last)
document.querySelector('#meet-navigation > #profile-nav > #next').style = 'display: none';
else if (fediloveData.meetAccountCurrentImg === 0)
document.querySelector('#meet-navigation > #profile-nav > #prev').style = 'display: none';
else {
document.querySelector('#meet-navigation > #profile-nav > #next').style = '';
document.querySelector('#meet-navigation > #profile-nav > #prev').style = '';
}
},
meetPageGoToCurrentAccount: function(isRightSwipe) {
isRightSwipe = isRightSwipe || false;
const elements = $('div.virtual-list > div.virtual-list-item > article');
@ -170,6 +190,7 @@ var fediloveFunctions = {
};
var fediloveData = {
chatAvatarCache: undefined,
meetAccountCurrentImg: 0,
gotEmojifyTextFunction: false,
composeTxtKeypressEvent: false
};
@ -381,6 +402,8 @@ function fedilove_customization() {
document.querySelector('#meet-navigation > #profile-nav').style = '';
$('#meet-navigation > #anim-swipe').html('');
// TO-DO: disable click events on every article
// prev and next navigation
const cloneBackSvg = function(selector) {
$(selector).html('');