Block the Pig - 지금 Coolmath Games에서 플레이해보세요 (2023)

'; } if (typeof signupPromoBottom !== '정의되지 않음' && signupPromoBottom !== '') { signupContainerBottom = '

'; } function preroll_signup_top_handler() { trackEvent('프리롤 가입 클릭', '프리롤 가입 상단', document.title); } function preroll_signup_bottom_handler() { trackEvent('프리롤 가입 클릭', '프리롤 가입 하단', document.title);}

'; jQuery("#html5game").replaceWith(notCheerpxBrowser); } game_width = drupalSettings.cmatgame.swfembed.swf.swf_1.width; game_height = drupalSettings.cmatgame.swfembed.swf.swf_1.height; var swfURLObject = drupalSettings.cmatgame.swfembed.swf.u; var swfURLArray = swfURLObject.split("/"); swf_1_game_movie_param = swfURLArray[swfURLArray.length-1]; //cheerpx js var swf_game_url = cmgGetCheerpxUrl()+swfURLArray[swfURLArray.length-1]+'&w='+game_width+'&h='+game_height; newswfiframe = '

'; jQuery("#swfgame").replaceWith(newswfiframe); iframeLoaded(); displayCmgCheerpxLoadingScreen(); } else { game_type = "플래시"; if (typeof isRemoveAdSwfJWPLayer === "정의되지 않음" || !isRemoveAdSwfJWPLayer) { var swf_game_url = jQuery("#swfgame").attr("src"); if (typeof swf_game_url !== 'undefine' && swf_game_url.indexOf("//") === 0) { swf_game_url = window.location.protocol + swf_game_url; } else if (typeof swf_game_url !== 'undefine' && swf_game_url.indexOf("//") > 0) { swf_game_url = swf_game_url.replace("http:", window.location.protocol); } newswfiframe = '

'; jQuery("#swfgame").replaceWith(newswfiframe); iframeLoaded(); var gameInstructions = document.getElementById('game-instructions'); // 게임 지침 필드 앞에 수정 플래시 div를 삽입합니다. if (typeof gameInstructions !== 'undefine' && gameInstructions !== null && typeof gameInstructions.innerHTML !== 'undefine' && gameInstructions.innerHTML !== null) { gameInstructions.innerHTML = '

이 플래시 게임이 컴퓨터에서 작동하지 않으면 다음으로 가세요.여기도와주기 위해.

