blob: dc66b5d315dea48c9cb71a45fad378bfee405338 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<html>
<head>
<meta charset="utf-8">
<script>
var testwindow;
function pingWorker() {
var port = navigator.mozSocial.getWorker().port;
port.onmessage = function(e) {
var topic = e.data.topic;
switch (topic) {
case "test-flyout-open":
navigator.mozSocial.openPanel("social_flyout.html");
break;
case "test-flyout-close":
navigator.mozSocial.closePanel();
break;
case "test-chatbox-open":
var url = "social_chat.html";
var data = e.data.data;
if (data && data.id) {
url = url + "?id="+data.id;
}
navigator.mozSocial.openChatWindow(url, function(chatwin) {
// Note that the following .focus() call should *not* arrange
// to steal focus - see browser_social_chatwindowfocus.js
if (data && data.stealFocus && chatwin) {
chatwin.focus();
}
port.postMessage({topic: "chatbox-opened",
result: chatwin ? "ok" : "failed"});
});
break;
case "test-isVisible":
port.postMessage({topic: "test-isVisible-response",
result: navigator.mozSocial.isVisible});
break;
}
}
port.postMessage({topic: "sidebar-message", result: "ok"});
}
</script>
</head>
<body onload="pingWorker();">
<p>This is a test social sidebar.</p>
<button id="chat-opener" onclick="navigator.mozSocial.openChatWindow('./social_chat.html');"/>
</body>
</html>
|