mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-03 16:10:31 +00:00
Replace lodash _.replace and _.pullAll usage
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user