From e5f69904485c924d8eef44dd64ee7a07d9fc4789 Mon Sep 17 00:00:00 2001 From: Einar Egilsson Date: Tue, 30 Aug 2011 14:09:25 +0200 Subject: Delete redirects --- chrome/js/settings.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'chrome/js') diff --git a/chrome/js/settings.js b/chrome/js/settings.js index c5675f6..29cdf29 100644 --- a/chrome/js/settings.js +++ b/chrome/js/settings.js @@ -75,7 +75,7 @@ $(document).ready(function() { var template = $('#redirect-list').html().replace(/^\s*|\s$/g, ''); function databind() { - $('#redirect-list').html(''); + $('#redirect-list').empty(); for (var i = 0; i < Redirector.redirectCount; i++) { var redirect = Redirector.getRedirectAt(i); var node = $(template); @@ -87,10 +87,16 @@ $(document).ready(function() { node.data('redirect', redirect); } - $('#redirect-list li a').click(function() { - alert(this.parentNode.parentNode.redirect); - }); } + + $('#redirect-list li div a.delete').live('click', function(ev) { + var redirect = $(this.parentNode.parentNode).data('redirect'); + if (PromptService.confirm(null, tr("deleteConfirmationTitle"), tr("deleteConfirmationText"))) { + Redirector.deleteRedirect(redirect); + $(this.parentNode.parentNode).remove(); + } + ev.preventDefault(); + }); databind(); -- cgit v1.2.3-70-g09d2