User:TheTechie/bookmarks.js

$(function{	mw.loader.using(['mediawiki.util', "mediawiki.api"], function { mw.util.addPortlet('p-bk', 'B', '#p-cactions'); let bk1, bk2, bk3, bk4, bk5, bk6, bk7, bk8, bk9; bk1 = mw.util.addPortletLink(portletId='p-bk', href='#', text='1'); bk2 = mw.util.addPortletLink(portletId='p-bk', href='#', text='2'); bk3 = mw.util.addPortletLink(portletId='p-bk', href='#', text='3'); bk4 = mw.util.addPortletLink(portletId='p-bk', href='#', text='4'); bk5 = mw.util.addPortletLink(portletId='p-bk', href='#', text='5'); bk6 = mw.util.addPortletLink(portletId='p-bk', href='#', text='6'); bk7 = mw.util.addPortletLink(portletId='p-bk', href='#', text='7'); bk8 = mw.util.addPortletLink(portletId='p-bk', href='#', text='8'); bk9 = mw.util.addPortletLink(portletId='p-bk', href='#', text='9'); let page_name = "Special:MyPage/bookmarks.json"; $.getJSON(			mw.util.wikiScript('api'),			{				format: 'json',				action: 'query',				prop: 'revisions',				rvprop: 'content',				rvlimit: 1,				titles: page_name			}		) .then(function ( data ) {				var page, wikitext;				try {					for ( page in data.query.pages ) {						wikitext = data.query.pages[page].revisions[0]['*'];						alert( wikitext );					}				} catch ( e ) {					alert(e);				}			}); //.catch( doSomethingInCaseOfError ); }); });