Jump to content

User talk:Danski454/unwatch.js

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

AJAX?

[edit]

@Danski454: Would it be possible to click to unwatch without leaving the current page? Perhaps with an AJAX method? ~nmaia d 10:54, 6 May 2019 (UTC)[reply]

@NMaia:  Done: just add var unwatchAJAX = true; to your common.js (I left the old code in for those who still want it). --Danski454 (talk) 12:16, 6 May 2019 (UTC)[reply]
Awesome, thanks! :) ~nmaia d 12:21, 6 May 2019 (UTC)[reply]
@Danski454: Did I... do this right? It didn't work for me. ~nmaia d 12:25, 6 May 2019 (UTC)[reply]
@NMaia: That should work, what is happening instead? Danski454 (talk) 12:31, 6 May 2019 (UTC)[reply]
@Danski454: I'm still being directed to another page when I click [unwatch], same as before your modifications. No errors on my browser (Firefox) console. ~nmaia d 12:35, 6 May 2019 (UTC)[reply]
@NMaia: That should not happen, have you tried clearing your cache? --Danski454 (talk) 12:40, 6 May 2019 (UTC)[reply]
you should actually clear it. Danski454 (talk) 12:41, 6 May 2019 (UTC)[reply]
@Danski454: I tried Ctrl+F5, to no avail, and then cleared cache and cookies from en.wikipedia.org, also to no avail. ~nmaia d 12:44, 6 May 2019 (UTC)[reply]
@NMaia: this probably won't work, but try moving the var unwatchAJAX = true; before the mw.loader.load statement. Danski454 (talk) 12:49, 6 May 2019 (UTC)[reply]
@Danski454: Still didn't work. I tried using Ctrl+F5 and all. ~nmaia d 13:28, 6 May 2019 (UTC)[reply]

@NMaia: what happens if you run the code typeof unwatchAJAX !== "undefined" && unwatchAJAX in the console? I'll probably need to ask WP:VPT anyway. Danski454 (talk) 13:37, 6 May 2019 (UTC)[reply]

@Danski454: Running that returns false. FWIW, on meta I get the same issue. ~nmaia d 14:14, 6 May 2019 (UTC)[reply]
@NMaia: I think I've found it. Replace var unwatchAJAX = true; with window.unwatchAJAX = true;. It seems that code in global.js is run in a different scope. Danski454 (talk) 14:21, 6 May 2019 (UTC)[reply]
@Danski454: It works! You rock! Thank you. You might want to document these two variables as a comment on the code for future users :) ~nmaia d 14:25, 6 May 2019 (UTC)[reply]