User:PetraMagna/HotCat.js: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
PetraMagna (talk | contribs) always autocommit |
PetraMagna (talk | contribs) m auto "click" add button after enter is pressed in edit box |
||
Line 1,563: | Line 1,563: | ||
// Handle return explicitly, to override the default form submission to be able to check for ctrl |
// Handle return explicitly, to override the default form submission to be able to check for ctrl |
||
if ( key === RET ) |
if ( key === RET ) { |
||
const result = self.accept( evt ); |
|||
// if save_button exists, we are in multiinput mode |
|||
const save_button = document.querySelector("#mw-normal-catlinks input[value='Save']"); |
|||
if (save_button) { |
|||
// automatically add a new add button |
|||
const add_button = document.querySelector("#mw-normal-catlinks a[title='Add a new category']"); |
|||
if (add_button) { |
|||
add_button.click(); |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
// Inhibit default behavior of ESC (revert to last real input in FF: we do that ourselves) |
// Inhibit default behavior of ESC (revert to last real input in FF: we do that ourselves) |
||
return ( key === ESC ) ? evtKill( evt ) : true; |
return ( key === ESC ) ? evtKill( evt ) : true; |