NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name OptionsGrabber // @namespace http://tampermonkey.net/ // @version 0.1201903281649 // @license MIT // @description grab options from a html form select // @author BrnLng // @grant none // @include * // ==/UserScript== // @match https://www.w3schools.com/html/tryit.asp?filename=tryhtml_elem_select // @match *://www.debentures.com.br/* function displayResult() { var list = document.getElementsByTagName('select'); var txt = ""; for (var i = 0; i < list.length; i++) { txt = txt + list[i].name + ":\n"; for (var j = 0; j < list[i].options.length; j++) { txt = txt + " " + list[i].options[j].label + " [" + list[i].options[j].value + "]\n"; } } alert(txt); } (function() { 'use strict'; var test = document.getElementsByTagName('select'); if (test.length > 0) { var css = ".BrnButtonGrabber { font-size: 0.7em; background: #fca838; border: 0; padding: .7em; margin-left: .7em; position: relative; top: -.25em; border-radius: 1.4em; }"; var style = document.createElement("style"); style.type = "text/css"; style.appendChild(document.createTextNode(css)); document.head.appendChild(style); var btn = document.createElement("button"); btn.innerHTML = "Grab options!"; btn.classList.add("BrnButtonGrabber"); btn.onclick = () => { displayResult(); return false; }; document.getElementsByTagName('select')[0].after(btn); } })();