Replace inputboxes with text value

Date: 2019-02-25

For copying text values (and not input boxes) from websites in e.g. Excel

Array.from(document.querySelectorAll('input,textarea'))
	.map(e => ({e, type: e.getAttribute('type').toLowerCase()}))
	.filter(e => !e.type || ['text', 'email', 'number', 'password'].includes(e.type))
	.forEach(d => {	
		const i = d.e;
		const r = i.getBoundingClientRect();
		const e = document.createElement('pre');
		e.style.display = 'inline-block';
		e.style.width = `${r.width}px`;
		e.style.height = `${r.height}px`;
		e.appendChild(document.createTextNode(i.value));
		i.parentElement.insertBefore(e, i)
		i.parentElement.removeChild(i);
	});
19170cookie-checkReplace inputboxes with text value