User talk:Alex Smotrov/wlunwatch.js
Note: this script has been superseded by user:js/watchlist
Documentation
[edit]The script adds unwatch (x) link to each entry on your watchlist:
21:18 (x) Wikipedia:Village pump (technical) (diff; hist)
Clicking (x) instantly removes the entry from your watchlist using Ajax (without reloading the page)
21:18 (+) Wikipedia:Village pump (technical) (diff; hist)
The link then changes to (+), so you can add the page back to your watchlist.
Dynamic Installation (recommended): add this to your monobook.js:
if (wgCanonicalSpecialPageName && wgCanonicalSpecialPageName=='Watchlist' && wgAction=='view')
addOnloadHook(function () {
var frm = document.getElementsByTagName('form')[0]
frm.parentNode.insertBefore(document.createTextNode(' | '), frm)
var lnk = document.createElement('a')
lnk.appendChild(document.createTextNode('Unwatch…'))
lnk.href = 'javascript:importScript("User:Alex_Smotrov/wlunwatch.js")'
frm.parentNode.insertBefore(lnk, frm)
})
This code will add a new "Unwatch…" link next to "Hide minor edits" link
Clicking this "Unwatch…" link will load the main script, which only then will add (x) unwatch links.
This way your watchlist page is not slowed down by wlUnwatch script when you don't need to unwatch anything.
Static Installation:
importScript('User:Alex Smotrov/wlunwatch.js');
→ your monobook.js
Notes
- Tested in IE6/7, Firefox 1.5/2, Opera 9, Safari 3
- Optional parameter
wlUnwatchShowMsg = true
will make the script show standard watch/unwatch message on top of the screen (not recommended, since it makes everything below to scroll out of sight). - You can also unwatch entry by opening (x) in a new window.
- The script is reusing common ajaxwatch.js functionality.
Discussion
[edit]Doesn't work
[edit]This doesn't seem to work for me. Does it work for anyone else? -- Ddxc 14:23, 4 December 2007 (UTC)
- The script by itself should work, however any error in your monobook.js prevents your browser from executing any scripts below. I'm referring to this version, where
talkpagelink = document.getElementById('ca-talk')
results in null on any special page (such as watchlist), and the next statement results in error. To debug your scripts please use Firefox or Opera with Error Console open ∴ AlexSm 16:06, 4 December 2007 (UTC)- Thanks, Alex! It works great now. -- Ddxc 16:58, 4 December 2007 (UTC)
Can't get it to work for me using Safari 3.0.4 or Firefox 2.0.0.11 using Mac OS X 10.5.1. Not sure if it is a "mac thing", but normally things that work for FireFox for other OSes will work for me. The script makes that "Unwatch" link at the top of my watch list, but nothing happens when I click it. -- Ned Scott 07:36, 2 February 2008 (UTC)
- Sorry for the troubles. Glad to hear (below) that it also works on Safari 3 on Mac, since I have no way to test that ∴ AlexSm 19:03, 4 February 2008 (UTC)
- No need to apologies, I'm just grateful that the option even exists. Also, not many people may know this, but Safari 3 is now available for Windows XP and Vista, if you're ever curious for testing reasons :) -- Ned Scott 03:47, 5 February 2008 (UTC)
- I already had Safari 3/Win, tried it the first thing, of course it worked (since I have expanded watchlist), so I too thought it could be a Mac thing. I often do forget to specify Safari 3 in my userscripts docs, thanks for adding it ∴ AlexSm 22:28, 5 February 2008 (UTC)
Has there been a change?
[edit]Hmm, has there been a change? I'd been using this script for quite awhile without any problems, and then it stopped working yesterday, meaning all the list "x" options in my watchlist went away. The script is the top item on my javascript page, and I've made no changes to my monobook.js page in a long time, it just suddenly stopped. Any idea what' up? --Elonka 20:58, 3 February 2008 (UTC)
- It seems the problem I noted above is related to this as well, though I assumed it was a compatibility problem. The script now works for me in both browsers. -- Ned Scott 06:35, 4 February 2008 (UTC)
- You're right, that was my mistake, which broke the script for all users without the option "Revent Changes->Enhanced recent changes". I reverted the change, and will try to be more careful next time ∴ AlexSm 19:03, 4 February 2008 (UTC)
- Thanks, all is working again, I'm glad to have it back! I use it all the time, thanks for writing it. :) --Elonka 19:41, 4 February 2008 (UTC)
- You're right, that was my mistake, which broke the script for all users without the option "Revent Changes->Enhanced recent changes". I reverted the change, and will try to be more careful next time ∴ AlexSm 19:03, 4 February 2008 (UTC)
modern skin
[edit]Does this work with the modern skin? I tried the static installation and it did nothing; I tried the dynamic one and the "unwatch" link appears, but does nothing... Waldir talk 16:35, 17 March 2008 (UTC)
- I guess it's a skin problem... the script works with the compatibility function gadget installed. Waldir talk 16:51, 18 March 2008 (UTC)
- Yes, it was a skin problem. I just made this script compatible with Modern, so it doesn't require a compatibility gadget anymore, however I would suggest switching to user:js/watchlist script which some other useful functions and is more likely to be maintaned in future. Cheers. —AlexSm 16:59, 24 March 2008 (UTC)
Portlet errors
[edit]Hiya, starting this evening, every time I try loading a Wikipedia page, I get a popup error box saying "Replaced by addPortletLink()" and an "Okay" button. I debugged my Javascript page by selectively removing and adding functions, and it seems to be the "wlunwatch.js" function that's doing it. Any idea what's up? --Elonka 10:22, 4 April 2008 (UTC)
Doesn't work with HTTPS
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
This script doesn't work using the newly default HTTPS for Wikipedia; I get this error in the console: [blocked] The page at 'https://en.wikipedia.org/wiki/Special:Watchlist' was loaded over HTTPS, but ran insecure content from 'http://en.wikipedia.org/w/index.php?title=User:Js/watchlist.js&action=raw&ctype=text/javascript': this content should also be loaded over HTTPS.
For users who haven't migrated to User:Js/watchlist.js, the http:
should be removed from the import call. ~HueSatLum 23:37, 4 March 2014 (UTC)
- Submitting edit request. Actually, the final line could probably be replaced with
importScript('User:Js/watchlist.js');
or if there is a reason why that isn't done,mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Js/watchlist.js&action=raw&ctype=text/javascript')
becauseimportScriptURI()
is deprecated. ~HueSatLum 22:52, 9 March 2014 (UTC)- It actually should be replaced with:
unwatchLinksOnLoad = true;//Backlink: [[User:Js/watchlist.js]]
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Js/watchlist.js&action=raw&ctype=text/javascript');
— {{U|Technical 13}} (t • e • c) 00:22, 10 March 2014 (UTC)
- Done with Technical 13's version. Callanecc (talk • contribs • logs) 06:36, 10 March 2014 (UTC)