-
-
Save krooluang/c9d7a47194855e75eca9222a67068514 to your computer and use it in GitHub Desktop.
ระบบคัดลอกข้อความ
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
function doGet() { | |
return HtmlService.createHtmlOutputFromFile('index') | |
.setTitle('copy Examblog') | |
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL) | |
.addMetaTag('viewport', 'width=device-width, initial-scale=1'); | |
} |
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="th"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Examblog Copy</title> | |
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"/> | |
<link href="https://fonts.googleapis.com/css2?family=Sarabun:wght@400;700&display=swap" rel="stylesheet"/> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css"/> | |
<style> | |
body { | |
font-family: 'Sarabun', sans-serif; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container mt-3"> | |
<div class="col-md-6 mx-auto"> | |
<h3 class="text-primary fw-bold text-center">นายสมปอง ครองใจ</h3> | |
<h4 class="text-center mb-3" id="accountNumber" onclick="copyToClipboard()"> | |
<i class="fa-regular fa-copy" style="cursor: pointer;"></i><span class="text-danger"> 12345678901</span> | |
</h4> | |
<textarea class="form-control" rows="5"></textarea> | |
<footer class="text-center fixed-bottom mb-3"> | |
© Copyright By Examblog | |
</footer> | |
</div> | |
</div> | |
<script> | |
function copyToClipboard() { | |
var element = document.getElementById('accountNumber'); | |
if (element) { | |
var textToCopy = element.innerText.split("\n")[0]; // ตัดไอคอนออกจากข้อความที่จะคัดลอก | |
navigator.clipboard.writeText(textToCopy).then(function() { | |
Swal.fire({ | |
position: "top", | |
icon: "success", | |
title: 'เลขที่บัญชีถูกคัดลอกแล้ว: ' + textToCopy, | |
showConfirmButton: true, | |
}); | |
}).catch(function(error) { | |
alert('เกิดข้อผิดพลาดในการคัดลอก: ' + error); | |
}); | |
} | |
} | |
</script> | |
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment