Skip to content

Instantly share code, notes, and snippets.

@nblenke
Last active December 24, 2015 12:29
Show Gist options
  • Save nblenke/6797928 to your computer and use it in GitHub Desktop.
Save nblenke/6797928 to your computer and use it in GitHub Desktop.
Create a staging environment
var stagify = function () {
if (window.location.search.search('staging=true') !== -1) {
$('html')
.addClass('staging')
.find('a').each(function () {
var h = $(this).attr('href'),
q = !!h && h.search(/\?/) !== -1 ? '&': '?';
if (!!h && h.search('#') === -1) {
$(this).attr('href', h + q + 'staging=true');
}
});
$('.staging-hide').hide();
$('.staging-show').css('display', 'block');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment