User:Asqueella/JEP 107: Difference between revisions

Jump to navigation Jump to search
m
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 myMods = new pageMod({
var ScriptMod = require("script-mod").ScriptMod;
   'include': ['*.google.com', 'jetpack.mozillalabs.com'],
var myMod = new ScriptMod({
  'exclude': ['https://mail.google.com/*'],
   include: ["*.example.com",
  'style': [
            "http://example.org/a/specific/url",
    'http://yui.yahooapis.com/3.0.0/build/cssbase/base-min.css',
            "http://example.info/*"],
    'body { background: #ffffff; font-family: Trebuchet MS; } span.details { font-size: 7px; }'
   script: [
  ],
     function(wrappedWindow) {
   'script': [
      // this runs each time a new content document starts loading, but
     'http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools.js',
      // before the page starts loading, so we can't interact with the
     function(){
      // page's DOM here yet.
      $('container').addEvents({
      wrappedWindow.wrappedJSObject.newExposedProperty = 1;
          'click:relay(ul li)': function(){ this.setStyles('background','#000') },
     },
          'mousenter:relay(ul li)': function(){ this.tween('background','#000') },
    ScriptMod.onDOMContentLoaded(function(wrappedWindow) {
          'mouseleave:relay(ul li)': function(){ this.tween('background','#fff') }
      // at this point we can work with the DOM
       });
       wrappedWindow.document.body.innerHTML = "<h1>Jetpack Page Mods</h1>";
     }
     })
   ]
   ]
});
});
Confirmed users
161

edits

Navigation menu