User:DannyS712 test/watch demo.js

// $(function { var scriptUrl = mw.config.get( 'wgScriptPath' ) + '/api.php';

mw.loader.using( 'mediawiki.util', function {    $(document).ready( function  { var page = mw.config.get('wgPageName'); console.log( page ); if ( page && page === 'Special:BlankPage/Global'){ GlobalWatch; }   } ); } ); async function GlobalWatch{ var watched = await getWatch; var serial = new XMLSerializer; var watchedString = serial.serializeToString( watched ); console.log( watchedString ); var content = $('#mw-content-text')[0]; content.innerHTML = ''; // blanked content.innerText = watchedString; } function getWatch { return new Promise((resolve) => {		var getter = {	       action: 'feedwatchlist',	        format: 'json'		};		$.get( mw.config.get( 'wgScriptPath' ) + '/api.php', getter, function( response ) { console.log(response); //location.reload; resolve(response); } );	} ); } }); //