diff --git a/doc/notes.txt b/doc/notes.txt index 893e85ba..04ba1aaa 100644 --- a/doc/notes.txt +++ b/doc/notes.txt @@ -125,11 +125,11 @@ TODO: - can't add control instructions b/c of split - single-stepping vector games makes screen fade - break on stack overflow, bad op, bad access, etc -- PPU/TIA register write visualization - nes - replay doesn't work for nes (force background tile redraw) - nes debug view toolbar - support NES_HEADER_16K? + - PPU/TIA register write visualization - vcs - vcs sound continues when paused - vcs: INPTx needs to be added to control state @@ -141,11 +141,9 @@ TODO: - target ES6 - don't have to include bootstrap-tourist each time? - don't have to include firebase always? -- build ca65 projects w/ no crt0? https://github.com/pinobatch/thwaite-nes/blob/master/makefile - Github - gh-pages branch with embedded - handle overwrite logic - - test edge/failure cases - what to do about included files? - can published files retain path? - what if import interrupted and partial files? @@ -154,7 +152,6 @@ TODO: - support projects with subdirectories, file list? - emulator needs reset shortcut for nes - switching platform of a repo? - - what to load if no main file? WEB WORKER FORMAT diff --git a/src/ui.ts b/src/ui.ts index f2fd8dad..8d3b4b29 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -420,7 +420,7 @@ function getBoundGithubURL() : string { return 'https://github.com/' + toks[0] + '/' + toks[1]; } -function importProjectFromGithub(githuburl:string) { +function importProjectFromGithub(githuburl:string, replaceURL:boolean) { var sess : GHSession; var urlparse = parseGithubURL(githuburl); if (!urlparse) { @@ -429,7 +429,7 @@ function importProjectFromGithub(githuburl:string) { } // redirect to repo if exists var existing = getRepos()[urlparse.repopath]; - if (existing && !confirm("You've already imported " + urlparse.repopath + " -- do you want to replace all files?")) { + if (existing && !confirm("You've already imported " + urlparse.repopath + " -- do you want to replace all local files?")) { return; } // create new store for imported repository @@ -446,7 +446,7 @@ function importProjectFromGithub(githuburl:string) { // reload repo qs = {repo:sess.repopath}; // file:sess.mainPath, platform:sess.platform_id}; setWaitDialog(false); - gotoNewLocation(); + gotoNewLocation(replaceURL); }).catch( (e) => { setWaitDialog(false); console.log(e); @@ -473,7 +473,7 @@ function _importProjectFromGithub(e) { btn.off('click').on('click', () => { var githuburl = $("#importGithubURL").val()+""; modal.modal('hide'); - importProjectFromGithub(githuburl); + importProjectFromGithub(githuburl, false); }); } @@ -1648,9 +1648,12 @@ function uninstallErrorHandler() { window.onerror = null; } -function gotoNewLocation() { +function gotoNewLocation(replaceHistory? : boolean) { uninstallErrorHandler(); - window.location.href = "?" + $.param(qs); + if (replaceHistory) + window.location.replace("?" + $.param(qs)); + else + window.location.href = "?" + $.param(qs); } function replaceURLState() { @@ -1815,7 +1818,7 @@ export function startUI(loadplatform : boolean) { installErrorHandler(); // import from github? if (qs['githubURL']) { - importProjectFromGithub(qs['githubURL']); + importProjectFromGithub(qs['githubURL'], true); return; } // lookup repository