|
@@ -22,21 +22,22 @@
|
|
function imgPrev() {
|
|
function imgPrev() {
|
|
var work = Number.parseInt(dialog.dataset.work);
|
|
var work = Number.parseInt(dialog.dataset.work);
|
|
var variant = Number.parseInt(dialog.dataset.variant) - 1;
|
|
var variant = Number.parseInt(dialog.dataset.variant) - 1;
|
|
- if (variant < 0) {
|
|
|
|
- work -= 1;
|
|
|
|
- if (work < 0) {
|
|
|
|
- work = figures.length - 1;
|
|
|
|
|
|
+ while (variant == -1) {
|
|
|
|
+ if (variant < 0) {
|
|
|
|
+ work -= 1;
|
|
|
|
+ if (work < 0) {
|
|
|
|
+ work = figures.length - 1;
|
|
|
|
+ }
|
|
|
|
+ const datalist = figures[work].lastElementChild;
|
|
|
|
+ variant = datalist.children.length - 1;
|
|
}
|
|
}
|
|
- const datalist = figures[work].lastElementChild;
|
|
|
|
- variant = datalist.children.length - 1;
|
|
|
|
}
|
|
}
|
|
updateImage(work, variant);
|
|
updateImage(work, variant);
|
|
};
|
|
};
|
|
function imgNext() {
|
|
function imgNext() {
|
|
var work = Number.parseInt(dialog.dataset.work);
|
|
var work = Number.parseInt(dialog.dataset.work);
|
|
var variant = Number.parseInt(dialog.dataset.variant) + 1;
|
|
var variant = Number.parseInt(dialog.dataset.variant) + 1;
|
|
- const datalist = figures[work].lastElementChild;
|
|
|
|
- if (variant >= datalist.children.length) {
|
|
|
|
|
|
+ while (variant >= figures[work].lastElementChild.children.length) {
|
|
work += 1;
|
|
work += 1;
|
|
if (work >= figures.length) {
|
|
if (work >= figures.length) {
|
|
work = 0;
|
|
work = 0;
|