-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
firefox w/greasemonkey #6
Comments
That runs asynchronously, right? Is that literally the only change you made? |
Yes it is asynchronous. fetchPositionProjections looks like this now: //Get the data from external sites
function fetchPositionProjections(position, cb) {
var source_site = '';
if (window.positions.indexOf(position) > -1) {
source_site = 'http://www.fantasypros.com/nfl/projections/' + position + '.php?filters=44:45:73:152:469&export=xls';
}
else {
source_site = 'http://www.fantasysharks.com/apps/bert/forecasts/projections.php?csv=1&Position=' + position;
}
/* Use GM_xmlhttpRequest for CORS in greasemonkey */
GM_xmlhttpRequest({
method: "GET",
url: source_site,
onload: function(response) {
cb(position, response.responseText.trim());
}
});
/*
$.get(source_site, function(data) {
cb(position, data.trim());
});
*/
} |
In fact, you could probably just add something like
I also prepended the jquery as I am not sure how to use multiple scripts with greasemonkey. I just made one concatenated script. |
Is there somewhere that this script is posted to download/add to greasemonkey? I am not very sure how to do it manually. |
I got this working as a greasemonkey script.
The only change I needed to make is $.get needed to be replaced with GM_xmlhttpRequest to get around CORS.
Should be helpful when making a firefox plugin. Not sure if theres an easy way to go from greasemonkey to full fledged firefox plugin (probably with JetPack).
Cheers!
The text was updated successfully, but these errors were encountered: