### Initialize Document Ready State and Layout Functions Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html This snippet defines global variables for page state (e.g., `isLogin`, `gvPageTitle`, `gv_lang`) and executes initialization routines upon document readiness using jQuery. The `def_fnInit` function handles dynamic layout adjustments and button behaviors, setting appropriate functions for various navigation actions like 'back', 'menu', or specific page redirects. ```javascript var btnFn = ""; var isLogin = false; // 로그인 여부 var gvPageTitle = "Attraction"; var sessionGuestYn = '0'; var gv_lang = "en"; var ggGsberChk = "1210"; $(function() { //mbf_Title(gvPageTitle); def_fnInit(); mbf_CloseProgressDialog(); eiwaf_InitDocumentReady({"code":0,"msgCode":"STATUS.Ok","message":"Processed successfully."}); }); // 초기값 세팅 function def_fnInit(){ var eiLayoutLocation = ''; var eiLayoutoBtnCss = ''; var eiLayoutoBtnCss2 = ''; var eiLayoutoLink = ''; var eiLayoutoRefresh = ''; if( !utlf_IsNullOrBlank(eiLayoutLocation) ){ layout_fnSetPath(eiLayoutoLocation); }else{ $("#divDefLocation").hide(); } if( !utlf_IsNullOrBlank(eiLayoutoBtnCss) ){ // 닫기버튼 생성 var btnBlindTxt = eiLayoutoBtnCss=="back"?"뒤로가기":"닫기"; if(eiLayoutoBtnCss == 'menu'){ btnFn = "mbf_MenuPressed();"; }else if(eiLayoutoBtnCss == 'payBack'){ eiLayoutoBtnCss = "back"; btnFn = "mbf_PayBackCheck();"; btnBlindTxt = "뒤로가기"; }else if(eiLayoutoBtnCss == 'payPageGo'){ eiLayoutoBtnCss = "back"; btnBlindTxt = "뒤로가기"; if(!utlf_IsNullOrBlank(eiLayoutoBtnCss2)){ btnFn = "mbf_payBackPageGo('"+eiLayoutoBtnCss2+"');"; }else{ btnFn = "mbf_HistoryBack();"; } }else if(eiLayoutoBtnCss == 'mypagedetail'){ eiLayoutoBtnCss = "back"; btnFn = "mbf_detailback();"; btnBlindTxt = "뒤로가기"; }else if(eiLayoutoBtnCss == 'eventBack'){ eiLayoutoBtnCss = "back"; btnFn = "mbf_eventCheck();"; btnBlindTxt = "뒤로가기"; }else if(eiLayoutoBtnCss == 'historyBack'){ eiLayoutoBtnCss = "back"; btnFn = "mbf_HistoryBack();"; btnBlindTxt = "뒤로가기"; }else if(eiLayoutoBtnCss == 'pop_close'){ btnFn = "mbf_HistoryBack();"; btnBlindTxt = "뒤로가기"; }else if(eiLayoutoBtnCss == 'regManage'){ eiLayoutoBtnCss = "back"; btnFn = "mbf_RegistBack();"; btnBlindTxt = "뒤로가기"; }else if(eiLayoutoBtnCss == 'pdtPageGo'){ eiLayoutoBtnCss = "back"; btnFn = "mbf_pdtBackPageGo();"; btnBlindTxt = "뒤로가기"; }else if(eiLayoutoBtnCss == 'mainPageGo'){ eiLayoutoBtnCss = "back"; btnFn = "mbf_GoMain();"; btnBlindTxt = "뒤로가기"; }else { btnFn = ""; btnBlindTxt = "뒤로가기"; } ``` -------------------------------- ### Initialize Main Reservation Swipe and UI on Document Ready Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html This function `eiwaf_DocumentReady` is executed when the document is ready. It initializes the main reservation swipe functionality, adjusts intro popup positioning, and manages the visibility of UI elements based on ticket status. It also handles focus and blur events for a search input field. ```javascript function eiwaf_DocumentReady(status) { initMainReservationSwipe(); if("N" == "Y"){ //인트로팝업 var $popCon = $('#introPopup .pop_cont'); var popHeight = $('#introPopup .pop_cont').height(); $popCon.css('marginTop', - (popHeight / 2)); } //티켓 유무 if("" == "hasTicket"){ $(".status1").show(); $(".status2").hide(); }else{ $(".status1").hide(); $(".status2").show(); } $('#searchbyName').focus( function (){ $('#searchbyName').val(''); }).focusout( function (){ if($('#searchbyName').val() == ''){ $('#searchbyName').val('이름 검색하기'); } }); } ``` -------------------------------- ### Integrate ChatAI Widget with React Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html Demonstrates how to integrate and render the `ChatAiWidget` React component, configuring its `applicationId`, `botId`, and custom button rendering logic. It initializes the widget with specific properties and renders it into a root DOM element, providing a custom toggle button with localized text. ```javascript const { ChatAiWidget } = window.ChatAiWidget; const Chatbot = () => { return ( (
)} /> ); }; ReactDOM.createRoot(document.querySelector('#root')).render(
); ``` -------------------------------- ### Integrate with L.pot Loyalty Program based on Park ID Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html Implements the `fnLpotOpen` function, which dynamically constructs a URL for the L.pot loyalty program. It sets affiliate IDs and UTM parameters based on a given park ID (`cfnGsber`), handling different encoding requirements for iOS and Android devices. The function either redirects the current page or opens a new browser window. ```javascript function fnLpotOpen(){ var cfnGsber = "1210"; var lPotUrl = ""; var n_affi; var c_utm_medium; /* dev2048 2020-09-07 롯데월드부산 */ switch(cfnGsber){ case "1270": //어드벤처 부산 case "1210": //어드벤처 n_affi = "6109934"; c_utm_medium = "롯데월드매직패스앱"; break; case "1230": //워터파크 n_affi = "6111342"; c_utm_medium = "워터파크"; break; case "1240": //아쿠아리움 n_affi = "6111341"; c_utm_medium = "롯데월드아쿠아리움"; break; case "1250": //전망대 n_affi = "6123266"; c_utm_medium = "롯데월드전망대"; break; case "1260": //키즈파크 n_affi = "128215642"; c_utm_medium = "키즈파크"; break; default: //어드벤처 n_affi = "6109934"; c_utm_medium = "롯데월드매직패스앱"; break; } //여기부분 수정해야함 if( navigator.userAgent.match(/iPhone|iPad|iPod/i) != null ){ // iphone 은 앱처리문제로 2번 encoding 함 //lPotUrl = "https://lpot.lpoint.com/app/lpot/LPPA100100.do?" + encodeURIComponent(encodeURIComponent("utm_source=롯데월드&utm_medium=롯데월드매직패스앱&utm_campaign=Lpot주변쿠폰")); lPotUrl = "https://lpot.lpoint.com/app/lpot/LPPA100100.do?affi="+encodeURIComponent(encodeURIComponent(n_affi))+"&utm_source="+encodeURIComponent(encodeURIComponent("롯데월드"))+"&utm_medium="+encodeURIComponent(encodeURIComponent(c_utm_medium))+"&utm_campaign="+encodeURIComponent(encodeURIComponent("Lpot주변쿠폰")); }else{ // 안드로이드는 한글부분만 encoding lPotUrl = "https://lpot.lpoint.com/app/lpot/LPPA100100.do?affi="+encodeURIComponent(n_affi)+"&utm_source="+encodeURIComponent("롯데월드")+"&utm_medium="+encodeURIComponent(c_utm_medium)+"&utm_campaign="+encodeURIComponent("Lpot주변쿠폰"); } if( location.href.indexOf("/app/mps/") > 0 ){ // 매직패스는 APP에서 mbf_OpenBrowser에 대한 처리가 없어서 href 로 처리함. location.href = lPotUrl; }else{ // 매직패스 외는 이 함수로 팝업 띄움 mbf_OpenBrowser(lPotUrl); } } ``` -------------------------------- ### Initialize Swiper for Magic Pass Reservations Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html The `initMainReservationSwipe` function initializes a Swiper instance for the `#myMagicPassSwipe` element if it's visible. It dynamically adds Swiper-specific classes to the container and its children, configures the Swiper with pagination, and then communicates the swipe area dimensions to a native application via a `app://setSwipeArea` URL scheme. ```javascript var swiper; function initMainReservationSwipe(){ var mp = $("#myMagicPassSwipe"); if(mp.length == 0){ return; } var obj; if(mp.is(":visible")){ if(swiper != undefined){ swiper.slideTo(0, 0); swiper.destroy(); } var cont = $("#myMagicPassSwipe"); cont.addClass("swiper-container"); cont.find("ul").addClass("swiper-wrapper"); var lis = cont.find("li"); lis.addClass("swiper-slide"); var h = lis.eq(0).height(); //$("#myMagicPassNav").addClass(".swiper-pagination"); var options = {pagination:"#myMagicPassNav", paginationElement:"li"}; swiper = new Swiper("#myMagicPassSwipe", options); obj = { top:Math.floor(cont.offset().top), height:h, index:1}; }else{ obj = {top:0, height:0, index:1}; } location.href = "app://setSwipeArea?json=" + JSON.stringify(obj); } ``` -------------------------------- ### Initialize Global Park IDs and Google Tag Manager Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html Defines various park IDs (e.g., Lotte World, Busan, Sky, Water, Kids, Aqua) as global JavaScript variables. It also includes the standard Google Tag Manager (GTM) initialization script for web analytics and tracking, along with a global language variable. ```javascript /* dev2048 2020-11-12 롯데월드부산 */ var st_std_cd_gsber_world_gs = "1210"; var st_std_cd_gsber_worldbusan_gs = "1270"; var st_std_cd_gsber_sky_gs = "1250"; var st_std_cd_gsber_water_gs = "1230"; var st_std_cd_gsber_kids_gs = "1260"; var st_std_cd_gsber_aqua_gs = "1240"; var dayWeek=['Sun' ,'Mon' ,'Tue' ,'Wed' ,'Thu' ,'Fri' ,'Sat' ]; function attrDM(){} function zindexDM(){} (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-TMWPSRN'); var ei_lang = 'en'; ``` -------------------------------- ### Theme Park API Configuration Constants Reference Source: https://github.com/themeparks/parksapi/blob/main/README.md A comprehensive list of environment variables or configuration keys used to interact with various theme park APIs. These constants typically define park IDs, base URLs, API keys, destination slugs, and category types for attractions, shows, and dining. ```APIDOC DORNEYPARK_ATTRACTIONCATEGORIES DORNEYPARK_SHOWCATEGORIES DORNEYPARK_DININGCATEGORIES KINGSDOMINION_PARKID KINGSDOMINION_DESTINATIONID KINGSDOMINION_CONFIGPATH KINGSDOMINION_BASEURL KINGSDOMINION_REALTIMEBASEURL KINGSDOMINION_LONGITUDE KINGSDOMINION_LATITUDE KINGSDOMINION_EXTRAATTRACTIONCATEGORYTYPES KINGSDOMINION_EXTRASHOWCATEGORYTYPES KINGSDOMINION_EXTRARESTAURANTCATEGORYTYPES KINGSDOMINION_ATTRACTIONCATEGORIES KINGSDOMINION_SHOWCATEGORIES KINGSDOMINION_DININGCATEGORIES MICHIGANSADVENTURE_PARKID MICHIGANSADVENTURE_DESTINATIONID MICHIGANSADVENTURE_CONFIGPATH MICHIGANSADVENTURE_BASEURL MICHIGANSADVENTURE_REALTIMEBASEURL MICHIGANSADVENTURE_LONGITUDE MICHIGANSADVENTURE_LATITUDE MICHIGANSADVENTURE_EXTRAATTRACTIONCATEGORYTYPES MICHIGANSADVENTURE_EXTRASHOWCATEGORYTYPES MICHIGANSADVENTURE_EXTRARESTAURANTCATEGORYTYPES MICHIGANSADVENTURE_ATTRACTIONCATEGORIES MICHIGANSADVENTURE_SHOWCATEGORIES MICHIGANSADVENTURE_DININGCATEGORIES VALLEYFAIR_PARKID VALLEYFAIR_DESTINATIONID VALLEYFAIR_CONFIGPATH VALLEYFAIR_BASEURL VALLEYFAIR_REALTIMEBASEURL VALLEYFAIR_LONGITUDE VALLEYFAIR_LATITUDE VALLEYFAIR_EXTRAATTRACTIONCATEGORYTYPES VALLEYFAIR_EXTRASHOWCATEGORYTYPES VALLEYFAIR_EXTRARESTAURANTCATEGORYTYPES VALLEYFAIR_ATTRACTIONCATEGORIES VALLEYFAIR_SHOWCATEGORIES VALLEYFAIR_DININGCATEGORIES WORLDSOFFUN_PARKID WORLDSOFFUN_DESTINATIONID WORLDSOFFUN_CONFIGPATH WORLDSOFFUN_BASEURL WORLDSOFFUN_REALTIMEBASEURL WORLDSOFFUN_LONGITUDE WORLDSOFFUN_LATITUDE WORLDSOFFUN_EXTRAATTRACTIONCATEGORYTYPES WORLDSOFFUN_EXTRASHOWCATEGORYTYPES WORLDSOFFUN_EXTRARESTAURANTCATEGORYTYPES WORLDSOFFUN_ATTRACTIONCATEGORIES WORLDSOFFUN_SHOWCATEGORIES WORLDSOFFUN_DININGCATEGORIES HERSHEYPARK_APIKEY HERSHEYPARK_BASEURL SIXFLAGS_BASEURL SIXFLAGS_AUTHHEADER HANSAPARK_RESORTID HANSAPARK_BASEURL HANSAPARK_LOCALE HANSAPARK_APIKEY KNOEBELS_DESTINATIONID KNOEBELS_PARKID KNOEBELS_INITIALDATAVERSION KNOEBELS_APPBUILD KNOEBELS_APPVERSION KNOEBELS_BASEURL KNOEBELS_DEVICEIDENTIFIER KNOEBELS_APIKEY KNOEBELS_CALENDARURL WALIBIBELGIUM_APIKEY WALIBIBELGIUM_BASEURL WALIBIBELGIUM_DESTINATIONSLUG WALIBIBELGIUM_PARKSLUG WALIBIBELGIUM_APISHORTCODE WALIBIBELGIUM_CULTURE ``` -------------------------------- ### Supported Parks API Environment Variables Source: https://github.com/themeparks/parksapi/blob/main/README.md This comprehensive list details the environment variables available for configuring various park destinations within the Parks API. Each variable follows a `CLASSNAME_VARIABLENAME` convention, allowing for granular control over specific resort and park settings, such as IDs, API keys, base URLs, and virtual queue settings. ```text WALTDISNEYWORLDRESORT_RESORTID WALTDISNEYWORLDRESORT_RESORTSHORTCODE WALTDISNEYWORLDRESORT_PARKIDS WALTDISNEYWORLDRESORT_VIRTUALQUEUEURL WALTDISNEYWORLDRESORT_GENIEDATA WALTDISNEYWORLDRESORT_SLUG DISNEYLANDRESORT_RESORTID DISNEYLANDRESORT_RESORTSHORTCODE DISNEYLANDRESORT_PARKIDS DISNEYLANDRESORT_VIRTUALQUEUEURL DISNEYLANDRESORT_GENIEDATA DISNEYLANDRESORT_SLUG DISNEYLANDPARIS_APIKEY DISNEYLANDPARIS_APIBASE DISNEYLANDPARIS_APIBASEWAITTIMES DISNEYLANDPARIS_LANGUAGE DISNEYLANDPARIS_STANDBYAPIBASE DISNEYLANDPARIS_STANDBYAPIKEY DISNEYLANDPARIS_STANDBYAUTHURL DISNEYLANDPARIS_STANDBYAPIREFRESHTOKEN DISNEYLANDPARIS_PREMIERACCESSAPIKEY DISNEYLANDPARIS_PREMIERACCESSURL DISNEYLANDPARIS_USERAGENT TOKYODISNEYRESORT_APIKEY TOKYODISNEYRESORT_APIAUTH TOKYODISNEYRESORT_APIOS TOKYODISNEYRESORT_APIBASE TOKYODISNEYRESORT_APIVERSION TOKYODISNEYRESORT_PARKIDS TOKYODISNEYRESORT_FALLBACKDEVICEID HONGKONGDISNEYLAND_RESORTID HONGKONGDISNEYLAND_DESTINATIONID HONGKONGDISNEYLAND_RESORTSHORTCODE HONGKONGDISNEYLAND_CULTUREFILTER HONGKONGDISNEYLAND_PARKIDS HONGKONGDISNEYLAND_SLUG HONGKONGDISNEYLAND_VIRTUALQUEUEURL HONGKONGDISNEYLAND_GENIEDATA SHANGHAIDISNEYLANDRESORT_APIBASE SHANGHAIDISNEYLANDRESORT_APIAUTH SHANGHAIDISNEYLANDRESORT_PARKIDS UNIVERSALSTUDIOS_CITY UNIVERSALSTUDIOS_RESORTSLUG UNIVERSALSTUDIOS_RESORTKEY UNIVERSALSTUDIOS_SECRETKEY UNIVERSALSTUDIOS_APPKEY UNIVERSALSTUDIOS_VQUEUEURL UNIVERSALSTUDIOS_BASEURL UNIVERSALSTUDIOS_ASSETSBASE UNIVERSALORLANDO_CITY UNIVERSALORLANDO_RESORTSLUG UNIVERSALORLANDO_RESORTKEY UNIVERSALORLANDO_SECRETKEY UNIVERSALORLANDO_APPKEY UNIVERSALORLANDO_VQUEUEURL UNIVERSALORLANDO_BASEURL UNIVERSALORLANDO_ASSETSBASE EUROPAPARK_PARKS EFTELING_APIKEY EFTELING_APIVERSION EFTELING_APPVERSION EFTELING_SEARCHURL EFTELING_WAITTIMESURL PHANTASIALAND_APIBASE SEAWORLDORLANDO_RESORTIDS SEAWORLDORLANDO_RESORTID SEAWORLDORLANDO_RESORTSLUG SEAWORLDORLANDO_APPID SEAWORLDORLANDO_APPVERSION SEAWORLDORLANDO_BASEURL SEAWORLDSANANTONIO_RESORTIDS SEAWORLDSANANTONIO_RESORTID SEAWORLDSANANTONIO_RESORTSLUG SEAWORLDSANANTONIO_APPID SEAWORLDSANANTONIO_APPVERSION SEAWORLDSANANTONIO_BASEURL SEAWORLDSANDIEGO_RESORTIDS SEAWORLDSANDIEGO_RESORTID SEAWORLDSANDIEGO_RESORTSLUG SEAWORLDSANDIEGO_APPID SEAWORLDSANDIEGO_APPVERSION SEAWORLDSANDIEGO_BASEURL BUSCHGARDENSTAMPA_RESORTIDS BUSCHGARDENSTAMPA_RESORTID BUSCHGARDENSTAMPA_RESORTSLUG BUSCHGARDENSTAMPA_APPID BUSCHGARDENSTAMPA_APPVERSION BUSCHGARDENSTAMPA_BASEURL BUSCHGARDENSWILLIAMSBURG_RESORTIDS BUSCHGARDENSWILLIAMSBURG_RESORTID BUSCHGARDENSWILLIAMSBURG_RESORTSLUG BUSCHGARDENSWILLIAMSBURG_APPID BUSCHGARDENSWILLIAMSBURG_APPVERSION BUSCHGARDENSWILLIAMSBURG_BASEURL ALTONTOWERS_DESTINATIONID ALTONTOWERS_PARKID ALTONTOWERS_INITIALDATAVERSION ALTONTOWERS_APPBUILD ALTONTOWERS_APPVERSION ALTONTOWERS_BASEURL ALTONTOWERS_DEVICEIDENTIFIER ALTONTOWERS_APIKEY ALTONTOWERS_CALENDARURL THORPEPARK_DESTINATIONID THORPEPARK_PARKID THORPEPARK_INITIALDATAVERSION THORPEPARK_APPBUILD THORPEPARK_APPVERSION THORPEPARK_BASEURL THORPEPARK_DEVICEIDENTIFIER THORPEPARK_APIKEY THORPEPARK_CALENDARURL CHESSINGTONWORLDOFADVENTURES_DESTINATIONID CHESSINGTONWORLDOFADVENTURES_PARKID CHESSINGTONWORLDOFADVENTURES_INITIALDATAVERSION CHESSINGTONWORLDOFADVENTURES_APPBUILD CHESSINGTONWORLDOFADVENTURES_APPVERSION CHESSINGTONWORLDOFADVENTURES_BASEURL CHESSINGTONWORLDOFADVENTURES_DEVICEIDENTIFIER CHESSINGTONWORLDOFADVENTURES_APIKEY CHESSINGTONWORLDOFADVENTURES_CALENDARURL LEGOLANDWINDSOR_DESTINATIONID LEGOLANDWINDSOR_PARKID LEGOLANDWINDSOR_INITIALDATAVERSION LEGOLANDWINDSOR_APPBUILD LEGOLANDWINDSOR_APPVERSION LEGOLANDWINDSOR_BASEURL LEGOLANDWINDSOR_DEVICEIDENTIFIER LEGOLANDWINDSOR_APIKEY LEGOLANDWINDSOR_CALENDARURL LEGOLANDORLANDO_DESTINATIONID LEGOLANDORLANDO_PARKID LEGOLANDORLANDO_INITIALDATAVERSION LEGOLANDORLANDO_APPBUILD LEGOLANDORLANDO_APPVERSION LEGOLANDORLANDO_BASEURL LEGOLANDORLANDO_DEVICEIDENTIFIER LEGOLANDORLANDO_APIKEY LEGOLANDORLANDO_CALENDARURL LEGOLANDCALIFORNIA_DESTINATIONID LEGOLANDCALIFORNIA_PARKID LEGOLANDCALIFORNIA_INITIALDATAVERSION LEGOLANDCALIFORNIA_APPBUILD LEGOLANDCALIFORNIA_APPVERSION LEGOLANDCALIFORNIA_BASEURL ``` -------------------------------- ### Dynamically Generate UI Buttons and Links Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html This JavaScript code dynamically creates and appends navigation buttons (back, refresh) and custom links to the '#bodyHeader' element based on provided layout parameters. It handles different link types, including those with parameters, and ensures proper styling and event handling. ```javascript var newBtn = '' + btnBlindTxt + ''; $("#bodyHeader").append(newBtn); //어드벤처가 아닌 경우에만 버튼을 생성한다 //함수는 동일하게 세팅되어야 백버튼에서 처리가능하겠지... /* dev2048 2020-09-08 롯데월드부산 */ if('1210' != '1210' || '1210' != '1270') { // 닫기버튼 생성 var newBtn = '뒤로가기'; $("#bodyHeader").append(newBtn); } if( !utlf_IsNullOrBlank(eiLayoutoLink) ){ // link 생성 var links = eiLayoutoLink.split("|"); // index 0:title 1:function var newLink = ""; if(links[1] == 'paramFunc'){ // index 0:title 1:구분 2:function 3:param newLink = ""+links[0]+""; }else{ newLink = ''+links[0]+''; } $("#bodyHeader").append(newLink); } if( !utlf_IsNullOrBlank(eiLayoutoRefresh) ){ // refresh버튼 생성 var newLink = '새로고침'; $("#bodyHeader").append(newLink); } ``` -------------------------------- ### Dynamically Modify Sendbird Links with MutationObserver Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html Implements a `MutationObserver` to detect dynamically added `` tags with specific classes (`sendbird-word__url`) and attributes (`target="_blank"`). It modifies these links by removing `target="_blank"` and replacing the default navigation with a custom `mbf_OpenBrowser` function, ensuring consistent link behavior within the application for dynamically loaded content. ```javascript document.addEventListener("DOMContentLoaded", function() { // 변화를 관찰할 대상 요소 설정 (문서의 body) var targetNode = document.body; // 관찰자 옵션 설정: 자손 노드의 추가를 관찰 var config = { childList: true, subtree: true }; // 변화 감지 시 실행할 콜백 함수 var callback = function(mutationsList, observer) { for(var mutation of mutationsList) { if (mutation.type === 'childList') { mutation.addedNodes.forEach(function(node) { // node가 Element이고 'a.sendbird-word__url' 클래스를 가진 태그인지 확인 if (node.nodeType === 1 && node.matches('a.sendbird-word__url[target="_blank"]')) { node.removeAttribute('target'); var href=node.getAttribute('href'); node.removeAttribute('href'); node.addEventListener('click',function(){mbf_OpenBrowser(href);}); } if (typeof node.querySelectorAll !== 'function') { return; } // 추가된 node가 자식 노드를 가지고 있는 경우, 그 내부도 확인 node.querySelectorAll('a.sendbird-word__url[target="_blank"]').forEach(function(innerNode) { innerNode.removeAttribute('target'); var href=node.getAttribute('href'); node.removeAttribute('href'); innerNode.addEventListener('click',function(){mbf_OpenBrowser(href);}); }); }); } } }; // MutationObserver 인스턴스 생성 및 실행 var observer = new MutationObserver(callback); observer.observe(targetNode, config); }); ``` -------------------------------- ### Common Back Button Navigation Handler Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html Defines a common JavaScript function `mbf_BackPressed` to handle back button functionality. It attempts to execute a predefined function (`btnFn`) if available, otherwise defaults to `history.back()` to navigate to the previous page. ```javascript function mbf_BackPressed(){ try{ //$("#btn_layoutBack").click(); if(btnFn != "" && btnFn != null) { eval(btnFn); } else { history.back(); } }catch(e){ history.back(); }; } ``` -------------------------------- ### Open Ride Waiting Time Management Page Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html Provides a JavaScript function `fnRideManageOpen` that redirects the user to a specific URL for inputting ride waiting times. This function is intended for ride managers to update attraction status. ```javascript function fnRideManageOpen(){ // var RideManageUrl = "https://mticket.lotteworld.com/web/etc/inputRideWaitingtime.do"; var RideManageUrl = "/app/etc/inputRideWaitingtime.do"; location.href = RideManageUrl; // mbf_OpenBrowser(RideManageUrl); } ``` -------------------------------- ### Initiate Reservation Cancellation via AJAX Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html The `fnCancleResv` function handles the cancellation of a reservation. It prompts the user for confirmation and then sends an asynchronous AJAX request to `/app/mps/myPassCnclResvAjax.do` with the reservation ID. It specifies `fnCancleResvCallback` as the function to handle the AJAX response. ```javascript function fnCancleResv(reservationId){ var f = document.form1; f.reservationId.value = reservationId; if( !confirm('Do you want to cancel the selected reservation?') ) return; /* var result = svcf_Ajax("/app/mps/myPassCnclResvAjax.do", f, { procType : "U", //async: false, sendFn: cmf_AjaxStart, stopFn: cmf_AjaxEnd }); */ svcf_Ajax("/app/mps/myPassCnclResvAjax.do", f, { callbackFn: fnCancleResvCallback, procType : "U", async: true, sendFn: cmf_AjaxStart, stopFn: cmf_AjaxEnd }); } ``` -------------------------------- ### Handle Location Selection in UI Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html The `fnSelLoc` function updates the UI to visually indicate the currently selected location. It removes the 'on' class from all 'a' elements within '#locList' and then applies the 'on' class to the clicked object, highlighting it as selected. ```javascript function fnSelLoc(obj){ $("#locList").find("a").attr("class",""); $(obj).attr("class","on"); } ``` -------------------------------- ### Search Attractions by Name Keyword Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html The `fnSchByNm` function filters the attraction list (`#attractionList`) based on a keyword entered in the `#searchbyName` input. It hides attractions that don't match the keyword in their `ride_nm` value and displays a 'no data' message if no attractions are found after the search. ```javascript function fnSchByNm(){ $('#place_name').val(cmf_getMessage({key:"UI.MPS.VIEW.LABEL.MSG0000"}));//위치별 보기 var searchKeyword = $("#searchbyName").val(); //searchKeyword = searchKeyword.substring(1); var ycnt = 0; $.each($('#attractionList li'),function(){ var rideName = $(this).find('.ride_nm').val(); if(rideName.indexOf(searchKeyword) != -1){ $(this).attr('style','display:block;'); ycnt = ycnt+1; }else{ $(this).attr('style','display:none;'); } if(ycnt < 1){ //검색된 어트랙션이 없을때 보여줌 $("#noData").attr('style','display:block;'); $(".couponbox").attr('style','display:none;'); $('.no_research').hide(); }else{ $("#noData").attr('style','display:none;'); $(".couponbox").attr('style','display:block;'); $('.no_research').show(); } }); } ``` -------------------------------- ### Handle Reservation Cancellation AJAX Callback Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html The `fnCancleResvCallback` function processes the response from the reservation cancellation AJAX request. It checks the status code of the operation and displays an alert message if the cancellation was unsuccessful (i.e., `status.code` is not 0). ```javascript function fnCancleResvCallback(status, data){ // 저장 콜백함수 if( status.code != 0 ){ alert(status.messa } } ``` -------------------------------- ### Prevent Touchmove and Show Notice Layer with jQuery Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html Illustrates jQuery usage to prevent default `touchmove` behavior on elements with the class `noticeLayer`, which is useful for preventing scrolling on overlay elements. It also includes a conditional check to display the `noticeLayer` based on a cookie value (`magic`) and a hardcoded string comparison. ```javascript $('.noticeLayer').bind('touchmove', function(e){ e.preventDefault(); }); if("N" == "Y" && getCookie("magic") != "done"){ $(".noticeLayer").show(); } ``` -------------------------------- ### Filter Attractions by Selected Location Source: https://github.com/themeparks/parksapi/blob/main/lotteworld.html This function `fnSchByLc` filters a list of attractions (`#attractionList`) based on a selected floor name. It clears previous search results, updates a display field, and shows/hides attractions accordingly. It also handles an 'All' option and truncates long floor names for display. ```javascript function fnSchByLc(){ //검색어 초기화 $("#noData").attr('style','display:none;'); $(".couponbox").attr('style','display:block;'); $('#searchbyName').val(''); $('#no_research').show(); //var floorname = $(this).text(); var li = $("#locList").find(".on"); var floorname = li.find("#floorlistitem").text(); if(floorname == "전체 보기" || floorname == ""){ $.each($('#attractionList li'),function(){ $(this).attr('style','display:block;'); }); }else{ $.each($('#attractionList li'),function(){ rideName = $(this).find('.ride_nm').val(); itemFloor = $(this).find('#itemfloor').val(); if(itemFloor == floorname){ $(this).attr('style','display:block;'); }else{ $(this).attr('style','display:none;'); } }); } if(floorname.length > 13){ //글자길이 제한 floorname = floorname.substring(0,13)+"..."; } $("#place_name").val(floorname); layerClose(); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.