Merge pull request #1261 from brendandahl/fixstepper

Fix stepper beyond page 1.
This commit is contained in:
notmasteryet 2012-02-21 16:37:28 -08:00
commit d10a83744d

View File

@ -190,6 +190,11 @@ var StepperManager = (function StepperManagerClosure() {
else else
stepper.panel.setAttribute('hidden', true); stepper.panel.setAttribute('hidden', true);
} }
var options = stepperChooser.options;
for (var i = 0; i < options.length; ++i) {
var option = options[i];
option.selected = option.value == pageNumber;
}
}, },
saveBreakPoints: function saveBreakPoints(pageNumber, bps) { saveBreakPoints: function saveBreakPoints(pageNumber, bps) {
breakPoints[pageNumber] = bps; breakPoints[pageNumber] = bps;
@ -234,7 +239,7 @@ var Stepper = (function StepperClosure() {
for (var i = 0; i < IRQueue.fnArray.length; i++) { for (var i = 0; i < IRQueue.fnArray.length; i++) {
var line = c('tr'); var line = c('tr');
line.className = 'line'; line.className = 'line';
line.id = 'idx' + i; line.dataset.idx = i;
table.appendChild(line); table.appendChild(line);
var checked = this.breakPoints.indexOf(i) != -1; var checked = this.breakPoints.indexOf(i) != -1;
var args = IRQueue.argsArray[i] ? IRQueue.argsArray[i] : []; var args = IRQueue.argsArray[i] ? IRQueue.argsArray[i] : [];
@ -299,13 +304,14 @@ var Stepper = (function StepperClosure() {
}, },
goTo: function goTo(idx) { goTo: function goTo(idx) {
var allRows = this.panel.getElementsByClassName('line'); var allRows = this.panel.getElementsByClassName('line');
for (var x = 0; x < allRows.length; x++) { for (var x = 0, xx = allRows.length; x < xx; ++x) {
allRows[x].style.backgroundColor = null; var row = allRows[x];
} if (row.dataset.idx == idx) {
var row = document.getElementById('idx' + idx);
if (row) {
row.style.backgroundColor = 'rgb(251,250,207)'; row.style.backgroundColor = 'rgb(251,250,207)';
row.scrollIntoView(); row.scrollIntoView();
} else {
row.style.backgroundColor = null;
}
} }
} }
}; };