[winxp] show 'local templates' panel

This commit is contained in:
maxkadushkin
2024-10-14 01:34:12 +03:00
parent df6c6f3ff8
commit 7bfbae747e
3 changed files with 51 additions and 37 deletions

View File

@ -49,7 +49,7 @@ $(document).ready(function() {
!window.app && (window.app = {controller:{}});
!window.app.controller && (window.app.controller = {});
if ( !window.utils.isWinXp && !!window.ControllerTemplates )
if ( !!window.ControllerTemplates )
window.app.controller.templates = (new ControllerTemplates).init();
window.app.controller.recent = (new ControllerRecent).init();
window.app.controller.folders = (new ControllerFolders).init();

View File

@ -82,7 +82,7 @@
<div class='flexbox content-box'>
<div class='lr-flex'>
<h3 class='table-caption' l10n>${_lang.actTemplates}</h3>
<div>
<div id='idx-nav-templates'>
<a data-value='local' class='nav-item'>Local</a>
<a data-value='cloud' class='nav-item'>Cloud</a>
</div>
@ -224,44 +224,49 @@
this.view.$panel.addClass('local');
$('.nav-item[data-value=local]', this.view.$panel).addClass('selected');
const _check_url_avail = () => {
if ( !iframe ) {
fetch(_url_templates.replace('{0}', 'en'), {mode: 'no-cors'}).
then(r => {
if ( r.status == 200 || r.type == 'opaque' ) {
iframe = _create_and_inject_iframe();
}
}).
catch(e => console.error('error on check templates url', e));
if ( window.utils.isWinXp ) {
$('#idx-nav-templates', this.view.$panel).hide();
this.view.$panel.addClass('win_xp');
} else {
const _check_url_avail = () => {
if ( !iframe ) {
fetch(_url_templates.replace('{0}', 'en'), {mode: 'no-cors'}).
then(r => {
if ( r.status == 200 || r.type == 'opaque' ) {
iframe = _create_and_inject_iframe();
}
}).
catch(e => console.error('error on check templates url', e));
}
}
_check_url_avail();
CommonEvents.on('panel:show', panel => {
if ( !iframe && panel == this.action ) {
_check_url_avail();
}
});
CommonEvents.on('lang:changed', (old, newlang) => {
window.errorBox.translate(newlang);
if ( !!iframe ) {
// iframe.contentWindow.postMessage(JSON.stringify({lang: newlang}));
_remove_frame(this.view.emptyPanelContent);
_check_url_avail();
}
});
CommonEvents.on('theme:changed', (theme, type) => {
if ( !!iframe ) {
// iframe.contentWindow.postMessage(JSON.stringify({theme: {name: theme, type: type}}));
_remove_frame(this.view.emptyPanelContent);
_check_url_avail();
}
});
}
_check_url_avail();
CommonEvents.on('panel:show', panel => {
if ( !iframe && panel == this.action ) {
_check_url_avail();
}
});
CommonEvents.on('lang:changed', (old, newlang) => {
window.errorBox.translate(newlang);
if ( !!iframe ) {
// iframe.contentWindow.postMessage(JSON.stringify({lang: newlang}));
_remove_frame(this.view.emptyPanelContent);
_check_url_avail();
}
});
CommonEvents.on('theme:changed', (theme, type) => {
if ( !!iframe ) {
// iframe.contentWindow.postMessage(JSON.stringify({theme: {name: theme, type: type}}));
_remove_frame(this.view.emptyPanelContent);
_check_url_avail();
}
});
// if ( !!localStorage.templatespanel ) {
// let iframe;
// if ( navigator.onLine ) {

View File

@ -1404,6 +1404,15 @@ li.menu-item {
flex-wrap: wrap;
gap: 10px 5px;
}
&.win_xp {
.icon {
.box {
left: 0;
transform: none;
}
}
}
}
#idx-update-cnt {