Replace lodash _.replace and _.pullAll usage

This commit is contained in:
jelveh
2026-04-24 22:36:31 -07:00
parent 0ae3f4dcfa
commit 205a8bbbc5
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -384,7 +384,7 @@ async function UIDesktop (options) {
// Update all elements whose paths start with old_path
$(`[data-path^="${`${html_encode(item.old_path) }/`}"]`).each(function () {
const new_el_path = _.replace($(this).attr('data-path'), `${item.old_path }/`, `${new_path }/`);
const new_el_path = $(this).attr('data-path').replace(`${item.old_path }/`, `${new_path }/`);
$(this).attr('data-path', new_el_path);
});
@@ -599,7 +599,7 @@ async function UIDesktop (options) {
// Update all elements whose paths start with old_path
$(`[data-path^="${`${html_encode(item.old_path) }/`}"]`).each(function () {
const new_el_path = _.replace($(this).attr('data-path'), `${item.old_path }/`, `${new_path }/`);
const new_el_path = $(this).attr('data-path').replace(`${item.old_path }/`, `${new_path }/`);
$(this).attr('data-path', new_el_path);
});
+1 -1
View File
@@ -3674,7 +3674,7 @@ $.fn.close = async function (options) {
const win_id = parseInt($(this).attr('data-id'));
let window_uuid = $(this).attr('data-element_uuid');
// remove all instances of win_id from window.window_stack
_.pullAll(window.window_stack, [win_id]);
window.window_stack = window.window_stack.filter(id => id !== win_id);
// taskbar update
let open_window_count = parseInt($(`.taskbar-item[data-app="${$(this).attr('data-app')}"]`).attr('data-open-windows'));
// update open window count of corresponding taskbar item
+1 -1
View File
@@ -2923,7 +2923,7 @@ window.rename_file = async (options, new_name, old_name, old_path, el_item, el_i
// Update the paths of all elements whose paths start with `old_path`
$(`[data-path^="${`${html_encode(old_path) }/`}"]`).each(function () {
const new_el_path = _.replace($(this).attr('data-path'), `${old_path }/`, `${new_path}/`);
const new_el_path = $(this).attr('data-path').replace(`${old_path }/`, `${new_path}/`);
$(this).attr('data-path', new_el_path);
});