User:Sportzpikachu/bookmarks.js: Difference between revisions
Appearance
Content deleted Content added
inject hint Tag: Reverted |
No edit summary Tag: Reverted |
||
Line 3: | Line 3: | ||
.then( ( r ) => r.json() ) |
.then( ( r ) => r.json() ) |
||
.then( ( bookmarks ) => { |
.then( ( bookmarks ) => { |
||
mw.util.addPortlet( 'p-bookmarks', 'Bookmarks [edit]', 'p-tb' ); |
|||
⚫ | |||
document.getElementById( 'p-bookmarks-label' ).innerHTML = |
document.getElementById( 'p-bookmarks-label' ).innerHTML = |
||
'Bookmarks [<a href="/w/index.php?title=Special:MyPage/bookmarks.json&action=edit">edit</a>]'; |
'Bookmarks [<a href="/w/index.php?title=Special:MyPage/bookmarks.json&action=edit">edit</a>]'; |
||
⚫ | |||
document.getElementById( 'p-bookmarks' ) |
|||
); |
|||
for ( const bookmark of bookmarks ) { |
for ( const bookmark of bookmarks ) { |
||
mw.util.addPortletLink( |
mw.util.addPortletLink( |
Revision as of 21:38, 31 May 2024
mw.loader.using( 'mediawiki.util' )
.then( () => fetch( '/w/index.php?title=Special:MyPage/bookmarks.json&action=raw&ctype=application/json' ) )
.then( ( r ) => r.json() )
.then( ( bookmarks ) => {
mw.util.addPortlet( 'p-bookmarks', 'Bookmarks [edit]', 'p-tb' );
document.getElementById( 'p-bookmarks-label' ).innerHTML =
'Bookmarks [<a href="/w/index.php?title=Special:MyPage/bookmarks.json&action=edit">edit</a>]';
document.getElementById( 'p-tb' ).after(
document.getElementById( 'p-bookmarks' )
);
for ( const bookmark of bookmarks ) {
mw.util.addPortletLink(
'p-bookmarks',
mw.util.getUrl( bookmark.url ),
bookmark.name,
null,
null,
bookmark.accesskey,
);
}
} );