Skip to content

Commit 8d2c1c1

Browse files
save file
1 parent c0e7580 commit 8d2c1c1

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

utils/misc/nodejs-terminal/v3.0/nodejs-terminal-v3.0.html

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@
558558
snapshot.list = $(snapshot.menu,'#list');
559559
snapshot.item = $(snapshot.list,'.item');
560560
snapshot.item.remove();
561-
ls.read.snapshot_list.value.forEach(snapshot.additem);
561+
ls.read.snapshot_list.value.forEach(snapshot.add);
562562

563563

564564
var links = $('#links-menu');
@@ -879,8 +879,13 @@
879879
//:
880880

881881

882-
snapshot.additem = function(file){
882+
snapshot.add = function(file){
883883

884+
var list = ls.read.snapshot_list;
885+
list.push(file);
886+
ls.write.snapshot_list = list;
887+
888+
884889
var empty = $(snapshot.list,'#empty');
885890
if(empty){
886891
empty.remove();
@@ -909,6 +914,22 @@
909914
e.stopPropagation();
910915
nitem.remove();
911916

917+
var list = ls.read.snapshot_list;
918+
var f1 = JSON.stringify(file);
919+
var n = list.length;
920+
for(var i=0;i<n;i++){
921+
922+
var file2 = list[i];
923+
var f2 = JSON.stringify(file2);
924+
if(f1==f2){
925+
console.log('remove : found',i);
926+
list.splice(i,1);
927+
ls.write.snapshot_list = list;
928+
return;
929+
}
930+
931+
}//for
932+
912933
}//remove
913934

914935
}//additem
@@ -932,7 +953,7 @@
932953

933954
menu_callback.snapshot.add = function(){
934955

935-
snapshot.additem(cur.file);
956+
snapshot.add(cur.file);
936957

937958
}//add
938959

0 commit comments

Comments
 (0)