From 9498f5129e15fe42ae98bd0e37a2936228cccdb9 Mon Sep 17 00:00:00 2001 From: Sam Caldwell Date: Thu, 23 Mar 2017 17:07:03 -0400 Subject: [PATCH] tweak crazy mikes --- js/examples/eve/crazy-mikes/index.html | 2 +- js/examples/eve/crazy-mikes/index.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/js/examples/eve/crazy-mikes/index.html b/js/examples/eve/crazy-mikes/index.html index 6b31497..b831485 100644 --- a/js/examples/eve/crazy-mikes/index.html +++ b/js/examples/eve/crazy-mikes/index.html @@ -16,7 +16,7 @@
diff --git a/js/examples/eve/crazy-mikes/index.js b/js/examples/eve/crazy-mikes/index.js index 62cb6c4..755d214 100644 --- a/js/examples/eve/crazy-mikes/index.js +++ b/js/examples/eve/crazy-mikes/index.js @@ -6,8 +6,10 @@ function spawnNavBar(defaultPage) { field this.currentPage = defaultPage; assert currentPage(this.currentPage); on message Syndicate.UI.globalEvent('.nav-btn', 'click', $e) { - // INVARIANT: the text content of each nav bar button is the page name - this.currentPage = e.originalTarget.textContent; + // INVARIANT: the id of each nav bar button is of the form 'nav-btn-Name', + // where Name is the name of the page associated with that button + var newPage = e.target.id.match(/nav-btn-(.*)/)[1]; + this.currentPage = newPage; } } }