Skip to content

Commit

Permalink
twinkle: Put TW menu back on the right side of the More menu
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemLinguae committed Nov 4, 2023
1 parent e6e05d9 commit 84aad5d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion twinkle.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,24 @@ Twinkle.addPortlet = function(navigation, id, text, type, nextnodeid) {
}
return null;
}

if (type === 'menu') {
// In order to get mw.util.addPortlet to generate a dropdown menu in vector and vector-2022, the nextnodeid must be p-cactions. Any other nextnodeid will generate a non-dropdown portlet instead.
nextnodeid = 'p-cactions';
}
return mw.util.addPortlet(id, text, '#' + nextnodeid);

let portlet = mw.util.addPortlet(id, text, '#' + nextnodeid);

if (mw.config.get('skin') === 'vector') {
$('#p-twinkle').insertAfter('#p-cactions');
} else if (mw.config.get('skin') === 'vector-2022') {
$('#p-twinkle-dropdown').insertAfter('.vector-page-tools-landmark');
// this creates two #p-twinkle-dropdowns for some reason, in different spots on the DOM. maybe some JS in vector 2022? delete the bad one:
$('.vector-column-end > #p-twinkle-dropdown').remove();
portlet = $('#p-twinkle-dropdown');
}

return portlet;
};

/**
Expand Down

0 comments on commit 84aad5d

Please sign in to comment.