use static js

master
michael 2022-11-04 17:55:25 -07:00
parent dcf78bb88d
commit fa1e988344
6 changed files with 31 additions and 35 deletions

View File

@ -1,11 +0,0 @@
function setOnchange() {
let imgPreview = document.getElementById('img-preview');
let imgUpload = document.getElementById('img-upload');
imgUpload.onchange = event => {
const [file] = imgUpload.files;
if (file) {
console.log(file)
imgPreview.src = URL.createObjectURL(file);
}
};
}

View File

@ -0,0 +1,3 @@
function saveCsv(csvString) {
}

9
static/js/img_preview.js Normal file
View File

@ -0,0 +1,9 @@
let imgPreview = document.getElementById('img-preview');
let imgUpload = document.getElementById('img-upload');
imgUpload.onchange = event => {
const [file] = imgUpload.files;
if (file) {
console.log(file)
imgPreview.src = URL.createObjectURL(file);
}
};

View File

@ -2,6 +2,8 @@
<head>
<title>Pyrometry Application</title>
<link rel="stylesheet" href="{{ url_for('static', filename='app.css') }}">
{% block head %}
{% endblock %}
</head>
<body>
<div class="navbar">

View File

@ -1,4 +1,8 @@
{% extends "base.html" %}
{% block head %}
{% endblock %}
{% block content %}
<form action="/ratio_pyro" method="POST" enctype="multipart/form-data">
<h2>Ratio Pyrometry Interface</h2>
@ -58,17 +62,7 @@
<input type="submit" value="Generate Heatmap"/>
</form>
<!-- <script src="/img_preview.js" onload="setOnChange()"></script> -->
<script>
let imgPreview = document.getElementById('img-preview');
let imgUpload = document.getElementById('img-upload');
imgUpload.onchange = event => {
const [file] = imgUpload.files;
if (file) {
console.log(file)
imgPreview.src = URL.createObjectURL(file);
}
};
</script>
<!-- Image Preview -->
<script src="/s/js/img_preview.js"></script>
{% endblock %}

View File

@ -14,26 +14,25 @@
<label for="area_threshold">Area threshold (to remove dust particles) in px</label>
<input type="number" name="area_threshold" value="250"/>
<br>
<br>
<label for="min_display_threshold">Minimum display threshold (in px)</label>
<input type="number" name="min_display_threshold" value="300"/>
<br>
<br>
<label for="min_display_threshold">Page size</label>
<input type="number" name="paper_width" value="8.5"/>
X
<input type="number" name="paper_height" value="11"/> inches
<br>
<br>
<br>
<input type="submit" value="Generate Projected Sizes"/>
</form>
<!-- <script src="/img_preview.js" onload="setOnChange()"></script> -->
<script>
let imgPreview = document.getElementById('img-preview');
let imgUpload = document.getElementById('img-upload');
imgUpload.onchange = event => {
const [file] = imgUpload.files;
if (file) {
console.log(file)
imgPreview.src = URL.createObjectURL(file);
}
};
</script>
<!-- Image Preview -->
<script src="/s/js/img_preview.js"></script>
{% endblock %}