';
scoreboard.find('.bb-gameInningScoreBody').append(src);
scoreboard.find('.bb-gameScoreTable--scoreboard tr').each(function() {
$(this).children().slice(1).each(function(i) {
let _this = $(this);
i++;
if (_this.hasClass('bb-gameScoreTable__data--now')){
inn_current = i;
}
if (!_this.is('.bb-gameScoreTable__total'))_this.addClass('js-inningNo--' + i);
});
});
scoreboard.find('.bb-gameScoreTable--scoreboard tr').each(function() {
$(this).children().slice(1).each(function(i) {
let _this = $(this);
i++;
if (inn_current === 0 || inn_current > inn_column - inn_max - 1){
if (i > inn_column - inn_max - 1) {
_this.show()
} else {
_this.hide()
}
} else {
if (_this.hasClass('bb-gameScoreTable__total')){
_this.show()
} else if (i >= inn_current && i < inn_current + inn_max - 3) {
_this.show()
} else {
_this.hide()
}
}
});
});
let last_inning = $('.bb-gameScoreTable--scoreboard thead th.bb-gameScoreTable__total')[0].previousElementSibling;
if (last_inning.style.display === 'none') {
scoreboard.find('.bb-paging__item--next button').prop('disabled', false);
}
if (inn_current === 1) {
scoreboard.find('.bb-paging__item--prev button').prop('disabled', true);
}
};
if (inn_max + 1 < scoreboard.find('.bb-gameScoreTable--scoreboard thead th').length) {
scoreBoard_paging();
}
let scoreBoard_paging_button = function(toggle) {
let hideNo,
showNo;
switch (toggle) {
case 'next':
hideNo = scoreboard.find('thead th:visible').eq(1).attr('class');
showNo = scoreboard.find('thead th[class^=\"js-inningNo\"]:visible:last').next().attr('class');
scoreboard.find('.' + hideNo).hide();
scoreboard.find('.' + showNo).show();
if (!scoreboard.find('.' + showNo + ' + th[class^=\"js-inningNo\"]').length) {
scoreboard.find('.bb-paging__item--next button').prop('disabled', true);
}
if (!scoreboard.find('.' + hideNo).prev('th:hidden').length) {
scoreboard.find('.bb-paging__item--prev button').prop('disabled', false);
}
break;
default:
hideNo = scoreboard.find('thead th[class^=\"js-inningNo\"]:visible:last').attr('class');
showNo = scoreboard.find('thead th:gt(0):visible:first').prev().attr('class');
scoreboard.find('.' + hideNo).hide();
scoreboard.find('.' + showNo).show();
if (!scoreboard.find('.' + showNo).prev('th:hidden').length) {
scoreboard.find('.bb-paging__item--prev button').prop('disabled', true);
}
if (!scoreboard.find('.' + hideNo + ' + th[class^=\"js-inningNo\"]:visible:last').next().length) {
scoreboard.find('.bb-paging__item--next button').prop('disabled', false);
}
}
}
if (('.bb-gameInningScore .bb-paging--scoreboard').length) {
scoreboard.on(
'click','.bb-paging--scoreboard button',
function(event) {
let toggle = $(this).parent().attr('class').split('bb-paging__item bb-paging__item--')[1];
scoreBoard_paging_button(toggle);
}
);
}
}
refleshInning();
// åºå ´æ績ãã¼ã¸ã®ã¤ãã³ã°ãã¼ãã®å次ãã¿ã³ã®æå
let blowResultsTable_paging = function(){
let src_prev = "
";
let src_prev_off = "
";
let src_next = "
";
let src_next_off = "
";
$(".bb-modBlowResultsTable .bb-blowResultsTable").each(function(i){
$(this).attr("id","js-scoreBord--"+i);
});
if (12 < $("#js-scoreBord--1 .bb-teamScoreTable__data--inningScore").length) {
let src ="
";
$("#js-scoreBord--0").prepend(src);
} else {
return;
}
$(".bb-statsTable tr").not(".bb-statsTable tr.sn-table__itemTr--total").each(function(){
$(this).children(":gt(13)").each(function(i){
i = i + 1;
$(this).addClass("js-inningNo--"+i);
if ($(this).is(":nth-last-child(-n + 12)")) {
$(this).show();
} else {
$(this).hide();
}
});
});
$(".bb-table--resultScoreBoard tr").each(function(){
$(this).children(":gt(1)").each(function(i){
i = i + 1;
$(this).addClass("js-inningNo--"+i);
if ($(this).is(":nth-last-child(-n + 12)")){
$(this).show();
} else {
$(this).hide();
}
});
});
$(document).on("click",".bb-modBlowResultsTable .bb-paging--scoreboard .bb-paging__item--next button", function(event) {
let hideNo = $("#js-scoreBord--0 thead th:visible").eq(14).attr("class");
let hideNo_array = hideNo.split(" ");
let showNo = $("#js-scoreBord--0 thead .bb-statsTable__head--inning:visible:last").next().attr("class");
let showNo_array = showNo.split(" ");
$(".bb-modBlowResultsTable ." + showNo_array[2]).show();
$(".bb-modBlowResultsTable ." + hideNo_array[2]).hide();
if (!$("#js-scoreBord--0 ." + showNo_array[2] +" + th").length) {
$(".bb-modBlowResultsTable .bb-paging__item--next ").remove();
$(".bb-modBlowResultsTable .bb-paging ul").append(src_next_off);
}
if (!$("#js-scoreBord--0 ." + hideNo_array[2]).prev("th:hidden").length) {
$(".bb-modBlowResultsTable .bb-paging__item--prev").remove();
$(".bb-modBlowResultsTable .bb-paging ul").prepend(src_prev);
}
});
$(document).on("click",".bb-modBlowResultsTable .bb-paging--scoreboard .bb-paging__item--prev button", function(event) {
let hideNo = $("#js-scoreBord--0 thead .js-inningNo--12 ~ th:visible:last").attr("class");
let hideNo_array = hideNo.split(" ");
let showNo = $("#js-scoreBord--0 thead .bb-statsTable__head--inning:visible:first").prev().attr("class");
let showNo_array = showNo.split(" ");
$(".bb-modBlowResultsTable ." + showNo_array[2]).show();
$(".bb-modBlowResultsTable ." + hideNo_array[2]).hide();
if (!$("#js-scoreBord--0 ." + showNo_array[2]).prev("th:hidden").length) {
$(".bb-modBlowResultsTable .bb-paging__item--prev").remove();
$(".bb-modBlowResultsTable .bb-paging ul").prepend(src_prev_off);
}
if (!$("#js-scoreBord--0 ." + hideNo_array[2] + " + th").length) {
$(".bb-modBlowResultsTable .bb-paging__item--next").remove();
$(".bb-modBlowResultsTable .bb-paging ul").append(src_next);
}
});
};
$(function() {
if ($(".bb-modBlowResultsTable").length){
blowResultsTable_paging();
}
});