j"19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAutMì#<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>SymRe - URL shortening on Bitcoin</title>
<meta property="og:type" content="website">
<meta property="og:site_name" content="SymRe">
<meta name="twitter:creator" content="@torusJKL">
<meta property="og:title" content="SymRe - ShortURL on Bitcoin">
<meta name="twitter:title" content="SymRe - ShortURL on Bitcoin">
<meta property="og:description" content="SymRe allows to use Bitcoin to store and retrieve short URLs.">
<meta name="description" content="SymRe allows to use Bitcoin to store and retrieve short URLs.">
<meta name="twitter:description" content="SymRe allows to use Bitcoin to store and retrieve short URLs.">
<link rel="icon" type="image/png" href="https://static.bitcoinfiles.org/1529b27b9f33b8631230cfe6534e1ee4594b4f8130509b3e9a0ecf5f5320a0ee">
<script
type="text/javascript"
src="https://unpkg.com/[email protected]/bsv.min.js"
integrity="sha256-5Mkg8jWEZkzGqdeJQyCA2DbGM9ivvC8c30kP55PjJSA="
crossorigin="anonymous"></script>
<script
type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js"
integrity="sha256-25ncr0CpJhgbzkUiR3wu/Fkk9sSykRG2qX+upHfJUos="
crossorigin="anonymous"></script>
<script
type="text/javascript"
src="https://www.moneybutton.com/moneybutton.js"></script>
</head>
<style>
html {
font-size: 20px;
}
body {
color: #455A64;
background-color: #e2e2e2;
font-family: Helvetica, Arial, Sans-Serif;
}
iframe {
display:block;
}
a:link {
color:inherit;
}
a:visited {
color:inherit;
}
.container {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: auto;
grid-template-areas:
"title_logo"
"description"
"URLinput"
"error"
"moneybutton"
"result"
"donate";
grid-gap: 5px;
}
.title_logo {
grid-area: title_logo;
justify-self: center;
margin-top: 10px;
}
.description {
grid-area: description;
justify-self: center;
}
.URLinput {
grid-area: URLinput;
justify-self: center;
}
.error {
grid-area: error;
justify-self: center;
color: red;
}
.moneybutton {
grid-area: moneybutton;
justify-self: center;
}
.result {
grid-area: result;
justify-self: center;
background: #c5e0ff;
border: none;
border-radius: 0.4rem;
padding: 10px;
}
.donate {
grid-area: donate;
justify-self: center;
}
.input-text {
display: block;
margin: 0;
color: inherit;
width: 90%;
font-family: inherit;
font-weight: inherit;
border: none;
border-radius: 0.4rem;
padding: 10px;
font-size: 2.1rem;
width: 100%;
}
input::placeholder {
color: #455A64;
}
</style>
<body onload="init();">
<div class="container">
<div class="title_logo">
<img src="https://static.bitcoinfiles.org/ca25febe75cc8fa450df355c149fe57aa5ba5645f15d32a56012d6b525935f3f">
</div>
<div class="description">
<h2>Create a short URL</h2>
</div>
<div class="URLinput">
<input type="text" id="urlInput" class="input-text" placeholder="Enter the address here" oninput="updateUrlButton()">
</div>
<div class="moneybutton" id="button-URL"></div>
<div class="error">
<div id="error">the URL is not valid. It needs a protocol prefix (e.g. http:// or bit://) and text afterwards</div>
</div>
<div class="result">
<div id="bsv"></div>
<div id="legacy"></div>
<div id="tx"></div>
</div>
<div class="donate">
<h3>Donate</h3>
<div id="qr">
<canvas height="100" width="100"></canvas>
<div class="addr">1SymRe7erxM46GByucUWnB9fEEMgo7spd</div>
</div>
<div id="button-donation"></div>
</div>
</div>
</body>
<script type="text/javascript">
let oldURL = ''
let addr = "1SymRe7erxM46GByucUWnB9fEEMgo7spd"
let qr = new QRious({
element: document.querySelector('#qr canvas'),
value: 'bitcoin:' + addr
})
function init(){
updateUrlButton()
donationButton()
}
function updateUrlButton(){
let errorelem = document.getElementById('error')
let mbelem = document.getElementById('button-URL')
let resultelem = document.getElementsByClassName('result')
let myURL = document.querySelector('#urlInput').value.trim()
resultelem[0].style.display = "none"
if(myURL == ""){
mbelem.style.display = "none"
return
}
if (myURL == oldURL)
return
if (!myURL == "" && !/(?:.+):\/\/(?:.+)/.test(myURL)){
errorelem.style.display = "block"
mbelem.style.display = "none"
oldURL = ""
return
}
oldURL = myURL
errorelem.style.display = "none"
let asmScript = toOpReturnASM(myURL).trim()
console.log("ASM script: \"" + asmScript + "\"")
urlButton(asmScript)
}
function toHex(str) {
var hexStr = '';
for(var i = 0; i < str.length; i++) {
hexStr += '' + str.charCodeAt(i).toString(16)
}
return hexStr
}
function toOpReturnASM(myURL){
return "OP_RETURN " + toHex('1SymRe7erxM46GByucUWnB9fEEMgo7spd') + " " + toHex(myURL)
}
function getShortURL(txid, length){
return bsv.encoding.Base58.fromHex(txid.substring(0,length)).toString()
}
function urlButton(OpReturnASM){
var elem = document.getElementById('button-URL')
elem.style.display = "block"
moneyButton.render(elem, {
outputs: [{
amount: "0",
currency: "USD",
type: 'SCRIPT',
script: OpReturnASM
},
{
to: "1SymRe7erxM46GByucUWnB9fEEMgo7spd",
amount: "0.00001003",
currency: "BSV",
}],
clientIdentifier: "3a2633a21e8edf7bdcec5568ace866ff",
onPayment: function (r) {
console.log('success:', r)
let resultelem = document.getElementsByClassName('result')
resultelem[0].style.display = "block"
let shortURL = getShortURL(r.txid, 10)
document.querySelector("#bsv").innerHTML = "<a href='https://bottle.bitdb.network/'>Bottle</a>: <a target='_blank' href='bit://1SymRe7erxM46GByucUWnB9fEEMgo7spd/" + shortURL + "'>bit://1SymRe7erxM46GByucUWnB9fEEMgo7spd/" + shortURL + "</a><br/>"
document.querySelector("#legacy").innerHTML = "Legacy: <a target='_blank' href='https://sym.re/" + shortURL + "'>https://sym.re/" + shortURL + "</a><br/>"
document.querySelector("#tx").innerHTML = "tx: <a target='_blank' href='https://whatsonchain.com/tx/" + r.txid + "'>" + r.txid + "</a>"
},
onError: function (r) {
console.log('error:', r)
let resultelem = document.getElementsByClassName('result')
resultelem[0].style.display = "block"
document.querySelector("#tx").innerHTML = "An error occured: " + r
}
})
}
function donationButton(){
var elem = document.getElementById('button-donation')
moneyButton.render(elem, {
amount: "0.0001",
currency: "BSV",
editable: true,
label: "Donate",
to: "1SymRe7erxM46GByucUWnB9fEEMgo7spd",
type: "tip"
})
}
</script>
</html>text/html; charset=utf-8UTF-8SymRe_index.html
https://whatsonchain.com/tx/60275b089707731ae357639f8a356aedef2c5c8f010dead326f7feead9560502