Skip to content

Commit

Permalink
Merge pull request #368 from jobsofferings/feature_release_delete_des…
Browse files Browse the repository at this point in the history
…ktop_icon

Fix the problem of deleting desktop applications
  • Loading branch information
User782Tec authored Jan 22, 2024
2 parents c028b76 + dfbe0f7 commit 9da50e1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@ $('input,textarea,*[contenteditable=true]').on('contextmenu', (e) => {
function addMenu() {
var parentDiv = document.getElementById('desktop');
var childDivs = parentDiv.getElementsByTagName('div');

for (var i = 0; i < childDivs.length; i++) {
for (let i = 0; i < childDivs.length; i++) {
if (i <= 4) {//win12内置的5个图标不添加
continue;
}
var div = childDivs[i];
let div = childDivs[i];
div.setAttribute('iconIndex', i - 5);
console.log(i - 5, div.getAttribute('appname'))
div.addEventListener('contextmenu', (event) => {
if (div.getAttribute('appname') != undefined) {
return showcm(event, 'desktop.icon', [div.getAttribute('appname'), div.getAttribute('iconIndex')]);
Expand Down Expand Up @@ -120,7 +118,7 @@ let cms = {
},
function (arg) {
if (arg[1] >= 0) {
return ['<i class="bi bi-trash3"></i> 删除', 'desktopItem.splice(' + (arg[1] - 1) + ', 1);saveDesktop();setIcon();addMenu();'];
return ['<i class="bi bi-trash3"></i> 删除', 'desktopItem.splice(' + (arg[1]) + ', 1);saveDesktop();setIcon();addMenu();'];
} else {
return 'null';
}
Expand Down Expand Up @@ -3788,7 +3786,7 @@ function setIcon() {
if (/^(1|0)+$/.test(sys_setting_back.join(''))/* 只含有0和1 */) {
sys_setting = sys_setting_back;
for (var i = 0; i < sys_setting.length; i++) {
document.getElementById('sys_setting_' + (i + 1)).setAttribute("class", 'a checkbox' + (sys_setting[i] ? ' checked' : '')); //设置class属性
document.getElementById('sys_setting_' + (i + 1))?.setAttribute("class", 'a checkbox' + (sys_setting[i] ? ' checked' : '')); //设置class属性
if (i == 5) {
use_music = sys_setting[i] ? true : false;
}
Expand Down

0 comments on commit 9da50e1

Please sign in to comment.