X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki.rcfilters%2Fdm%2Fmw.rcfilters.dm.ChangesListViewModel.js;h=0155a587fd9e8839c3c3a066dc7d9ae9bab8fee7;hp=f221b2b81f1f3ceda1b8ebfbfb4d982a83095b48;hb=3df3b575c6617df64ec98533cc7141bd2314e274;hpb=d6551bcbad8e2c0c94af630212433150ac7ff841 diff --git a/resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.ChangesListViewModel.js b/resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.ChangesListViewModel.js index f221b2b81f..0155a587fd 100644 --- a/resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.ChangesListViewModel.js +++ b/resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.ChangesListViewModel.js @@ -14,6 +14,7 @@ this.newChangesExist = false; this.nextFrom = null; this.liveUpdate = false; + this.unseenWatchedChanges = false; }; /* Initialization */ @@ -79,6 +80,7 @@ var from = this.nextFrom; this.valid = true; this.extractNextFrom( $fieldset ); + this.checkForUnseenWatchedChanges( changesListContent ); this.emit( 'update', changesListContent, $fieldset, isInitialDOM, separateOldAndNew ? from : null ); }; @@ -108,7 +110,8 @@ * @param {jQuery} $fieldset */ mw.rcfilters.dm.ChangesListViewModel.prototype.extractNextFrom = function ( $fieldset ) { - this.nextFrom = $fieldset.find( '.rclistfrom > a' ).data( 'params' ).from; + var data = $fieldset.find( '.rclistfrom > a' ).data( 'params' ); + this.nextFrom = data ? data.from : null; }; /** @@ -138,4 +141,20 @@ return this.liveUpdate; }; + /** + * Check if some of the given changes watched and unseen + * + * @param {jQuery|string} changeslistContent + */ + mw.rcfilters.dm.ChangesListViewModel.prototype.checkForUnseenWatchedChanges = function ( changeslistContent ) { + this.unseenWatchedChanges = changeslistContent !== 'NO_RESULTS' && + changeslistContent.find( '.mw-changeslist-line-watched' ).length > 0; + }; + + /** + * @return {boolean} Whether some of the current changes are watched and unseen + */ + mw.rcfilters.dm.ChangesListViewModel.prototype.hasUnseenWatchedChanges = function () { + return this.unseenWatchedChanges; + }; }( mediaWiki ) );