User:PetraMagna/HotCat.js: Difference between revisions

shift and + to enter into edit mode in NS File; no need to touch the mouse now
(press shift + enter to save)
(shift and + to enter into edit mode in NS File; no need to touch the mouse now)
 
Line 1,354:
DEL = 46,
IME = 229;
function clickAddButton() {
const add_buttons = document.querySelectorAll("#mw-normal-catlinks a[title='Add a new category']");
if (add_buttons.length == 0) {
return;
}
const add_button = add_buttons[add_buttons.length - 1]
if (add_button) {
add_button.click();
}
}
 
CategoryEditor.prototype = {
Line 1,573 ⟶ 1,584:
}
if (save_button) {
clickAddButton();
// automatically click the add button
const add_buttons = document.querySelectorAll("#mw-normal-catlinks a[title='Add a new category']");
if (add_buttons.length == 0) {
return;
}
const add_button = add_buttons[add_buttons.length - 1]
if (add_button) {
add_button.click();
}
}
}, 100);
Line 2,694 ⟶ 2,697:
}
}; // end CategoryEditor.prototype
 
// Added by PetraMagna: auto start editing with a keypress
function startEditing() {
const several_button = document.querySelector("#catlinks a[title='Modify several categories']");
several_button.click();
clickAddButton();
}
 
function initialize() {
Line 2,832 ⟶ 2,842:
}
is_rtl = ( is_rtl === 'rtl' );
}
if (mw.config.get("wgNamespaceNumber") === 6) {
window.addEventListener("keyup", (event) => {
if (event.shiftKey && event.keyCode === 187) {
startEditing();
}
})
}
}