XFileSharing Pro - Countdown button

Message
Author
thebeer
Posts: 47
Joined: Feb 01, 2010 9:41 am

Countdown button

#1 Postby thebeer » Oct 18, 2011 10:15 am

Hi, so I have set the countdown button script on download0 page to 15 seconds, now what I want is to be able to set the time in user limits page.

The code looks like this now:

Code: Select all

<script>
var tminus = 15; /// <- need to change this value so it gets the user limits value

function countdown(){
 if (tminus >= 0.1){
  tminus = tminus - 0.1;
  tminus = Math.round(tminus*100)/100

  if (!(Math.round(tminus*100) % 100)){
   tminus = tminus + ".0";
  }

 }else {
  tminus = "Continue";
 }

 if (tminus != "Continue"){
  document.countdown_form.countdown.disabled = true;
 }else{
   document.countdown_form.countdown.disabled = false;
 }

 document.getElementById("countdown").value=tminus;
 setTimeout("countdown();", 100); 
}
</script>
What I need is somehow to get the value that is set in user limits Downloads countdown fields.

Can anyone help?

Thanks!

PowerChaos
Posts: 521
Joined: Dec 19, 2009 5:12 pm

#2 Postby PowerChaos » Oct 28, 2011 2:54 pm

here is your code

Code: Select all

<script> 
var tminus = <TMPL_VAR countdown>; /// <- need to change this value so it gets the user limits value 

function countdown(){ 
 if (tminus >= 0.1){ 
  tminus = tminus - 0.1; 
  tminus = Math.round(tminus*100)/100 

  if (!(Math.round(tminus*100) % 100)){ 
   tminus = tminus + ".0"; 
  } 

 }else { 
  tminus = "Continue"; 
 } 

 if (tminus != "Continue"){ 
  document.countdown_form.countdown.disabled = true; 
 }else{ 
   document.countdown_form.countdown.disabled = false; 
 } 

 document.getElementById("countdown").value=tminus; 
 setTimeout("countdown();", 100); 
} 
</script>
it should work , exept if it can not take the value

Greetings From PowerChaos

glumbo
Posts: 211
Joined: Mar 11, 2011 6:26 am

#3 Postby glumbo » Nov 05, 2011 7:44 am

I didn't need help with this question but just wanted to thank PowerChaos for helping out so many users. You are awesome!

thebeer
Posts: 47
Joined: Feb 01, 2010 9:41 am

#4 Postby thebeer » Nov 05, 2011 1:43 pm

PowerChaos it doesn't work inside javascript.

PowerChaos
Posts: 521
Joined: Dec 19, 2009 5:12 pm

#5 Postby PowerChaos » Nov 05, 2011 2:00 pm

here is a other work around

Code: Select all

<TMPL_UNLESS premium>
<TMPL_IF registered>
<script> 
var tminus = 15; /// <- Logged in users

function countdown(){ 
 if (tminus >= 0.1){ 
  tminus = tminus - 0.1; 
  tminus = Math.round(tminus*100)/100 

  if (!(Math.round(tminus*100) % 100)){ 
   tminus = tminus + ".0"; 
  } 

 }else { 
  tminus = "Continue"; 
 } 

 if (tminus != "Continue"){ 
  document.countdown_form.countdown.disabled = true; 
 }else{ 
   document.countdown_form.countdown.disabled = false; 
 } 

 document.getElementById("countdown").value=tminus; 
 setTimeout("countdown();", 100); 
} 
</script> 
<TMPL_ELSE>
<script> 
var tminus = 35; /// <- Not logged in users 

function countdown(){ 
 if (tminus >= 0.1){ 
  tminus = tminus - 0.1; 
  tminus = Math.round(tminus*100)/100 

  if (!(Math.round(tminus*100) % 100)){ 
   tminus = tminus + ".0"; 
  } 

 }else { 
  tminus = "Continue"; 
 } 

 if (tminus != "Continue"){ 
  document.countdown_form.countdown.disabled = true; 
 }else{ 
   document.countdown_form.countdown.disabled = false; 
 } 

 document.getElementById("countdown").value=tminus; 
 setTimeout("countdown();", 100); 
} 
</script> 
</TMPL_IF>
</TMPL_UNLESS>
<TMPL_IF premium>
</TMPL_IF>
this way you manaul set the value , but you just show a differend value depending on user

Greetings From PowerChaos

sharing1
Posts: 6
Joined: Nov 04, 2011 12:41 pm

#6 Postby sharing1 » Nov 05, 2011 7:51 pm

hey power chaos i saw you helped a lot of ppl.

you got no solutuion for my problem?

i wanna use flash upload as main upload forum instead of normal upload

PowerChaos
Posts: 521
Joined: Dec 19, 2009 5:12 pm

#7 Postby PowerChaos » Nov 05, 2011 11:45 pm

sharing1 wrote:hey power chaos i saw you helped a lot of ppl.

you got no solutuion for my problem?

i wanna use flash upload as main upload forum instead of normal upload
ask in a new post
this topic is just for the countdown button

but to give a answer , i do not use the flashupload but i can see what i can get done ( shoulnd be to hard :P )

Greetings From PowerChaos