Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@
}
});

newBlueprintString(START_EXAMPLE_BLUEPRINT);
const paramsString = window.location.search;
const searchParams = new URLSearchParams(paramsString);
newBlueprintString(searchParams.get("bp") ?? START_EXAMPLE_BLUEPRINT);
showBlueprint();

// Add click handler for random color palette button
Expand Down
38 changes: 38 additions & 0 deletions view.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="Online tool to artfully visualize Factorio Blueprints.">
<title>Factorio Blueprint Visualizer</title>
<link rel='shortcut icon' type='image/x-icon' href='website/favicon.ico'/>
<link rel="stylesheet" href="website/index.css">
<script defer data-domain="piebro.github.io/factorio-blueprint-visualizer" src="https://plausible.io/js/plausible.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js"></script>
<!-- for deflating the blueprint string -->
<script src="website/startExampleBlueprintString.js"></script>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this and expect that bp is set, otherwise maybe show a small text that no blueprint is set

<script src="website/entityProperties.js"></script>
<script src="website/drawingSettings.js"></script>
<script src="website/blueprintVisualizer.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/theme/monokai.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/mode/javascript/javascript.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/addon/lint/lint.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/addon/lint/lint.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/addon/lint/json-lint.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsonlint/1.6.0/jsonlint.min.js"></script>
Comment on lines +16 to +23
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not needed here

</head>
<body>
<div class="svg-container" id="svg-container"></div>
<script>
window.addEventListener("load", () => {
const paramsString = window.location.search;
const searchParams = new URLSearchParams(paramsString);
const blueprintString = searchParams.get("bp") ?? START_EXAMPLE_BLUEPRINT;
const [_, currentBlueprintJsons] = getBlueprintList(blueprintString);
const currentBlueprint = processBlueprint(currentBlueprintJsons[0])
document.getElementById("svg-container").innerHTML = drawBlueprint(currentBlueprint, EXAMPLE_SETTINGS, svgWidthInMm = 300)
})
</script>
</body>
</html>