Skip to content

Instantly share code, notes, and snippets.

@brittanydionigi
Last active January 4, 2016 20:29
Show Gist options
  • Save brittanydionigi/8674413 to your computer and use it in GitHub Desktop.
Save brittanydionigi/8674413 to your computer and use it in GitHub Desktop.
/*
* Helper function for getting query string parameters
* @param {string} name The name of the query parameter we want the value of
* @return {string} results Value of the query parameter
*/
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
/* Hide the masthead if we are in an NYT app */
var qParam = getParameterByName("nytapp");
if (qParam) {
$("#masthead").hide(); // or whatever you want to do here. some people add a class to the html or body tag to hide stuff with CSS
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment