Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Update script
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillweston committed May 3, 2024
1 parent cd340fc commit 22ff761
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>肥猫代币</title>
<title>胖猫代币</title>
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<!-- Font Awesome icons (free version)-->
<script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script>
Expand All @@ -19,7 +19,7 @@
<!-- Navigation-->
<nav class="navbar navbar-expand-lg navbar-dark navbar-custom fixed-top">
<div class="container px-5">
<a class="navbar-brand" href="#page-top">肥猫</a>
<a class="navbar-brand" href="#page-top">胖猫</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ms-auto">
Expand Down Expand Up @@ -99,7 +99,7 @@ <h2 class="display-4">悬赏基金</h2>
</section>
<!-- Footer-->
<footer class="py-5 bg-black">
<div class="container px-5"><p class="m-0 text-center text-white small">Copyright &copy; FeiMao 2023</p></div>
<div class="container px-5"><p class="m-0 text-center text-white small">Copyright &copy; PangMao 2024-04-11</p></div>
</footer>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
Expand Down
27 changes: 21 additions & 6 deletions js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,27 @@ function copyAddress(event) {
var copyInput = document.getElementById("address");
var fullAddress = copyInput.getAttribute("data-full-address");

// Using the Clipboard API
navigator.clipboard.writeText(fullAddress).then(function() {
console.log('Address copied to clipboard successfully!');
}, function(err) {
console.error('Could not copy text: ', err);
});
if (navigator.clipboard) {
// Clipboard API is available
navigator.clipboard.writeText(fullAddress).then(function() {
console.log('Address copied to clipboard successfully!');
}, function(err) {
console.error('Could not copy text: ', err);
});
} else {
// Clipboard API is not available, use document.execCommand('copy')
var textarea = document.createElement('textarea');
textarea.value = fullAddress;
document.body.appendChild(textarea);
textarea.select();
try {
document.execCommand('copy');
console.log('Address copied to clipboard successfully!');
} catch (err) {
console.error('Could not copy text: ', err);
}
document.body.removeChild(textarea);
}

// Create and show a hint message
var hint = document.createElement('span');
Expand Down

0 comments on commit 22ff761

Please sign in to comment.