Page MenuHomePhabricator

Use Ajax to watch/unwatch articles
Closed, ResolvedPublic

Description

Author: ayg

Description:
Currently, when you click the watch/unwatch tab, it brings you to a new page
confirming that the page has been watched/unwatched. Could we use Ajax for this
by default, keeping the current behavior as a fallback? There's a script to do
this at http://wikipedia.quarl.org/scripts/watchbutton.js (I've asked about
licensing on [[User talk:Quarl]]).


Version: unspecified
Severity: enhancement

Details

Reference
bz7169

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:25 PM
bzimport set Reference to bz7169.
bzimport added a subscriber: Unknown Object (MLST).

robchur wrote:

There's another open bug which, if fulfilled in whole or part, would mean that
the user was returned to the article view once a watchlist operation was
completed. That might be quick enough to not require this.

ayg wrote:

Bug 7129? Closely related, yes, now that you point it out, but there's not
really any point in leaving the page to begin with, if you think about it.

robchur wrote:

No, of course not, but I'd suggest that we make the fallback behaviour
"apparently identical" to the fancy AJAX behaviour.

dto wrote:

By the way, as far as I can tell, that script would make the experience somewhat
better for the user, although without some server-side changes, no bandwidth or
processing time will be saved.

dto wrote:

patch

Adds ajax watch/unwatch functionality.

Test it out at
http://www.dtopo.afraid.org/svnwiki/index.php?title=Special:Userlogin&returnto=User:Dto/Sandbox

(user: Test123; pass: test).

Some of the bigger changes:

New file skins/common/ajaxwatch.js: adds main client-side logic
New system message Ajaxwatch.js: used to customize/internationalize user
interface used by ajaxwatch.js
New configuration setting $wgAjaxWatch: flag to turn this functionality on/off
New ajax function wfAjaxWatch: the function that is called through AJAX

If the browser does not support this feature, it should not become effective on
the client side and the default HTML link should remain.

I have tested this successfully on Windows with Firefox 1.5, IE 6, and Opera 9.

attachment ajaxwatch.diff ignored as obsolete

dto wrote:

Some limitations: Only works with SkinTemplate-based templates (which have the
ca-watch/ca-unwatch tabs), i.e. MonoBook, Chick, MySkin, and Simple.

MySkin is the only one of those four skins which does *not* have a .usermessage
css class (so far only used for "you have new messages", I believe), so the
message is currently barely visible.

dto wrote:

Currently rewriting patch so we don't suffer from the same problems that
Monobook.js (bug 5376) does...

dto wrote:

better patch

Updated patch.

Same demo installation as before.

Big changes (ignore big changes in previous comment):

New file skins/common/ajaxwatch.js: adds main client-side logic
New system messages addedwatchajaxtext, removedwatchajaxtext, watching,
unwatching: interface text
New configuration setting $wgAjaxWatch: flag to turn functionality on/off
New ajax function wfAjaxWatch: the function that is called through AJAX
Several new functions in wikibits.js: facilitate updating access key/tooltip
for just one element

The internationalization through the new system messages (and the existing
messages watch and unwatch) is done through some javascript appended to the
site js (i.e. action=raw&gen=js).

If the browser does not support this feature, it should not become effective on

the client side and the default HTML link should remain.

I have tested this successfully on Windows with Firefox 1.5, IE 6, and Opera 9.

attachment ajaxwatch.diff ignored as obsolete

dto wrote:

betterer patch

Small changes. This is hopefully the final patch.

Attached:

ayg wrote:

Applied with modifications in r18598.