[components] Add WebCompat Addon as feature-webcompat
[gecko.git] / mobile / android / android-components / components / feature / webcompat / src / main / assets / extensions / webcompat / injections / js / bug1570856-medium.com-menu-isTier1.js
blobf8bb926b60d0c99b37f50040900a9d36aa2aa5b1
1 "use strict";
3 /**
4  * medium.com - Override window.GLOBALS.useragent.isTier1 to be true
5  * WebCompat issue #25844 - https://webcompat.com/issues/25844
6  *
7  * This site is not showing main menu when scrolling. There is a GLOBALS variable
8  * at the bottom of the template being defined based on a server side UA detection.
9  * Setting window.GLOBALS.useragent.isTier1 to true makes the menu appear when scrolling
10  */
12 /* globals exportFunction */
14 console.info(
15   "window.GLOBALS.useragent.isTier1 has been set to true for compatibility reasons. See https://webcompat.com/issues/25844 for details."
18 let globals = {};
20 Object.defineProperty(window.wrappedJSObject, "GLOBALS", {
21   get: exportFunction(function() {
22     return globals;
23   }, window),
25   set: exportFunction(function(value = {}) {
26     globals = value;
28     if (!globals.useragent) {
29       globals.useragent = {};
30     }
32     globals.useragent.isTier1 = true;
33   }, window),
34 });