shuffle_list.TXT 9.79 KB
function shuffle(x){
    if(x.name === "kia"){
        for(j = 0; j < kia_hitter_shuffle.length; j++){
            if(kia_hitter_shuffle.length == 0){
                continue;
            }
            else if(x.value == kia_hitter_shuffle[j][0]){
                console.log(x.value == kia_hitter_shuffle[j][0])
                return 0;
            }
        }
        for(i = 0; i < kia_hitter.length; i++){
            if(x.value == kia_hitter[i][0]){
                kia_hitter_shuffle.push(kia_hitter[i]);
            }
        }
    }
    console.log(kia_hitter_shuffle);
    ////////////////////////////////////////////////////////////////
    if(x.name === "dusan"){
        for(j = 0; j < dusan_hitter_shuffle.length; j++){
            if(dusan_hitter_shuffle.length == 0){
                continue;
            }
            else if(x.value == dusan_hitter_shuffle[j][0]){
                console.log(x.value == dusan_hitter_shuffle[j][0])
                return 0;
            }
        }
        for(i = 0; i < dusan_hitter.length; i++){
            if(x.value == dusan_hitter[i][0]){
                dusan_hitter_shuffle.push(dusan_hitter[i]);
            }
        }
    }
    console.log(dusan_hitter_shuffle);
    //나머지 팀들 똑같이 추가
    if(x.name === "hanhwa"){
        for(j = 0; j < hanhwa_hitter_shuffle.length; j++){
            if(hanhwa_hitter_shuffle.length == 0){
                continue;
            }
            else if(x.value == hanhwa_hitter_shuffle[j][0]){
                console.log(x.value == hanhwa_hitter_shuffle[j][0])
                return 0;
            }
        }
        for(i = 0; i < hanhwa_hitter.length; i++){
            if(x.value == hanhwa_hitter[i][0]){
                hanhwa_hitter_shuffle.push(hanhwa_hitter[i]);
            }
        }
    }
    console.log(hanhwa_hitter_shuffle);

    if(x.name === "kiwoom"){
        for(j = 0; j < kiwoom_hitter_shuffle.length; j++){
            if(kiwoom_hitter_shuffle.length == 0){
                continue;
            }
            else if(x.value == kiwoom_hitter_shuffle[j][0]){
                console.log(x.value == kiwoom_hitter_shuffle[j][0])
                return 0;
            }
        }
        for(i = 0; i < kiwoom_hitter.length; i++){
            if(x.value == kiwoom_hitter[i][0]){
                kiwoom_hitter_shuffle.push(kiwoom_hitter[i]);
            }
        }
    }
    console.log(kiwoom_hitter_shuffle);

    if(x.name === "kt"){
        for(j = 0; j < kt_hitter_shuffle.length; j++){
            if(kt_hitter_shuffle.length == 0){
                continue;
            }
            else if(x.value == kt_hitter_shuffle[j][0]){
                console.log(x.value == kt_hitter_shuffle[j][0])
                return 0;
            }
        }
        for(i = 0; i < kt_hitter.length; i++){
            if(x.value == kt_hitter[i][0]){
                kt_hitter_shuffle.push(kt_hitter[i]);
            }
        }
    }
    console.log(kt_hitter_shuffle);

    if(x.name === "lg"){
        for(j = 0; j < lg_hitter_shuffle.length; j++){
            if(lg_hitter_shuffle.length == 0){
                continue;
            }
            else if(x.value == lg_hitter_shuffle[j][0]){
                console.log(x.value == lg_hitter_shuffle[j][0])
                return 0;
            }
        }
        for(i = 0; i < lg_hitter.length; i++){
            if(x.value == lg_hitter[i][0]){
                lg_hitter_shuffle.push(lg_hitter[i]);
            }
        }
    }
    console.log(lg_hitter_shuffle);

    if(x.name === "lotte"){
        for(j = 0; j < lotte_hitter_shuffle.length; j++){
            if(lotte_hitter_shuffle.length == 0){
                continue;
            }
            else if(x.value == lotte_hitter_shuffle[j][0]){
                console.log(x.value == lotte_hitter_shuffle[j][0])
                return 0;
            }
        }
        for(i = 0; i < lotte_hitter.length; i++){
            if(x.value == lotte_hitter[i][0]){
                lotte_hitter_shuffle.push(lotte_hitter[i]);
            }
        }
    }
    console.log(lotte_hitter_shuffle);

    if(x.name === "nc"){
        for(j = 0; j < nc_hitter_shuffle.length; j++){
            if(nc_hitter_shuffle.length == 0){
                continue;
            }
            else if(x.value == nc_hitter_shuffle[j][0]){
                console.log(x.value == nc_hitter_shuffle[j][0])
                return 0;
            }
        }
        for(i = 0; i < nc_hitter.length; i++){
            if(x.value == nc_hitter[i][0]){
                nc_hitter_shuffle.push(nc_hitter[i]);
            }
        }
    }
    console.log(nc_hitter_shuffle);

    if(x.name === "samsung"){
        for(j = 0; j < samsung_hitter_shuffle.length; j++){
            if(samsung_hitter_shuffle.length == 0){
                continue;
            }
            else if(x.value == samsung_hitter_shuffle[j][0]){
                console.log(x.value == samsung_hitter_shuffle[j][0])
                return 0;
            }
        }
        for(i = 0; i < samsung_hitter.length; i++){
            if(x.value == samsung_hitter[i][0]){
                samsung_hitter_shuffle.push(samsung_hitter[i]);
            }
        }
    }
    console.log(samsung_hitter_shuffle);

    if(x.name === "ssg"){
        for(j = 0; j < ssg_hitter_shuffle.length; j++){
            if(ssg_hitter_shuffle.length == 0){
                continue;
            }
            else if(x.value == ssg_hitter_shuffle[j][0]){
                console.log(x.value == ssg_hitter_shuffle[j][0])
                return 0;
            }
        }
        for(i = 0; i < ssg_hitter.length; i++){
            if(x.value == ssg_hitter[i][0]){
                ssg_hitter_shuffle.push(ssg_hitter[i]);
            }
        }
    }
    console.log(ssg_hitter_shuffle);
}

