Permalink
Browse files

Change recently-dropped text when toggling

Change "show recently dropped sets" to "hide recently dropped sets" when they're being shown. Closes #33.
  • Loading branch information...
1 parent 3657ff0 commit 2bdda6a6a2940f256b741b4e3e9c6415690fe247 @glacials committed Jul 6, 2016
Showing with 14 additions and 5 deletions.
  1. +3 −1 index.html
  2. +11 −4 js/toggleRecentlyDropped.js
View
@@ -26,7 +26,9 @@
</div>
<div class="col-md-5">
<div class="recently-dropped-toggle-container">
- <a href="#" class="low-distraction" onclick="toggleRecentlyDropped();">show recently dropped sets</a>
+ <a id="recently-dropped-toggler" href="#" class="low-distraction" onclick="toggleRecentlyDropped();">
+ show recently dropped sets
+ </a>
</div>
<ul id="recently-dropped" class="list-group list-group--dropped" style="display: none;">
<li class="list-group-item gray">
@@ -1,10 +1,17 @@
+var showText = "show recently dropped sets";
+var hideText = "hide recently dropped sets";
+
+var toggler = $("#recently-dropped-toggler")[0];
+var sets = $("#recently-dropped")[0];
+
var toggleRecentlyDropped = function() {
- var el = $("#recently-dropped")[0];
- if(el.style.display == 'none') {
- el.style.display = 'block';
+ if(sets.style.display == 'none') {
+ sets.style.display = 'block';
+ toggler.innerHTML = hideText;
ga('send', 'event', 'link', 'click', 'show recently dropped sets');
} else {
- el.style.display = 'none';
+ sets.style.display = 'none';
+ toggler.innerHTML = showText;
ga('send', 'event', 'link', 'click', 'hide recently dropped sets');
}
};

0 comments on commit 2bdda6a

Please sign in to comment.