User:PetraMagna/HotCat.js: Difference between revisions

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:
const result = self.accept( evt );
// if save_button exists, we are in multiinput mode
setTimeout(function() {
const save_button = document.querySelector("#mw-normal-catlinks input[value='Save']");
if (save_button) {
//if automatically(save_button) add a new add button{
// automatically click the add button
const add_buttonadd_buttons = document.querySelectorquerySelectorAll("#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 (save_buttonadd_button) {
add_button.click();
}
}
}, 100);
return result;
}