Last active
December 24, 2015 12:29
-
-
Save nblenke/6797928 to your computer and use it in GitHub Desktop.
Create a staging environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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