deevroman / better-osm-org

A userscript that adds several useful features to osm.org. β
30 stars 1 forks source link

Message title and body is lost whem using this script #24

Open Dimitar5555 opened 3 months ago

Dimitar5555 commented 3 months ago

Looking at the code, it shouldn't do anything with the message text boxes but for some reason it clears them when you change the page and go back. If the script is disabled (but TamperMonkey is enabled) the issue is not present.

https://github.com/deevroman/better-osm-org/assets/19364673/e3ca2e63-f22b-460b-832d-0fe5ec150b33

deevroman commented 3 months ago

Hmm, my fields are cleared even when the script (and Tampermoney) is disabled.

However, this only happens in Firefox; in Google Chrome, the fields are saved even when the extension is enabled

deevroman commented 3 months ago

Okay, I restarted the browser in safe mode and the fields started saving.

After that I restarted the browser again, enabled Tampermonkey and the fields are also saved. However, after running the script, the fields were cleared

However, after disabling the script, the fields continue to be cleared

deevroman commented 3 months ago

This happens when Tampermonkey even embeds a script like this:

// ==UserScript==
// @name         Better osm.org
// @match        https://www.openstreetmap.org/*
// ==/UserScript==

function main() {}

init.then(main);
Dimitar5555 commented 3 months ago

After enabling/disabling the script or TamperMonkey, you have to open a new tab with osm. Otherwise it seems to "remember" what was enabled.

deevroman commented 3 months ago

@Dimitar5555 if you refresh the page do you lose the contents of the fields? (with Tampermonkey disabled)

Dimitar5555 commented 3 months ago

@Dimitar5555 if you refresh the page do you lose the contents of the fields? (with Tampermonkey disabled)

The content remains, but if the osm tab was open while TamperMonkey was enabled, you need to close the tab and open a new one, after disabling TamperMonkey. If you don't do it, the content is always lost.

deevroman commented 3 months ago

Total (in each case I restarted the browser):

Firefox (128):

I'll report the Firefox bug to the developer Tampermonkey, but something tells me there's some kind of problem on the osm.org side too

upd: https://github.com/Tampermonkey/tampermonkey/issues/2092

Dimitar5555 commented 3 months ago

I'm using Firefox 126.0.1 with Linux Mnt 21.03 which may make a diffrence.

deevroman commented 3 months ago

I found a workaround: in 0.4, I no longer run the extension on important pages with forms:

https://www.openstreetmap.org/diary/new https://www.openstreetmap.org/message/new/ https://www.openstreetmap.org/reports/new/

For note and comment form pages, the problem persists because the extension changes these pages