Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hook into jQuery existing events
// ==UserScript==
// @name test @grant GM_*
// @namespace https://github.com/jerone/UserScripts
// @include https://github.com/*
// @version 1
// @grant GM_setValue
// ==/UserScript==
unsafeWindow.$(document).on("pjax:end", exportFunction(function() {
console.log('test @grant GM_* 1');
}, unsafeWindow));
unsafeWindow.$(window).on('popstate', exportFunction(function() {
console.log('test @grant GM_* 2');
}, unsafeWindow));
// ==UserScript==
// @name test @grant none
// @namespace https://github.com/jerone/UserScripts
// @include https://github.com/*
// @version 1
// @grant none
// ==/UserScript==
unsafeWindow.$(document).on("pjax:end", function() {
console.log('test @grant none 1');
});
unsafeWindow.$(window).on('popstate', function() {
console.log('test @grant none 2');
});
@jerone
Copy link
Author

jerone commented Apr 1, 2015

@jerone
Copy link
Author

jerone commented Apr 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment