User:PetraMagna/HotCat.js: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
m auto "click" add button after enter is pressed in edit box
previous one doesn't work; insanely ugly solution that fixes it; whatever
Line 1,566: Line 1,566:
const result = self.accept( evt );
const result = self.accept( evt );
// if save_button exists, we are in multiinput mode
// if save_button exists, we are in multiinput mode
setTimeout(function() {
const save_button = document.querySelector("#mw-normal-catlinks input[value='Save']");
const save_button = document.querySelector("#mw-normal-catlinks input[value='Save']");
if (save_button) {
// automatically add a new add button
if (save_button) {
// automatically click the add button
const add_button = document.querySelector("#mw-normal-catlinks a[title='Add a new category']");
const add_buttons = document.querySelectorAll("#mw-normal-catlinks a[title='Add a new category']");
if (add_button) {
if (add_buttons.length == 0) {
add_button.click();
return;
}
const add_button = add_buttons[add_buttons.length - 1]
if (add_button) {
add_button.click();
}
}
}
}
}, 100);
return result;
return result;
}
}