File: timelineOverlay.js

package info (click to toggle)
timeline 0.5-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 220 kB
  • ctags: 60
  • sloc: makefile: 2
file content (57 lines) | stat: -rwxr-xr-x 1,651 bytes parent folder | download
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
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
 	                    .getService(Components.interfaces.nsIPrefBranch);

// reload the timeline
function refresh() {
    var browser = document.getElementById("timeline");
    if (browser) {
        browser.reload();
    }
}

// reload the timeline every 30 minutes to refresh the events
window.setInterval("refresh",1800000);

// Make the timeline option in the view menu show and hide the timeline.
function setTimelineCheckBox() {
    goToggleToolbar('timeline_vbox', 'show_timeline')
    refresh();
}

//This function takes the mouse wheel event and alters the zoom of the timeline.
// delta is + or - depending on which way the mouse wheel is rolled
function handle(delta) {        	
		var size = prefs.getIntPref("extensions.timeline.hour");
        if (delta < 0) {
			size = size*2;
        } else{
        	size = size/2;
		}
		if (size < 8) size = 8;
		if (size > 256) size = 256;
		prefs.setIntPref("extensions.timeline.hour", size);
		refresh();
}

//Event handler for mouse wheel event.
function wheel(event){
        //If event.detail is non-zero, alter extensions.timeline.hour
        if (event.detail)
			handle(event.detail);
		//also suppress the default mouse wheel action (scrolling usually)
        if (event.preventDefault)
			event.preventDefault();
		event.returnValue = false;
}

//These functions are called when the mouse enters or leaves the Timeline area
function initScroll() {
	window.addEventListener('DOMMouseScroll', wheel, false);
	return;
}

function removeScroll() {
	window.removeEventListener('DOMMouseScroll', wheel, false);
	return;
}