Merge branch 'master' into master

This commit is contained in:
Alexey Matveev
2023-04-17 17:01:57 +03:00
committed by GitHub

View File

@ -104,6 +104,7 @@ window.Asc = {
const pos = location.href.indexOf('store/index.html');
const ioUrl = location.href.substring(0, pos);
const bAppDirectory = getUrlSearchValue('type').length !== 0; // if we have type, the we work in appdirectory
// get translation file
getTranslation();
@ -142,7 +143,7 @@ window.onload = function() {
toogleView(event.target, elements.btnMyPlugins, messages.linkPR, true, false);
};
// elements.arrow.onclick = onClickBack;
elements.arrow.onclick = onClickBack;
// elements.imgScreenshot.onclick = onClickScreenshot;
elements.arrowPrev.onclick = function(event) {
@ -369,7 +370,7 @@ function fetchAllPlugins(bFirstRender, bshowMarketplace) {
makeRequest(configUrl).then(
function(response) {
allPlugins = JSON.parse(response);
if (installedPlugins)
if (installedPlugins || bAppDirectory)
getAllPluginsData(bFirstRender, bshowMarketplace);
},
function(err) {
@ -440,7 +441,7 @@ function initElemnts() {
elements.linkNewPlugin = document.getElementById('link_newPlugin');
elements.divBody = document.getElementById('div_body');
elements.divMain = document.getElementById('div_main');
// elements.arrow = document.getElementById('arrow');
elements.arrow = document.getElementById('arrow');
// elements.close = document.getElementById('close');
elements.divHeader = document.getElementById('div_header');
elements.divSelected = document.getElementById('div_selected_toolbar');
@ -663,8 +664,10 @@ function createPluginDiv(plugin, bInstalled) {
div.onclick = onClickItem;
let installed = bInstalled ? plugin : findPlugin(false, plugin.guid);
if (bInstalled) {
// todo поправить
let installed =
? null : bInstalled ? plugin : findPlugin(false, plugin.guid);
if (bInstalled || bAppDirectory) {
plugin = findPlugin(true, plugin.guid);
}
@ -806,7 +809,7 @@ function onClickItem() {
divPreview.id = 'div_preview';
divPreview.className = 'div_preview';
let installed = findPlugin(false, guid);
let installed = bAppDirectory ? null : findPlugin(false, guid);
let plugin = findPlugin(true, guid);
if ( !plugin || ( isDesktop && installed ) ) {
elements.divGitLink.classList.add('hidden');
@ -903,7 +906,7 @@ function onClickItem() {
elements.divSelectedMain.classList.remove('hidden');
elements.divBody.classList.add('hidden');
sendMessage( { type : "showButton" } );
// elements.arrow.classList.remove('hidden');
elements.arrow.classList.remove('hidden');
};
function onClickBack() {
@ -918,7 +921,7 @@ function onClickBack() {
current.index = 0;
current.screenshots = [];
current.url = '';
// elements.arrow.classList.add('hidden');
elements.arrow.classList.add('hidden');
if(Ps) Ps.update();
};
@ -1129,7 +1132,11 @@ function onTranslate() {
function showMarketplace() {
// show main window to user
if (!isPluginLoading && !isTranslationLoading && !isFrameLoading && installedPlugins) {
if (!isPluginLoading && !isTranslationLoading && !isFrameLoading && (installedPlugins || bAppDirectory)) {
if(bAppDirectory) {
installedPlugins = [];
document.getElementsByClassName('toolbar_top')[0].classList.add('hidden');
}
createSelect();
if (isOnline)
showListofPlugins(isOnline);
@ -1430,6 +1437,7 @@ function removeUnloaded(unloaded) {
};
function findPlugin(bAll, guid) {
// todo поправить везде где есть поиск, чтобы поиск запускался, если только есть такая группа плагинов
let res = bAll
? allPlugins.find(function(el){return el.guid === guid})
: installedPlugins.find(function(el){return el.guid === guid});