Skip to content

Instantly share code, notes, and snippets.

@boertel
Last active December 28, 2015 10:59
Show Gist options
  • Save boertel/7489836 to your computer and use it in GitHub Desktop.
Save boertel/7489836 to your computer and use it in GitHub Desktop.
Hide red ribbon after 5 seconds
#rwd_tab {
display: none !important;
}
#rwd_tab.shown {
display: block !important;
}
window.ptReady = [] || window.ptReady;
window.ptReady.push(function () {
// Hide/Show the red ribbon
function displayRedRibbon(display) {
var redRibbon = document.getElementById("rwd_tab");
if (redRibbon) {
redRibbon.className = display ? redRibbon.className + " shown" : redRibbon.className.replace(" shown", "");
}
}
// Wait until the ribbon is loaded
PT.event.bind("rewardtab.ready", function () {
var cookieName = "reward_ribbon_showed"; // Does the user already saw the ribbon?
if (!PT.cookie.get(cookieName)) {
displayRedRibbon(true);
window.setTimeout(function () {
displayRedRibbon(false);
PT.cookie.set(cookieName, true)
}, 5 * 1000); // wait 5 seconds before hiding the red ribbon
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment