mirror of
https://github.com/gamaio/unps.us-Shortener.git
synced 2024-12-22 02:02:40 +00:00
Add simple "Copy to Clipboard"
This will let people copy to clipboard by left-clicking the link right-click->copy still works
This commit is contained in:
parent
d3d8302f94
commit
a3806241bd
@ -37,7 +37,7 @@ class api{
|
||||
if($result = $sdb->query($sql)){
|
||||
if($row = $result->fetch_assoc()){
|
||||
$short = $row['shortlink'];
|
||||
return "<div id=\"error\">Existing link: <a href=\"http://unps.us/?l=$short\" target=\"$short\">http://unps.us/?l=$short</a></div>";
|
||||
return "<div id=\"error\">Existing link: <a onclick=\"copyToClipboard('http://unps.us/?l=$short');\" href=\"http://unps.us/?l=$short\" target=\"$short\">http://unps.us/?l=$short</a></div>";
|
||||
}
|
||||
}
|
||||
if(checkRemoteFile($link) !== true) return "<div id=\"error\">Dead Link: $link</div>";
|
||||
@ -51,7 +51,7 @@ class api{
|
||||
else: $sql = "INSERT INTO `links` (link, shortlink, dpass) VALUES ('$link', '$short', '$apikey')";
|
||||
endif;
|
||||
|
||||
if($result = $sdb->query($sql)): return "<div id=\"success\">Shortened: <a href=\"http://unps.us/?l=$short\" target=\"$short\">http://unps.us/?l=$short</a><br />Your link deletion password (write this down): $dpass</div>";
|
||||
if($result = $sdb->query($sql)): return "<div id=\"success\">Shortened: <a onclick=\"copyToClipboard('http://unps.us/?l=$short');\" href=\"http://unps.us/?l=$short\" target=\"$short\">http://unps.us/?l=$short</a><br />Your link deletion password (write this down): $dpass</div>";
|
||||
else: return '<div id="error">ERROR: ['.$sdb->error.']</div>';
|
||||
endif;
|
||||
}
|
||||
|
@ -170,8 +170,8 @@
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function(){
|
||||
// When the page loads, we're gonna want to hide the shorten-password and report-details elements
|
||||
$("#shorten-password").slideUp("slow");
|
||||
$("#report-details").slideUp("slow");
|
||||
$("#shorten-password").slideUp("fast");
|
||||
$("#report-details").slideUp("fast");
|
||||
$('#link').focus();
|
||||
|
||||
$('#error').fadeIn("slow");
|
||||
@ -200,6 +200,10 @@
|
||||
});
|
||||
});
|
||||
|
||||
function copyToClipboard(text){
|
||||
window.prompt ("Copy to clipboard: Ctrl+C, Enter (when closed I will open your link in a new tab)", text);
|
||||
}
|
||||
|
||||
// This is our AJAX - Thank you Wizzy <3
|
||||
$("#form-shorten").submit(function(event){
|
||||
event.preventDefault();
|
||||
|
Loading…
Reference in New Issue
Block a user