~cmiller/ubuntu/quantal/deluge/fix-parameter-move-storage

« back to all changes in this revision

Viewing changes to deluge/ui/webui/static/refresh.js

  • Committer: Bazaar Package Importer
  • Author(s): Cristian Greco
  • Date: 2009-11-13 02:39:45 UTC
  • mfrom: (4.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091113023945-te1bybo2912ejzuc
Tags: 1.2.0~rc3-4
* debian/control: bump build-dep on python-setuptools to (>= 0.6c9).
* debian/patches:
  - 25_r5921_fastresume_files.patch
    new, should fix problems with fresh configs;
  - 30_r5931_ipc_lockfile.patch:
    new, should fix an issue where Deluge will fail to start if there is a
    stale ipc lockfile. (Closes: #555849)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
# Copyright (C) Martijn Voncken 2008 <mvoncken@gmail.com>
3
 
#
4
 
# This program is free software; you can redistribute it and/or modify
5
 
# it under the terms of the GNU General Public License as published by
6
 
# the Free Software Foundation; either version 3, or (at your option)
7
 
# any later version.
8
 
#
9
 
# This program is distributed in the hope that it will be useful,
10
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
# GNU General Public License for more details.
13
 
#
14
 
# You should have received a copy of the GNU General Public License
15
 
# along with this program.  If not, write to:
16
 
#     The Free Software Foundation, Inc.,
17
 
#     51 Franklin Street, Fifth Floor
18
 
#     Boston, MA  02110-1301, USA.
19
 
#
20
 
#    In addition, as a special exception, the copyright holders give
21
 
#    permission to link the code of portions of this program with the OpenSSL
22
 
#    library.
23
 
#    You must obey the GNU General Public License in all respects for all of
24
 
#    the code used other than OpenSSL. If you modify file(s) with this
25
 
#    exception, you may extend this exception to your version of the file(s),
26
 
#    but you are not obligated to do so. If you do not wish to do so, delete
27
 
#    this exception statement from your version. If you delete this exception
28
 
#    statement from all source files in the program, then also delete it here.
29
 
#
30
 
 
31
 
#
32
 
 
33
 
quick and dirty auto-refresh timer.
34
 
Our users have waited too long for a new auto-refresh.
35
 
I need to get things done (even if it's not pretty). ;with the least dependencies for a backport to 1.05
36
 
*/
37
 
var seconds=0;
38
 
var refresh_secs = 10;
39
 
var prc = 0;
40
 
var timer_active = 0;
41
 
function continue_timer(){
42
 
    if (!timer_active) {
43
 
        return;
44
 
    }
45
 
    seconds+=0.1;
46
 
    if (seconds > refresh_secs){
47
 
        timer_active = 0;
48
 
        do_refresh();
49
 
     }
50
 
     prc = ((seconds / refresh_secs) * 100 );
51
 
     el("timer_bar").style.width = prc + "%";
52
 
     setTimeout("continue_timer()",100)
53
 
}
54
 
 
55
 
function do_refresh(){
56
 
   location.reload(true);
57
 
}
58
 
 
59
 
function start_timer(){
60
 
    timer_active = 1;
61
 
    continue_timer();
62
 
    el("timer_pause").style.display = "none";
63
 
    el("timer_start").style.display = "inline";
64
 
    el("timer_outer").title = "Auto refresh:Active; click here to pause";
65
 
    setCookie('auto_refresh',"1");
66
 
}
67
 
function stop_timer(){
68
 
    timer_active = 0;
69
 
    el("timer_pause").style.display = "inline";
70
 
    el("timer_start").style.display = "none";
71
 
    el("timer_outer").title = "Auto refresh:Paused; click here to start";
72
 
    setCookie('auto_refresh',"0");
73
 
}
74
 
 
75
 
 
76
 
function toggle_timer() {
77
 
    if (timer_active) {
78
 
        stop_timer();
79
 
    }
80
 
    else {
81
 
        start_timer();
82
 
    }
83
 
}