(emscripten) use localstorage variables instead of passing the parameters in a URL

This commit is contained in:
radius 2016-09-05 23:29:00 -05:00
parent 82d82110ae
commit 18527d2fef
2 changed files with 9 additions and 5 deletions

View File

@ -13,13 +13,13 @@
<a class="navbar-brand" href="#">RetroArch</a>
<ul class="nav navbar-nav">
<li class="nav-item gambatte">
<a class="nav-link" href="./?core=gambatte">Gambatte</a>
<a class="nav-link" href="." onclick=switchCore("gambatte")>Gambatte</a>
</li>
<li class="nav-item snes9x2010">
<a class="nav-link" href="./?core=snes9x2010">Snex9x 2010</a>
<a class="nav-link" href="." onclick=switchCore("snes9x2010")>Snes9X 2010</a>
</li>
<li class="nav-item vba_next">
<a class="nav-link vba_next" href="./?core=vba_next">VBA Next</a>
<a class="nav-link" href="." onclick=switchCore("vba_next")>VBA Next</a>
</li>
</ul>
</div>

View File

@ -215,14 +215,17 @@ var Module =
}
};
function switchCore(corename) {
localStorage.setItem("core", corename);
}
// When the browser has loaded everything.
$(function() {
// Find which core to load.
var core = getParam('core');
var core = localStorage.getItem("core", core);
if (!core) {
core = 'gambatte';
}
// Show the current core as the active core.
$('.nav-item.' + core).addClass('active');
@ -234,6 +237,7 @@ $(function() {
/**
* Attempt to disable some default browser keys.
*/
window.addEventListener('keydown', function(e) {
// Space key, arrows, and F1.
if([32, 37, 38, 39, 40, 112].indexOf(e.keyCode) > -1) {