Confirmed users
161
edits
mNo edit summary |
|||
Line 4: | Line 4: | ||
==== Page Mods <i>Initialization</i> ==== | ==== Page Mods <i>Initialization</i> ==== | ||
<pre class="brush:js;"> | <pre class="brush:js;"> | ||
var | var ScriptMod = require("script-mod").ScriptMod; | ||
var myMod = new ScriptMod({ | |||
include: ["*.example.com", | |||
"http://example.org/a/specific/url", | |||
"http://example.info/*"], | |||
script: [ | |||
function(wrappedWindow) { | |||
// this runs each time a new content document starts loading, but | |||
// before the page starts loading, so we can't interact with the | |||
// page's DOM here yet. | |||
wrappedWindow.wrappedJSObject.newExposedProperty = 1; | |||
}, | |||
ScriptMod.onDOMContentLoaded(function(wrappedWindow) { | |||
// at this point we can work with the DOM | |||
wrappedWindow.document.body.innerHTML = "<h1>Jetpack Page Mods</h1>"; | |||
} | }) | ||
] | ] | ||
}); | }); |