////////////////remove

function remove(x){
    if(document.getElementById(x.name).name == 'kia'){
        for(i = 0; i < kia_hitter_shuffle.length; i++){
            if(kia_hitter_shuffle.length == 0){
                return 0;
            }
            else if(document.getElementById(x.name).value == kia_hitter_shuffle[i][0]){
                kia_hitter_shuffle.splice(i,1);
            }
        }
    }
    console.log(kia_hitter_shuffle);
    //나머지 팀들 똑같이 추가

    if(document.getElementById(x.name).name == 'dusan'){
        for(i = 0; i < dusan_hitter_shuffle.length; i++){
            if(dusan_hitter_shuffle.length == 0){
                return 0;
            }
            else if(document.getElementById(x.name).value == dusan_hitter_shuffle[i][0]){
                dusan_hitter_shuffle.splice(i,1);
            }
        }
    }
    console.log(dusan_hitter_shuffle);

    if(document.getElementById(x.name).name == 'hanhwa'){
        for(i = 0; i < hanhwa_hitter_shuffle.length; i++){
            if(hanhwa_hitter_shuffle.length == 0){
                return 0;
            }
            else if(document.getElementById(x.name).value == hanhwa_hitter_shuffle[i][0]){
                hanhwa_hitter_shuffle.splice(i,1);
            }
        }
    }
    console.log(hanhwa_hitter_shuffle);

    if(document.getElementById(x.name).name == 'kiwoom'){
        for(i = 0; i < kiwoom_hitter_shuffle.length; i++){
            if(kiwoom_hitter_shuffle.length == 0){
                return 0;
            }
            else if(document.getElementById(x.name).value == kiwoom_hitter_shuffle[i][0]){
                kiwoom_hitter_shuffle.splice(i,1);
            }
        }
    }
    console.log(kiwoom_hitter_shuffle);

    if(document.getElementById(x.name).name == 'kt'){
        for(i = 0; i < kt_hitter_shuffle.length; i++){
            if(kt_hitter_shuffle.length == 0){
                return 0;
            }
            else if(document.getElementById(x.name).value == kt_hitter_shuffle[i][0]){
                kt_hitter_shuffle.splice(i,1);
            }
        }
    }
    console.log(kt_hitter_shuffle);

    if(document.getElementById(x.name).name == 'lg'){
        for(i = 0; i < lg_hitter_shuffle.length; i++){
            if(lg_hitter_shuffle.length == 0){
                return 0;
            }
            else if(document.getElementById(x.name).value == lg_hitter_shuffle[i][0]){
                lg_hitter_shuffle.splice(i,1);
            }
        }
    }
    console.log(lg_hitter_shuffle);

    if(document.getElementById(x.name).name == 'lotte'){
        for(i = 0; i < lotte_hitter_shuffle.length; i++){
            if(lotte_hitter_shuffle.length == 0){
                return 0;
            }
            else if(document.getElementById(x.name).value == lotte_hitter_shuffle[i][0]){
                lotte_hitter_shuffle.splice(i,1);
            }
        }
    }
    console.log(lotte_hitter_shuffle);

    if(document.getElementById(x.name).name == 'nc'){
        for(i = 0; i < nc_hitter_shuffle.length; i++){
            if(nc_hitter_shuffle.length == 0){
                return 0;
            }
            else if(document.getElementById(x.name).value == nc_hitter_shuffle[i][0]){
                nc_hitter_shuffle.splice(i,1);
            }
        }
    }
    console.log(nc_hitter_shuffle);

    if(document.getElementById(x.name).name == 'samsung'){
        for(i = 0; i < samsung_hitter_shuffle.length; i++){
            if(samsung_hitter_shuffle.length == 0){
                return 0;
            }
            else if(document.getElementById(x.name).value == samsung_hitter_shuffle[i][0]){
                samsung_hitter_shuffle.splice(i,1);
            }
        }
    }
    console.log(samsung_hitter_shuffle);

    if(document.getElementById(x.name).name == 'ssg'){
        for(i = 0; i < ssg_hitter_shuffle.length; i++){
            if(ssg_hitter_shuffle.length == 0){
                return 0;
            }
            else if(document.getElementById(x.name).value == ssg_hitter_shuffle[i][0]){
                ssg_hitter_shuffle.splice(i,1);
            }
        }
    }
    console.log(ssg_hitter_shuffle);
}