Created
April 9, 2010 19:17
-
-
Save erikvold/361483 to your computer and use it in GitHub Desktop.
This userscript demonstrates how a user script author can add a DOMContentLoaded listener to trigger their user script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name DOMContentLoaded Issue (A Workaround Example) | |
// @namespace gmTest | |
// @include http://erikvold.com/tests/greasemonkey/DOMContentLoaded/index.cfm | |
// @include http://erikvold.lan/tests/greasemonkey/DOMContentLoaded/index.cfm | |
// @version 0.1 | |
// @author Erik Vergobbi Vold | |
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html | |
// @description This userscript demonstrates how a user script author can add a DOMContentLoaded listener to trigger their user script. | |
// ==/UserScript== | |
alert('user script level - load!'); | |
document.addEventListener("DOMContentLoaded", function() { | |
alert('user script level - DOMContentLoaded (use capture)'); | |
}, true); | |
document.addEventListener("DOMContentLoaded", function() { | |
alert('user script level - DOMContentLoaded (!use capture)'); | |
}, false); | |
window.addEventListener("load", function() { | |
alert('user script level - load (use capture)'); | |
}, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment