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