Merge "resources: Strip '$' and 'mw' from file closures"
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / dm / mw.rcfilters.dm.ChangesListViewModel.js
index 15fe334..e51829c 100644 (file)
@@ -1,20 +1,22 @@
-( function ( mw ) {
+( function () {
        /**
         * View model for the changes list
         *
         * @mixins OO.EventEmitter
         *
+        * @param {jQuery} $initialFieldset The initial server-generated legacy form content
         * @constructor
         */
-       mw.rcfilters.dm.ChangesListViewModel = function MwRcfiltersDmChangesListViewModel() {
+       mw.rcfilters.dm.ChangesListViewModel = function MwRcfiltersDmChangesListViewModel( $initialFieldset ) {
                // Mixin constructor
                OO.EventEmitter.call( this );
 
                this.valid = true;
                this.newChangesExist = false;
-               this.nextFrom = null;
                this.liveUpdate = false;
                this.unseenWatchedChanges = false;
+
+               this.extractNextFrom( $initialFieldset );
        };
 
        /* Initialization */
@@ -74,7 +76,6 @@
         * @param {jQuery|string} changesListContent
         * @param {jQuery} $fieldset
         * @param {string} noResultsDetails Type of no result error
-        *   timeout.
         * @param {boolean} [isInitialDOM] Using the initial (already attached) DOM elements
         * @param {boolean} [separateOldAndNew] Whether a logical separation between old and new changes is needed
         * @fires update
         */
        mw.rcfilters.dm.ChangesListViewModel.prototype.extractNextFrom = function ( $fieldset ) {
                var data = $fieldset.find( '.rclistfrom > a, .wlinfo' ).data( 'params' );
-               this.nextFrom = data ? data.from : null;
+               if ( data && data.from ) {
+                       this.nextFrom = data.from;
+               }
        };
 
        /**
        mw.rcfilters.dm.ChangesListViewModel.prototype.hasUnseenWatchedChanges = function () {
                return this.unseenWatchedChanges;
        };
-}( mediaWiki ) );
+}() );