' + gameInstructions.innerHTML; } } } isRemoveAdSwfJWPLayer = true; } } } jQuery('.game-xp-bar-immerse-button').addClass('enabled'); jQuery('.btn.btn-primary.btn-sm.requestfullscreen').css('display', 'inline-block'); //Deferred js is breaking the display of bigscreen button var deferredbigscreenbtn = setTimeout(function () { if (jQuery('.btn.btn-primary.btn-sm.requestfullscreen').length && !jQuery('.btn.btn-primary.btn-sm.requestfullscreen').is(":visible")) { jQuery('.btn.btn-primary.btn-sm.requestfullscreen').css('display', 'inline-block'); } }, 2000); } } var objpad = new cmg_game_validate(); //check if iframe loaded function iframeLoaded(){ const iframe = document.querySelector(".field-game iframe"); var isDesktop = $('.desktop-layout .game-on-desktop').is(":visible"); if(iframe && isDesktop){ var i = 0; iframe.onload = () => { console.log("iframeLoaded..."); var cmatgame_subscriber = getCookie('cmg_sx'); if (typeof cmatgame_subscriber !== 'undefined' && cmatgame_subscriber !== null) { document.getElementById("html5game").contentWindow.postMessage("valid-subscriber", "*"); } else { document.getElementById("html5game").contentWindow.postMessage("not-subscriber", "*"); } if(i==0){ i++; trackEventNonInteractive("gameplay", "game loaded", location.pathname); } }; } } iframeLoaded(); function iframeLoadedOnMobile(){ const iframe = document.querySelector(".field-game iframe"); if(iframe){ var i = 0; iframe.onload = () => { if(i==0){ i++; trackEventNonInteractive("gameplay", "game loaded", location.pathname); } }; } } var browser = (function () { var test = function (regexp) { return regexp.test(window.navigator.userAgent) } switch (true) { case test(/edg/i): return "Microsoft Edge"; case test(/trident/i): return "Microsoft Internet Explorer"; case test(/firefox|fxios/i): return "Mozilla Firefox"; case test(/opr\//i): return "Opera"; case test(/ucbrowser/i): return "UC Browser"; case test(/samsungbrowser/i): return "Samsung Browser"; case test(/chrome|chromium|criosm|cros/i): return "Google Chrome"; case test(/safari/i): return "Apple Safari"; default: return "Other"; } })(); jQuery(document).ready(function () { if (typeof drupalSettings != "undefined" && typeof drupalSettings.cmatgame != "undefined" && typeof drupalSettings.cmatgame.flash_emulation != "undefined" && drupalSettings.cmatgame.flash_emulation === "2" && ( /mediatek/i.test(navigator.userAgent) || /aarch64/i.test(navigator.userAgent) ) ) { jQuery('html').addClass('mediatek'); } }); cmgAInvD = false; // user profile related variables var is_level_based = 0; var level_offset = 0; var xp_per_level = 10; var flashemulation = ''; var iframed_game_url = ''; var cmatgame_premium_free_game_limit_days = '180'; var fastly_frontend_domain = 'https://www.coolmathgames.com'; var stripe_subscription_free_trial_group_token = 'b2df5a33'; var destination = '/0-block-the-pig'; var userprofile_level_xp = "100,200,250,300,350,400,450,500,550,625,700,775,850,925,1000,1075,1150,1225,1300,1375,1450,1525,1600,1700,1800,1900,2000,2100,2200,2300,2400,2500,2600,2700,2800,2900,3000,3100,3200,3300,3400,3500,3600,3700,3800,3900,4000,4100,4200,4300,4400,4500,4600,4700,4800,4900,5000,5100,5200,5300,5400,5500,5600,5700,5800,5900,6000,6100,6200,6300,6400,6500,6600,6700,6800,6900,7000,7100,7200,7300,7400,7500,7600,7700,7800,7900,8000,8100,8200,8300,8400,8500,8600,8700,8800,8900,9000,9100,9200,10000"; userprofile_level_xpData = userprofile_level_xp.split(","); incrementedTotalPlays = false; lastKeyBoardorMouseActivityTime = Date.now(); workerstatusvar = "notstartedinit"; supportCMGDefault = false; // disable a/b test supportCMGABTest = false; supportCMGABTestImage1 = false; supportCMGABTestImage2 = false; supportCMGABTestImage3 = false; start_full_screen_without_ad = true; // define all the marketing promo values to false if they are not defined before if (typeof watchAdtoUnlockGame == "undefined") { watchAdtoUnlockGame = false; } if (typeof displayAdblockOverlay == "undefined") { displayAdblockOverlay = false; } if (typeof supportCMG == "undefined") { supportCMG = false; } if (typeof premiumAvatarGame == "undefined") { premiumAvatarGame = false; } gamesPlayed = navigator.cookieEnabled ? parseInt(localStorage.getItem('gamesPlayed') || 0) : 0; cmg_stop_truex_promo = ""; truex_overlay_preroll_ad_display = false; premiumAvatarGame = false;//disabling to fix timer count down issue function getGameName() { var url = window.location.href; var lastPart = url.split("/").pop(); return lastPart; } var coep_frame_type = 'crossorigin="use-credentials"'; if (/(Firefox)/.test(navigator.userAgent)) { coep_frame_type = 'allow="cross-origin-isolated"'; } function setIframeHeight(iframe) { if (iframe) { var gamename = getGameName(); if (gamename == "0-chess") { iframe.height = "620px"; } } }; jQuery(function(){ setIframeHeight(document.getElementById('html5game')); }); if (isUserValidFreeUserOrSubscriber()) { var userprofileData = JSON.parse(localStorage.getItem("userprofile")); var levelofcompletedgame = 1; if(userprofileData && typeof userprofileData.mygameslist != "undefined") { for (var i = 0; i < userprofileData.mygameslist.length; i++) { if (userprofileData.mygameslist[i].id == gameId) { var levelbasedCompletedStatus = userprofileData.mygameslist[i].timebasedcompletedSt; var levelofcompletedgame = userprofileData.mygameslist[i].level; } } } } var workerstatusvar = "no"; var count = 0; var myInterval; // Active function chkIdleOnpage() { var userActivityTime = Date.now(); // check if user activity is not there more than 55 min 60000*55 = 3300000 if (userActivityTime - lastKeyBoardorMouseActivityTime > 3300000) { if (typeof(w) != "undefined") { workerstatusvar = "terminated"; w.terminate(); w = undefined; } } else { // May be keyboard is active start new worker settimebased(); } } // Inactive if (!is_level_based) { // check idle time in every 5 min 60000 * 5 = 300000 idleOnPageCheckTimer = setInterval(function () { chkIdleOnpage() }, 300000); } function settimebased() { if (!is_level_based) { jQuery(document).ready(function () { if (navigator.cookieEnabled) { if (isUserValidFreeUserOrSubscriber()) { window.addEventListener("beforeunload", function (e) { console.log("CMGProfileXP: beforeunload of page save nonXPTime in userprofile -- calling saveUserProgress"); saveUserProgress(); }); } if (typeof(Worker) !== "undefined") { if (typeof(w) == "undefined") { w = new Worker("/modules/custom/cmatgame_userprofile/js/userprogress_workers.js"); var timerInterval = 60000; if(typeof xpTimeInterval !== "undefined" && parseInt(xpTimeInterval)) { timerInterval = xpTimeInterval * 1000; } else { xpTimeInterval = 180; timerInterval = xpTimeInterval * 1000; } w.onmessage = function (event) { var userActivityTime = Date.now(); // save userprofile object back to localstorage userprofile = event.data; localStorage.setItem("userprofile", JSON.stringify(userprofile)); if (isUserValidFreeUserOrSubscriber()) { // display user progressbar display_user_profile_progressbar(); //checkTimeBasedGameCompletion checkTimeBasedGameCompletion(gameId); //adding save userprogress back to api server saveUserProgress(); } if(typeof cmg_game_xp_dsp == "function") { cmg_game_xp_dsp(userprofile); } chkIdleOnpage(); }; var userprofile = localStorage.getItem("userprofile"); setTimeout(function () { var userprofile = localStorage.getItem("userprofile"); var currentGameData = searchGamesById(gameId); if (typeof drupalSettings.cmatgame != "undefined" && typeof drupalSettings.cmatgame.swfembed != "undefined" && drupalSettings.cmatgame.swfembed != "" && typeof drupalSettings.cmatgame.flash_emulation != "undefined" && drupalSettings.cmatgame.flash_emulation == 0 ) { //Do nothing here } else if (typeof w != 'undefined' && 'object' == typeof currentGameData && currentGameData.length) { w.postMessage([ gameId, xp_per_level, userprofile, currentGameData, cmatgameSearchGames, userprofile_level_xpData, xpTimeInterval ]); } }, timerInterval); } } } }); } } // Stop timer function stopTimer() { count = 0; if (workerstatusvar == "terminated") { settimebased(); workerstatusvar = "started"; } window.clearInterval(myInterval); } function checkKeyboardOrMouseActivity() { lastKeyBoardorMouseActivityTime = Date.now(); if (!is_level_based) { if (typeof isRemoveAdSwfJWPLayer === "undefined" || !isRemoveAdSwfJWPLayer) { // html 5 game } else { stopTimer(); } } } function startTimer() { // for flash based game check idle time in every 5 min 60000 * 5 = 300000 myInterval = window.setInterval(timerHandler, 30000); } function timerHandler() { count++; // count of flash based game will for 55 rounds if (count == 55) { workerstatusvar = "terminated"; if (typeof w !== 'undefined') { w.terminate(); w = undefined; } } } document.addEventListener("mousemove", checkKeyboardOrMouseActivity, false); document.addEventListener('keydown', checkKeyboardOrMouseActivity, false); document.addEventListener("keypress", checkKeyboardOrMouseActivity, false); document.addEventListener("touchmove", checkKeyboardOrMouseActivity, false); if (!is_level_based) { if (typeof isRemoveAdSwfJWPLayer === "undefined" || !isRemoveAdSwfJWPLayer) { // html 5 game document.addEventListener("visibilitychange", function() { if (document.visibilityState == 'hidden') { //startTimer(); if (typeof idleOnPageCheckTimer !== 'undefined') { clearInterval(idleOnPageCheckTimer); } if (typeof w !== 'undefined') { w.terminate(); w = undefined; workerstatusvar = "terminated"; } } else if (document.visibilityState == 'visible') { stopTimer(); // starts worker. } }, false); } else { // flash game window.addEventListener('focus', stopTimer); window.addEventListener('blur', startTimer); // Check browser minimize document.addEventListener("visibilitychange", function () { if (document.visibilityState == 'hidden') { startTimer(); } else if (document.visibilityState == 'visible') { stopTimer(); } }, false); startTimer(); } } // end of !is_level_based function putSharedObjectsInDB(syncData) { flashStorage = syncData; saveUserProgress(); } isRemoveAdSwfJWPLayer = false; prerollAdDisplayed = false; //use this when switching from mobile view to desktop view and preroll ad was not shown earlier prerollAdStart = ""; prerollAdEnd = ""; window.addEventListener("message", receiveMessage, false); function receiveMessage(event) { var valid_domain_msg = false; if (/coolmathgames\.com|coolmathgames\.local|coolmathgames/.test(event.origin)) { valid_domain_msg = true; } if (valid_domain_msg && event.data == "cmgGameEventStatic") { ga4_trackEvent("cmgGameEventStatic", ); } else if (event.data == "continue-without-big-screen" && jQuery('#big-screen-overlay').length && valid_domain_msg) { // close overlay if (jQuery('#big-screen-overlay').length) { jQuery('#big-screen-overlay').hide(); if (jQuery('#big-screen-truex-overlay').length) { jQuery('#big-screen-truex-overlay').hide(); } } } else if (event.data == "continue-with-login-big-screen" && jQuery('#big-screen-overlay').length && valid_domain_msg) { jQuery('#big-screen-overlay').hide(); if (jQuery('#big-screen-truex-overlay').length) { jQuery('#big-screen-truex-overlay').hide(); } if (drupalSettings.language !== "en"){ window.location = `/${drupalSettings.language}/login?destination=${window.location.pathname}`; } else { window.location = "/login?destination=" + window.location.pathname; } } else if (event.data == "not-available-in-your-area-hexanaut" && jQuery('#big-screen-overlay').length && valid_domain_msg) { jQuery('#big-screen-overlay').hide(); if (jQuery('#big-screen-truex-overlay').length) { jQuery('#big-screen-truex-overlay').hide(); } if (drupalSettings.language !== "en"){ window.location = `/${drupalSettings.language}/0-hexanaut-io?destination=${window.location.pathname}`; } else { window.location = "/0-hexanaut-io?destination=" + window.location.pathname; } } else if (event.data == "not-available-in-your-area-signup" && jQuery('#big-screen-overlay').length && valid_domain_msg) { jQuery('#big-screen-overlay').hide(); if (jQuery('#big-screen-truex-overlay').length) { jQuery('#big-screen-truex-overlay').hide(); } if (drupalSettings.language !== "en"){ window.location = `/${drupalSettings.language}/signup?destination=${window.location.pathname}`; } else { window.location = "/signup?destination=" + window.location.pathname; } } else if (event.data == "continue-premium-big-screen" && (jQuery('#big-screen-overlay').length || jQuery('#pr-profile-screen-overlay').length) && valid_domain_msg) { jQuery('#big-screen-overlay').hide(); jQuery('#pr-profile-screen-overlay').hide(); if (jQuery('#big-screen-truex-overlay').length) { jQuery('#big-screen-truex-overlay').hide(); } window.location.reload(); } else if (event.data == "big-screen-profile-customize" && (jQuery('#big-screen-overlay').length || jQuery('#pr-profile-screen-overlay').length) && valid_domain_msg) { jQuery('#big-screen-overlay').hide(); jQuery('#pr-profile-screen-overlay').hide(); if (jQuery('#big-screen-truex-overlay').length) { jQuery('#big-screen-truex-overlay').hide(); } if (getCookie('cmg_fx') !== null) { window.location = '/profile/' + getCookie('cmg_fx').toLowerCase() + '/edit'; } } else if (event.data == "big-screen-premium-benefits" && jQuery('#big-screen-overlay').length && valid_domain_msg) { jQuery('#big-screen-overlay').hide(); if (jQuery('#big-screen-truex-overlay').length) { jQuery('#big-screen-truex-overlay').hide(); } if (getCookie('cmg_fx') !== null) { window.location = '/premium-benefits'; } } else if (event.data == "keypress-from-game") { checkKeyboardOrMouseActivity(); } else if (event.origin === "https://copterroyale.coolmathgames.com" || event.origin === "https://copterroyale2.coolmathgames.com" || event.origin === "https://powerline.coolmathgames.com") { var eventObject = JSON.parse(event.data); if (eventObject.eventType == "gameEvent") { cmgGameEvent(eventObject.key, eventObject.value); } else if (eventObject.eventType == "dataEvent") { cmgDataEvent(eventObject.key, eventObject.value); } } else if (event.origin == 'https://rps-frontend.coolmathgames.com') { var eventObject = JSON.parse(event.data); if (eventObject.eventType == "gameEvent") { cmgGameEvent("Rockpaperscissors "+eventObject.key, eventObject.value); } else if (eventObject.eventType == "dataEvent") { cmgDataEvent("Rockpaperscissors "+eventObject.key, eventObject.value); } } else if (event.origin == 'https://hangman-backend.coolmathgames.com' || event.origin == 'https://hangman-frontend.coolmathgames.com' || event.origin == 'https://hangmanqa-frontend.coolmathgames.com' || event.origin == 'https://hangmanqa.coolmathgames.com') { var eventObject = JSON.parse(event.data); if (eventObject.eventType == "gameEvent") { cmgGameEvent("Hangman "+eventObject.key, eventObject.value); } else if (eventObject.eventType == "dataEvent") { cmgDataEvent("Hangman "+eventObject.key, eventObject.value); } } else if (event.origin == 'https://wordrace-4inrow-stage.coolmathgames.com' || event.origin == 'https://wordrace-4inrow.coolmathgames.com' ) { var eventObject = JSON.parse(event.data); var eventGame = "wordrace"; if (/0-four-in-a-row/.test(location.pathname)) { eventGame = "fourinarow"; } if (eventObject.eventType == "gameEvent") { cmgGameEvent(eventGame+" "+eventObject.key, eventObject.value); } else if (eventObject.eventType == "dataEvent") { cmgDataEvent(eventGame+" "+eventObject.key, eventObject.value); } } else if (event.origin == 'https://hexanaut.coolmathgames.com') { var eventObject = JSON.parse(event.data); var eventGame = "hexanaut"; if (eventObject.eventType == "gameEvent") { cmgGameEvent(eventGame+" "+eventObject.key, eventObject.value); } else if (eventObject.eventType == "dataEvent") { cmgDataEvent(eventGame+" "+eventObject.key, eventObject.value); } } else if (event.origin == 'https://cheerpx.coolmathgames.com' || event.origin == 'https://cheerpx-prod.coolmathgames.com') { //close loading screen closeCmgCheerpxLoadingScreen(); // Remove Narrow screen loading closeCmgCheerpxLoadingScreenResized(); } else if (event.origin == 'https://www.coolmath-games.com' || event.origin != 'https://d8-dev.coolmathgames.com') { if (event.data.eventType == "syncEventPut") { syncData = event.data.syncJSON; putSharedObjectsInDB(syncData); } if (event.data.eventType == "syncEventGet") { if (typeof flashStorageFromDB != "undefined") { // restoring flash shared objects from DB for (var i = 0; i < flashStorageFromDB.length; i++) { flashStorageFromDB[i].swfdata = decodeURI(flashStorageFromDB[i].swfdata); } document.getElementById('swfgame').contentWindow.postMessage({ 'eventType': 'syncEventGet', 'soData': flashStorageFromDB }, '*'); } else { document.getElementById('swfgame').contentWindow.postMessage({ 'eventType': 'gamePlay' }, '*'); } } } else { return; } } // var signupPromoTop = 'Join to Play Ad-Free'; var signupPromoBottom = 'Join to Skip All Ads'; if (typeof signupPromoTop !== 'undefined' && signupPromoTop !== '') { signupContainerTop = '

