Last active
July 27, 2021 07:43
-
-
Save naphatamity/cfa1da90bb85de4eeac7ea6eac4cb7f3 to your computer and use it in GitHub Desktop.
redirect_tool.html
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | |
<link | |
rel="stylesheet" | |
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" | |
/> | |
<link | |
rel="stylesheet" | |
href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" | |
/> | |
<link | |
rel="stylesheet" | |
href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" | |
/> | |
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css" /> | |
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> | |
<script src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script> | |
<script src="https://static.line-scdn.net/liff/edge/2.1/sdk.js"></script> | |
<script> | |
let os = ''; | |
function initializeLiff(myLiffId) {} | |
$(document).ready(function () { | |
var urlParams = new URLSearchParams(location.search); | |
const url = urlParams.get("url"); | |
document.getElementById("urlClipboard").value ="https://".concat(url); | |
let myLiffId = ""; | |
liff.init( | |
{ liffId: myLiffId }, | |
() => { | |
os = liff.getOS(); | |
$("#os").val(os); | |
if (os == "ios") { | |
window.location.replace("microsoft-edge-https://".concat(url)); | |
setTimeout(function () { | |
liff.closeWindow(); | |
}, 3000); | |
} else if (os == "android") { | |
document.getElementById("urlCopy").style.display = "block"; | |
document.getElementById("loader").style.display = "none"; | |
setTimeout(function () { | |
liff.closeWindow(); | |
}, 3000); | |
} else { | |
document.getElementById("urlCopy").style.display = "block"; | |
document.getElementById("loader").style.display = "none"; | |
} | |
} | |
); | |
}); | |
</script> | |
<script> | |
function copyToClipboard() { | |
var copyText = document.getElementById("urlClipboard"); | |
copyText.select(); | |
copyText.setSelectionRange(0, 99999) | |
document.execCommand("copy"); | |
if(os == "android") { | |
alert("กรุณานำ URL Link ที่คัดลอกแล้ว ไปวางบน Browser ใน Microsoft Edge เพื่อเข้าถึง KKM"); | |
} | |
} | |
</script> | |
<title>ขั้นตอนการเปิด KKM</title> | |
<style> | |
div { | |
margin: 10px; | |
} | |
.loader { | |
position: absolute; | |
left: 50%; | |
top: 50%; | |
z-index: 1; | |
width: 120px; | |
height: 120px; | |
margin: -76px 0 0 -76px; | |
border: 16px solid #f3f3f3; | |
border-radius: 50%; | |
border-top: 16px solid #3498db; | |
-webkit-animation: spin 2s linear infinite; | |
animation: spin 2s linear infinite; | |
} | |
.center { | |
margin: auto; | |
width: 50%; | |
padding: 10px; | |
} | |
#urlCopy{ | |
display: none; | |
} | |
@keyframes spin { | |
0% { | |
transform: rotate(0deg); | |
} | |
100% { | |
transform: rotate(360deg); | |
} | |
} | |
.copybutton { | |
background-color: #04AA6D; | |
border: none; | |
color: white; | |
padding: 5px; | |
text-align: center; | |
text-decoration: none; | |
font-size: 14px; | |
border-radius: 8px; | |
display: inline-block; | |
margin-left: auto; | |
margin-right: auto; | |
width: 100%; | |
} | |
.fontsize { | |
font-size: 12px; | |
text-align: center; | |
margin-left: auto; | |
margin-right: auto; | |
width: 100%; | |
} | |
.inputtext { | |
margin-left: auto; | |
margin-right: auto; | |
width: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="loader" id="loader"></div> | |
<div class="center" id="urlCopy"> | |
<p class="fontsize">กรุณาคัดลอก URL Link | |
</br> นำไปเปิดใน Microsoft Edge | |
</p> | |
<input class="inputtext" type="text" id="urlClipboard" readonly> | |
</br> | |
</br> | |
<button class="copybutton" onclick="copyToClipboard()" >กดเพื่อคัดลอก</button> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment