Page MenuHomeWickedGov Phorge

watchlistexpiry.js
No OneTemporary

Size
908 B
Referenced Files
None
Subscribers
None

watchlistexpiry.js

( function () {
/*
* On touch devices, make it possible to click on the watchlist expiry clock icon
* and get a text display of the remaining days or hours for that watchlist item.
*
* @private
* @param {Event} event The click event.
*/
function addDaysLeftMessages( event ) {
const $clock = $( event.target );
const timeLeft = $clock.data( 'days-left' );
if ( timeLeft === undefined ) {
// Give up if there's no data attribute (e.g. in the watchlist legend).
return;
}
const msg = timeLeft > 0 ?
mw.msg( 'watchlist-expiry-days-left', timeLeft ) :
mw.msg( 'watchlist-expiry-hours-left' );
$clock.after( $( '<span>' )
.addClass( 'mw-watchlistexpiry-msg' )
.text( mw.msg( 'parentheses', msg ) ) );
}
$( () => {
if ( 'ontouchstart' in document.documentElement ) {
$( '.mw-changesList-watchlistExpiry' ).one( 'click', addDaysLeftMessages );
}
} );
}() );

File Metadata

Mime Type
text/x-asm
Expires
Sat, May 16, 12:52 (1 d, 4 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0a/60/77f78f2ca8bf6037c9744234d2b7
Default Alt Text
watchlistexpiry.js (908 B)

Event Timeline