From: Dariusz Murakowski Date: Wed, 25 Apr 2018 20:16:03 +0000 (-0400) Subject: LANL: alt+s on results page labels sequences with accession and patient ID X-Git-Url: http://src.murakowski.org/?a=commitdiff_plain;h=bd42b4690095a3cfa2cc1e6faebdc81da2895bf2;p=userscripts.git LANL: alt+s on results page labels sequences with accession and patient ID --- diff --git a/set alt+S keyboard shortcut on HIV LANL results page to improve download options.user.js b/set alt+S keyboard shortcut on HIV LANL results page to improve download options.user.js new file mode 100644 index 0000000..afd1852 --- /dev/null +++ b/set alt+S keyboard shortcut on HIV LANL results page to improve download options.user.js @@ -0,0 +1,45 @@ +// ==UserScript== +// @name set alt+S keyboard shortcut on HIV LANL results page to improve download options +// @namespace http://tampermonkey.net/ +// @version 0.1 +// @description add alt+S shortcut to include HXB2 seq and label with accession code and patient ID +// @author You +// @match https://www.hiv.lanl.gov/components/sequence/HIV/search/search.comp +// @grant none +// @run-at document-end +// ==/UserScript== + +(function() { + 'use strict'; + + function get0(s) { + var sel = document.querySelectorAll(s); + if (sel.length == 1) { + var out = sel[0]; + console.log(out); + return out; + } + } + + function doStuff() { + // onclick="showElt('both'); hideElt('tree'); hideElt('down'); showElt('save')" + get0('input[value="Download Sequences"]').click(); + + // simulate clicking the "compose a label" link + Changesaveoutput();showElt('compose'); + + // set options + get0('input[name=INCLUDE_HXB2]').checked = true; + get0('input[name=comp_sa_genbankaccession]').value = 5; + get0('input[name=comp_ssam_pat_id]').value = 6; + } + + // https://superuser.com/questions/496212/shortcut-to-open-specific-bookmark-url-in-chrome/1313997#1313997 + document.addEventListener('keyup', function(event) { + if (!event.ctrlKey && event.altKey && !event.shiftKey) { + if ('S' == String.fromCharCode(event.keyCode)) { + doStuff(); + } + } + }); +})(); \ No newline at end of file