* Animate watch/unwatch links to use asynchronous API requests to
* watch pages, rather than navigating to a different URI.
*
- * @class mw.page.watch.ajax
+ * Usage:
+ *
+ * var watch = require( 'mediawiki.page.watch.ajax' );
+ * watch.updateWatchLink(
+ * $node,
+ * 'watch',
+ * 'loading'
+ * );
+ *
+ * @class mw.plugin.page.watch.ajax
+ * @singleton
*/
( function ( mw, $ ) {
var watch,
};
module.exports = watch;
- // Deprecated since 1.30
- mw.log.deprecate( mw, 'page',
- { watch: watch },
- 'Use require( \'mediawiki.page.watch.ajax\' ) instead.',
- 'mw.page'
- );
-
$( function () {
- var $links = $( '.mw-watchlink a, a.mw-watchlink' );
- // Restrict to core interfaces, ignore user-generated content
- $links = $links.filter( ':not( #bodyContent *, #content * )' );
+ var $links = $( '.mw-watchlink a[data-mw="interface"], a.mw-watchlink[data-mw="interface"]' );
+ if ( !$links.length ) {
+ // Fallback to the class-based exclusion method for backwards-compatibility
+ $links = $( '.mw-watchlink a, a.mw-watchlink' );
+ // Restrict to core interfaces, ignore user-generated content
+ $links = $links.filter( ':not( #bodyContent *, #content * )' );
+ }
$links.click( function ( e ) {
var mwTitle, action, api, $link;