User:Sportzpikachu/bookmarks.js: Difference between revisions
Appearance
Content deleted Content added
m fix: selector should be a selector (again) |
fix: bookmarks label selector |
||
Line 4: | Line 4: | ||
.then( ( bookmarks ) => { |
.then( ( bookmarks ) => { |
||
mw.util.addPortlet( 'p-bookmarks', 'Bookmarks [edit]', '#p-lang' ); |
mw.util.addPortlet( 'p-bookmarks', 'Bookmarks [edit]', '#p-lang' ); |
||
$( '#p-bookmarks |
$( '#p-bookmarkslabel' ).html( 'Bookmarks [<a href="/w/index.php?title=Special:MyPage/bookmarks.json&action=edit">edit</a>]' ); |
||
for ( const bookmark of bookmarks ) { |
for ( const bookmark of bookmarks ) { |
Revision as of 16:10, 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-lang' );
$( '#p-bookmarks-label' ).html( 'Bookmarks [<a href="/w/index.php?title=Special:MyPage/bookmarks.json&action=edit">edit</a>]' );
for ( const bookmark of bookmarks ) {
mw.util.addPortletLink(
'p-bookmarks',
mw.util.getUrl( bookmark.url ),
bookmark.name,
null,
null,
bookmark.accesskey,
);
}
} );