From 6cf010039dc761738b6e0a4c40ed0b3945be8957 Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Fri, 24 Jan 2014 12:42:45 -0500 Subject: [PATCH] Confirm note download --- karmaworld/assets/js/note-detail.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/karmaworld/assets/js/note-detail.js b/karmaworld/assets/js/note-detail.js index da96df8..9bd282f 100644 --- a/karmaworld/assets/js/note-detail.js +++ b/karmaworld/assets/js/note-detail.js @@ -106,16 +106,18 @@ $(function() { }); $("#note-download-button").click(function(event) { - // disable handler so it won't be run again - $(this).unbind('click'); + if (confirm('It costs 2 karma points to download a note. Are you sure?')) { + // disable handler so it won't be run again + $(this).unbind('click'); - // tell server that somebody downloaded - // this note - $.ajax({ - url: note_downloaded_url, - dataType: "json", - type: 'POST', - async: false - }); + // tell server that somebody downloaded + // this note + $.ajax({ + url: note_downloaded_url, + dataType: "json", + type: 'POST', + async: false + }) + }; }); }); -- 2.25.1