Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Jetpack Snippets

Note: This page documents the Jetpack Prototype, which is  no longer under active development. Read the experiment report for what we learned from it and the blog post announcing the first SDK release for what we're up to next!

Bits of code that may come in handy. Feel free to add your own!

Using firebug lite in a slidebar

jetpack.future.import("slideBar");

jetpack.slideBar.append({
html: <html><head></head><body>
<p>some slidbar you want to debug</p>
<a href="javascript:console.log('hello!')">test</a>
<script><![CDATA[
//firebug lite bookmarklet code:
var firebug=document.createElement('script');
firebug.setAttribute('src','https://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js');
document.body.appendChild(firebug);
(function(){if(window.firebug.version){firebug.init();}else{setTimeout(arguments.callee);}})();void(firebug);
]]></script>
</body></html>,
width: 800, //wide enough to use firebug
onSelect: function(slide) {
slide.slide(800, true);
}
});

 

Calling into a slidebar from the global jetpack scope

jetpack.slideBar.append({   
onReady: function (slide) {
// call out to a global function, passing the slidebar object
  exInitSlidebar(slide);
 },
 
...
});

function exInitSlidebar(aSlidebar) { // This variable will now be global
  slider = aSlidebar;
}

// then, accessing the slidebar HTML
var tl = slider.contentDocument.getElementById("thumbList"); // or calling slidebar API methods or accessing properties
slider.notify();

Document Tags and Contributors

 Contributors to this page: Sheppy, MykMelez, Kinger
 Last updated by: Sheppy,