-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsidebar.htm
62 lines (52 loc) · 2.62 KB
/
sidebar.htm
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<html x-manifest="appcache.manifest">
<head>
<title>DemoSocialService</title>
<link id="siteicon" rel="icon" href="./firefox.png"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
var baselocation = location.href.substr(0, location.href.indexOf("sidebar.htm"));
// The sidebar is loaded when the user makes the sidebar visible, and unloaded
// a period of time after the user closes the sidebar. They may reopen the
// sidebar before the page is unloaded, you can use the following visibility
// APIs to know when you are visible or not.
// testing the standard HTML5 Visibility API
// https://developer.mozilla.org/en-US/docs/DOM/Using_the_Page_Visibility_API
function onVisibilityChange() {
dump("onVisibilityChange, document hidden?"+document.hidden+"\n");
}
window.addEventListener("load", function() {
onVisibilityChange();
});
document.addEventListener("visibilitychange", function() {
onVisibilityChange()
});
// frameShow/Hide will eventually be deprecated, though some social panels work
// best with this right now, see the visibility api above, these event handlers
// demonstrate that document.visibilityState will contain the same value as
// mozSocial.isVisible
window.addEventListener("socialFrameShow", function(e) {
dump("socialFrameShow, visibility is "+document.visibilityState+" or "+navigator.mozSocial.isVisible+"\n");
}, false);
window.addEventListener("socialFrameHide", function(e) {
dump("socialFrameHide, visibility is "+document.visibilityState+" or "+navigator.mozSocial.isVisible+"\n");
}, false);
function goTo(url) { window.open(url, "shareWindow"); }
// There are a few special APIs on navigator.mozSocial documented at
// https://developer.mozilla.org/en-US/docs/Web/API/navigator.mozSocial
// otherwise, it's just HTML, have fun!
</script>
</head>
<body contextmenu="mymenu">
<p>SocialAPI Simple Sidebar Example.</p>
<p>The rest is just HTML!</p>
<!-- This is just a normal HTML5 context menu -->
<menu type="context" id="mymenu">
<menu label="Share on...">
<menuitem label="Twitter" icon="http://www.twitter.com/favicons/favicon.png"
onclick="goTo('//twitter.com/intent/tweet?text=' + document.title + ': ' + window.location.href);"></menuitem>
<menuitem label="Facebook" icon="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAAX0lEQVQ4jWP4%2F%2F8%2FAyUYTFhHzjgDxP9JxGeQDSBVMxgTbUBCxer%2Fr999%2BQ8DJBuArJksA9A10s8AXIBoA0B%2BR%2FY%2FjD%2BEwoBoA1yT5v3PbdmCE8MAshhID%2FUMoDgzUYIBj0Cgi7ar4coAAAAASUVORK5CYII%3D"
onclick="goTo('//facebook.com/sharer/sharer.php?u=' + window.location.href);"></menuitem>
</menu>
</menu>
</body>
</html>