[Bps-public-commit] RT-Extension-FeaturedTickets branch, master, updated. a04cfa65e4055d03dc7393d186b3f9b4f37fc690

Craig Kaiser craig at bestpractical.com
Fri Mar 30 09:40:01 EDT 2018


The branch, master has been updated
       via  a04cfa65e4055d03dc7393d186b3f9b4f37fc690 (commit)
      from  d199458ca0cbb94af8eda7fa0d1e4fbc2e246cc8 (commit)

Summary of changes:
 static/js/featured-tickets.js | 55 ++++++++++++++++---------------------------
 1 file changed, 20 insertions(+), 35 deletions(-)

- Log -----------------------------------------------------------------
commit a04cfa65e4055d03dc7393d186b3f9b4f37fc690
Author: craig Kaiser <craig at bestpractical.com>
Date:   Fri Mar 30 09:17:32 2018 -0400

    Fix bug with JS trying to run on every page

diff --git a/static/js/featured-tickets.js b/static/js/featured-tickets.js
index c1dac64..0197e43 100644
--- a/static/js/featured-tickets.js
+++ b/static/js/featured-tickets.js
@@ -1,32 +1,3 @@
-var modal;
-var span;
-var form;
-var span;
-var name;
-var email;
-var amount;
-var ticket_id;
-var data;
-
-jQuery(document).ready(function() {
-    // Get the modal
-    modal = document.getElementById('featured-tickets-modal-modal');
-
-    FeaturedTicketsPage = document.getElementById('featured-tickets-body');
-
-    // Get the <span> element that closes the modal
-    FeaturedTicketSpan = document.getElementById('featured-tickets-modal-close');
-
-    // Our new sponsor form
-    form = jQuery("#new-sponsor").serialize();
-
-    // When the user clicks on <span> (x), close the modal
-    FeaturedTicketSpan.onclick = function() {
-        modal.style.display = "none";
-        FeaturedTicketsPage.style.overflow = 'auto';
-    }
-});
-
 // Create our new ticket for the sponsor
 function NewSponsor() {
     sponsor_name = document.getElementById('featured-tickets-name');
@@ -49,7 +20,11 @@ function NewSponsor() {
             }
     });
 
-    modal.style.display = "none";
+    var FeaturedTicketsModal = document.getElementById('featured-tickets-modal-modal');
+    var FeaturedTicketsPage = document.getElementById('featured-tickets-body');
+    var FeaturedTicketSpan = document.getElementById('featured-tickets-modal-close');
+
+    FeaturedTicketsModal.style.display = "none";
     FeaturedTicketsPage.style.overflow = 'auto';
 
     sponsor_name.value = '';
@@ -69,14 +44,24 @@ function detailsClicked( args )  {
     goal.innerHTML = args['Goal'];
     form_ticket_id.value = args['ticket_id'];
 
-    modal.style.display = "block";
+    var FeaturedTicketsPage = document.getElementById('featured-tickets-body');
+    var FeaturedTicketsModal = document.getElementById('featured-tickets-modal-modal');
+
+
+    FeaturedTicketsModal.style.display = "block";
     FeaturedTicketsPage.style.overflow = 'hidden';
-}
 
-// When the user clicks anywhere outside of the modal, close it
-window.onclick = function(event) {
-    if (event.target == modal) {
+    FeaturedTicketSpan.onclick = function() {
         modal.style.display = "none";
         FeaturedTicketsPage.style.overflow = 'auto';
     }
+
+
+    // When the user clicks anywhere outside of the modal, close it
+    window.onclick = function(event) {
+        if (event.target == FeaturedTicketsModal) {
+            modal.style.display = "none";
+            FeaturedTicketsPage.style.overflow = 'auto';
+        }
+    }
 }

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list