Skip to content

Instantly share code, notes, and snippets.

@ryancdotorg
Created March 27, 2024 23:59
Show Gist options
  • Save ryancdotorg/9fa22f783ab505e7a03fd9b7e577894b to your computer and use it in GitHub Desktop.
Save ryancdotorg/9fa22f783ab505e7a03fd9b7e577894b to your computer and use it in GitHub Desktop.
// This will look for a form that has titles to select from a dropdown list,
// add "Mx" as an option if not already present, and mark "Mx" as active.
// WARNING: This will not work on all sites, and subtle breakage may occur
// that is not immediately obvious. Please get in touch if you have ideas
// for improvement. You need to save the URL below as a bookmark, and then
// you can select it from your bookmarks to run it on the current page.
javascript:(D=>{D.querySelectorAll("option[value^=mrs i]").forEach(N=>{for(var r=D.createElement("option"),p=N.parentNode,o=p.children,t=0;t<o.length;++t)if(/^mx/i.test(o[t].value))return o[t].selected=!0;r.value=r.innerText=N.value.replace(/rs/i,s=>"R"==s[0]?"X":"x"),p.appendChild(r),r.selected=!0})})(document)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment