3/1/2017 - 2:07 PM

Data.Medicare.Gov helper script

Data.Medicare.Gov helper script

This helps with the data "tables" (which are really nested divs in divs) on data.medicare.gov

One of the main features is the ability to copy values in the data tables by Ctrl+clicking on a value.

The selected and/or copied text is displayed above the table for confirmation.

NOTE: The method used to detect what was clicked isn't very reliable, mostly due to the way this "table" is created and clicks are detected. I'll continue to work on a better method and update the script accordingly.

Finally, there are some basic log outputs in the console, which may help you determine what's going on if it's not expected.

// ==UserScript==
// @name         Helper for data.medicare.gov
// @namespace    http://tampermonkey.net/
// @version      0.2.1
// @description  Ctrl+click copy and more
// @author       Jake Bathman
// @downloadURL  https://gist.githubusercontent.com/jakebathman/8d2ca9a798e4f3e83baefda2ffc22b32/raw
// @include      https://data.medicare.gov/Home-Health-Compare*
// @include      https://data.medicare.gov/Hospital-Compare*
// @grant GM_setClipboard
// ==/UserScript==


        cntrlIsPressed = true;

    cntrlIsPressed = false;

var cntrlIsPressed = false;
$("#infoBox").append('<div style="padding:5px;font-size:13px;color:grey;margin:5px;" id="copiedText"></div>');

(function() {
    $('.outerContainer').on('click',function (event) {
        el = $('.blist-hot')[0];


            GM_setClipboard($(el).html()); // Copy to clipboard
            $("#copiedText").css('color','black').css('background-color','#c9f5c9').html("COPIED: <strong>" + $(el).html() + "</strong");
            timeoutEl = setTimeout(function(){
            }, 2000);
            console.log("Copied to clipboard: ");