Skip to content

Instantly share code, notes, and snippets.

@Asuza
Last active August 23, 2017 21:09
Show Gist options
  • Save Asuza/53dbea445c96a1b171108e4aeaafc01e to your computer and use it in GitHub Desktop.
Save Asuza/53dbea445c96a1b171108e4aeaafc01e to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Example Script
// @match https://site.com/wildpath*
// @match https://site.com/specificpath
// ==/UserScript==
(function ($) {
/**
* Processes all successful AJAX calls
* @param {Object} event
* @param {Object} jqXHR
* @param {Object} options
* @param {Object} data Response data
*/
function processResponse (event, jqXHR, options, data) {
if (/route\/and\/data\.json/.test(options.bareUrl)) {
// process url
} else if (/neato\.json/.test(options.bareUrl)) {
// process other url
}
}
$(document).bind("ajaxSuccess", processResponse);
})(unsafeWindow.jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment