You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Difference between revisions of "User:Razzi/common.js"

From Wikitech-static
Jump to navigation Jump to search
imported>Razzi
(Created page with "function toggleEdit() { document.querySelector("[accesskey='e']").click() } document.onkeydown = function(e) { const mRet = e.metaKey && e.key === 'Enter' if (e.metaKey &...")
 
imported>Razzi
(m-ret toggle edit)
Line 1: Line 1:
function toggleEdit() {
function toggleEdit() {
document.querySelector("[accesskey='e']").click()
const submitButton = document.getElementById('wpSave')
if (submitButton) {
submitButton.click()
} else {
document.querySelector("[accesskey='e']").click()
}
}
}


Line 6: Line 11:
const mRet = e.metaKey && e.key === 'Enter'
const mRet = e.metaKey && e.key === 'Enter'


if (e.metaKey && e.key === 'Enter') {
if (mRet) {
console.log('M-RET')
console.log('M-RET')
toggleEdit()
toggleEdit()
}
}
}
}

Revision as of 18:13, 14 June 2021

function toggleEdit() {
	const submitButton = document.getElementById('wpSave')
	if (submitButton) {
		submitButton.click()
	} else {
		document.querySelector("[accesskey='e']").click()
	}
}

document.onkeydown = function(e) {
	const mRet = e.metaKey && e.key === 'Enter'

	if (mRet) {
		console.log('M-RET')
		toggleEdit()
	}
}