-
Notifications
You must be signed in to change notification settings - Fork 28
/
panel.js
71 lines (65 loc) · 2.25 KB
/
panel.js
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
63
64
65
66
67
68
69
70
71
function onLoad() {
// visual verification that we do indeed get a worker port
var worker = navigator.mozSocial.getWorker();
var el = document.getElementById("content");
if (worker) {
el.style.borderColor = "green";
} else {
el.style.borderColor = "red";
}
onhashchange();
}
onhashchange = function() {
var text = document.createTextNode(location.hash);
var hash = document.getElementById("openValue");
if (hash.firstChild) hash.removeChild(hash.firstChild);
hash.appendChild(text);
}
// dumping these events for test reasons
window.addEventListener("DOMWindowClose", function(e) {
dump("DOMWindowClose in panel...\n");
}, false);
window.addEventListener("close", function(e) {
dump("onclose in panel...\n");
}, false);
window.addEventListener("scroll", function(e) {
dump("scrolling flyout...\n");
}, false);
window.addEventListener("focus", function(e) {
dump("panel focus...\n");
}, false);
window.addEventListener("blur", function(e) {
dump("panel blur...\n");
}, false);
// frameShow/Hide will eventually be deprecated, see the visibility api below
// 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);
// via the visibility api
// https://developer.mozilla.org/en-US/docs/DOM/Using_the_Page_Visibility_API
function onVisibilityChange() {
dump("onVisibilityChange, document hidden?"+document.hidden+"\n");
}
document.addEventListener("load", function() {
onVisibilityChange();
});
document.addEventListener("visibilitychange", function() {
onVisibilityChange()
});
function changeSize() {
var el = document.getElementById('list');
while (el.firstChild) {
el.removeChild(el.firstChild);
}
var count = Math.floor( Math.random() * 20 );
for( var i=0; i < count; ++i ) {
var ap = document.createElement("li");
ap.innerHTML = "Item <span>__</span> <i>#</i> <b>" + i + "</b>";
el.appendChild( ap );
}
}