From 71ea9b22cec575a91dca48bffa80fc8bfafdd482 Mon Sep 17 00:00:00 2001 From: Hamza Zia Date: Wed, 6 Jun 2012 01:24:15 +0800 Subject: [PATCH] functionality for adding multiple links to new download added --- index.html | 14 ++++++++++---- js/script.js | 26 ++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index f1f5eeb..4baa526 100755 --- a/index.html +++ b/index.html @@ -61,7 +61,7 @@
- +


@@ -140,7 +140,7 @@ - + + - + + - + + + diff --git a/js/script.js b/js/script.js index 44d188c..56076bb 100755 --- a/js/script.js +++ b/js/script.js @@ -55,8 +55,24 @@ $(function() { clear_dialogs(); update_ui(); $('#newDownload').click(function() { + $('#newDownload_url').val(""); + $('.download_urls').html(""); modals.newDownload_modal.modal('show'); }); + $('#multiple_uris').click(function() { + var url = $('#newDownload_url').val(); + var html = '
  • '; + html += ''; + html += url; + html += ''; + html += ' '; + html += '
  • '; + $(html).appendTo('.download_urls'); + $('#newDownload_url').val(""); + $('.download_urls a').click(function() { + $(this).parents('li').remove(); + }); + }); $('#addNewDownload').click(newDownload); }); @@ -74,8 +90,14 @@ function addDownload(uris) { } function newDownload() { - var url = $('#newDownload_url').val(); - addDownload([[url]]); + var li = $('.download_urls li'); + var urls = []; + for(var i = 0; i < li.length; i++) { + urls.push($(li[i]).text().trim()); + + } + alert(JSON.stringify(urls)); + addDownload([urls]); } var d_files = {