Some improvements and new internal-code features

* We can use fediloveUI.toast(msg) to send a message using the React toast
* I couldnt manage to export formatIntl function to the outside, and the only option was to set the desired keys at the _layout.html initial load
* Some little fixes and localizations
This commit is contained in:
Bofh 2021-01-11 23:21:09 +01:00
parent 8d2194af4b
commit 51f318e1a4
3 changed files with 23 additions and 5 deletions

View File

@ -276,4 +276,5 @@ export async function showMoreItemsForThread (instanceName, timelineName) {
if (process.browser) {
window.__database = database;
window.__toast = toast;
}

View File

@ -79,6 +79,7 @@
<script>
import { store } from './_store/store'
import { observe } from 'svelte-extras'
import { formatIntl } from './_utils/formatIntl'
import { importShowEmojiDialog } from './_components/dialog/asyncDialogs/importShowEmojiDialog'
import { updateCustomEmojiForInstance } from './_actions/emoji'
@ -102,6 +103,10 @@
document.body.appendChild(script);
};
window.__intl = {
'nothingToShow': formatIntl('intl.nothingToShow'),
};
loadScript('/jquery-3.5.1.min.js');
loadScript("/fedilove-no-react.js?v="+Date.now(), true);

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -198,7 +198,8 @@ var fediloveUI = {
count++;
var newLen = $('div.the-list > div').length;
if (count >= 100 || newLen != startLen) {
document.querySelector('div.the-list > div:last-child').scrollIntoView();
const elem = document.querySelector('div.the-list > div:last-child');
if (elem !== null) elem.scrollIntoView();
clearInterval(_this);
}
}, 150);
@ -268,6 +269,10 @@ var fediloveUI = {
countMax++;
}, 100);
},
toast: function(whatToSay) {
if (window.__toast !== undefined)
window.__toast.say(whatToSay);
},
animateMainContentSwipe: function(animName, cback) {
$('div.virtual-list')[0].style.animation = `${animName} .25s linear 1`;
setTimeout(cback, 220);
@ -473,8 +478,15 @@ function fedilove_customization() {
return;
}
if (fediloveData.myAccountId === undefined && window.__store.get().verifyCredentials !== undefined)
fediloveData.myAccountId = window.__store.get().verifyCredentials[fediloveApi.getCurrentInstance()].id;
if (fediloveData.myAccountId === undefined && window.__store.get().verifyCredentials !== undefined) {
var aCountMax = 0;
const _a = setInterval(function() {
const theData = window.__store.get().verifyCredentials[fediloveApi.getCurrentInstance()];
if (aCountMax > 20 || theData !== null)
fediloveData.myAccountId = theData !== null ? theData.id : undefined;
aCountMax++;
}, 500);
}
if (document.querySelector('#main-nav > div#dummy-nav') != null) {
document.querySelector('#main-nav > div#dummy-nav').remove();
@ -545,7 +557,7 @@ function fedilove_customization() {
if (!e.ctrlKey && !e.shiftKey) {
e.stopPropagation();
e.preventDefault();
setTimeout(function() { api_send_message() }, 100);
setTimeout(function() { fediloveMastodon.API.sendMessage() }, 100);
return true;
} else {
if (!e.shiftKey && e.ctrlKey) {
@ -740,7 +752,7 @@ function fedilove_customization() {
// added when there is no more profiles to Meet
if ($('div#noone-to-meet').length === 0)
$('div.timeline').parent().append('<div id="noone-to-meet" style="display: none"><span>Nothing to show</span></div>');
$('div.timeline').parent().append('<div id="noone-to-meet" style="display: none"><span>'+window.__intl.nothingToShow+'</span></div>');
// remove discarded accounts from timeline (temporal,
// if /meet is reloaded, blocked accounts won't show either)