mailer project continued:
[mailer.git] / templates / de / html / js / js_surfbar_frame_top.tpl
1 /**
2  * JavaScript for ext-surfbar - top frame
3  * --------------------------------------------------------------------
4  * $Revision::                                                        $
5  * $Date::                                                            $
6  * $Tag:: 0.2.1-FINAL                                                 $
7  * $Author::                                                          $
8  * --------------------------------------------------------------------
9  * Copyright (c) 2003 - 2009 by Roland Haeder
10  * Copyright (c) 2009 - 2012 by Mailer Developer Team
11  * For more information visit: http://mxchange.org
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
26  * MA  02110-1301  USA
27  */
28
29 var currCounter = '{%pipe,gerSurfbarReloadTime=$content[url_id]%}';
30 var maxCounter  = '{%pipe,gerSurfbarReloadTime=$content[url_id]%}';
31 var counter     = document.getElementById('surfbar_counter');
32 var points      = document.getElementById('surfbar_points');
33 var reload      = document.getElementById('surfbar_reload');
34 var max         = document.getElementById('surfbar_max');
35 var countDown   = null;
36
37 function startStopCounter () {
38         if (countDown == null) {
39                 // Start counter
40                 document.getElementById('start').innerHTML = '{--MEMBER_SURFBAR_ACTION_PAUSE_SUBMIT--}';
41                 countDown = window.setInterval('startCounter()', 1000);
42         } else {
43                 document.getElementById('start').innerHTML = '{--MEMBER_SURFBAR_ACTION_UNPAUSE_SUBMIT--}';
44                 window.clearInterval(countDown);
45                 countDown = null;
46         }
47         return false;
48 }
49
50 function init () {
51         countDown = window.setInterval('startCounter()', 1000);
52         window.setTimeout('initCounter()', 500);
53 }
54
55 function confirm () {
56         if (parent.surfbar_url != null) {
57                 // Is in right frameset
58                 parent.surfbar_url.location.href = '{%url=surfbar.php?id=$content[url_id]&check=$content[check]&salt=$content[salt]%}';
59         } else {
60                 // Called frame=top directly
61                 window.location.href = '{%url=surfbar.php%}';
62         }
63 }
64
65 function reloadSurfbar () {
66         if (parent.surfbar_stats != null) {
67                 // Is in right frameset
68                 parent.surfbar_stats.location.reload();
69         } else {
70                 // Called frame=top directly
71                 window.location.href = '{%url=surfbar.php%}';
72         }
73         this.location.reload();
74 }
75
76 function initCounter () {
77         if (parent.surfbar_url != null) {
78                 // Is in right frameset
79                 parent.surfbar_url.location.href = '{%pipe,gerSurfbarUrl=$content[url_id]%}';
80         } else {
81                 // Called frame=top directly
82                 window.location.href = '{%url=surfbar.php%}';
83         }
84
85         counter.innerHTML = '{%pipe,gerSurfbarReloadTime=$content[url_id]%}';
86         points.innerHTML  = '{%pipe,gerSurfbarReward,translateComma=$content[url_id]%}';
87         reload.innerHTML  = '{%pipe,getSurfbarUserLocks%}';
88         max.innerHTML     = '{%pipe,getSurfbarTotalUrls%}';
89 }
90
91 function startCounter () {
92         if (currCounter < 1) {
93                 return false;
94         }
95
96         currCounter--;
97         counter.innerHTML = currCounter;
98
99         if (currCounter == 0) {
100                 clearInterval(countDown);
101                 confirm();
102                 window.setTimeout('reloadSurfbar()', 500);
103         }
104 }
105
106 init();