-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert.html
39 lines (37 loc) · 1.2 KB
/
convert.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
layout: convert
---
<script>
function convert () {
var url = document.getElementById("input_text");
url = url.value;
if(url == ""){
alert("Bạn cần nhập vào URL !");
} else {
if(!url.includes("www")){
url = url.replace("{{ site.targeturl }}", "{{ site.url }}/{{ site.baseurl }}");
} else {
url = url.replace("www.{{ site.targeturl }}", "{{ site.url }}/{{ site.baseurl }}");
}
document.getElementById("output_text").value = url;
}
}
function copyURL() {
var copyText = document.getElementById("output_text");
copyText.select();
copyText.setSelectionRange(0, 99999)
document.execCommand("copy");
alert("Copied the text: " + copyText.value);
}
</script>
<div style="font-family: Courier New; margin: 0px auto; width: 80%;">
<label>URL of page {{ site.targeturl }} </label><br />
<input id="input_text" type="text" />
<button class="button" onclick="convert()">Convert</button>
<br />
<br />
<br />
<label>URL of github page:</label><br />
<input id="output_text" readonly="readonly" type="text" />
<button class="button" onclick="copyURL()">Copy</button>
</div>