Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
deevroman committed Mar 14, 2020
1 parent 6cfbc83 commit 4ad5ddb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/fix_page.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
document.querySelectorAll('a').forEach(function (elem) {
let reg = /^((https:\/\/|http:\/\/)?(telegram|t)\.me\/([a-zA-z0-9_]{1,}))$/g;
let reg = /^((https:\/\/|http:\/\/)?(telegram|t)\.me\/([a-zA-z0-9_]+))$/g;
if (reg.test(elem.href)) {
elem.href = elem.href.replace(reg, "tg://resolve?domain=$4");
}
reg = /^((https:\/\/|http:\/\/)?(telegram|t)\.me\/joinchat\/([a-zA-z0-9_]{1,}))$/g;
reg = /^((https:\/\/|http:\/\/)?(telegram|t)\.me\/joinchat\/([a-zA-z0-9_]+))$/g;
if (reg.test(elem.href)) {
elem.href = elem.href.replace(reg, "tg://resolve?invite=$4");
}
Expand Down
4 changes: 2 additions & 2 deletions src/popup/popup.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
function fixUrl(event) {
let reg = /^((https:\/\/|http:\/\/)?(telegram|t)\.me\/([a-zA-z0-9_]{1,}))$/g;
let reg = /^((https:\/\/|http:\/\/)?(telegram|t)\.me\/([a-zA-z0-9_]+))$/g;
if (reg.test(event.target.value)) {
let fixedLink = event.target.value.replace(reg, "tg://resolve?domain=$4");
document.getElementById("output-link").innerHTML = "<a href='" + fixedLink + "'>" + fixedLink + "</a>";
} else {
let reg = /^((https:\/\/|http:\/\/)?(telegram|t)\.me\/joinchat\/([a-zA-z0-9_]{1,}))$/g;
let reg = /^((https:\/\/|http:\/\/)?(telegram|t)\.me\/joinchat\/([a-zA-z0-9_]+))$/g;
if (reg.test(event.target.value)) {
let fixedLink = event.target.value.replace(reg, "tg://resolve?invite=$4");
document.getElementById("output-link").innerHTML = "<a href='" + fixedLink + "'>" + fixedLink + "</a>";
Expand Down

0 comments on commit 4ad5ddb

Please sign in to comment.