Skip to content
Snippets Groups Projects
Commit 3d5c544c authored by Lillian Gray's avatar Lillian Gray
Browse files

Unify permalink generation & copy #4

parent 23f2c1b5
Branches
No related merge requests found
...@@ -40,14 +40,10 @@ ...@@ -40,14 +40,10 @@
<div id="site-options" class="flex-parent"> <div id="site-options" class="flex-parent">
<a id="csvDownload" href="#"><button class="csvBtn" type="button">Download CSV</button></a> <a id="csvDownload" href="#"><button class="csvBtn" type="button">Download CSV</button></a>
<form id="plink-form"> <div id="plink-form">
<input id="plink" type="text" value=""></input> <input id="plink" type="text" value=""></input>
<input class="getPlink"type="button" value="Get Permalink" <button class="getPlink" type="button" onclick= genPermalink();>Get Permalink</button>
onclick=" </div>
document.getElementById('plink').value = genPermalink();
document.getElementById('plink').select();
"></input>
</form>
</div> </div>
<div id="site-details"> <div id="site-details">
......
...@@ -213,23 +213,14 @@ function genPermalink(){ ...@@ -213,23 +213,14 @@ function genPermalink(){
if(!whichBuildings[i]) if(!whichBuildings[i])
disabledBuildings += i; disabledBuildings += i;
} }
return URLComponents[0]+"?"+startStr+"+"+endStr+"+"+disabledBuildings; var permalink = URLComponents[0]+"?"+startStr+"+"+endStr+"+"+disabledBuildings;
}
// Browser notifying permalink has been copied
$('.getPlink').click(function(event) {
$('#plink').focus();
$('#plink').select();
try {
var successful = document.execCommand('copy');
var message = successful? 'successfully' : 'unsuccessfully';
window.alert("Link copied successfully and ready to be pasted!")
} catch(err) {
console.log("link copying failed");
}
});
//Copies permalink and puts permalink in text box next to the button
var plinkTextField = document.getElementById('plink');
plinkTextField.value = permalink;
plinkTextField.select();
document.execCommand('copy');
}
$('#csvDownload').click(function () { $('#csvDownload').click(function () {
//prepares and then downloads a csv file based on what is currently shown in the chart //prepares and then downloads a csv file based on what is currently shown in the chart
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment