Skip to content

Instantly share code, notes, and snippets.

@gardner
Created November 26, 2017 01:57
Show Gist options
  • Save gardner/3196364c7c6c701d800906757798ae6c to your computer and use it in GitHub Desktop.
Save gardner/3196364c7c6c701d800906757798ae6c to your computer and use it in GitHub Desktop.
Remove annoying urgency decorations from Hotels.com booking website
// ==UserScript==
// @name Hotels.com Silence Urgency
// @namespace https://gist.github.com/gardner/3196364c7c6c701d800906757798ae6c
// @version 0.1
// @description Remove annoying urgency decorations from Hotels.com booking website
// @author Gardner Bickford
// @match https://www.hotels.com/*
// @grant none
// ==/UserScript==
function hideIfVisible(elem) {
if ($(elem).is(':visible')) {
console.log('hiding ', elem);
$(elem).hide();
}
}
function clickIfVisible(elem) {
if ($(elem).is(':visible')) {
console.log('hiding ', elem);
$(elem).click();
}
}
var clearSpam = function() {
hideIfVisible('#urgency');
clickIfVisible('#listings > ol > div > div > div.message-wrapper > button');
clickIfVisible('#search-header > div > div.reward-banner.punch-card.hrw-reward-banner.enabled > div > button');
// hiding scarcity messages
$('.scarcity-message').hide();
$('.urgency-message').hide();
$('.nudge-container').hide();
callSpam();
};
function callSpam() {
setTimeout(clearSpam, 1000);
}
(function() {
'use strict';
callSpam();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment