Skip to content

Instantly share code, notes, and snippets.

@benjamine
Last active December 29, 2015 12:09
Show Gist options
  • Save benjamine/7669023 to your computer and use it in GitHub Desktop.
Save benjamine/7669023 to your computer and use it in GitHub Desktop.
UserScript/ClarinetTrainerButtons
// ==UserScript==
// @name Clariner Trainer Buttons
// @namespace clarinettrainer.buttons
// @version 0.2
// @description make clariner trainer show buttons for all notes
// @include http://www.clarinettrainer.com/*
// @copyright 2013+, Benjamin Eidelman
// ==/UserScript==
(function(){
var select = document.getElementsByName('review')[0];
var ce = function(){
return document.createElement.apply(document, arguments);
};
var div = ce('div');
for (var i=0; i<select.options.length; i++) {
if (i===0) {
continue;
}
var btn = ce('button');
var option = select.options[i];
btn.innerText = option.innerText;
btn.setAttribute('onclick', "document.location.href='/?review="+(114+i)+"';return false;");
div.appendChild(btn);
if (i % 12 == 0) {
div.appendChild(ce('br'));
}
}
div.style.position = "absolute";
div.style.left = "230px";
div.style.width = "550px";
var container = ce('div');
container.style.position="relative";
container.appendChild(div);
select.parentElement.appendChild(container);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment