2019-02-12 22:57:29 +03:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
2019-02-13 11:35:35 +03:00
|
|
|
<meta charset="utf-8">
|
|
|
|
<link rel="stylesheet" type="text/css" href="/css/main.css" media="screen">
|
2019-02-12 22:57:29 +03:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class=content>
|
|
|
|
<div class=title>
|
|
|
|
URL Shortener
|
|
|
|
</div>
|
|
|
|
<div class=shorten_form>
|
|
|
|
<form method=post>
|
2019-02-13 11:35:35 +03:00
|
|
|
<input type=text name=url class="url_input">
|
2019-02-12 22:57:29 +03:00
|
|
|
<input type=submit value=short!>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<% if (exists($page_data->{'url'})) { %>
|
|
|
|
<div class=url_data>
|
|
|
|
<p>source url: <a href='<%== $page_data->{'url'} %>'><%= $page_data->{'url'} %></a></p>
|
2019-02-13 11:51:06 +03:00
|
|
|
<p><div id='short_url_container' class=short_url_text ><%= $page_data->{'shorten_url'} %></div>
|
|
|
|
<button class="copy_short_url" onclick="CopyToClipboard('short_url_container')"><img src="/icons/copy2.png"></button></p>
|
2019-02-12 22:57:29 +03:00
|
|
|
</div>
|
|
|
|
<% } %>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
<script>
|
2019-02-13 11:51:06 +03:00
|
|
|
function CopyToClipboard(containerid) {
|
|
|
|
if (document.selection) {
|
|
|
|
var range = document.body.createTextRange();
|
|
|
|
range.moveToElementText(document.getElementById(containerid));
|
|
|
|
range.select().createTextRange();
|
|
|
|
document.execCommand("copy");
|
2019-02-12 22:57:29 +03:00
|
|
|
|
2019-02-13 11:51:06 +03:00
|
|
|
} else if (window.getSelection) {
|
|
|
|
var range = document.createRange();
|
|
|
|
range.selectNode(document.getElementById(containerid));
|
|
|
|
window.getSelection().addRange(range);
|
|
|
|
document.execCommand("copy");
|
|
|
|
}}
|
2019-02-12 22:57:29 +03:00
|
|
|
</script>
|
|
|
|
</html>
|