Debian Codegraph @

resources/src/mediawiki.misc-authed-ooui/special.undelete.loadMoreRevisions.js

raw symbols SCIP
1 /*!
2 * JavaScript for Special:Undelete when results exceed REVISION_HISTORY_LIMIT.
3 */
4 ( function () {
5 'use strict';
6 const $linkSpan = $( '#mw-load-more-revisions' );
7 let $link = $( '<a>' );
8
9 $link = $linkSpan.wrapAll( $link ).on( 'click', () => {
10 // Get the URL of the last link in the list
11 const urlString = $( '.mw-undelete-revlist li:last-child a' ).prop( 'href' );
12 // Extract the timestamp
13 const timestamp = mw.util.getParamValue( 'timestamp', urlString );
14 const $oldList = $( '.mw-undelete-revlist' );
15 const $spinner = $.createSpinner( { size: 'large', type: 'block' } );
16 const path = mw.util.wikiScript() + '?' + $.param( {
17 title: mw.config.get( 'wgPageName' ),
18 target: mw.config.get( 'wgRelevantPageName' )
19 } );
20
21 $oldList.after( $spinner );
22
23 $.ajax( {
24 type: 'GET',
25 url: path,
26 dataType: 'html',
27 data: {
28 historyoffset: timestamp,
29 action: 'render'
30 },
31 success: function ( data, status, jqXHR ) {
32 $spinner.remove();
33 const $newDoc = $.parseHTML( data );
34 if ( !$newDoc.length ) {
35 return;
36 }
37 const $newList = $( $newDoc[ 0 ] );
38 $oldList.append( $newList.children() );
39 if ( jqXHR.status !== 206 ) {
40 $link.hide();
41 }
42 },
43 error: function ( data, textStatus, errorMessage ) {
44 $spinner.remove();
45 $link.show();
46 mw.log.error( errorMessage );
47 }
48 } );
49 } );
50 }() );