4
edits
Tylermenezes (talk | contribs) |
Robcoblurn (talk | contribs) m (Scripting Usage) |
||
| Line 4: | Line 4: | ||
tylermenezes: The example method won't work in Prism 0.9, im my code or even in a blank webapp.js. Error is "missing : after property ID", on void log(aMsg); I can't do getBrowser() by itself, either. Maybe I'm doing something wrong, I'm new to this. | tylermenezes: The example method won't work in Prism 0.9, im my code or even in a blank webapp.js. Error is "missing : after property ID", on void log(aMsg); I can't do getBrowser() by itself, either. Maybe I'm doing something wrong, I'm new to this. | ||
== Scripting Usage == | |||
The scripting is a bit confusing. We could use some examples. XUL documentation is out there, but it's not very easy to jump into. Here's some examples using gmail - doesn't do much, but helps you get the idea. | |||
/* webapp.js */ | |||
/*global host*/ | |||
//Get things started | |||
function startup () { | |||
//Only Works if sidebar is on | |||
host.sidebar.add(null, "http://talkgadget.google.com/talkgadget/popout"); | |||
host.sidebar.visible = true; | |||
//Lots of the same command | |||
//host.getBrowser().goHome(); | |||
//host.getBrowser().loadURI(host.getBrowser().homePage); | |||
//host.getBrowser().loadURI('http://mail.google.com/mail/'); | |||
var aImage = host.getResource("gmail.ico"); | |||
var aTitle = "Gmail says"; | |||
//Can't actually get contentDocument.title yet, because document hasn't loaded yet - but it won't break anything | |||
var aMessage = host.getBrowser().contentDocument.title; | |||
host.showAlert(aImage, aTitle, aMessage); | |||
} | |||
function shutdown () { | |||
//If you need to clear up anything | |||
var aImage = host.getResource("gmail.ico"); | |||
var aTitle = "Gmail says"; | |||
var aMessage = host.getBrowser().contentDocument.title; | |||
host.showAlert(aImage, aTitle, aMessage); | |||
} | |||
function dropFiles (uris) { | |||
} | |||
edits