You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<script>
const copyButtonLabel = "Copy Address";
// use a class selector if available
let blocks = document.querySelectorAll("pre");
blocks.forEach((block) => {
// only add a button if browser supports Clipboard API
if (navigator.clipboard) {
let button = document.createElement("button");
button.innerText = copyButtonLabel;
button.addEventListener("click", copyCode);
block.appendChild(button);
}
else {
let button = document.createElement("button");
button.innerText = copyButtonLabel;
button.addEventListener("click", copyData);
block.appendChild(button);
}
});
async function copyCode(event) {
const button = event.srcElement;
const pre = button.parentElement;
let code = pre.querySelector("code");
let text = code.innerText;
await navigator.clipboard.writeText(text);
}
function copyData() {
var text = document.getElementById("textArea").value;
var listener = function(ev) {
ev.clipboardData.setData("text/plain", text);
ev.preventDefault();
};
document.addEventListener("copy", listener);
document.execCommand("copy");
document.removeEventListener("copy", listener);
navigator.clipboard.writeText(text.value);
var tooltip = document.getElementById("myTooltip");
tooltip.innerHTML = "Copied: " + text.value;
}
function copyData2() {
var text = document.getElementById("textArea2").value;
var listener = function(ev) {
ev.clipboardData.setData("text/plain", text);
ev.preventDefault();
};
document.addEventListener("copy", listener);
document.execCommand("copy");
document.removeEventListener("copy", listener);
navigator.clipboard.writeText(text.value);
var tooltip = document.getElementById("myTooltip");
tooltip.innerHTML = "Copied: " + text.value;
}
function outFunc() {
var tooltip = document.getElementById("myTooltip");
tooltip.innerHTML = "Copy to clipboard";
}
</script>
Donate 0.01 ETH
<script>
var MY_ADDRESS = '0xD2592996A462A5C5478fF3AfE09943095ce4C178'
var tipButton = document.querySelector('.tip-button')
tipButton.addEventListener('click', function()
{
if (typeof web3 === 'undefined')
{
return renderMessage('
You need to install MetaMask to use this feature. https://metamask.io
')
}
var user_address = web3.eth.accounts[0]
web3.eth.sendTransaction(
{
to: MY_ADDRESS,
from: user_address,
value: web3.toWei('0.01', 'ether'),
},
function (err, transactionHash)
{
if (err) return renderMessage('There was a problem!: ' + err.message)
renderMessage('Thanks for the generosity!!')
})
})
function renderMessage (message)
{
var messageEl = document.querySelector('.message')
messageEl.innerHTML = message
}
</script>