Skip to content

Commit

Permalink
Fix regression for previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
NozomiIto committed Mar 17, 2015
1 parent 99525c8 commit 2a5e092
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions src/main/resources/js/report/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,35 @@ function selectTr(trObject) {
};

/**
* change current slide index to the index for the selected tr.
* - do nothing if slider is not loaded yet
* @returns {number} -1 if no tr is selected
*/
function syncSlideIndexToSelectedTr() {
function getSlideIndexForSelectedTr() {
var selected = getSelectedTr();
if (selected.length == 0) {
return;
return -1;
}
var ttId = getTrTtId(selected);
var slideIndex = getTtIdSlideIndex(ttId);
if (slideIndex != -1) {
return slideIndex;
}

slideIndex = getTtIdSlideIndex('noImage');
if (slideIndex != -1) {
return slideIndex;
}

throw new Error("noImage slide not found");
};

/**
* change current slide index to the index for the selected tr.
* - do nothing if slider is not loaded yet
*/
function syncSlideIndexToSelectedTr() {
var slideIndex = getSlideIndexForSelectedTr();
if (slideIndex == -1) {
slideIndex = getTtIdSlideIndex('noImage');
if (slideIndex == -1) {
throw new Error("noImage slide not found");
}
return;
}
if (slider != null) {
slider.goToSlide(slideIndex);
Expand Down Expand Up @@ -555,20 +569,24 @@ $(document).ready(function() {
selectTr(firstTrObj);

hideSrcInfo();
selectTrSlideAndRefresh(false);

var slideIndex = getSlideIndexForSelectedTr();
if (slideIndex == -1) {
slideIndex = 0;
}
slider = $(".bxslider").bxSlider({
speed: 1,
infiniteLoop: false,
hideControlOnEnd: true,
pager: false,
controls: false
controls: false,
startSlide: slideIndex
});

$(".scrollContainer").perfectScrollbar({
useKeyboard: false,
suppressScrollX: true
});
slideScrollBarSet = true;

selectTrSlideAndRefresh(false);
});

0 comments on commit 2a5e092

Please sign in to comment.