' + signupPromoTop + '

'; } else { signupPromoTop = ''; signupContainerTop = '

' + signupPromoTop + '

'; } if (typeof signupPromoBottom !== '정의되지 않음' && signupPromoBottom !== '') { signupContainerBottom = '

' + signupPromoBottom + '

'; } else { signupPromoBottom = ''; signupContainerBottom = '

' + signupPromoBottom + '

'; } function preroll_signup_top_handler() { trackEvent('프리롤 가입 클릭', '프리롤 가입 상단', document.title); } function preroll_signup_bottom_handler() { trackEvent('프리롤 가입 클릭', '프리롤 가입 하단', document.title); } // Experiments.js에서 이 변수 ​​signUpURLABTest를 정의합니다. var cmg_upg_days_limit = 180; var user_dst = window.location.pathname; user_dst = user_dst.replace("\/", ""); if (window.location.host !== 'cmatgame.local') { if (typeof signUpURL === '정의되지 않음' || signUpURL === '') { signUpURL = '/premium-access/ b2df5a33?origin=' + user_dst; } else { signUpURL = signUpURL + '?origin=' + user_dst; } } else if (signUpURLABTest 유형 === "정의되지 않음" || signUpURLABTest === null) { signUpURL = 'https://' + window.location.hostname + '/premium-access/ b2df5a33?origin=' + user_dst ; } else { signUpURL = signUpURLABTest; } function subscribe_promo_handler() { if (typeof freeTrialUser !== 'undefine' && freeTrialUser) { trackEvent('프리미엄 구독' + subscriberLeg, '구독 오버레이 클릭됨', userPlayedGames); trackGoalVirtualPV('/virtual/subscription-overlay-click'); } 반품; } 함수 subscribeSignUpUrl() { var user_played_games = ''; var zeroFreeGamesLeftUsers = localStorage.getItem("zeroFreeGamesLeftUsers"); if (userPlayedGames 유형 !== '정의되지 않음' && userPlayedGames) { user_played_games = "upg=" + userPlayedGames; } else { user_played_games = "upg=0"; } if (zeroFreeGamesLeftUsers !== null && user_played_games !== '') { user_played_games = user_played_games + '&zfg=' + zeroFreeGamesLeftUsers; } else if (zeroFreeGamesLeftUsers !== null) { user_played_games = 'zfg=' + zeroFreeGamesLeftUsers; } if (signUpURL 유형 !== '정의되지 않음' && signUpURL !== null && signUpURL.indexOf('upg') === -1) { if (signUpURL.indexOf('?random_true') > -1) { signUpURL = signUpURL.replace('?random_true', ''); } if (signUpURL.indexOf('?') > -1) { signUpURL = signUpURL + '&' + user_played_games; } else { signUpURL = signUpURL + '?' + user_played_games; } } } function updateMyGamesTimeSpent(gameId) { var userActivityTime = Date.now(); if (currentTimeInterval >= 2) { currentTimeInterval = 0; if (isUserValidFreeUserOrSubscriber()) { // 구독자에 대해서만 MyGames 저장 saveMyGames(gameId, 0, 1); currentTime = userActivityTime; } } else { currentTimeInterval = currentTimeInterval + 1; saveUserProgress(); } } function updateMyGamesTimeSpent1(gameId) { if (isUserValidFreeUserOrSubscriber()) { // 구독자에 대해서만 MyGames 저장 if (userActivityTime - lastKeyBoardorMouseActivityTime <= 60000) { saveMyGames(gameId, 0, 1); } } } function updateMyGamesTimeSpentLevelBase(gameId, level) { if (isUserValidFreeUserOrSubscriber()) { // 구독자에 대해서만 MyGames 저장 saveMyGames(gameId, 1, level); } } if (is_level_based) { var userActivityTime = Date.now(); // 레벨 기반 게임의 경우. 사용자 활동이 55분 이상 지속되지 않았는지 확인합니다. 60000*55 = 3300000 if (userActivityTime - lastKeyBoardorMouseActivityTime <= 3300000) { var objGameNode = {}; objGameNode[gameId] = "아니요"; var localgamestrate = "storagelocal-" + gameId + "-storagelocal"; localStorage.setItem("runoncestarted", JSON.stringify(objGameNode)); localStorage.setItem(localgamestrate, "no"); updateMyGamesTimeSpentLevelBase(gameId, levelofcompletedgame) } } function cmgGetCheerpxUrl() { var cheatpxUrl = 'https://cheerpx-prod.coolmathgames.com/cheerpx.html?f='; if (location.host != "www.coolmathgames.com" && !/(Firefox)/.test(navigator.userAgent)) { cheatpxUrl = 'https://cheerpx.coolmathgames.com/cheerpx.html?f=' ; } 응원xUrl을 반환; } function displayCmgCheerpxLoadingScreen() { jQuery("#swfgame").parent().before('

