diff --git a/pages/index.html b/pages/index.html index bffeb0a..554c293 100644 --- a/pages/index.html +++ b/pages/index.html @@ -369,17 +369,17 @@ let formattedLink = ""; if (githubLink.startsWith("https://github.com/") || githubLink.startsWith("http://github.com/")) { - formattedLink = "https://" + currentHost + "/github.com" + githubLink.substring(githubLink.indexOf("/", 8)); + formattedLink = window.location.protocol + "//" + currentHost + "/github.com" + githubLink.substring(githubLink.indexOf("/", 8)); } else if (githubLink.startsWith("github.com/")) { - formattedLink = "https://" + currentHost + "/" + githubLink; + formattedLink = window.location.protocol + "//" + currentHost + "/" + githubLink; } else if (githubLink.startsWith("https://raw.githubusercontent.com/") || githubLink.startsWith("http://raw.githubusercontent.com/")) { - formattedLink = "https://" + currentHost + githubLink.substring(githubLink.indexOf("/", 7)); + formattedLink = window.location.protocol + "//" + currentHost + githubLink.substring(githubLink.indexOf("/", 7)); } else if (githubLink.startsWith("raw.githubusercontent.com/")) { - formattedLink = "https://" + currentHost + "/" + githubLink; + formattedLink = window.location.protocol + "//" + currentHost + "/" + githubLink; } else if (githubLink.startsWith("https://gist.githubusercontent.com/") || githubLink.startsWith("http://gist.githubusercontent.com/")) { - formattedLink = "https://" + currentHost + "/gist.github.com" + githubLink.substring(githubLink.indexOf("/", 18)); + formattedLink = window.location.protocol + "//" + currentHost + "/gist.github.com" + githubLink.substring(githubLink.indexOf("/", 18)); } else if (githubLink.startsWith("gist.githubusercontent.com/")) { - formattedLink = "https://" + currentHost + "/" + githubLink; + formattedLink = window.location.protocol + "//" + currentHost + "/" + githubLink; } else { showToast('请输入有效的GitHub链接'); return null; @@ -437,4 +437,4 @@ - \ No newline at end of file +