Confirm note download
authorCharles Connell <charles@connells.org>
Fri, 24 Jan 2014 17:42:45 +0000 (12:42 -0500)
committerCharles Connell <charles@connells.org>
Fri, 24 Jan 2014 17:42:45 +0000 (12:42 -0500)
karmaworld/assets/js/note-detail.js

index da96df8508aad422a74c03a4bb65fe571d536955..9bd282fe4cba05efe0895631291b35ca6f8d297b 100644 (file)
@@ -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
+      })
+    };
   });
 });