Last active
January 3, 2023 06:55
-
-
Save kballenegger/9e74bef91b745399d721dec5fceb24b9 to your computer and use it in GitHub Desktop.
Force IHG to speak English
This file contains hidden or 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
// ==UserScript== | |
// @name IHG English | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Force IHG site to English | |
// @author Kenneth Ballenegger | |
// @match https://www.ihg.com/hotels/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=kswizz.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const currentUrl = new URL(window.location.href); | |
const regex = /^\/hotels\/(?!us\/en)..\/../; | |
if (regex.test(currentUrl.pathname)) { | |
currentUrl.pathname = currentUrl.pathname.replace(regex, '/hotels/us/en'); | |
window.history.replaceState(null, null, currentUrl.toString()); | |
location.reload(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment