Building layouts complete

This commit is contained in:
2025-06-16 22:41:30 -07:00
parent 379ff877f9
commit 32147aaa4a
4 changed files with 115 additions and 46 deletions

View File

@@ -66,36 +66,37 @@ function clearMoveEndedIndicators(records) {
function load() {
const svg = this.contentDocument.querySelector('svg'),
startLocs = svg.querySelector('.start-locations'),
scriptEl = this.contentDocument.querySelector('script');
startLocs = svg.querySelector('.start-locations')
// , scriptEl = this.contentDocument.querySelector('script')
;
const linkEl = document.createElement('link');
linkEl.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
linkEl.setAttribute('rel', 'stylesheet');
linkEl.setAttribute('href', 'http://localhost:8080/assets/css/map.css');
linkEl.setAttribute('type', 'text/css');
// const linkEl = document.createElement('link');
// linkEl.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
// linkEl.setAttribute('rel', 'stylesheet');
// linkEl.setAttribute('href', 'http://localhost:8080/assets/css/map.css');
// linkEl.setAttribute('type', 'text/css');
linkEl.onload = function (e) {
console.log('map.css loaded');
// linkEl.onload = function (e) {
// console.log('map.css loaded');
if (scriptEl) {
scriptEl.onload = function () {
console.log('map.js loaded');
gameboard.start(svg);
recordSheet.start(startLocs, gameboard.getUnits(), gameboard.unSelect, gameboard.select);
};
scriptEl.setAttribute('href', 'http://localhost:8080/map.js');
}
};
// if (scriptEl) {
// scriptEl.onload = function () {
// console.log('map.js loaded');
svg.prepend(linkEl);
// };
// scriptEl.setAttribute('href', 'http://localhost:8080/map.js');
// }
// };
// svg.prepend(linkEl);
this.style.opacity = 1;
mapPlaceholder.style.opacity = 0;
URL.revokeObjectURL(this.data);
panzoom.start(svg);
recordSheet.clear();
gameboard.start(svg);
recordSheet.start(startLocs, gameboard.getUnits(), gameboard.unSelect, gameboard.select);
}
document.querySelectorAll('.end-turn').forEach(el =>
@@ -173,7 +174,7 @@ document.querySelector('#download-save').addEventListener('click', e => {
element.setAttribute('download', 'save.svg');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(data));
element.style.display = 'none';
// element.style.display = 'none';
// document.body.appendChild(element);
element.click();