Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -1887,6 +1887,12 @@ function geticon(name) {
else return name + '.svg';
}

function syncTaskbarLayout() {
const count = $('#taskbar>a').length;
$('#taskbar').attr('count', count);
$('#taskbar').css('display', count == 0 ? 'none' : 'flex');
$('#taskbar').css('width', 4 + count * (34 + 4));
}

function openapp(name) {
if (taskmgrTasks.findIndex(elt => elt.link == name) > -1 && apps.taskmgr.tasks.findIndex(elt => elt.link == name) == -1) {
Expand All @@ -1901,14 +1907,11 @@ function openapp(name) {
}
$('.window.' + name).addClass('load');
showwin(name);
$('#taskbar').attr('count', Number($('#taskbar').attr('count')) + 1);
$('#taskbar').append(`<a class="${name}" onclick="taskbarclick('${name}\')" win12_title="${$(`.window.${name}>.titbar>p`).text()}" onmouseenter="showdescp(event)" onmouseleave="hidedescp(event)" oncontextmenu="return showcm(event, 'taskbar', '${name}')"><img src="icon/${icon[name] || (name + '.svg')}"></a>`);
if ($('#taskbar').attr('count') == '1') {
$('#taskbar').css('display', 'flex');
}
syncTaskbarLayout();
$('#taskbar>.' + name).addClass('foc');
setTimeout(() => {
$('#taskbar').css('width', 4 + $('#taskbar').attr('count') * (34 + 4));
syncTaskbarLayout();
}, 0);
let tmp = name.replace(/\-(\w)/g, function (all, letter) {
return letter.toUpperCase();
Expand Down
9 changes: 3 additions & 6 deletions module/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,10 @@ function hidewin(name, arg = 'window') {
closeVideo()
}
if (arg == 'window') {
$('#taskbar').attr('count', Number($('#taskbar').attr('count')) - 1);
$('#taskbar>.' + name).remove();
$('#taskbar').css('width', 4 + $('#taskbar').attr('count') * (34 + 4));
syncTaskbarLayout();
setTimeout(() => {
if ($('#taskbar').attr('count') == '0') {
$('#taskbar').css('display', 'none');
}
syncTaskbarLayout();
}, 80);
}
setTimeout(() => {
Expand Down Expand Up @@ -496,4 +493,4 @@ function taskbarclick(name) {
minwin(name);
}
focwin(name);
}
}