Advertisement
jcunews

SpoofIntlLocaleAndTimeZone.user.js

Nov 23rd, 2021
1,031
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Spoof Intl Locale and Time Zone
  3. // @namespace    https://greasyfork.org/en/users/85671-jcunews
  4. // @version      1.0.1
  5. // @license      AGPLv3
  6. // @author       jcunews
  7. // @description  .
  8. // @match        *://*/*
  9. // @grant        none
  10. // @run-at       document-start
  11. // ==/UserScript==
  12.  
  13. (ro => {
  14.   //=== CONFIGURATION BEGIN ===
  15.   //All should be valid values. Otherwise websites may choke.
  16.   let fakeLocale   = "en-GB";
  17.   let fakeTimezone = "Europe/London";
  18.   //=== CONFIGURATION BEGIN ===
  19.  
  20.   ro = Intl.DateTimeFormat.prototype.resolvedOptions;
  21.   Intl.DateTimeFormat.prototype.resolvedOptions = function() {
  22.     let res = ro.apply(this, arguments);
  23.     res.locale = fakeLocale;
  24.     res.timeZone = fakeTimezone;
  25.     return res;
  26.   };
  27. })();
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement