Skip to content

Instantly share code, notes, and snippets.

@jackkoppa
Created March 14, 2016 03:30
Show Gist options
  • Save jackkoppa/497bd41c980add6659df to your computer and use it in GitHub Desktop.
Save jackkoppa/497bd41c980add6659df to your computer and use it in GitHub Desktop.
Auto-Download Participant Report from EventSpot
// ==UserScript==
// @name Auto-Download Participant Report from EventSpot
// @namespace http://jackkoppa.com/
// @version 0.1.1
// @description On any Event page, opens the reporting tab, runs a full report, waits for it to export, and downloads the report.
// @author jackkoppa
// @match https://ui.constantcontact.com/rnavmap/evp/hub/*
// @grant none
// ==/UserScript==
/* jshint -W097 */
'use strict';
// Anonymous "self-invoking" function
(function() {
// Load the script
console.log("Loaded script from Tampermonkey");
var script = document.createElement("SCRIPT");
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';
script.type = 'text/javascript';
document.getElementsByTagName("head")[0].appendChild(script);
// Poll for jQuery to come into existance
var checkReady = function(callback) {
if (window.jQuery) {
callback(jQuery);
}
else {
window.setTimeout(function() { checkReady(callback); }, 100);
}
};
// Start polling...
checkReady(function($) {
$("#evp-nav-event-reporting").click();
$("#btnRunReport").click();
var checkReadyInner = function(callback) {
if ($( "a:contains(Download)").length) {
var element = $( "a:contains(Download)");
callback(element);
}
else {
window.setTimeout(function() { checkReadyInner(callback); }, 1000);
}
};
checkReadyInner(function(element) {
$( "a:contains(Download)").click();
console.log("clicked Download");
})
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment