User:Sportzpikachu/bookmarks.js

Promise.all( [ fetch( '/w/index.php?title=Special:MyPage/bookmarks.json&action=raw&ctype=application/json' ), mw.loader.using( 'mediawiki.util' ) ] ) .then( ( [ r ] ) => r.json ) .then( ( bookmarks ) => {		mw.util.addPortlet( 'p-bookmarks', 'Bookmarks [edit]', '#p-interaction' );		if ( !document.querySelector( '#p-bookmarks' ) ) {			// fallback			mw.util.addPortlet( 'p-bookmarks', 'Bookmarks [edit]', '#p-tb' );		}		document.querySelector( '#p-bookmarks > .vector-menu-heading' ).innerHTML =			'Bookmarks [edit]' ;

for ( const bookmark of bookmarks ) { mw.util.addPortletLink(				'p-bookmarks',				mw.util.getUrl( bookmark.url ),				bookmark.name,				null,				null,				bookmark.accesskey,			); }	} );