annotate downloads/static/js/downloads-get.js @ 1101:999b32c63cae
Made main menu aligned to right.
Since expanded seems broken...
author |
Brian Neal <bgneal@gmail.com> |
date |
Wed, 06 Jul 2016 19:46:20 -0500 |
parents |
ee87ea74d46b |
children |
f56798c96ec2 |
rev |
line source |
bgneal@404
|
1 $(document).ready(function() {
|
bgneal@404
|
2 $('.dl-button').each(function(n) {
|
bgneal@404
|
3 var button = $(this);
|
bgneal@404
|
4 var id = button.attr('id');
|
bgneal@404
|
5 var numeric_id = -1;
|
bgneal@404
|
6 if (id.match(/dl-(\d+)/))
|
bgneal@404
|
7 {
|
bgneal@404
|
8 numeric_id = RegExp.$1;
|
bgneal@404
|
9 }
|
bgneal@404
|
10 button.click(function() {
|
bgneal@404
|
11 button.attr('disabled', 'disabled').val('Getting link, stand by...');
|
bgneal@404
|
12 $.ajax({
|
bgneal@404
|
13 url: '/downloads/request/',
|
bgneal@404
|
14 type: 'POST',
|
bgneal@404
|
15 data: { id: numeric_id },
|
bgneal@404
|
16 dataType: 'json',
|
bgneal@404
|
17 success: function(result) {
|
bgneal@404
|
18 var link_id = result.id;
|
bgneal@404
|
19 var div = $('#link-' + link_id);
|
bgneal@404
|
20 div.hide();
|
bgneal@404
|
21 div.html(
|
bgneal@404
|
22 'Thank you! Your download is now ready. <a href="' + result.url +
|
bgneal@404
|
23 '">Click here to download</a>.');
|
bgneal@404
|
24 div.fadeIn(3000);
|
bgneal@404
|
25 },
|
bgneal@404
|
26 error: function (xhr, textStatus, ex) {
|
bgneal@404
|
27 alert('Oops, an error occurred. ' + xhr.statusText + ' - ' +
|
bgneal@404
|
28 xhr.responseText);
|
bgneal@404
|
29 }
|
bgneal@404
|
30 });
|
bgneal@404
|
31 });
|
bgneal@404
|
32 });
|
bgneal@404
|
33 });
|