mirror of
https://github.com/chrislgarry/Apollo-11.git
synced 2025-02-19 02:10:28 +00:00
feat: add first/last buttons
This commit is contained in:
parent
74aba54707
commit
4f51f408a1
1 changed files with 28 additions and 10 deletions
38
index.html
38
index.html
|
@ -7,32 +7,48 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||||
<script>
|
<script>
|
||||||
|
const COMANCHE055 = "Comanche055";
|
||||||
|
const LUMINARY099 = "Luminary099";
|
||||||
const COMANCHE055_PAGES = 1751;
|
const COMANCHE055_PAGES = 1751;
|
||||||
const LUMINARY099_PAGES = 1743;
|
const LUMINARY099_PAGES = 1743;
|
||||||
|
|
||||||
function changeDir() {
|
function changeDir() {
|
||||||
showPage();
|
showPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showFirst() {
|
||||||
|
changePage(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function showLast() {
|
||||||
|
const directory = document.form.directory.value;
|
||||||
|
if (directory === COMANCHE055) changePage(COMANCHE055_PAGES);
|
||||||
|
else if (directory === LUMINARY099) changePage(LUMINARY099_PAGES);
|
||||||
|
}
|
||||||
|
|
||||||
function showPrevious() {
|
function showPrevious() {
|
||||||
const newpage = parseInt(document.form.pagenum.value) - 1;
|
const newpage = parseInt(document.form.pagenum.value) - 1;
|
||||||
if (newpage >= 1) {
|
if (newpage >= 1) {
|
||||||
changePage(newpage);
|
changePage(newpage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showNext() {
|
function showNext() {
|
||||||
const newpage = parseInt(document.form.pagenum.value) + 1;
|
const newpage = parseInt(document.form.pagenum.value) + 1;
|
||||||
const directory = document.form.directory.value;
|
const directory = document.form.directory.value;
|
||||||
if (
|
if (
|
||||||
(directory === "Comanche055" && newpage <= COMANCHE055_PAGES) ||
|
(directory === COMANCHE055 && newpage <= COMANCHE055_PAGES) ||
|
||||||
(directory === "Luminary099" && newpage <= LUMINARY099_PAGES)
|
(directory === LUMINARY099 && newpage <= LUMINARY099_PAGES)
|
||||||
) {
|
) {
|
||||||
changePage(newpage);
|
changePage(newpage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function changePage(page) {
|
function changePage(page) {
|
||||||
document.form.pagenum.value = parseInt(page);
|
document.form.pagenum.value = parseInt(page);
|
||||||
showPage();
|
showPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
function showPage() {
|
function showPage() {
|
||||||
let page = parseInt(document.form.pagenum.value);
|
let page = parseInt(document.form.pagenum.value);
|
||||||
const directory = document.form.directory.value;
|
const directory = document.form.directory.value;
|
||||||
|
@ -40,17 +56,16 @@
|
||||||
if (page < 1) {
|
if (page < 1) {
|
||||||
document.form.pagenum.value = 1;
|
document.form.pagenum.value = 1;
|
||||||
page = 1;
|
page = 1;
|
||||||
} else if (directory === "Comanche055" && page > COMANCHE055_PAGES) {
|
} else if (directory === COMANCHE055 && page > COMANCHE055_PAGES) {
|
||||||
document.form.pagenum.value = COMANCHE055_PAGES;
|
document.form.pagenum.value = COMANCHE055_PAGES;
|
||||||
page = COMANCHE055_PAGES;
|
page = COMANCHE055_PAGES;
|
||||||
} else if (directory === "Luminary099" && page > LUMINARY099_PAGES) {
|
} else if (directory === LUMINARY099 && page > LUMINARY099_PAGES) {
|
||||||
document.form.pagenum.value = LUMINARY099_PAGES;
|
document.form.pagenum.value = LUMINARY099_PAGES;
|
||||||
page = LUMINARY099_PAGES;
|
page = LUMINARY099_PAGES;
|
||||||
}
|
}
|
||||||
|
|
||||||
formattedPage = page.toString().padStart(4, "0");
|
const formattedPage = page.toString().padStart(4, "0");
|
||||||
|
const imageURL = `https://www.ibiblio.org/apollo/ScansForConversion/${directory}/${formattedPage}.jpg`;
|
||||||
imageURL = `https://www.ibiblio.org/apollo/ScansForConversion/${directory}/${formattedPage}.jpg`;
|
|
||||||
document.image.src = imageURL;
|
document.image.src = imageURL;
|
||||||
document.body.style.cursor = "progress";
|
document.body.style.cursor = "progress";
|
||||||
}
|
}
|
||||||
|
@ -82,7 +97,8 @@
|
||||||
<option>Comanche055</option>
|
<option>Comanche055</option>
|
||||||
<option>Luminary099</option>
|
<option>Luminary099</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="button" onClick="showPrevious()" value="Previous Page" />
|
<input type="button" onClick="showFirst()" value="First" />
|
||||||
|
<input type="button" onClick="showPrevious()" value="Previous" />
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="pagenum"
|
name="pagenum"
|
||||||
|
@ -91,10 +107,12 @@
|
||||||
maxlength="4"
|
maxlength="4"
|
||||||
value="1"
|
value="1"
|
||||||
/>
|
/>
|
||||||
<input type="button" onClick="showNext()" value="Next Page" />
|
<input type="button" onClick="showNext()" value="Next" />
|
||||||
|
<input type="button" onClick="showLast()" value="Last" />
|
||||||
<span>
|
<span>
|
||||||
Images hosted by
|
Images hosted by
|
||||||
<a href="https://www.ibiblio.org/apollo">Ibiblio</a> and the Virtual AGC project
|
<a href="https://www.ibiblio.org/apollo">Ibiblio</a>
|
||||||
|
and the Virtual AGC project
|
||||||
</span>
|
</span>
|
||||||
</form>
|
</form>
|
||||||
<img
|
<img
|
||||||
|
|
Loading…
Add table
Reference in a new issue