Skip to content

Instantly share code, notes, and snippets.

@lucaswerkmeister
Created February 18, 2018 13:30
Show Gist options
  • Save lucaswerkmeister/d53661a7c77f5175af8f0ada639d01e0 to your computer and use it in GitHub Desktop.
Save lucaswerkmeister/d53661a7c77f5175af8f0ada639d01e0 to your computer and use it in GitHub Desktop.
Export Special:EditWatchlist’s state before submitting the page
( function() {
let list = '';
for ( let checkbox of document.querySelectorAll( 'input[type=checkbox]' ) ) {
let checked = checkbox.checked,
title = checkbox.value,
labelElement = checkbox.nextElementSibling.querySelector( 'a' ),
text;
if ( !labelElement ) {
labelElement = checkbox.nextElementSibling;
}
text = labelElement.textContent;
list += checked + '\t' + title + '\t' + text + '\n';
}
let output = document.createElement( 'pre' );
output.textContent = list;
document.body.appendChild( output );
console.log( 'done' );
} )();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment