Another simple addon. This time to add the ability to bring back the unstarred segments. It works for up to 50 removed elements. If you need more, you can change the value of MAX_LENGTH in the code for the appropriate value.
It has its limitations - doesn’t work, if you remove all the segments at once.
It will also add a segment to the queue, if you split any segment (splitting a segment removes the old one, after all).
It has a single list for all the tabs, so if you have more than one instances of Neuroglancer opened, beware of that.
The button to bring back a removed segment is at the top bar near the right side of the screen. The counter next to the “Undelete” label shows, how many segments there are in the queue. When the queue is full, the oldest ones (removed earlier) are removed from the list and you can’t no longer bring them back.
Just noting a bug: It seems like if you add and remove the same segment multiple times the Undelete function gets stuck in a loop and won’t move back through older segments.
I was able to reproduce this issue for a moment, but then I’ve cleared the undelete history (in localStorage) and I’m no longer able to reproduce it. @Celia_D Do you have some steps to reproduce is regularly?
Also, try clearing the history in localStorage and see, if the problem persists.
To clear it:
Open the Console (F12) and make sure, you’re on the Console tab.
Paste this code: localStorage.removeItem('delete') and press Enter.
Refresh the page. Warning: this will clear you’re undelete history, but that probably won’t be a problem, since it currently doesn’t work anyway.
It seemed to clear up for a moment, but then I went further back in the list and it seems like it’s still stuck. Here’s my link if you want to give it a look - neuroglancer , though maybe it won’t work for you if it’s a local issue
Unfortunately, that won’t help me. If you could get me a copy of your localStorage that could potentially help.
To do this, in the console type: localStorage.getItem('deleted') and press Enter.
Now I was able to reproduce the issue.
The problem seems to be with the shorter numbers (starting with 7 in this case). If I’m not mistaken, those numbers happen, when Neuroglancer adds a component segment ID, instead of the whole segment ID. Not sure, why it happens, but it happens, none the less.
The issue with the loop happens, because even if a user tries to manually add such shorter number as a segment ID, Neuroglancer will remove such segment automatically. So, when the addon tries to undelete such a segment, Neuroglancer removes it, addons adds it to its list and we’re in a loop.
I’ll fix the issue by checking the length of the number added to the list (hopefully, the future segment IDs won’t change in length, or they won’t be added to the undelete list. But if it was going to happen, I’ll just try to find another fix then).
In the meantime, to escape from the loop, just clear the localStorage. Just a small correction: yesterday I wrote, that the instruction is with delete in it, but it should be deleted (with the “d” at the end). So, the correct one is: localStorage.removeItem('deleted').
Ok, now in v. 1.2 it should be fixed.
Also added a small update: if a user removes the same segment for a few times in a row without undeleting it in the meantime, the segment will be added to the undelete history only once.