} | } | ||||
function HANDLE_NewProject(){ | |||||
GlobalEvents.emit("modal-close"); | |||||
CTRLNameTablesStore.clear(); | |||||
CTRLBanksStore.clear(); | |||||
CTRLPalettesStore.clear(); | |||||
CTRLPalettesStore.createPalette("Palette 1"); | |||||
CTRLBanksStore.createBank("Bank 1"); | |||||
} | |||||
function HANDLE_SaveProject(e){ | function HANDLE_SaveProject(e){ | ||||
//var a = document.createElement("a"); | //var a = document.createElement("a"); | ||||
var file = new Blob([JSONFromProject()], {type: "text/plain"}); | var file = new Blob([JSONFromProject()], {type: "text/plain"}); | ||||
GlobalEvents.listen("load-project", HANDLE_LoadProjectRequest); | GlobalEvents.listen("load-project", HANDLE_LoadProjectRequest); | ||||
GlobalEvents.listen("export-pal-asm", HANDLE_ExportPalASM); | GlobalEvents.listen("export-pal-asm", HANDLE_ExportPalASM); | ||||
GlobalEvents.listen("export-nametable", HANDLE_ExportNameTableASM); | GlobalEvents.listen("export-nametable", HANDLE_ExportNameTableASM); | ||||
GlobalEvents.listen("new-project", HANDLE_NewProject); | |||||
var input = document.querySelectorAll("input.project-loader"); | var input = document.querySelectorAll("input.project-loader"); | ||||
if (input.length > 0){ | if (input.length > 0){ |
<form> | <form> | ||||
<input type="file" class="project-loader" accept="text/plain" style="display:none;"></input> | <input type="file" class="project-loader" accept="text/plain" style="display:none;"></input> | ||||
</form> | </form> | ||||
<li class="pure-menu-item" emit="modal-open" emit-args='{"cls":".new-project-modal"}'> | |||||
<a href="#" class="pure-menu-link"> | |||||
<i class="fa fa-file-alt"></i> | |||||
New Project | |||||
</a> | |||||
</li> | |||||
<li class="pure-menu-item" emit="load-project"> | <li class="pure-menu-item" emit="load-project"> | ||||
<a href="#" class="pure-menu-link"> | <a href="#" class="pure-menu-link"> | ||||
<i class="fa fa-folder-open"></i> | <i class="fa fa-folder-open"></i> |
<%- include("modals/export_CHR.html"); %> | <%- include("modals/export_CHR.html"); %> | ||||
<%- include("modals/export_NT.html"); %> | <%- include("modals/export_NT.html"); %> | ||||
<%- include("modals/new_project.html"); %> |
<div class="modal new-project-modal"> | |||||
<div class="modal-content"> | |||||
Clicking <b>"Yes"</b> will destroy all work in the current project.<br> | |||||
If this is <i>not</i> what you, click <b>"No"</b><br><br> | |||||
Start a new project? | |||||
<form class="pure-form new-project-form"> | |||||
<button type="submit" class="pure-button" emit="new-project">Yes</button> | |||||
<button type="submit" class="pure-button" emit="modal-close">No</button> | |||||
</form> | |||||
</div> | |||||
</div> |