MediaWiki:Common.js
From TANGOWIKI-TITAF
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
mw.loader.using('jquery').done(function () {
$(document).ready(function () {
setTimeout(function () {
// Target Composer and Lyricist token fields
$('select[name="Recording[Composer][]"], select[name="Recording[Lyricist][]"]').on('select2:select', function () {
const $select = $(this);
setTimeout(function () {
$select.find('option:selected').each(function () {
const label = $(this).text();
const match = label.match(/\((TITAF-P-\d+)\)$/); // Look for pattern: (TITAF-P-1234567)
if (match) {
const id = match[1];
$(this).text(id).val(id);
}
});
}, 50);
});
}, 500);
});
});