Confirmed users
70
edits
Jloganolson (talk | contribs) No edit summary |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
This page is a place for you to drop in solutions to common code problems that JfL projects face in their jetpacks during the Design Camp. | This page is a place for you to drop in solutions to common code problems that JfL projects face in their jetpacks during the Design Camp. | ||
We encourage you to dump your code on etherpad.com or Github, and link to it here. The format on this page will be similar to a FAQ, with a question and answer. The answer can have a description of the soltion (optional) and a link to the code for the solution. | We encourage you to dump your code on etherpad.com or Github, and link to it here. The format on this page will be similar to a FAQ, with a question and answer. The answer can have a description of the soltion (optional) and a link to the code for the solution. | ||
Example: | Example: | ||
'''Q: How do I insert an image into a Web page?''' | '''Q: How do I insert an image into a Web page?''' | ||
A. First you need to get the document, then determine the insertion point using the DOM, and then do XYZ to insert the image. A code example is at: | A. First you need to get the document, then determine the insertion point using the DOM, and then do XYZ to insert the image. A code example is at: [http://github.com/jflimageinsertion http://github.com/jflimageinsertion] | ||
[http://github.com/jflimageinsertion http://github.com/jflimageinsertion] | |||
<br> '''Q: How do save the tab state for later recreation?''' | |||
You can capture the current tab state information from "sessionstore.js". Recreating it is TBD, but see code at http://etherpad.com/OrGP3AA7F5 which reads the session store file and instantiates the JSON object. | |||
'''Q: How do I see when a tab is opened (as opposed to when it's loaded)?''' | |||
Use a progress listener (https://developer.mozilla.org/en/Code_snippets/Progress_Listeners) with an addTabsProgressListener https://developer.mozilla.org/en/Listening_to_events_on_all_tabs) called per window opened. Will post a Jetpack-specific example when written. | |||
'''Q: How do I open a new tab with my blob of html as a page?''' | |||
http://software.hixie.ch/utilities/cgi/data/data | |||
'''Q: How do I access 'document' without security restrictions?''' | |||
var doc = jetpack.tabs.focused.contentDocument.wrappedJSObject; |