横浜FC

\
\
\ \
\

\ REPLACE_DATE\ REPLACE_WEEKREPLACE_TIME\

\

REPLACE_COMPETITOR_NAMEREPLACE_STADIUM

\
\
\ \
\ \ '; const getJson = async url => { // getJson() は promise を返す const response = await fetch(url); // fetch() が返した promise の処理が完了するのを待つ const json = await response.json(); // json() が返した promise の処理が完了するのを待つ return json; } const top_slider_show = async (url) => { const json = await getJson(url); // getJson() が返した promise の処理が完了するのを待つ let post = json[0]; let allLeague = post.acf.league; let top_match_arr = []; allLeague.forEach((league) => { let gamesOfLeague = league.game; gamesOfLeague = gamesOfLeague.map(match => { const leagueName = league.league_name; match.league_name = leagueName.replace('2023', ''); return match; }); top_match_arr = top_match_arr.concat(gamesOfLeague); }) const get_json_detail = async (item, allClubs) => { const slide_flag = item.slide; if (slide_flag == true) { const league_name = item.league_name; const home_v2_id = item.home_v2; const home_team_id = item.game_home_team.value; const home_team_name = item.game_home_team.label; const away_v2_id = item.away_v2; const away_team_id = item.game_away_team.value; const away_team_name = item.game_away_team.label; let date_field = item.game_date; let date_arr = date_field.split('('); const date = date_arr[0]; const week = "(" + date_arr[1]; const time = item.game_time; const section = item.game_section; const stadium = item.game_stadium; const event_url = item.game_kickoff_url; const ticket_url = item.ticket_url; let event_flag = ""; let ticket_flag = ""; if (event_url) { event_flag = "is-active"; } if (ticket_url) { ticket_flag = "is-active"; } let side; let competitor_logo; let competitor_name; if (home_v2_id && away_v2_id) { const currentHome = getClubByClubId(home_v2_id, allClubs); const currentAway = getClubByClubId(away_v2_id, allClubs); if (currentHome.name === '横浜FC') { side = "home"; competitor_logo = currentAway.logo_url; competitor_name = currentAway.name; } else { side = "away"; competitor_logo = currentHome.logo_url; competitor_name = currentHome.name; } } else { if (parseInt(home_team_id) === 296) { side = "home"; competitor_logo = '/wp-content/themes/yokohamafc-2020/assets/img/emblem/' + away_team_id + '.svg'; competitor_name = away_team_name; } else { side = "away"; competitor_logo = '/wp-content/themes/yokohamafc-2020/assets/img/emblem/' + home_team_id + '.svg'; competitor_name = home_team_name; } } let html = HTML_TEMPLATE_MATCH_INFO; html = html.replace('REPLACE_LEAGUE_NAME', league_name); html = html.replace('REPLACE_SECTION', section); html = html.replace('REPLACE_STADIUM', stadium); html = html.replace('REPLACE_DATE', date); html = html.replace(/REPLACE_HOME_AWAY/g, side); html = html.replace('REPLACE_COMPETITOR_LOGO', competitor_logo); html = html.replace('REPLACE_COMPETITOR_NAME', competitor_name); html = html.replace('REPLACE_WEEK', week); html = html.replace('REPLACE_TIME', time); html = html.replace('REPLACE_EVENT_URL', event_url); html = html.replace('REPLACE_TICKET_URL', ticket_url); html = html.replace('REPLACE_EVENT_VISIBLE', event_flag); html = html.replace('REPLACE_TICKET_VISIBLE', ticket_flag); MATCH_LIST.append(html); } } const getClubByClubId = (clubId, allClubs) => { if (!allClubs) return null; const findIndex = allClubs.findIndex((clubData) => clubData.id === clubId); return allClubs[findIndex]; } const top_match_init = async (arr) => { let all_clubs; try { const clubsData = localStorage.getItem('all_clubs'); all_clubs = JSON.parse(clubsData); } catch (e) { console.log('Can not find Clubs data', e); } await Promise.all(arr.map(async item => await get_json_detail(item, all_clubs))); MATCH_LIST.slick({ infinite: true, draggable: true, fade: false, autoplay: false, arrows: true, initialSlide: 0, centerMode: true, variableWidth: true, responsive: [{ breakpoint: 767, settings: { slideToShow: 2, slidesToScroll: 2, centerMode: false, infinite: false } }] }); } const topMatchSortByDate = top_match_arr.sort((a, b) => parseInt(a.game_date_en, 10) - parseInt(b.game_date_en, 10)); top_match_init(topMatchSortByDate); }; top_slider_show(REST_API_TOP_MATCH_INFO);

J2 season Ranking

    SPECIAL CONTENT

    YOUTUBE

    PICK UP!

    NEWS

    • ALL
    • 試合・チケット
    • ファン
    • チーム
    • クラブ
    • 受付中

    OFFICIAL PARTNER