/*! * Scripts for WatchlistExpiry on action=edit */ 'use strict'; // Toggle the watchlist-expiry dropdown's disabled state according to the // selected state of the watchthis checkbox. $( () => { // The 'wpWatchthis' and 'wpWatchlistExpiry' fields come from EditPage.php. const watchThisNode = document.getElementById( 'wpWatchthisWidget' ), expiryNode = document.getElementById( 'wpWatchlistExpiryWidget' ); if ( watchThisNode && expiryNode ) { const watchThisWidget = OO.ui.infuse( watchThisNode ); const expiryWidget = OO.ui.infuse( expiryNode ); // Set initial state to match the watchthis checkbox. expiryWidget.setDisabled( !watchThisWidget.isSelected() ); // Change state on every change of the watchthis checkbox. watchThisWidget.on( 'change', ( enabled ) => { expiryWidget.setDisabled( !enabled ); } ); } } );