Delete Diigo lists

By Tim McCormack Last update Jul 18, 2009 — Installed 52 times.

preparation for installation

in
Subscribe to preparation for installation 2 posts, 2 voices



Graham Perrin User
SafariMacintosh

Hi

I don't know scripting, but glancing at these two lines:

//delete everything on this page, then go to next page
var listsFound = $xpath("//span[starts-with(@onclick, 'delete')]");

— is it sensible for the user to time the installation carefully (avoid installing it too soon)?

Thanks
Graham

 
Tim McCormack Script's Author
FirefoxX11

Not sure what you mean by "too soon". It is a crude line of code, yes: It finds any link that deletes *something*, grabs the first numerical sequence it can find from the inline script, and tries to delete the list with that ID. There are several safeguards to ensure that only lists are deleted:

  • The code will only run on pages with URLs that start "http://www.diigo.com/list/..."
  • The GET that is sent to Diigo via the <img src=> hack is specific to lists

So let's say the user installs the script and then somehow visits a page that shows their bookmarks themselves but begins with /list. Worst case is that the userscript will probably hammer the server with requests to delete list IDs that don't exist. In any case, a big red message appears at the top of their screen, so they know what's going on if the page is "randomly" refreshing.

...but I really doubt the user is going to find themselves in that scenario, since /list only has lists (as far as I can tell.)

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel