Fixed major URL param bugs
This commit is contained in:
parent
ddd2908245
commit
188dd25a74
@ -30,7 +30,7 @@ module.exports = {
|
||||
"globals": {
|
||||
"DoseeLoader": true,
|
||||
"Emulator": true,
|
||||
"metaContent": true,
|
||||
"getMetaContent": true,
|
||||
"storageAvailable": true,
|
||||
|
||||
"BuildEcma48": true,
|
||||
|
@ -7,7 +7,7 @@
|
||||
"use strict"
|
||||
|
||||
// Returns the content data stored in HTML <meta> tags
|
||||
function metaContent(name) {
|
||||
function getMetaContent(name) {
|
||||
const elm = document.getElementsByName(name)
|
||||
if (elm[0] === undefined) return null
|
||||
else return elm[0].getAttribute(`content`)
|
||||
@ -134,7 +134,7 @@ function storageAvailable(type) {
|
||||
// dosee screen capture button
|
||||
ssb.addEventListener(`click`, function() {
|
||||
const canvas = document.getElementById(`doseeCanvas`)
|
||||
const filename = metaContent(`dosee:capname`)
|
||||
const filename = getMetaContent(`dosee:capname`)
|
||||
canvas.toBlob(function(blob) {
|
||||
saveAs(blob, filename)
|
||||
ssb.style.color = `green`
|
||||
|
@ -50,12 +50,12 @@ const utils = function(q) {
|
||||
// Load configurations obtained from <meta name="dosee:"> HTML tags
|
||||
const cfg = {
|
||||
start: false,
|
||||
exe: metaContent(`dosee:startexe`),
|
||||
filename: metaContent(`dosee:filename`),
|
||||
gus: metaContent(`dosee:gusaudio`),
|
||||
path: metaContent(`dosee:gamefilepath`),
|
||||
res: metaContent(`dosee:resolution`),
|
||||
utils: metaContent(`dosee:utils`)
|
||||
exe: getMetaContent(`dosee:startexe`),
|
||||
filename: getMetaContent(`dosee:filename`),
|
||||
gus: getMetaContent(`dosee:gusaudio`),
|
||||
path: getMetaContent(`dosee:gamefilepath`),
|
||||
res: getMetaContent(`dosee:resolution`),
|
||||
utils: getMetaContent(`dosee:utils`)
|
||||
}
|
||||
|
||||
// Start DOSee automatically?
|
||||
|
@ -136,7 +136,10 @@ Module = null;
|
||||
console.log(`DOSee needs the URLSearchParams interface to read URL query string values`)
|
||||
return args
|
||||
}
|
||||
const urlParams = new URLSearchParams(window.location.href)
|
||||
|
||||
// extract URL query string and run it through the URLSearchParams API
|
||||
const wlh = window.location.href
|
||||
const urlParams = new URLSearchParams(wlh.slice(wlh.indexOf(`?`), wlh.indexOf(`#`)))
|
||||
|
||||
// graphic engine scalers (https://www.dosbox.com/wiki/Scaler)
|
||||
let scaler = null
|
||||
@ -210,6 +213,7 @@ Module = null;
|
||||
|
||||
// emulation sound cards
|
||||
const sound = urlParams.get(`dosaudio`)
|
||||
console.log(`DOS Audio --->`,sound)
|
||||
switch (sound) {
|
||||
case `none`:
|
||||
verbose += ` No audio.`
|
||||
|
26
index.js
26
index.js
@ -4,7 +4,14 @@
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
;(function() {
|
||||
// todo
|
||||
function setMetaContent(name) {
|
||||
const elm = document.getElementsByName(name)
|
||||
if (elm[0] === undefined) return null
|
||||
else return elm[0].getAttribute(`content`)
|
||||
}
|
||||
|
||||
(function() {
|
||||
const hw = document.getElementById(`hardware`)
|
||||
const opt = document.getElementById(`options`)
|
||||
const hlp = document.getElementById(`helpTab`)
|
||||
@ -17,13 +24,6 @@
|
||||
hlp.style.display = `none`
|
||||
}
|
||||
|
||||
resetMenu()
|
||||
hw.style.display = `block`
|
||||
|
||||
const h2 = document.getElementById(`doseeH2`)
|
||||
h2.innerText = `${metaContent(`dosee:filename`)}`
|
||||
|
||||
console.info(`index.js v1.0 loaded`)
|
||||
// document.getElementById(`hardware`)
|
||||
hwBut.onclick = function() {
|
||||
resetMenu()
|
||||
@ -37,4 +37,14 @@
|
||||
resetMenu()
|
||||
hlp.style.display = `block`
|
||||
}
|
||||
|
||||
|
||||
resetMenu()
|
||||
hwBut.click()
|
||||
|
||||
// set the header to show the filename
|
||||
document.getElementById(`doseeH2`).innerText = `${getMetaContent(`dosee:filename`)}`
|
||||
|
||||
console.info(`index.js v1.0 loaded`)
|
||||
|
||||
})()
|
||||
|
Loading…
x
Reference in New Issue
Block a user