(ems) override F1 and other keys, use paths relative to the base url

This commit is contained in:
radius 2016-09-08 23:37:05 -05:00
parent 934bd2d018
commit 8b2434a408
2 changed files with 57 additions and 21 deletions

View File

@ -9,7 +9,7 @@
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css">
<!-- Material Design Bootstrap -->
<link href="https://bot.libretro.com/web/mdb/css/mdb.min.css" rel="stylesheet">
<link href="mdb/css/mdb.min.css" rel="stylesheet">
<link href="proto.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="media/icon_dark.ico" />
@ -150,10 +150,12 @@
</div>
<script src="//code.jquery.com/jquery-3.1.0.min.js"></script>
<script src="//rawgit.com/jeresig/jquery.hotkeys/master/jquery.hotkeys.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/tether/1.3.4/js/tether.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.3/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/dropbox.js/0.10.2/dropbox.min.js"></script>
<script src="https://use.fontawesome.com/bb20806e1e.js"></script>
<script src="analytics.js"></script>
<script src="browserfs.js"></script>
<script src="proto.js"></script>
</body>

View File

@ -103,9 +103,9 @@ function setupFileSystem(backend)
var lsfs = new BrowserFS.FileSystem.LocalStorage();
/* create an XmlHttpRequest filesystem for assets */
var xfs1 = new BrowserFS.FileSystem.XmlHttpRequest
(".index-xhr", "https://bot.libretro.com/web/assets/");
(".index-xhr", "/web/assets/");
var xfs2 = new BrowserFS.FileSystem.XmlHttpRequest
(".index-xhr", "https://bot.libretro.com/assets/cores/");
(".index-xhr", "/assets/cores/");
/* mount the local filesystem at the root of mfs*/
mfs.mount('/home/web_user/userdata', lsfs);
@ -124,9 +124,9 @@ function setupFileSystem(backend)
var mfs = new BrowserFS.FileSystem.MountableFileSystem();
/* create an XmlHttpRequest filesystem for assets */
var xfs1 = new BrowserFS.FileSystem.XmlHttpRequest
(".index-xhr", "https://bot.libretro.com/web/assets/");
(".index-xhr", "/web/assets/");
var xfs2 = new BrowserFS.FileSystem.XmlHttpRequest
(".index-xhr", "https://bot.libretro.com/assets/cores/");
(".index-xhr", "/assets/cores/");
/* mount the local filesystem at the root of mfs*/
mfs.mount('/home/web_user/userdata', afs);
@ -265,16 +265,17 @@ function switchStorage(backend) {
// When the browser has loaded everything.
$(function() {
// Find which core to load.
var core = localStorage.getItem("core", core);
if (!core) {
core = 'gambatte';
}
// Show the current core as the active core.
$('.nav-item.' + core).addClass('active');
// Find which core to load.
var core = localStorage.getItem("core", core);
if (!core) {
core = 'gambatte';
}
// Show the current core as the active core.
$('.nav-item.' + core).addClass('active');
// Load the Core's related JavaScript.
$.getScript(core + '_libretro.js', function () {
// Load the Core's related JavaScript.
$.getScript(core + '_libretro.js', function ()
{
// Activate the Start RetroArch button.
$('#btnRun').removeClass('disabled');
$('#icnRun').removeClass('fa-spinner spinning');
@ -297,11 +298,44 @@ $(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) {
e.preventDefault();
var util = { };
document.addEventListener('keydown', function(e)
{
var key = util.key[e.which];
if( key )
{
e.preventDefault();
}
}, false);
});
});
})
util.key = {
9: "tab",
13: "enter",
16: "shift",
18: "alt",
27: "esc",
33: "rePag",
34: "avPag",
35: "end",
36: "home",
37: "left",
38: "up",
39: "right",
40: "down",
112: "F1",
113: "F2",
114: "F3",
115: "F4",
116: "F5",
117: "F6",
118: "F7",
119: "F8",
120: "F9",
121: "F10",
122: "F11",
123: "F12"
}
});
});