XFileSharing Pro - You have to wait x minutes till next download

Message
Author
Timmy
Posts: 146
Joined: Feb 10, 2010 8:17 pm

You have to wait x minutes till next download

#1 Postby Timmy » Apr 08, 2010 12:26 pm

hi guys,

Its possible to add a counter in this time message?
You have to wait 13 minutes, 31 seconds till next download
So people don't need to refresh the page to see how many time need to wait till next download?

thank you :)

Timmy
Posts: 146
Joined: Feb 10, 2010 8:17 pm

#2 Postby Timmy » Apr 12, 2010 11:59 am

Any ideas? :)

admin
Site Admin
Posts: 1839
Joined: Mar 22, 2006 12:32 pm

#3 Postby admin » Apr 12, 2010 6:04 pm

What's the problem? Javascript can do anything.

ankurs
Posts: 1054
Joined: Mar 10, 2009 2:34 am

#4 Postby ankurs » Apr 13, 2010 1:11 pm

admin wrote:What's the problem? Javascript can do anything.
he wants, that to be converted to javascript counter so once the time is over; it would show download button using ajax or similar

Timmy
Posts: 146
Joined: Feb 10, 2010 8:17 pm

#5 Postby Timmy » Apr 13, 2010 1:13 pm

thats It! thank you ankurs! :)

FZee
Posts: 116
Joined: Mar 03, 2010 11:26 am

#6 Postby FZee » Apr 16, 2010 11:43 pm

I want to know this too actually . its better than refreshing the page multiple times

mrperl
Posts: 65
Joined: Mar 06, 2010 11:40 am

re: You have to wait x minutes till next download

#7 Postby mrperl » Apr 17, 2010 8:23 am

Here's an example with JavaScript and a DIV:

Code: Select all

<html>
<head>
<script type="text/javascript">
var Timer = 0;
var period = 1000;
var n = 61;

function initCountDown()
{
   Timer = setInterval("countDown()", period);
}

function countDown()
{
   var o = document.getElementById("myTimer");

   var minutes = parseInt(n / 60);
   var seconds = n % 60;

   var minutes_str = "minutes";

   if (minutes == 1) {
      minutes_str = "minute";
   }

   var seconds_str = "seconds";

   if (seconds == 1) {
      seconds_str = "second";
   }

   if (n) {
      o.innerHTML = "<p>You have to wait " + minutes + " " + minutes_str + ", " + seconds + " " + seconds_str + " till next download</p>\n";
      n--;
   }
   else {
      clearInterval(Timer);
      o.innerHTML = "<p>Enjoy.</p>\n";
   }
}
</script>
</head>

<body onload="initCountDown();">
<div id="myTimer">
</div>
</body>
</html>
Last edited by mrperl on Apr 17, 2010 8:41 am, edited 1 time in total.

ankurs
Posts: 1054
Joined: Mar 10, 2009 2:34 am

Re: re: You have to wait x minutes till next download

#8 Postby ankurs » Apr 17, 2010 8:38 am

mrperl wrote:Here's an example with a delay displayed in seconds:]
from what i understand, the system wont create a download link for that many minutes/hrs & hence this delayed display wont work

this kinda approach can also be easily bypassed by disabling JS

mrperl
Posts: 65
Joined: Mar 06, 2010 11:40 am

Re: You have to wait x minutes till next download

#9 Postby mrperl » Apr 18, 2010 2:27 am

Ankurs:

An average programmer would be able to modify the XFS PRo source to
use the JavaScript sample above for a countdown timer.

You can enforce JavaScript-only browser users by redirecting to another
page after the countdown is done, or display "JavaScript is required."

I gave you some sample code. How you use it is up to you.

mrperl.