Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

twinkle: Put TW menu back on the right side of the More menu #1887

Merged
merged 5 commits into from
Nov 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
NovemLinguae marked this conversation as resolved.
Show resolved Hide resolved

if (mw.config.get('skin') === 'vector') {
$('#p-twinkle').insertAfter('#p-cactions');
NovemLinguae marked this conversation as resolved.
Show resolved Hide resolved
} else if (mw.config.get('skin') === 'vector-2022') {
$('#p-twinkle-dropdown').insertAfter('.vector-page-tools-landmark');
NovemLinguae marked this conversation as resolved.
Show resolved Hide resolved
// 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:
NovemLinguae marked this conversation as resolved.
Show resolved Hide resolved
$('.vector-column-end > #p-twinkle-dropdown').remove();
NovemLinguae marked this conversation as resolved.
Show resolved Hide resolved
portlet = $('#p-twinkle-dropdown');
}

return portlet;
};

/**
Expand Down
Loading