summaryrefslogtreecommitdiff
path: root/smarttv-client/Javascript/Spinner.js
blob: 4a9b8eade520c2a7a16c53cc40f693c04be3e281 (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
48
49
50
51
var Spinner = 
{ 
	index : 1, 
	run: 0,
 	timeout : 0      
};
    
Spinner.init = function () {
//	var sp_width = 	$("#Spinning").width();
//	var sp_height = $("#Spinning").height();

	// TODO: No Abs Number please
	$("#Spinning").children().eq(0).css({"margin-left": "43px", "margin-top": "37px"});
};

Spinner.show= function() {
	if (this.run == 1)
		return;
	
	if (this.timeout > 0) {
		clearTimeout(this.timeout);
		this.timeout = 0;
	}
	
	this.index=1;

	if (this.run==0) {
		this.run=1;		
		$("#Spinning").show();
		Spinner.step();
	}
};
    
Spinner.hide= function() {
	$("#Spinning").hide();
	this.run=0;
};  

 Spinner.step=function() {
	 $("#Spinning").children().eq(0).attr("src", "Images/spinner/loading_"+this.index+".png");
	
	this.index++;
		
	if (this.index > 12) {
		this.index=1;
	}

	if (this.run) {
		this.timeout = setTimeout("Spinner.step();", 200);
	}
};