diff options
Diffstat (limited to 'www/photo.causal.agency/trips.html')
-rw-r--r-- | www/photo.causal.agency/trips.html | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/www/photo.causal.agency/trips.html b/www/photo.causal.agency/trips.html index 21c308da..d65aeaef 100644 --- a/www/photo.causal.agency/trips.html +++ b/www/photo.causal.agency/trips.html @@ -32,14 +32,28 @@ input[type="number"] { width: 5ch; } </select> <label for="roll-film">Film:</label> <input id="roll-film" list="films" required> +<span>Exposures:</span> +<span> +<input id="roll-36" type="radio" name="roll-exposures" value="36" checked> +<label for="roll-36">36</label> +<input id="roll-27" type="radio" name="roll-exposures" value="27"> +<label for="roll-27">27</label> +<input id="roll-24" type="radio" name="roll-exposures" value="24"> +<label for="roll-24">24</label> +<input id="roll-12" type="radio" name="roll-exposures" value="12"> +<label for="roll-12">12</label> +</span> <button type="button" onclick="loadRoll()">Load</button> </form> <datalist id="films"> + <option>Ferrania P30 80</option> + <option>Flic Film Elektra 100</option> + <option>Ilford FP4 Plus 125</option> + <option>Fomapan Creative 200</option> <option>Harman Phoenix 200</option> - <option>Ilford HP5 Plus 400</option> <option>Shanghai Color 400</option> - <option>Fomapan Action 400</option> + <option>Reflx Lab 800T</option> </datalist> </section> @@ -200,18 +214,27 @@ function setTrips() { let rollTrips = tripsByRoll[rollId]; if (!rollTrips) continue; let rollLi = document.createElement("li"); - rollLi.appendChild(document.createTextNode(` - ${rollTrips[0].film} (${rollTrips[0].body}) - `)); + let rollB = document.createElement("b"); + rollB.appendChild(document.createTextNode(rollTrips[0].film)); + rollLi.appendChild(rollB); + rollLi.appendChild(document.createTextNode(` (${rollTrips[0].body})`)); + let body = bodies.find(body => body.name == rollTrips[0].body); let rollUl = document.createElement("ul"); - for (let trip of rollTrips) { + for (let [index, trip] of rollTrips.entries()) { let li = document.createElement("li"); - li.appendChild(document.createTextNode(` - ${trip.date}: - ${trip.firstExposure}–${trip.lastExposure} - `)); - li.appendChild(document.createElement("br")); - li.appendChild(document.createTextNode(trip.lens)); + let b = document.createElement("b"); + b.appendChild(document.createTextNode(trip.date)); + li.appendChild(b); + li.appendChild(document.createTextNode( + `: ${trip.firstExposure}–${trip.lastExposure}` + )); + if ( + body.mount != body.name && + (!index || trip.lens != rollTrips[index-1].lens) + ) { + li.appendChild(document.createElement("br")); + li.appendChild(document.createTextNode(trip.lens)); + } if (trip.note) { li.appendChild(document.createElement("br")); li.appendChild(document.createTextNode(`“${trip.note}”`)); @@ -234,6 +257,10 @@ function setTripBody() { option.appendChild(document.createTextNode(lensString(lens))); select.appendChild(option); } + let lastTrip = trips.findLast(trip => trip.body == bodyName); + if (lastTrip) { + select.value = lastTrip.lens; + } let roll = rolls[body.name]; if (roll) { document.getElementById("trip-film").value = roll.film; @@ -251,6 +278,7 @@ setTripBody(); function clearForm(form) { let inputs = form.querySelectorAll("input"); for (input of inputs) { + if (input.type == "radio") continue; input.value = null; } } @@ -303,7 +331,8 @@ function loadRoll() { if (!form.checkValidity()) return; let body = document.getElementById("roll-body").value; let film = document.getElementById("roll-film").value; - rolls[body] = { id: nextId++, film, used: 0, exposures: 36 }; + let exposures = +new FormData(form).get("roll-exposures"); + rolls[body] = { id: nextId++, film, exposures, used: 0 }; localStorage.setItem("nextId", nextId); setRolls(); clearForm(form); |