Prevent "Prevent leave" / "You have unsaved changes"

https://openuserjs.org/scripts/linonetwo/Tiddlywiki_Prevent_Prevent_Leave

I found some Tiddlywiki websites are annoying when they try to catch me and prevent me to leave them. Even they are just documentation website, that I may modify something, and don’t want to save them at all.

I developed Prevent Edit plugin for plugin developers, but seems no many plugin developers install it in their website.

So I have to hunt it down on my side. With this user script, I can force those website to close now!

I can see that it might be useful to some. But for me, the opposite problem is much more likely: I accidentally ignore an unsaved wiki prompt and lose data, so I live with the minor annoyance of the popup that’s not usually necessary.

You can ignore you own wiki’s url when using user script.

I only use TidGi Desktop app and Mobile App, so it is fine for me.

Well, my own wikis are almost always served over Node with autosave, or publicly on GitHub pages, often in read-only mode. It’s when I’m playing with wikis from other people that I run into this issue. It happened just the other day. I was playing with the new Geospatial plugin, just using the demo page as a testbed. But my computer decided then when I told it to go into hibernation, I really meant for it to reboot, and when I came back, that work was lost. It wasn’t a big deal, and if I really wanted to recreate it, I probably could, but that’s the sort of scenario that I run into.

Please see the attached, it is a transportable bookmarklet in a tiddler.

  • Import it to any wiki
  • look inside to see its javascript payload in javascript-function the (For your safety)
  • Drag Reset Dirty link to your bookmarklets.
    • if you keep this tiddler in your wiki, you can also click it in the tiddler for the same effect.
  • Click to reset the dirty indicator on any wiki
    • Further changes will set dirty again

Reset Dirty save status.json (919 Bytes)

To find in the future visit https://bookmarklets.tiddlyhost.com/ and see Bookmarklets sidebar

1 Like