Browse Source

Show RSVP link if 'rsvp' query string is present

master
Brett Langdon 8 years ago
parent
commit
d849f495a0
No known key found for this signature in database GPG Key ID: B664881177781B04
1 changed files with 22 additions and 1 deletions
  1. +22
    -1
      index.html

+ 22
- 1
index.html View File

@ -23,7 +23,7 @@
</a>
<aside class="menu mobile-menu is-hidden is-size-4" style="background-color: whitesmoke; position: fixed; width: 100%; height: 100%; top: 0; left: 0; z-index: 100;">
<a class="close-mobile-menu box" style="position: absolute; width: 40px; height: 40px; top: 1rem; right: 1rem;">
<a class="close-mobile-menu box" style="position: relative; width: 40px; height: 40px; margin-top: 1rem; margin-left: 1rem;">
<svg style="position: absolute; top: 8px; left: 8px; width: 25px; height: 25px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path fill="#1D1D1B" d="M28.941 31.786L.613 60.114a2.014 2.014 0 1 0 2.848 2.849l28.541-28.541 28.541 28.541c.394.394.909.59 1.424.59a2.014 2.014 0 0 0 1.424-3.439L35.064 31.786 63.41 3.438A2.014 2.014 0 1 0 60.562.589L32.003 29.15 3.441.59A2.015 2.015 0 0 0 .593 3.439l28.348 28.347z"/></svg>
</a>
<ul class="menu-list">
@ -32,6 +32,7 @@
<li><a href="#things-to-do">Things to do in Rochester</a></li>
<li><a href="#registry">Registry</a></li>
<li><a href="#faq">FAQ</a></li>
<li><a href="https://rsvp.as/" target="_blank" class="rsvp is-hidden">RSVP</a></li>
</ul>
</aside>
@ -51,6 +52,7 @@
<li><a href="#things-to-do">Things to do in Rochester</a></li>
<li><a href="#registry">Registry</a></li>
<li><a href="#faq">FAQ</a></li>
<li><a href="https://rsvp.as/" target="_blank" class="rsvp is-hidden">RSVP</a></li>
</ul>
</div>
</nav>
@ -293,6 +295,25 @@
}
}
});
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
var rsvpCode = getParameterByName('rsvp');
if (rsvpCode) {
var rsvp = document.querySelectorAll('.rsvp')
for (var i = 0; i < rsvp.length; i += 1) {
rsvp[i].href = 'https://rsvp.as/' + encodeURIComponent(rsvpCode);
rsvp[i].classList.remove('is-hidden');
}
}
</script>
</body>
</html>

Loading…
Cancel
Save