Improvements on Meet Account profile images loading
This commit is contained in:
parent
9094e0b844
commit
4291d4e442
|
@ -136,7 +136,17 @@
|
|||
),
|
||||
accountId: ({ account }) => account.id,
|
||||
avatarHeader: ({ account }) => account.header,
|
||||
originalAccount: ({ originalStatus }) => originalStatus.account,
|
||||
originalAccount: ({ originalStatus }) => {
|
||||
if (process.browser) {
|
||||
if (window.localStorage.store_meetAccounts === undefined)
|
||||
window.localStorage.store_meetAccounts = '{}';
|
||||
const aJson = JSON.parse(window.localStorage.store_meetAccounts);
|
||||
if (aJson[originalStatus.account.id] === undefined)
|
||||
aJson[originalStatus.account.id] = originalStatus.account;
|
||||
window.localStorage.store_meetAccounts = JSON.stringify(aJson);
|
||||
}
|
||||
return originalStatus.account
|
||||
},
|
||||
originalAccountId: ({ originalAccount }) => originalAccount.id,
|
||||
accountMeetAge: ({ originalAccount }) => {
|
||||
const fieldVal = originalAccount.fields.find(function(a) { return a.name == 'fedilove_age' })
|
||||
|
|
|
@ -150,6 +150,7 @@ body.chat {
|
|||
body.meet, body.account {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
background: #222 !important;
|
||||
|
||||
div#sapper, div.virtual-list, main.infinite-scroll-page {
|
||||
background: #222 !important;
|
||||
|
@ -550,6 +551,11 @@ div.main-content.meet {
|
|||
main {
|
||||
padding: 0 !important;
|
||||
width: initial !important;
|
||||
|
||||
div.timeline {
|
||||
max-width: 90em;
|
||||
margin: auto;
|
||||
}
|
||||
}
|
||||
|
||||
div.infinite-scroll-page {
|
||||
|
@ -565,7 +571,7 @@ div.main-content.meet {
|
|||
position: fixed;
|
||||
top: 0 !important;
|
||||
width: 0;
|
||||
max-width: 100em;
|
||||
max-width: 90em;
|
||||
margin: auto;
|
||||
opacity: 1 !important;
|
||||
z-index: 0;
|
||||
|
|
|
@ -234,6 +234,26 @@ var fediloveApi = {
|
|||
document.getElementById(_id).click();
|
||||
document.body.removeChild(a);
|
||||
},
|
||||
getMeetAccount: function() {
|
||||
if (window.localStorage.store_meetAccounts === undefined)
|
||||
return undefined;
|
||||
if (document.getElementById(window.fediloveData.currentIDMeetTimeline) === undefined)
|
||||
return undefined;
|
||||
var accId;
|
||||
if (window.location.pathname == '/federated')
|
||||
accId = $(document.getElementById(window.fediloveData.currentIDMeetTimeline)).data('account');
|
||||
else if (window.location.pathname.startsWith('/accounts/'))
|
||||
accId = window.location.pathname.match(/^\/accounts\/(\d+)/)[1];
|
||||
if (accId === undefined)
|
||||
return undefined;
|
||||
const aJson = JSON.parse(window.localStorage.store_meetAccounts);
|
||||
if (aJson[accId] === undefined) {
|
||||
if (window.__store.get().currentAccountProfile === undefined)
|
||||
return undefined;
|
||||
return window.__store.get().currentAccountProfile;
|
||||
}
|
||||
return aJson[accId];
|
||||
},
|
||||
getChatMessageId: function() {
|
||||
var parts = window.location.pathname.split('/');
|
||||
return parts[parts.length-1];
|
||||
|
@ -279,8 +299,7 @@ var fediloveData = {
|
|||
meetAccountCurrentImg: 0,
|
||||
meetAccountImageLocked: false,
|
||||
myAccountId: undefined,
|
||||
currentAccount: null,
|
||||
currentAccouontIsEmpty: false,
|
||||
currentAccountIsEmpty: false,
|
||||
currentIDMeetTimeline: null,
|
||||
gotEmojifyTextFunction: false,
|
||||
composeTxtKeypressEvent: false
|
||||
|
@ -538,9 +557,10 @@ function fedilove_customization() {
|
|||
const _applyImageTo = function(selector) {
|
||||
setTimeout(function()
|
||||
{ // set image of first item to the account header (100ms after cloning the object)
|
||||
if (window.fediloveData.currentAccount != null) {
|
||||
const accObj = window.fediloveApi.getMeetAccount();
|
||||
if (accObj !== undefined) {
|
||||
if ($(selector)[0] !== undefined)
|
||||
$(selector)[0].src = window.fediloveData.currentAccount.header;
|
||||
$(selector)[0].src = accObj.header;
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
|
@ -567,7 +587,7 @@ function fedilove_customization() {
|
|||
}
|
||||
|
||||
clearInterval(_this);
|
||||
} else if (fediloveData.currentAccountIsEmpty && window.fediloveData.currentAccount != null) {
|
||||
} else if (fediloveData.currentAccountIsEmpty) {
|
||||
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');
|
||||
|
|
Loading…
Reference in New Issue