플래시 게임이 로드 중입니다.
평소보다 시간이 더 걸릴 수 있습니다

'); } // 좁은 화면 로딩 화면 함수 displayCmgCheerpxLoadingScreenResize(){ jQuery("#swfgame").parent().before('

플래시 게임이 로드 중입니다.
평소보다 시간이 더 걸릴 수 있습니다

'); } function closeCmgCheerpxLoadingScreen() { jQuery("#cmg-cheerpxloading-screen").remove(); } // 좁은 화면 로딩 화면 기능 제거 closeCmgCheerpxLoadingScreenResize(){ if ($("#cmg-cheerpxloading-screen-resize").length > 0){ jQuery("#cmg-cheerpxloading-screen-resize").remove( ); } } function cmgRemoveMadg() { if(adsManager 유형 != "정의되지 않음" && AdsManager) { AdsManager.destroy(); } jQuery("#afg_container").hide(); jQuery("#afg_preloader").hide(); jQuery("#continue-container").hide(); jQuery(".field-game").show(); jQuery(".user-controls").attr("style", "display: flex !important"); // 사용자 컨트롤 표시 jQuery(".falseBtn").remove(); if(window.document.getElementById('swfgame') != null) { window.document.getElementById('swfgame').setAttribute("tabindex","0"); window.document.getElementById('swfgame').focus(); } else if(window.parent.document.getElementById('html5game') != null){ window.document.getElementById('html5game').setAttribute("tabindex","0"); window.document.getElementById('html5game').focus(); } } /* * 전면 광고 타이머 함수 */ function gameInterstitialAdTimerAction() { gameInterstitialAdTimerDone = true; ClearGameInterstitialAdTimer(); } functionclearGameInterstitialAdTimer() {clearTimeout(gameInterstitialAdTimer); gameInterstitialAdTimer = null; } 함수 getGameData(arr){ let gameData = []; for(let {nid} of arr){ let game = searchGamesById(nid)[0]; if(게임 유형 != "정의되지 않음" || 게임 != ""){ gameData.push(게임); } } 게임데이터를 반환합니다. } 함수 generateTopPicksHTML(games){ let tempHTML = ''; for(게임 중의 게임){ let gameVideo = ''; if(typeof game.vdo != "정의되지 않음" && game.vdo != ""){ gameVideo = `

` } tempHTML += `

${gameVideo} ${game.title}

`; } tempHTML을 반환합니다; } 함수 cmg_discover_games_let_off() { var myGames = cmg_get_lpg(10); if(myGames.length > 0 && typeof isMobile != "undefine" && isMobile){ myGames = myGames.filter(game => game.mpv == "1"); } if(typeof myGames == "정의되지 않음" || myGames == "" || myGames.length == 0){ //return false; // 최고 추천 게임 표시 let baseURL = location.origin + '/cmg/toppicks.json'; $.getJSON(baseURL, function(data){ if(typeof 데이터 != "정의되지 않음"){ var topPicksGames = getGameData(data); let topPickHTML = ''; if(typeof isMobile != "정의되지 않음" && isMobile){ var mobileTopPicksGames = topPicksGames.filter(game => game.mpv == "1"); if(mobileTopPicksGames.length > 12){ mobileTopPicksGames.splice(12); } topPickHTML = generateTopPicksHTML(mobileTopPicksGames); } else { topPicksGames.splice( 12); topPickHTML = generateTopPicksHTML(topPicksGames); } jQuery("#cmg_pickup_block").html(topPickHTML).prev(".title").text("Coolmath 최고 추천"); jQuery("#cmg_pickup_block").closest (".cmg-pickup-block").addClass("cmg-top-picks").show(); } }) } else { let pickupBlockHTML = ''; function RemoveDuplicateGames(array, key) { var check = new Set(); return array.filter(obj => !check.has(obj[key]) && check.add(obj[key])); } constfilteredGames = RemoveDuplicateGames(myGames, 'id'); for(filteredGames의 게임){ let gameVideo = ''; if(game.vdo && game.vdo != ""){ gameVideo = `

` } let gamePercent = ''; if(game.ilb == "1"){ gamePercent = Math.floor((game.level / game.ml) * 100); } else { gamePercent = Math.floor((game.time / game.mta) * 100); }pickupBlockHTML += `

${gameVideo} ${game.title}

`; } if(filteredGames.length <= 3){ PickupBlockHTML += `

무작위 게임 플레이

