diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-06-19 21:33:15 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-06-19 21:33:15 +0000 |
commit | 06e53e9ad202c5236af9b4efd52b8262ee59c019 (patch) | |
tree | c5a90f0756a44ea6bc8f4f24395d76f738e90137 /g/js | |
parent | 855d36a3ec9fb8769c03c03032c8eeeee6604f12 (diff) | |
download | www-06e53e9ad202c5236af9b4efd52b8262ee59c019.tar www-06e53e9ad202c5236af9b4efd52b8262ee59c019.tar.gz www-06e53e9ad202c5236af9b4efd52b8262ee59c019.tar.bz2 www-06e53e9ad202c5236af9b4efd52b8262ee59c019.tar.xz www-06e53e9ad202c5236af9b4efd52b8262ee59c019.zip |
g/js/donators-list.js: move code to a function
Diffstat (limited to 'g/js')
-rw-r--r-- | g/js/donators-list.js | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/g/js/donators-list.js b/g/js/donators-list.js index 2255f1b54..615b0c1ef 100644 --- a/g/js/donators-list.js +++ b/g/js/donators-list.js @@ -395,31 +395,33 @@ var previous_donors = [ '姜 奕轲', ]; -var donators = {}; -for (var i = 0; i < previous_donors.length; i++) { - donators[previous_donors[i]] = previous_donors_url; -} - -$.getJSON(donations_who_url, function(data) { - for (var i = 0; i < data.length; i++) { - donators[data[i].who] = data[i].url; - } - var sorted_donators = []; - for (var d in donators) { - if (donators.hasOwnProperty(d)) - sorted_donators.push(d); +function thankyou_page() { + var donators = {}; + for (var i = 0; i < previous_donors.length; i++) { + donators[previous_donors[i]] = previous_donors_url; } - sorted_donators.sort(); - var dlist = ''; - for (var i = 0; i < sorted_donators.length; i++) { - dlist += '<li><a href="' + donators[sorted_donators[i]] + '">' - + sorted_donators[i] + '</a></li>'; - }; - document.getElementById("donlist").innerHTML=dlist; -}); + $.getJSON(donations_who_url, function(data) { + for (var i = 0; i < data.length; i++) { + donators[data[i].who] = data[i].url; + } + var sorted_donators = []; + for (var d in donators) { + if (donators.hasOwnProperty(d)) + sorted_donators.push(d); + } + sorted_donators.sort(); -$.getJSON(treasurer_infos_url, function(data) { - document.getElementById("donations_30days").innerHTML=data.donations_30days; - document.getElementById("last_update").innerHTML=data.last_update; -}); + var dlist = ''; + for (var i = 0; i < sorted_donators.length; i++) { + dlist += '<li><a href="' + donators[sorted_donators[i]] + '">' + + sorted_donators[i] + '</a></li>'; + }; + document.getElementById("donlist").innerHTML=dlist; + }); + + $.getJSON(treasurer_infos_url, function(data) { + document.getElementById("donations_30days").innerHTML=data.donations_30days; + document.getElementById("last_update").innerHTML=data.last_update; + }); +} |