github: import replaces URL history

This commit is contained in:
Steven Hugg 2019-05-22 17:03:56 -04:00
parent b190cb7cfd
commit aa8ececcea
2 changed files with 11 additions and 11 deletions

View File

@ -125,11 +125,11 @@ TODO:
- can't add control instructions b/c of split - can't add control instructions b/c of split
- single-stepping vector games makes screen fade - single-stepping vector games makes screen fade
- break on stack overflow, bad op, bad access, etc - break on stack overflow, bad op, bad access, etc
- PPU/TIA register write visualization
- nes - nes
- replay doesn't work for nes (force background tile redraw) - replay doesn't work for nes (force background tile redraw)
- nes debug view toolbar - nes debug view toolbar
- support NES_HEADER_16K? - support NES_HEADER_16K?
- PPU/TIA register write visualization
- vcs - vcs
- vcs sound continues when paused - vcs sound continues when paused
- vcs: INPTx needs to be added to control state - vcs: INPTx needs to be added to control state
@ -141,11 +141,9 @@ TODO:
- target ES6 - target ES6
- don't have to include bootstrap-tourist each time? - don't have to include bootstrap-tourist each time?
- don't have to include firebase always? - don't have to include firebase always?
- build ca65 projects w/ no crt0? https://github.com/pinobatch/thwaite-nes/blob/master/makefile
- Github - Github
- gh-pages branch with embedded - gh-pages branch with embedded
- handle overwrite logic - handle overwrite logic
- test edge/failure cases
- what to do about included files? - what to do about included files?
- can published files retain path? - can published files retain path?
- what if import interrupted and partial files? - what if import interrupted and partial files?
@ -154,7 +152,6 @@ TODO:
- support projects with subdirectories, file list? - support projects with subdirectories, file list?
- emulator needs reset shortcut for nes - emulator needs reset shortcut for nes
- switching platform of a repo? - switching platform of a repo?
- what to load if no main file?
WEB WORKER FORMAT WEB WORKER FORMAT

View File

@ -420,7 +420,7 @@ function getBoundGithubURL() : string {
return 'https://github.com/' + toks[0] + '/' + toks[1]; return 'https://github.com/' + toks[0] + '/' + toks[1];
} }
function importProjectFromGithub(githuburl:string) { function importProjectFromGithub(githuburl:string, replaceURL:boolean) {
var sess : GHSession; var sess : GHSession;
var urlparse = parseGithubURL(githuburl); var urlparse = parseGithubURL(githuburl);
if (!urlparse) { if (!urlparse) {
@ -429,7 +429,7 @@ function importProjectFromGithub(githuburl:string) {
} }
// redirect to repo if exists // redirect to repo if exists
var existing = getRepos()[urlparse.repopath]; 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; return;
} }
// create new store for imported repository // create new store for imported repository
@ -446,7 +446,7 @@ function importProjectFromGithub(githuburl:string) {
// reload repo // reload repo
qs = {repo:sess.repopath}; // file:sess.mainPath, platform:sess.platform_id}; qs = {repo:sess.repopath}; // file:sess.mainPath, platform:sess.platform_id};
setWaitDialog(false); setWaitDialog(false);
gotoNewLocation(); gotoNewLocation(replaceURL);
}).catch( (e) => { }).catch( (e) => {
setWaitDialog(false); setWaitDialog(false);
console.log(e); console.log(e);
@ -473,7 +473,7 @@ function _importProjectFromGithub(e) {
btn.off('click').on('click', () => { btn.off('click').on('click', () => {
var githuburl = $("#importGithubURL").val()+""; var githuburl = $("#importGithubURL").val()+"";
modal.modal('hide'); modal.modal('hide');
importProjectFromGithub(githuburl); importProjectFromGithub(githuburl, false);
}); });
} }
@ -1648,9 +1648,12 @@ function uninstallErrorHandler() {
window.onerror = null; window.onerror = null;
} }
function gotoNewLocation() { function gotoNewLocation(replaceHistory? : boolean) {
uninstallErrorHandler(); uninstallErrorHandler();
window.location.href = "?" + $.param(qs); if (replaceHistory)
window.location.replace("?" + $.param(qs));
else
window.location.href = "?" + $.param(qs);
} }
function replaceURLState() { function replaceURLState() {
@ -1815,7 +1818,7 @@ export function startUI(loadplatform : boolean) {
installErrorHandler(); installErrorHandler();
// import from github? // import from github?
if (qs['githubURL']) { if (qs['githubURL']) {
importProjectFromGithub(qs['githubURL']); importProjectFromGithub(qs['githubURL'], true);
return; return;
} }
// lookup repository // lookup repository