`; } pickupBlockHTML을 반환합니다; } } jQuery(document).ready(function(){ if(jQuery("#cmg_pickup_block").length > 0){ const cmg_left_off_html = cmg_discover_games_let_off(); if(cmg_left_off_html){ jQuery("#cmg_pickup_block").html( cmg_left_off_html).closest(".cmg-pickup-block").show(); } } }); /* * 프리롤 제거 및 게임 표시 제거. 이전 함수 이름: RemovePrerollAndDisplayGame(). */ var cmgRemovePadgInvoked = false; function cmatgame_premium_subscription_game_display() { var cmatgame_subscriber = getCookie('cmg_sx'); var validSubscriber = false; if (typeof cmatgame_subscriber !== '정의되지 않음' && cmatgame_subscriber !== null) { validSubscriber = true; } var cmatgame_free_user = getCookie('cmg_fx'); var validFreeUser = false; if (typeof cmatgame_free_user !== '정의되지 않음' && cmatgame_free_user !== null) { validFreeUser = true; } freeGamesExceeded = true; if (validSubscriber) {retrieveUserProgress(); objpad.cmg_check_padg(); jQuery(문서).ready(function () { $('.game-xp-bar-immerse-button').addClass('enabled'); jQuery('.btn.btn-primary.btn-sm.requestfullscreen' ).css('display', 'inline-block'); immersive_mode_display_controller(); }); } else if (getCookie('cmg_schwl') !== null || cmg_no_ads 유형 !== '정의되지 않음' || (! validSubscriber && schoolHours || (!schoolHours && !targetStateUser) || (!schoolHours && targetStateUser && getCookie( 'cmg_active_anonymous_user') !== null))) { // TODO 게임 표시 objpad.cmg_check_padg(); jQuery(문서).ready(function () { $('.game-xp-bar-immerse-button').addClass('enabled'); jQuery('.btn.btn-primary.btn-sm.requestfullscreen' ).css('display', 'inline-block'); }); if (!/0-chess/.test(window.location.pathname)) { } } else if (!validSubscriber && !schoolHours && targetStateUser && getCookie('cmg_active_anonymous_user') === null && getCookie('cmg_editor') = == null) { // 사용자가 Google에서 온 경우 구독 페이월을 표시하지 않음 var ref = document.referrer; // 이번 달에 사용자가 플레이한 게임 수를 계산합니다. userPlayedGames = 0; var userFreeGameList = []; var freeGameNid = 711; if (sessionStorage.getItem("userFreeGameList") !== null && navigator.cookieEnabled) { userFreeGameList = JSON.parse(sessionStorage.getItem("userFreeGameList")); } if ((localStorage.getItem("userPlayedGames") == null || getCookie('cmg_upg') === null) && freeGameLimit !== 0 && navigator.cookieEnabled) { userPlayedGames = 1; localStorage.setItem("userPlayedGames", userPlayedGames); setCookie('cmg_upg', 'true', cmg_upg_days_limit * 24 * 60 * 60 * 1000); userFreeGameList = [freeGameNid]; sessionStorage.setItem("userFreeGameList", JSON.stringify(userFreeGameList)); objpad.cmg_check_padg(); } else { if (localStorage.getItem("userPlayedGames") !== null && getCookie('cmg_upg') !== null) { userPlayedGames =parseInt(localStorage.getItem("userPlayedGames")); } else { userPlayedGames = 0; setCookie('cmg_upg', 'true', cmg_upg_days_limit * 24 * 60 * 60 * 1000); } if (freeGameLimit != 0 && userPlayedGames < freeGameLimit && userFreeGameList.indexOf(freeGameNid) === -1) { userPlayedGames ++; freeGamesExceeded = 거짓; if (userFreeGameList.length > 0) { userFreeGameList = userFreeGameList.concat(freeGameNid); } else { userFreeGameList = [freeGameNid]; } localStorage.setItem("userPlayedGames", userPlayedGames); sessionStorage.setItem("userFreeGameList", JSON.stringify(userFreeGameList)); } else { freeGamesExceeded = true; } var validReferer = false; var validGameSession = false; if (userFreeGameList.indexOf(freeGameNid) > -1) { validGameSession = true; } if (ref.match("google.com") !== null || ref.match("yahoo.com") !== null || ref.match("bing.com") !== null) {validReferer = true; } 구독SignUpUrl(); if (! validReferer && userPlayedGames >= freeGameLimit && ! validGameSession) {clearInterval(intervalId); jQuery("#afg_container").remove(); jQuery(".game-instructions").remove(); var 이미SubscriberText = '

이미 구독자이신가요?로그인

'; if (getCookie('cmg_l') != null) { 이미SubscriberText = ''; } var headLine = '

계속 플레이하려면 가입하세요

'; if (getCookie('cmg_l') != null && getCookie('cmg_sx') != null) { headLine = '

계속 플레이하려면 지금 구독하세요

'; } jQuery(".field-game").html('

' + 헤드라인 + '

세계 최고의 게임 컬렉션
논리, 추론 및 재미를 위해.지금 구독하세요' + 이미SubscriberText + '

'); jQuery("#videoplayer").remove(); } else { objpad.cmg_check_padg(); } } } } function UnlockAllLevels() { trackEvent('모든 레벨 잠금 해제 카테고리', '클릭한 모든 레벨 잠금 해제 버튼', document.title); 모든레벨 = '

레벨 잠금 해제

'; jQuery("#subscriber-banner").replaceWith(alllevels); var cmgorigindomain = /coolmath-games/; var cmgtargetdomain = window.location.protocol + 'www.coolmath-games.com'; if (/edit-stage/.test(window.location.hostname)) { cmgtargetdomain = window.location.protocol + 'edit-stage.coolmath-games.com'; } else if (/d8-dev/.test(window.location.hostname)) { cmgtargetdomain = window.location.protocol + 'stage.coolmath-games.com'; } else if (/cmatgame.local|dev.coolmath.games.com/.test(window.location.hostname)) { cmgtargetdomain = window.location.protocol + 'stage.coolmath-games.com'; } if (game_type == "html5") { document.getElementById("html5game").contentWindow.unlockAllLevels(); } else { if (cmgorigindomain.test(window.location.hostname)) { document.getElementById("swfObjID").unlockAllLevels(); } else { var recievergameFrame = document.getElementById("swfgame"); gDate = 새로운 날짜(); recievergameFrame.contentWindow.postMessage('unlockAllLevels', cmgtargetdomain); // TODO - 대상 원점 입력 } } } function addSubToUnlockGAEvent() { trackEvent('모든 레벨 잠금 해제 카테고리', '클릭한 잠금 해제 버튼 구독', document.title); trackGoalVirtualPV('/virtual/unlock-button-click'); window.location.href = "https://www.coolmathgames.com/signup/ b2df5a33?origin= /0-block-the-pig&stual=1" } var immersive_mode_enabled = false; //BS: 1. 싱글톤. 페이지 로드 시 전체 화면 핸들러 연결 function immersive_mode_display_controller() { if (!immersive_mode_enabled) { immersive_mode_enabled = true; immersive_mode_display(); } } var bigScreenTimer = null; bigScreenActive = 거짓; function cmgbsoptclose() { if (jQuery('#big-screen-truex-overlay').length) { jQuery('#big-screen-truex-overlay').hide(); } } popover_login_click = false; 함수 cmg_display_login_page() { popover_login_click = true; if (jQuery('#popover' + gameId).length) { jQuery('#popover' + gameId).remove(); immerse_hover_on = 0; } window.location = "/login?destination=" + window.location.pathname } function display_cmg_overlay_signupform(variant) { if (jQuery('#popover' + gameId).length) { jQuery('#popover' + gameId). 제거하다(); immerse_hover_on = 0; } if ((getCookie('cmg_sx') === null )) { myStopFunction(); } if (유형 변형 === '정의되지 않음' || 변형 === '') { 변형 = '/16'; } if (cmg_stop_truex_promo !== '' && cmg_stop_truex_promo === 'yes' && jQuery('#big-screen-overlay').length) { jQuery('#big-screen-overlay').show(); } else if (cmg_stop_truex_promo !== '' && cmg_stop_truex_promo === 'yes') { var big_screen_url = ''; if (getCookie('cmg_fx') === null) { if (drupalSettings.언어 == 'en') { big_screen_url = '/premium-access/6ea95de6' + 변형 + '?ts='+new Date(). getTime();//BSWOJ 무계획 } else { big_screen_url = '/'+drupalSettings.언어+'/premium-access/6ea95de6' + 변형 + '?ts='+new Date().getTime();//BSWOJ anon 계획 } } else { if (drupalSettings.언어 == 'en') { big_screen_url = '/profile/premium-access/e180e28d' + 변형 + '?ts=' + new Date().getTime(); // BSWOJ 로그인 사용자 계획 } else { big_screen_url = '/'+drupalSettings.언어+'/profile/premium-access/e180e28d' + 변형 + '?ts=' + new Date().getTime(); } } if (변종 == '감사합니다') { if (drupalSettings.언어 == 'en') { big_screen_url = '/signup/thank-you/overlay?ts=1596827222&src=wc&origin=/premium-access/1bb008bd/14b&sp =0&cmgtypl=1bb008bd&cmgovly=1'; } else { big_screen_url = '/'+drupalSettings.언어+'/signup/thank-you/overlay?ts=1596827222&src=wc&origin=/premium-access/1bb008bd/14b&sp=0&cmgtypl=1bb008bd&cmgovly=1'; } } var ov_css = 'style="display:none; 위치: 고정; z-index: 100000; 왼쪽: 0; 위쪽: 0; 너비: 100%; 높이: 100%; 오버플로: 자동; 배경색: rgb (0,0,0); 배경색: rgba(0,0,0,0.4);" 최소 높이="1040px"'; var ovc_css = 'style="margin: 자동; 패딩: 10px; 너비: 850px;" 최소 높이="540px"'; var iframe_overlay = '

';//이 iframe/메시지를 올바른 위치에 추가하세요. jQuery('.global-wrapper').before(iframe_overlay); // TODO jQuery('#big_screen_iframe').css('height', '800px'); jQuery('#big-screen-overlay').fadeIn(1000); jQuery('.big-screen-signup-container .btn-close').on('click', function (e) { e.preventDefault(); jQuery('#big-screen-overlay').hide() ; }); } else { var big_screen_url = ''; if (getCookie('cmg_fx') === null) { if (drupalSettings.언어 == 'en') { big_screen_url = '/premium-access/849ef809' + 변형 + '?ts=' + 새 날짜(). getTime(); // BSWOJ 익명 계획 } else { big_screen_url = '/'+drupalSettings.언어+'/premium-access/849ef809' + 변형 + '?ts=' + new Date().getTime(); // BSWOJ 익명 계획 } } else { if (drupalSettings.언어 == 'en') { big_screen_url = '/profile/premium-access/e180e28d' + 변형 + '?ts=' + new Date().getTime() ; // BSWOJ 로그인 사용자 계획 } else { big_screen_url = '/'+drupalSettings.언어+'/profile/premium-access/e180e28d' + 변형 + '?ts=' + new Date().getTime(); // BSWOJ 로그인 사용자 계획 } } if (variant == 'thankyou') { if (drupalSettings.언어 == 'en') { big_screen_url = '/signup/thank-you/overlay?ts=1596827222&src=wc&origin= /premium-access/849ef809/14b&sp=0&cmgtypl=1bb008bd&cmgovly=1'; } else { big_screen_url = '/'+drupalSettings.언어+'/signup/thank-you/overlay?ts=1596827222&src=wc&origin=/premium-access/849ef809/14b&sp=0&cmgtypl=1bb008bd&cmgovly=1'; } } if (/coolmathgames/.test(location.host)) { } var ov_css = 'style="display:none; 위치: 고정; z-index: 100000; 왼쪽: 0; 위쪽: 0; 너비: 100% ; 높이: 100%; 오버플로: 자동; 배경색: rgb(0,0,0); 배경색: rgba(0,0,0,0.4);" 최소 높이="1040px"'; var ovc_css = 'style="margin: 자동; 패딩: 10px; 너비: 850px;" 최소 높이="540px"'; var iframe_overlay = '

'; // 이동해야 하는 올바른 위치에 이 iframe을 추가합니다. jQuery('.global-wrapper').before(iframe_overlay); // TODO jQuery('#big_screen_iframe').css('height', '800px'); jQuery('#big-screen-overlay').fadeIn(1000); jQuery('.big-screen-signup-container .btn-close').on('click', function (e) { e.preventDefault(); jQuery('#big-screen-overlay').hide() ; }); } } function immersive_mode_exit_handler(variant) { start_full_screen_without_ad = false;//1번째 시도 후 광고 없음 bigScreenActive = false; if (getCookie('cmg_sx') === null ) { // 사용자를 가입 페이지로 리디렉션합니다. if (jQuery.fullscreen.isFullScreen()) { jQuery.fullscreen.exit(); } if (cmg_stop_truex_promo !== '' && cmg_stop_truex_promo === 'yes') { display_cmg_overlay_signupform(variant); } } else if (getCookie('cmg_sx') === null ) { myTimerAction(); } if (bigScreenTimer) {clearTimeout(bigScreenTimer); bigScreenTimer = null; } } function bigScreenTimerAction() { if (typeof bigScreenActive !== 'undefine' && bigScreenActive) {clearTimeout(bigScreenTimer); bigScreenTimer = null; } } var immerse_hover_on = 0; var immerse_hover_in = 0; var big_screen_msg_on = 0; function immersive_fullscreenButtonText() { var fullscreenButtonText = "새로운 프리미엄 기능! 지금 무료로 사용해 보세요"; if ((getCookie('cmg_sx') !== null )) { fullscreenButtonText = "새로운 프리미엄 기능! 지금 사용해 보세요!"; } fullscreenButtonText를 반환합니다. } var cmg_bs_popover_prefix = '

30초 광고 후 큰 화면 재생

'); myStopFunction(); trueXTimer = setTimeout(function () { jQuery('#big-screen-truex-header-text').css('배경색', '#131B29').css('padding-top', '14px') .html('

계속하려면 이 광고와 상호작용하세요.

'); // .css('margin-top', '150px'); }, 25 * 1000); }); truexAd.onCredit(function (engagement) { trackEvent('BigScreen-TrueX-Promo', '스폰서 동영상 보기: TrueX 광고 크레딧', document.title); jQuery('#big-screen-truex-header-text') .css('배경색', '#131B29').css('padding-top', '14px').html('

'); document.getElementById("truex-bigscreen-activate-id").onclick = function () { event.preventDefault(); if (typeof bigScreenActive === '정의되지 않음' || typeof bigScreenActive !== '정의되지 않음' && !bigScreenActive) { jQuery('#big-screen-signup-container-id').html(""); jQuery('#big-screen-truex-overlay').remove(); cmg_start_game_full_screen('truex'); } } }); truexAd.onClose(function (activity) { // 사용자가 광고 단위를 닫았습니다. trackEvent('BigScreen-TrueX-Promo', '스폰서 동영상 보기: TrueX Ad Closed', document.title); ContainerClose(); requestTrueXAdsAndDisplay(client) ; }); truexAd.onFinish(function (activity) { // 사용자가 광고를 종료했습니다. trackEvent('BigScreen-TrueX-Promo', '스폰서 동영상 보기: TrueX Ad Finished', document.title); jQuery('#big-screen -signup-container-id').html(""); jQuery('#big-screen-truex-overlay').remove(); cmg_start_game_full_screen("truex"); }); truexAd.onMessage(function (payload) { // log("onMessage = " + payload); }); // 옵트인 클릭 이벤트 처리 // DOM에 TrueX 옵트인 추가 if (jQuery("#cmg-big-screen-truex-activity").length) { var truex_container = document.getElementById("cmg-big- 화면-truex-활동"); document.getElementById("cmg-big-screen-truex-activity").onclick = function () { event.preventDefault(); trackEvent('BigScreen-TrueX-Promo', '스폰서 동영상 보기: 버튼 클릭', document.title); jQuery('.big-screen-options-container').hide(); if (truex_ad_available && typeof client !== 'undefine') { // BigScreen-TrueX-Promo trackEvent('BigScreen-TrueX-Promo', '스폰서 동영상 보기: TrueX Ad Loading', document.title); client.loadActivityIntoContainer(truexAd, 'big-screen-signup-container-id', { 너비: "960px", 높이: "540px" }); } else { truex_overlay_preroll_ad_display = true; show_big_screen_preroll_ad(); trackEvent('BigScreen-TrueX-Promo', '스폰서 동영상 보기: 프리롤 광고 로드', document.title); } }; } // cmg-big-screen-truex-signup if (jQuery("#cmg-big-screen-truex-signup").length) { document.getElementById("cmg-big-screen-truex-signup"). onclick = function () { event.preventDefault(); jQuery('#big-screen-truex-overlay').remove(); display_cmg_overlay_signupform(); }; } } 함수 truex_preroll_display_handler() { event.preventDefault(); trackEvent('BigScreen-TrueX-Promo', '스폰서 동영상 보기: 버튼 클릭', document.title); jQuery('.big-screen-options-container').hide(); if (truex_ad_available && (typeof client !== 'undefine' || cmg_truex_client != null) ) { // BigScreen-TrueX-Promo if (typeof client == "undefine") { client = cmg_truex_client; truexAd = cmg_truexAd; } trackEvent('BigScreen-TrueX-Promo', '스폰서 동영상 보기: TrueX 광고 로드', document.title); client.loadActivityIntoContainer(truexAd, 'big-screen-signup-container-id', { 너비: "960px", 높이: "540px" }); } else { truex_overlay_preroll_ad_display = true; show_big_screen_preroll_ad(); trackEvent('BigScreen-TrueX-Promo', '스폰서 동영상 보기: 프리롤 광고 로드', document.title); } } function ContainerClose() { // log("containerClose가 호출되었습니다."); } function log(msg) { console.log("CMG [%s] - %s", new Date().toLocaleTimeString(), msg); } cmg_truex_promo_events_add = 0; function display_big_screen_truex_options_overlay() { // 옵션 해시를 사용하여 trueX 광고 클라이언트 초기화 trackEvent('BigScreen-TrueX-Promo', 'Bigscreen 버튼 클릭', document.title); if (getCookie('cmg_sx') !== null || getCookie('cmg_editor') !== null ) { event.preventDefault(); cmg_start_game_full_screen('truex'); } else { network_user_id = getCookie('_ga'); if (typeof network_user_id !== '정의되지 않음' && network_user_id !== '') { network_user_id = network_user_id.replace('GA', 'cmg').replaceAll("\.", ""); } // TRUEX 테스트 해시 // truex_options = {'network_user_id': network_user_id, 'partner_config_hash': '83f879b26797c723882473d6435e6361c105d86b'}; truex_options = { 'network_user_id': network_user_id, 'partner_config_hash': '375f2f2b728700cd991bb24601b3841c98375886' }; if (typeof truex !== '정의되지 않음') { truex.client(truex_options, function (클라이언트) { requestTrueXAdsAndDisplay(client); }); } var ov_css = ' style="display:none; 위치: 고정; z-index: 1000; 왼쪽: 0; 위쪽: 0; 너비: 100%; 높이: 100%; 배경색: rgb(0,0, 0); 배경색: rgba(0,0,0,0.7);" 최소 높이="1040px" '; var ovc_css = ' '; var ovc_css_id = ' style="margin: 자동; margin-top: 150px; 너비: 960px; " '; var truex_css = ' '; var truex_options1 = "

빅 스크린 모드에서 이 게임을 플레이하려면

"; //cmg_country 쿠키 확인 var validCountry = true; if(getCookie('cmg_country') !== null) { var cmgCList = /us|ca|au|gb|pr|ie|nz/; var urCountry = getCookie ('cmg_country'); if(!cmgCList.test(urCountry)) { validCountry = false; } } var truex_options2 = "

스폰서 동영상 보기

"; //var truex_optionsOR = "

"; var truex_options3 = "

"; if (getCookie("cmg_sac") == "no" || !validCountry){ // truex_optionsOR = ""; truex_options3 = ""; } var truex_options4 = "

"; var truex_options_prefix = '

'; var truex_options_suffix = '

'; truex_options = truex_options_prefix + truex_options1 + truex_options2 + truex_options3 + truex_options4 + truex_options_suffix; var truex_options_heading = '

' + '

'; var preroll_container = '

' + '

' + '

'; jQuery('.global-wrapper').before(bs_truex_options); jQuery('#big_screen_iframe').css('높이', '800px'); jQuery('.big-screen-options-container').show(); jQuery('#big-screen-truex-overlay').fadeIn(1000); jQuery('.big-screen-options-container .btn-close').on('click', function (e) { e.preventDefault(); jQuery('#big-screen-truex-overlay').hide (); }); jQuery('#cmg-big-screen-truex-promo-close').on('click', function (e) { e.preventDefault(); jQuery('#big-screen-truex-overlay').hide (); }); } } function show_big_screen_preroll_ad() { event.preventDefault(); jQuery('#big-screen-truex-header-text').css('padding-top', '14px').html("

"); jQuery('.big-screen-options-container').hide(); var cmatgame_subscriber = getCookie('cmg_sx'); var validSubscriber = false; if (typeof cmatgame_subscriber !== '정의되지 않음' && cmatgame_subscriber != = null) { validSubscriber = true; } // 프리롤 광고 var prerollUrls = /0\-testing/; if (!validSubscriber) { // 프리롤 광고 표시 window.scrollTo(0, 0); var modal = document.getElementById( 'big-screen-preroll-container'); // modal.style.display = 'block'; // 새로 고침 타이머 지우기 if (typeofrefreshTimer !== "undefine") {clearTimeout(refreshTimer);refreshTimer = null; } var adTagUrl = 'https://pubads.g.doubleclick.net/gampad/ads?iu=/137548614/1023174/71134/1023174-71134-video&description_url=https%3A%2F%2Fwww.coolmathgames.com%2F&env=vp&impl =s&correlator=&tfcd=0&npa=0&gdfp_req=1&output=vast&sz=640x480&unviewed_position_start=1'; if (typeof window.PW_CMG != "정의되지 않음") { var AuctionCallback = function (displayAds, videoUrl) { application = new Application(displayAds, videoUrl) ; }; window.PW_CMG.startAuction(auctionCallback); } else { // 광고 차단 애플리케이션 = new Application(false, adTagUrl); } bs_preroll_timer = 15; bs_preroll_intervalId = setInterval(function () { bs_preroll_timer --; jQuery('#big-screen-truex-header-text').html('

'); document.getElementById("truex-bigscreen-activate-id").onclick = function () { event.preventDefault(); $('a.requestfullscreen>span.big-screen-popover-span').html('큰 화면 재생'); if (typeof bigScreenActive === '정의되지 않음' || typeof bigScreenActive !== '정의되지 않음' && !bigScreenActive) { jQuery('#big-screen-signup-container-id').html(""); jQuery('#big-screen-truex-overlay').remove(); start_full_screen_without_ad = false; cmg_start_game_full_screen('truex'); } }clearInterval(bs_preroll_intervalId); } }, 1000); } } // TRUEX 종료 함수 cmg_start_game_full_screen(cmgsource) { myStopFunction(); // 광고 새로고침 없음 bigScreenActive = true; if (cmg_stop_truex_promo !== '' && cmg_stop_truex_promo === '예') { cmgbsoptclose(); bigScreenTimer = setTimeout(function () { bigScreenTimerAction(); }, 60 * 1000); } else { cmgbsoptclose() } var elem = document.getElementById('block-system-main'); if (jQuery('html').hasClass('mobile-device')) { requestFullscreenModal(elem, document.title); 거짓을 반환; } if (elem.requestFullscreen) { elem.requestFullscreen(); } else if (elem.mozRequestFullScreen) { /* Firefox */ elem.mozRequestFullScreen(); } else if (elem.webkitRequestFullscreen) { /* Chrome, Safari & Opera */ elem.webkitRequestFullscreen(); } else if (elem.msRequestFullscreen) { /* IE/Edge */ elem.msRequestFullscreen(); } else { requestFullscreenModal(elem, document.title); 거짓을 반환; } adjustWidthHeightGame(); } function immersive_mode_display() { // 게임 가져오기 var elem = document.getElementById('block-system-main'); // 전체 화면으로 게임 열기 $('#game-fullscreen #cmgwadfs').on('click', function (e) { e.preventDefault(); $('.hasPopup').removeClass('active'); if (/\/test-game\//.test(window.location.pathname)){ cmg_start_game_full_screen(); } if (cmg_stop_truex_promo === '' || cmg_stop_truex_promo !== 'yes') { if (start_full_screen_without_ad) { display_big_screen_truex_options_overlay(); } else { cmg_start_game_full_screen(); } } return; }); // 게임 전체 화면 닫기 $('#block-system-main .close-full-screen').on('click', function (e) { e.preventDefault(); immersive_mode_exit_handler(); jQuery.fullscreen.exit( ); }); $('body').keypress(function (e) { if (e.which == 27) { if ($('.immerse-button .requestfullscreen').length && typeof bigScreenActive !== '정의되지 않음' && bigScreenActive ) { immersive_mode_exit_handler(); } } }); var screen_change_events = "webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange"; // 전체 화면 창 전환 class jQuery(document).on(screen_change_events, function () { if (jQuery.fullscreen.isFullScreen()) { if (jQuery('html').hasClass('mobile-device')) { jQuery("#block-system-main #html5game").attr('src', jQuery('#playNowButton').attr('href')); } $("body").addClass('immersiveActive') ; elem.classList.add('full-screen-window'); // 확대된 경고 추가 if(typeof chkZoomValues ​​=== "function") { chkZoomValues(); } // iframe 게임의 너비 및 높이 조정 adjustWidthHeightGame() ; } else { if (jQuery('html').hasClass('mobile-device')) { jQuery("#block-system-main #html5game").removeAttr('src'); } immersive_mode_exit_handler(); $ ("body").removeClass('immersiveActive'); elem.classList.remove('full-screen-window'); // 확대된 알림 제거 $('.zoomedalert').remove(); $('#html5game ').removeAttr("스타일"); $('#swfgame').removeAttr("스타일"); $('.game-xp-bar-immerse-button').removeAttr("스타일"); } } ); } function adjustWidthHeightGame() { var iframe = document.getElementById('html5game') ? document.getElementById('html5game') : document.getElementById('swfgame'); var iframeWidth = parsInt(iframe.width); var iframeHeight =parseInt(iframe.height); // var windowWidth =parseInt(screen.width); // var windowHeight =parseInt(screen.height) - 75; var windowWidth =parseInt($(window).width()); var windowHeight =parseInt($(window).height()); var xpbarPos = (windowHeight + 75 - iframeHeight) / 2 + iframeHeight + 10; $('.game-xp-bar-immerse-button').css('top', xpbarPos + "px"); if ($("body").hasClass("game-scalable")) { if (iframeHeight > windowHeight) { var ratio = iframeHeight / windowHeight; } else { var 비율 = windowHeight / iframeHeight; } // 창 높이를 기준으로 게임 너비 계산 var gameWidth = iframeWidth * ratio; // iframe 및 XP를 사용하여 새로운 너비와 높이를 적용합니다. bar iframe.style.width = gameWidth + "px"; iframe.style.height = windowHeight + "px"; var xpbarPos = windowHeight + 10; $('.game-xp-bar-immerse-button').css('top', xpbarPos + "px"); } else if ($("body").hasClass("game-full-screen")) { // iframe 및 xp에 새로운 너비와 높이 적용 bar iframe.style.width = windowWidth + "px"; iframe.style.height = windowHeight + "px"; var xpbarPos = windowHeight + 10; $('.game-xp-bar-immerse-button').css('top', xpbarPos + "px"); } } function adjustWidthHeightModalGame(is_resize) { var iframe = $('#immersiveModal').find('#html5game'); var iframeWidth = parsInt(iframe.attr('너비')); var iframeHeight =parseInt(iframe.attr('height')); var time_out = (is_resize === true) ? 500:0; var wdWidth =parseInt($(window).width()); var wdHeight =parseInt($(window).height()); var oTwdWidth =parseInt($(window).outerWidth()); var oTwdHeight =parseInt($(window).outerHeight()); var windowWidth = (oTwdWidth > wdWidth) ? oTwd폭 : wd폭; var windowHeight = (oTwdHeight > wdHeight) ? oTwdHeight : wdHeight; if ($("body").hasClass("game-scalable")) { if (iframeHeight > windowHeight) { var ratio = iframeHeight / windowHeight; } else { var 비율 = windowHeight / iframeHeight; } // 창 높이를 기준으로 게임 너비 계산 var gameWidth = iframeWidth * ratio; // iframe을 사용하여 새로운 너비와 높이를 적용합니다. iframe.css("width", windowWidth); iframe.css("높이", windowHeight); } else if ($("body").hasClass("game-full-screen")) { iframe.css("width", windowWidth); iframe.css("높이", windowHeight); } } // 화면이 세로에서 가로로 회전하는 경우 게임 너비/높이 조정 window.addEventListener("resize", function () { if ($("body").hasClass("immersiveActive")) { adjustWidthHeightGame(); } if ($("body").hasClass("isFullScreen")) { adjustWidthHeightGame(); } if ($("body").find("#immersiveModal").length) { adjustWidthHeightModalGame(true); } if ( $("#swfgamewrapper #html5game").prop("tagName") == "IFRAME1" && !cmg_is_mobile_device() && document.documentElement.clientWidth >= 960 - ( window.innerWidth-jQuery(document).width() ) ) { if (hide_preroll_ads == false && (prerollAdDisplayed == false || prerollAdEnd != "" && prerollAdStart != prerollAdEnd ) && prerollAdEnd != "mob") { displayPrerollAd_Desktop(); } else if (hide_preroll_ads == true || prerollAdDisplayed == true) { objpad.cmg_check_padg(); } } }, false); var cmg_mmg_html = ''; var cmg_mmg_swf_html = ''; var cmg_game_modal_attached = false; function attachmentModalHtml(elem, title) { cmg_game_modal_attached = true; var elem = document.getElementById('block-system-main'); var cmgmobile_game_files = drupalSettings.cmatgame.cmgmobile_game_files; var iframed_mobile_game_url = drupalSettings.cmatgame.iframed_mobile_game_url; var game_src = ''; var queryString = '?id' + '=' + gameId; let isMobile = cmg_is_mobile_device(); if (cmgmobile_game_files != '' && iframed_mobile_game_url != '' && isMobile) { game_src = iframed_mobile_game_url; } else if (cmgmobile_game_files != '' && isMobile) { game_src = jQuery("#html5game").attr("src") + queryString; } else if (iframed_mobile_game_url != '' && isMobile) { game_src = iframed_mobile_game_url; } else { game_src = jQuery("#html5game").attr("src"); } html = '

'; $('body').append(html); var gamewrapper = jQuery("#swfgamewrapper"); jQuery('#immersiveModal .modal-body').html(gamewrapper); if (cmg_is_mobile_device() || (jQuery(".game-page-mobile .playNow").length && jQuery(".game-page-mobile .playNow").is(':visible') ) ) { newiframe = '

'; } if (cmg_flash_emulated_game()) { if (drupalSettings.cmatgame.flash_emulation === "1"){ //ruffle game_type = "html5"; var swfURLObject = drupalSettings.cmatgame.swfembed.swf.u; var swfURLArray = swfURLObject.split("/"); game_width = drupalSettings.cmatgame.swfembed.swf.swf_1.width; game_height = drupalSettings.cmatgame.swfembed.swf.swf_1.height; var swf_game_url = 'https://www.coolmath-games.com/sites/cmatgame/files/ruffle1/ruffle.html?f='+swfURLArray[swfURLArray.length-1]+'&w='+game_width+'&h= '+게임_높이; cmg_mmg_swf_html = '

'; } else if (drupalSettings.cmatgame.flash_emulation === "2"){ //ruffle game_type = "html5"; game_width = drupalSettings.cmatgame.swfembed.swf.swf_1.width; game_height = drupalSettings.cmatgame.swfembed.swf.swf_1.height; game_type = "html5"; var swfURLObject = drupalSettings.cmatgame.swfembed.swf.u; var swfURLArray = swfURLObject.split("/"); swf_1_game_movie_param = swfURLArray[swfURLArray.length-1]; //cheerpx js var swf_game_url = cmgGetCheerpxUrl()+swfURLArray[swfURLArray.length-1]+'&w='+game_width+'&h='+game_height; newswfiframe = '

'; jQuery("#swfgame").replaceWith(newswfiframe); } } } } function requestFullscreenModal(elem, title) { $("#immersiveModal").addClass('modal fade show full-screen-modal').css({"display":"block", "z-index" :10000}); $('body').addClass('isModalPlay'); $('#immersiveModal').find('#swfgamewrapper').show(); if ($('#html5game').length || cmg_mmg_html) { jQuery("#swfgamewrapper").html(cmg_mmg_html); if (cmg_flash_emulated_game()) { jQuery("#swfgamewrapper").html(cmg_mmg_swf_html); } } else if (jQuery('#swfgame').length) { if (cmg_flash_emulated_game()) { if (drupalSettings.cmatgame.flash_emulation === "2"){ jQuery("#swfgamewrapper").html(newswfiframe) ; } else { jQuery("#swfgamewrapper").html(cmg_mmg_swf_html); } } } iframeLoadedOnMobile(); if (drupalSettings.cmatgame.flash_emulation === "2"){ displayCmgCheerpxLoadingScreenResize(); } $('#immersiveModal').find('.close').click(function () { $("#immersiveModal").remove(); }); window.location.hash = "immersiveModal"; $(window).on('hashchange', function (event) { if (window.location.hash != "#immersiveModal") { $("#immersiveModal").hide(); if ($('#html5game ').length) { $('#html5game').remove(); } else if (jQuery('#swfgame').length) { jQuery('#swfgame').remove(); } $('body ').removeClass('isModalPlay'); } }); adjustWidthHeightModalGame(false); if (브라우저 유형 !== "정의되지 않음" && 브라우저 == "Microsoft Internet Explorer") { if ("함수" === checkVersionBrowser 유형) { ieVersion = checkVersionBrowser(); if (ieVersion == "IE 11" && !jQuery('#html5game').length) { jQuery("#swfgamewrapper").html(cmg_mmg_html); } } } }

References

Top Articles
Latest Posts
Article information

Author: Van Hayes

Last Updated: 08/04/2023

Views: 6088

Rating: 4.6 / 5 (46 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Van Hayes

Birthday: 1994-06-07

Address: 2004 Kling Rapid, New Destiny, MT 64658-2367

Phone: +512425013758

Job: National Farming Director

Hobby: Reading, Polo, Genealogy, amateur radio, Scouting, Stand-up comedy, Cryptography

Introduction: My name is Van Hayes, I am a thankful, friendly, smiling, calm, powerful, fine, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.