Last active
September 6, 2020 06:47
-
-
Save Karl-Han/cdcc25f630d2acbcdfce208d1963a9cd to your computer and use it in GitHub Desktop.
revise version of HTML for ukuq / cloudflare
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
.content{ | |
position: absolute; | |
left: 50%; | |
top: 30%; | |
margin: -50px 0 0 -50px; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="content"> | |
<h1>直链Cloudflare反代</h1> | |
<textarea type="url" placeholder="url" id="url" style="width: 200px; display: block;" cols="2" rows="6"></textarea> | |
<input type="submit" id="submit" value="submit"/> | |
<div id="res"></div> | |
<a id="a" href=""></a> | |
<br/> | |
<div>注:该工具只针对直链有效</div> | |
<div>原作者Github仓库: <a href="https://github.com/ukuq/cloudflare">https://github.com/ukuq/cloudflare</a></div> | |
<div>加上简单CSS后HTML页面: <a href="https://gist.github.com/Karl-Han/cdcc25f630d2acbcdfce208d1963a9cd">Link</a></div> | |
</div> | |
<script> | |
document.getElementById('submit').onclick=function(){ | |
let url = document.getElementById('url').value; | |
console.log('url: '+url); | |
let a = document.getElementById('a'); | |
let div = document.getElementById('res'); | |
if(!url || !url.startsWith('http')){ | |
div.textContent="链接不合法: "+url; | |
a.style="display:none"; | |
}else{ | |
div.textContent=""; | |
let res = (new URL(window.location.href)).origin+'?url='+encodeURIComponent(url); | |
a.textContent="下载链接"; | |
a.href=res; | |
a.style=""; | |
} | |
} | |
</script> | |
</body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment