Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keyboard shortcuts #11

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ Licensed as GPLv3. Other licenses available upon request. Feel free to [ask ques

Icons by streamlineicons.com.

## Keyboard shortcuts

- Download Text (T)
- Download Image (D)
- Switch to Map (M)
- View/Set ID (I)
- Random New Planet (R)

## Additional Contributors ✨

Thanks goes to these wonderful people:

* [Efface Studios](https://www.effacestudios.com) Image Download Code
* [Efface Studios](https://www.effacestudios.com) Image Download Code
27 changes: 21 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,28 @@
<div id="DownloadDiv" style="width: 100% !important; position: absolute;">


<a download="planet.txt" id="downloadText" class="button"><img src="download-text.png"><div class="tooltip">Download Text</div></a>
<a download="Planet.png" id="download" onmouseover="writeImageData();" class="button"><img src="download-image.png"><div class="tooltip">Download Image</div></a>
<a id="mapSwitch" class="button" onclick="doMapSwitch();"><img src="map.png"><div class="tooltip">Switch to Map</div></a>
<a id="setID" class="button" onclick="setID();"><img src="id.png"><div class="tooltip">View/Set ID</div></a>
<a id="nextPlanet" class="button" onclick="genFromRandomID();"><img src="next.png"><div class="tooltip">Random New Planet</div></a>
<a download="planet.txt" id="downloadText" class="button"><img src="download-text.png"><div class="tooltip">Download Text (T)</div></a>
<a download="Planet.png" id="download" onmouseover="writeImageData();" class="button"><img src="download-image.png"><div class="tooltip">Download Image (D)</div></a>
<a id="mapSwitch" class="button" onclick="doMapSwitch();"><img src="map.png"><div class="tooltip">Switch to Map (M)</div></a>
<a id="setID" class="button" onclick="setID();"><img src="id.png"><div class="tooltip">View/Set ID (I)</div></a>
<a id="nextPlanet" class="button" onclick="genFromRandomID();"><img src="next.png"><div class="tooltip">Random New Planet (R)</div></a>

<script>
$(document).keydown(function(e){
if (e.keyCode==84){ // T
document.getElementById("downloadText").click();
}else if (e.keyCode==68){ // D
writeImageData();
document.getElementById("download").click();
}else if (e.keyCode==77){ // M
document.getElementById("mapSwitch").click();
}else if (e.keyCode==73){ // I
document.getElementById("setID").click();
}else if (e.keyCode==82){ // R
document.getElementById("nextPlanet").click();
}
});
</script>

</br>
</div>
Expand Down Expand Up @@ -964,7 +980,6 @@
document.getElementById("mapSwitch").innerHTML = doRenderMap ? '<img src="planet.png">' : '<img src="map.png">';
}


</script>


Expand Down