Improve Chinese text on Firefox

Change lang="zh" attribute to lang="zh-cn" so Firefox can style it correctly

  1. // ==UserScript==
  2. // @name Improve Chinese text on Firefox
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-10-26-04
  5. // @description Change lang="zh" attribute to lang="zh-cn" so Firefox can style it correctly
  6. // @author bellisk
  7. // @match http://*/*
  8. // @match https://*/*
  9. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  10. // @require https://cdn.jsdelivr.net/gh/CoeJoder/waitForKeyElements.js@a03933c5e42343b434c7800eb2777575342d8287/waitForKeyElements.js
  11. // @license MIT
  12. // @grant none
  13. // @run-at document-idle
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. waitForKeyElements("*:lang(zh)", (element) => {
  20. element.lang = "zh-cn";
  21. })
  22. })();