🏠 返回首頁 

Greasy Fork is available in English.

Telegram tg:// to web+tg://

Converts "tg://" links to "web+tg://". See https://github.com/zhukov/webogram/issues/594


Installer dette script?
  1. // ==UserScript==
  2. // @name Telegram tg:// to web+tg://
  3. // @namespace http://denilson.sa.nom.br/
  4. // @version 0.1
  5. // @description Converts "tg://" links to "web+tg://". See https://github.com/zhukov/webogram/issues/594
  6. // @homepage https://gist.github.com/denilsonsa/b32ee2957982bfa86a00
  7. // @homepage https://greasyfork.org/en/scripts/18593-telegram-tg-to-web-tg
  8. // @author Denilson Sá
  9. // @grant none
  10. // @license Public domain
  11. // ==/UserScript==
  12. // Due to web restrictions, web.telegram.org cannot register itself to "tg://" protocol.
  13. // The browser only allows the white-listed version "web+tg://".
  14. // See also: https://github.com/zhukov/webogram/issues/594
  15. //
  16. // This user-script converts any "tg://" link to "web+tg://".
  17. // It is only run when a document finishes loading, so it won't slow down the entire browser.
  18. // This also means that any dynamically-created links will be left untouched.
  19. //
  20. // This script is also hosted at https://greasyfork.org/en/scripts/18593-telegram-tg-to-web-tg
  21. (function(){
  22. for (var i = 0; i < document.links.length; i++) {
  23. var anchor = document.links[i];
  24. if (/^tg:\/\//.test(anchor.href)) {
  25. anchor.href = 'web+' + anchor.href;
  26. }
  27. }
  28. })();