mirror of
https://github.com/jstrieb/urlpages.git
synced 2025-03-15 13:04:33 +01:00
Add TinyURL shortlink button
This commit is contained in:
parent
b7d901b0af
commit
14beaf04b9
3 changed files with 14 additions and 1 deletions
|
@ -43,7 +43,7 @@ ${data["html"]}
|
|||
|
||||
/* Return a link to view the page */
|
||||
function getViewLink(pageData) {
|
||||
return `../#${window.btoa(pageData)}`;
|
||||
return `http://jstrieb.github.io/urlpages/#${window.btoa(pageData)}`;
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,6 +63,9 @@ function update() {
|
|||
// Update the URL for the "Get Link" button
|
||||
document.getElementById("getLinkLink").href = getViewLink(html);
|
||||
|
||||
// Update the URL for the "Short Link" button
|
||||
document.getElementById("url").value = getViewLink(html);
|
||||
|
||||
// Update the download link
|
||||
document.getElementById("downloadLink").href = `data:text/html,${html}`
|
||||
|
||||
|
|
|
@ -14,6 +14,12 @@
|
|||
</div>
|
||||
|
||||
<div id="buttons">
|
||||
<!-- Seemingly random attributes necessary for TinyUrl to accept the request -->
|
||||
<form action="http://tinyurl.com/create.php" method="get" target="_blank">
|
||||
<input type="hidden" id="source" name="source" value="indexpage">
|
||||
<input type="hidden" name="url" id="url" />
|
||||
<button>Get Short Link</button>
|
||||
</form>
|
||||
<button><a id="getLinkLink" href="" target="_blank">Get Link</a></button>
|
||||
<button onclick="showCopyCodePrompt()">Copy Code</button>
|
||||
<button><a id="downloadLink" href="" target="_blank" download="export.html">Download Code</a></button>
|
||||
|
|
|
@ -41,3 +41,7 @@ a, button {
|
|||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
form {
|
||||
display: inline;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue