Learn to Fly 2 | coolmathgames.com (2024)

'; } if (typeof signupPromoBottom !== 'undefined' && signupPromoBottom !== '') { signupContainerBottom = '

'; } function preroll_signup_top_handler() { trackEvent('Preroll Signup Clicked', 'Preroll Signup Top', document.title); } function preroll_signup_bottom_handler() { trackEvent('Preroll Signup Clicked', 'Preroll Signup Bottom', 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 = "flash"; if (typeof isRemoveAdSwfJWPLayer === "undefined" || !isRemoveAdSwfJWPLayer) { var swf_game_url = jQuery("#swfgame").attr("src"); if (typeof swf_game_url !== 'undefined' && swf_game_url.indexOf("//") === 0) { swf_game_url = window.location.protocol + swf_game_url; } else if (typeof swf_game_url !== 'undefined' && 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'); // insert fix flash div before game instructions field if (typeof gameInstructions !== 'undefined' && gameInstructions !== null && typeof gameInstructions.innerHTML !== 'undefined' && gameInstructions.innerHTML !== null) { gameInstructions.innerHTML = '

If this flash game doesn\'t work on your computer, go here for help.

' + 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_check(); //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 = () => { 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 = 1; var level_offset = 0; var xp_per_level = 5; 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 = '/fr/0-learn-to-fly-2'; 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') { 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 == "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 !== 'undefined' && signupPromoBottom !== '') { signupContainerBottom = '

' + signupPromoBottom + '

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

' + signupPromoBottom + '

'; } function preroll_signup_top_handler() { trackEvent('Preroll Signup Clicked', 'Preroll Signup Top', document.title); } function preroll_signup_bottom_handler() { trackEvent('Preroll Signup Clicked', 'Preroll Signup Bottom', document.title); } // we will define this varialbe signUpURLABTest in experiments.js 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 === 'undefined' || signUpURL === '') { signUpURL = '/premium-access/ b2df5a33?origin=' + user_dst; } else { signUpURL = signUpURL + '?origin=' + user_dst; } } else if (typeof signUpURLABTest === "undefined" || signUpURLABTest === null) { signUpURL = 'https://' + window.location.hostname + '/premium-access/ b2df5a33?origin=' + user_dst; } else { signUpURL = signUpURLABTest; } function subscription_promo_handler() { if (typeof freeTrialUser !== 'undefined' && freeTrialUser) { trackEvent('Premium Subscription ' + subscriberLeg, 'Subscription overlay clicked', userPlayedGames); trackGoalVirtualPV('/virtual/subscription-overlay-click'); } return; } function subscriptionSignUpUrl() { var user_played_games = ''; var zeroFreeGamesLeftUsers = localStorage.getItem("zeroFreeGamesLeftUsers"); if (typeof userPlayedGames !== 'undefined' && 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 (typeof signUpURL !== 'undefined' && 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()) { // save MyGames only for subscribers saveMyGames(gameId, 0, 1); currentTime = userActivityTime; } } else { currentTimeInterval = currentTimeInterval + 1; saveUserProgress(); } } function updateMyGamesTimeSpent1(gameId) { if (isUserValidFreeUserOrSubscriber()) { // save MyGames only for subscribers if (userActivityTime - lastKeyBoardorMouseActivityTime <= 60000) { saveMyGames(gameId, 0, 1); } } } function updateMyGamesTimeSpentLevelBase(gameId, level) { if (isUserValidFreeUserOrSubscriber()) { // save MyGames only for subscribers saveMyGames(gameId, 1, level); } } if (is_level_based) { var userActivityTime = Date.now(); // for level based game. check if user activity is not there more than 55 min 60000*55 = 3300000 if (userActivityTime - lastKeyBoardorMouseActivityTime <= 3300000) { var objGameNode = {}; objGameNode[gameId] = "no"; var localgamestrate = "storagelocal-" + gameId + "-storagelocal"; localStorage.setItem("runoncestarted", JSON.stringify(objGameNode)); localStorage.setItem(localgamestrate, "no"); updateMyGamesTimeSpentLevelBase(gameId, levelofcompletedgame) } } function cmgGetCheerpxUrl() { var cheerpxUrl = 'https://cheerpx-prod.coolmathgames.com/cheerpx.html?f='; if (location.host != "www.coolmathgames.com" && !/(Firefox)/.test(navigator.userAgent)) { cheerpxUrl = 'https://cheerpx.coolmathgames.com/cheerpx.html?f='; } return cheerpxUrl; } function displayCmgCheerpxLoadingScreen() { jQuery("#swfgame").parent().before('

Your Flash game is loading
it may take longer than usual

'); } // Narrow Screen Loading Screen function displayCmgCheerpxLoadingScreenResized(){ jQuery("#swfgame").parent().before('

Your Flash game is loading
it may take longer than usual

'); } function closeCmgCheerpxLoadingScreen() { jQuery("#cmg-cheerpxloading-screen").remove(); } // Removing Narrow Screen Loading Screen function closeCmgCheerpxLoadingScreenResized(){ if ($("#cmg-cheerpxloading-screen-resized").length > 0){ jQuery("#cmg-cheerpxloading-screen-resized").remove(); } } function cmgRemoveMadg() { if(typeof adsManager != "undefined" && 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"); // show user controls 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(); } } /* * Interstitial ad timer functions */ function gameInterstitialAdTimerAction() { gameInterstitialAdTimerDone = true; clearGameInterstitialAdTimer(); } function clearGameInterstitialAdTimer() { clearTimeout(gameInterstitialAdTimer); gameInterstitialAdTimer = null; } function cmg_discover_games_let_off() { var myGames = cmg_get_lpg(10); if(myGames.length > 0 && isMobile){ myGames = myGames.filter(game => game.mpv == "1"); } if(typeof myGames == "undefined" || myGames == "" || myGames.length == 0){ //return false; // Display Top Picks Games let baseURL = location.origin + '/cmg/toppicks.json'; $.getJSON(baseURL, function(data){ let topPickHTML = ''; for(let game of data){ game = searchGamesById(game.nid)[0]; if(isMobile && game.mpv == "0"){ continue; } let gameVideo = ''; if(game.vdo && game.vdo != ""){ gameVideo = `

` } topPickHTML += `

${gameVideo} ${game.title}

`; } jQuery("#cmg_pickup_block").html(topPickHTML).prev(".title").text("Meilleurs choix 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])); } const filteredGames = removeDuplicateGames(myGames, 'id'); for(game of 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 += `

Jouez au jeu aléatoire

`; } return 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(); } } }); /* * Remove remove Preroll And Display Game. Old function name: removePrerollAndDisplayGame(). */ var cmgRemovePadgInvoked = false; function cmatgame_premium_subscription_game_display() { var cmatgame_subscriber = getCookie('cmg_sx'); var validSubscriber = false; if (typeof cmatgame_subscriber !== 'undefined' && cmatgame_subscriber !== null) { validSubscriber = true; } if (getCookie("cmg_wl") !== null) { validSubscriber = true; } var cmatgame_free_user = getCookie('cmg_fx'); var validFreeUser = false; if (typeof cmatgame_free_user !== 'undefined' && cmatgame_free_user !== null) { validFreeUser = true; } freeGamesExceeded = true; if (validSubscriber || getCookie("cmg_wl") !== null) { retrieveUserProgress(); objpad.cmg_check_access(); jQuery(document).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 || typeof cmg_no_ads !== 'undefined' || (! validSubscriber && schoolHours || (!schoolHours && !targetStateUser) || (!schoolHours && targetStateUser && getCookie('cmg_active_anonymous_user') !== null))) { // TODO Display Game objpad.cmg_check_access(); jQuery(document).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) { // if user comes from google dont show the subscription paywall var ref = document.referrer; // count number of games played by the user this month userPlayedGames = 0; var userFreeGameList = []; var freeGameNid = 11561; 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_access(); } 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 = false; 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; } subscriptionSignUpUrl(); if (! validReferer && userPlayedGames >= freeGameLimit && ! validGameSession) { clearInterval(intervalId); jQuery("#afg_container").remove(); jQuery(".game-instructions").remove(); var alreadySubscriberText = '

Already a Subscriber? Login

'; if (getCookie('cmg_l') != null) { alreadySubscriberText = ''; } var headLine = '

Please Sign up to keep playing

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

PLEASE SUBSCRIBE NOW TO KEEP PLAYING

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

' + headLine + '

The World\'s Best Collection of Games
For Logic, Reasoning & Fun. Subscribe Now' + alreadySubscriberText + '

'); jQuery("#videoplayer").remove(); } else { objpad.cmg_check_access(); } } } } function unlockAllLevels() { trackEvent('Unlock All Levels category', 'unlock all levels button clicked', document.title); alllevels = '

levels-unlocked

'; 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 = new Date(); recievergameFrame.contentWindow.postMessage('unlockAllLevels', cmgtargetdomain); // TODO -- put target origin } } } function addSubToUnlockGAEvent() { trackEvent('Unlock All Levels category', 'subscribe to unlock button clicked', document.title); trackGoalVirtualPV('/virtual/unlock-button-click'); window.location.href = "https://www.coolmathgames.com/signup/ b2df5a33?origin= /fr/0-learn-to-fly-2&stual=1" } var immersive_mode_enabled = false; //BS: 1. Singleton. Attach full screen handler on page load function immersive_mode_display_controller() { if (! immersive_mode_enabled) { immersive_mode_enabled = true; immersive_mode_display(); } } var bigScreenTimer = null; bigScreenActive = false; function cmgbsoptclose() { if (jQuery('#big-screen-truex-overlay').length) { jQuery('#big-screen-truex-overlay').hide(); } } popover_login_click = false; function 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).remove(); immerse_hover_on = 0; } if ((getCookie('cmg_sx') === null && getCookie('cmg_wl') === null)) { myStopFunction(); } if (typeof variant === 'undefined' || variant === '') { variant = '/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.language == 'en') { big_screen_url = '/premium-access/6ea95de6' + variant + '?ts='+new Date().getTime();//BSWOJ anon plan } else { big_screen_url = '/'+drupalSettings.language+'/premium-access/6ea95de6' + variant + '?ts='+new Date().getTime();//BSWOJ anon plan } } else { if (drupalSettings.language == 'en') { big_screen_url = '/profile/premium-access/e180e28d' + variant + '?ts=' + new Date().getTime(); // BSWOJ logged-in user plan } else { big_screen_url = '/'+drupalSettings.language+'/profile/premium-access/e180e28d' + variant + '?ts=' + new Date().getTime(); } } if (variant == 'thankyou') { if (drupalSettings.language == '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.language+'/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; position: fixed; z-index: 100000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgb(0,0,0); background-color: rgba(0,0,0,0.4);" min-height="1040px"'; var ovc_css = 'style="margin: auto; padding: 10px; width: 850px;" min-height="540px"'; var iframe_overlay = '

'; //Add this iframe at the correct place that it needs to go. 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.language == 'en') { big_screen_url = '/premium-access/849ef809' + variant + '?ts=' + new Date().getTime(); // BSWOJ anon plan } else { big_screen_url = '/'+drupalSettings.language+'/premium-access/849ef809' + variant + '?ts=' + new Date().getTime(); // BSWOJ anon plan } } else { if (drupalSettings.language == 'en') { big_screen_url = '/profile/premium-access/e180e28d' + variant + '?ts=' + new Date().getTime(); // BSWOJ logged-in user plan } else { big_screen_url = '/'+drupalSettings.language+'/profile/premium-access/e180e28d' + variant + '?ts=' + new Date().getTime(); // BSWOJ logged-in user plan } } if (variant == 'thankyou') { if (drupalSettings.language == '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.language+'/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; position: fixed; z-index: 100000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgb(0,0,0); background-color: rgba(0,0,0,0.4);" min-height="1040px"'; var ovc_css = 'style="margin: auto; padding: 10px; width: 850px;" min-height="540px"'; var iframe_overlay = '

'; // Add this iframe at the correct place that it needs to go. 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;//no ad after 1st trial bigScreenActive = false; if (getCookie('cmg_sx') === null && getCookie('cmg_wl') === null) { // Redirect the user to signup page 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 && getCookie('cmg_wl') === null) { myTimerAction(); } if (bigScreenTimer) { clearTimeout(bigScreenTimer); bigScreenTimer = null; } } function bigScreenTimerAction() { if (typeof bigScreenActive !== 'undefined' && 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 = "New Premium Feature! Try it for FREE now"; if ((getCookie('cmg_sx') !== null || getCookie('cmg_wl') !== null)) { fullscreenButtonText = "New Premium Feature! Try it now!"; } return fullscreenButtonText; } var cmg_bs_popover_prefix = '

PLAY BIG SCREEN AFTER THIS 30 SECOND AD

'); myStopFunction(); trueXTimer = setTimeout(function () { jQuery('#big-screen-truex-header-text').css('background-color', '#16202c').css('padding-top', '14px').html('

PLEASE INTERACT WITH THIS AD TO CONTINUE

'); // .css('margin-top', '150px'); }, 25 * 1000); }); truexAd.onCredit(function (engagement) { trackEvent('BigScreen-TrueX-Promo', 'View a Sponsored Video: TrueX Ad Credited', document.title); jQuery('#big-screen-truex-header-text').css('background-color', '#16202c').css('padding-top', '14px').html('

'); document.getElementById("truex-bigscreen-activate-id").onclick = function () { event.preventDefault(); if (typeof bigScreenActive === 'undefined' || typeof bigScreenActive !== 'undefined' && !bigScreenActive) { jQuery('#big-screen-signup-container-id').html(""); jQuery('#big-screen-truex-overlay').remove(); cmg_start_game_full_screen('truex'); } } }); truexAd.onClose(function (activity) { // user closed the ad unit trackEvent('BigScreen-TrueX-Promo', 'View a Sponsored Video: TrueX Ad Closed', document.title); containerClose(); requestTrueXAdsAndDisplay(client); }); truexAd.onFinish(function (activity) { // user got to end of ad trackEvent('BigScreen-TrueX-Promo', 'View a Sponsored Video: 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); }); // handle opt-in click event // add TrueX Opt-in to DOM if (jQuery("#cmg-big-screen-truex-activity").length) { var truex_container = document.getElementById("cmg-big-screen-truex-activity"); document.getElementById("cmg-big-screen-truex-activity").onclick = function () { event.preventDefault(); trackEvent('BigScreen-TrueX-Promo', 'View a Sponsored Video: Button clicked', document.title); jQuery('.big-screen-options-container').hide(); if (truex_ad_available && typeof client !== 'undefined') { // BigScreen-TrueX-Promo trackEvent('BigScreen-TrueX-Promo', 'View a Sponsored Video: TrueX Ad Loading', document.title); client.loadActivityIntoContainer(truexAd, 'big-screen-signup-container-id', { width: "960px", height: "540px" }); } else { truex_overlay_preroll_ad_display = true; show_big_screen_preroll_ad(); trackEvent('BigScreen-TrueX-Promo', 'View a Sponsored Video: Preroll Ad Loading', 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(); }; } } function truex_preroll_display_handler() { event.preventDefault(); trackEvent('BigScreen-TrueX-Promo', 'View a Sponsored Video: Button clicked', document.title); jQuery('.big-screen-options-container').hide(); if (truex_ad_available && (typeof client !== 'undefined' || cmg_truex_client != null) ) { // BigScreen-TrueX-Promo if (typeof client == "undefined") { client = cmg_truex_client; truexAd = cmg_truexAd; } trackEvent('BigScreen-TrueX-Promo', 'View a Sponsored Video: TrueX Ad Loading', document.title); client.loadActivityIntoContainer(truexAd, 'big-screen-signup-container-id', { width: "960px", height: "540px" }); } else { truex_overlay_preroll_ad_display = true; show_big_screen_preroll_ad(); trackEvent('BigScreen-TrueX-Promo', 'View a Sponsored Video: Preroll Ad Loading', document.title); } } function containerClose() { // log("containerClose called."); } function log(msg) { console.log("CMG [%s] - %s", new Date().toLocaleTimeString(), msg); } cmg_truex_promo_events_added = 0; function display_big_screen_truex_options_overlay() { // initialize trueX ad client w/ options hash trackEvent('BigScreen-TrueX-Promo', 'Bigscreen button clicked', document.title); if (getCookie('cmg_sx') !== null || getCookie('cmg_wl') !== null || getCookie('cmg_editor') !== null ) { event.preventDefault(); cmg_start_game_full_screen('truex'); } else { network_user_id = getCookie('_ga'); if (typeof network_user_id !== 'undefined' && network_user_id !== '') { network_user_id = network_user_id.replace('GA', 'cmg').replaceAll("\.", ""); } // TRUEX Test Hash // 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 !== 'undefined') { truex.client(truex_options, function (client) { requestTrueXAdsAndDisplay(client); }); } var ov_css = ' style="display:none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgb(0,0,0); background-color: rgba(0,0,0,0.7);" min-height="1040px" '; var ovc_css = ' '; var ovc_css_id = ' style="margin: auto; margin-top: 150px; width: 960px; " '; var truex_css = ' '; var truex_options1 = "

Pour jouer à ce jeu en mode grand écran

"; var truex_options2 = "

Voir une vidéo sponsorisée

"; //var truex_optionsOR = "

"; var truex_options3 = "

"; if (getCookie("cmg_sac") == "no"){ // 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('height', '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 !== 'undefined' && cmatgame_subscriber !== null) { validSubscriber = true; } // preroll ads var prerollUrls = /0\-testing/; if (! validSubscriber) { // display preroll ads window.scrollTo(0, 0); var modal = document.getElementById('big-screen-preroll-container'); // modal.style.display = 'block'; // clear refresh timer if (typeof refreshTimer !== "undefined") { 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 != "undefined") { var auctionCallback = function (displayAds, videoUrl) { application = new Application(displayAds, videoUrl); }; window.PW_CMG.startAuction(auctionCallback); } else { // adblock application = 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('Play Big Screen'); if (typeof bigScreenActive === 'undefined' || typeof bigScreenActive !== 'undefined' && !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 end function cmg_start_game_full_screen(cmgsource) { myStopFunction(); // no ad refresh bigScreenActive = true; if (cmg_stop_truex_promo !== '' && cmg_stop_truex_promo === 'yes') { 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); return false; } 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); return false; } adjustWidthHeightGame(); } function immersive_mode_display() { // get game var elem = document.getElementById('block-system-main'); // open game in fullscreen $('#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; }); // close game fullscreen $('#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 !== 'undefined' && bigScreenActive) { immersive_mode_exit_handler(); } } }); var screen_change_events = "webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange"; // toggle full screen window 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'); // add zoomed alert if(typeof chkZoomValues === "function") { chkZoomValues(); } // Adjusted width and height of iframe game 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'); // remove zoomed alert $('.zoomedalert').remove(); $('#html5game').removeAttr("style"); $('#swfgame').removeAttr("style"); $('.game-xp-bar-immerse-button').removeAttr("style"); } }); } function adjustWidthHeightGame() { var iframe = document.getElementById('html5game') ? document.getElementById('html5game') : document.getElementById('swfgame'); var iframeWidth = parseInt(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 ratio = windowHeight / iframeHeight; } // Calculating game width based on window height var gameWidth = iframeWidth * ratio; // apply new width and height with iframe and 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")) { // apply new width and height with iframe and 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 = parseInt(iframe.attr('width')); 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) ? oTwdWidth : wdWidth; var windowHeight = (oTwdHeight > wdHeight) ? oTwdHeight : wdHeight; if ($("body").hasClass("game-scalable")) { if (iframeHeight > windowHeight) { var ratio = iframeHeight / windowHeight; } else { var ratio = windowHeight / iframeHeight; } // Calculating game width based on window height var gameWidth = iframeWidth * ratio; // apply new width and height with iframe iframe.css("width", windowWidth); iframe.css("height", windowHeight); } else if ($("body").hasClass("game-full-screen")) { iframe.css("width", windowWidth); iframe.css("height", windowHeight); } } // adjust game width/height if screen rotate from portrait to landscape 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_access(); } } }, false); var cmg_mmg_html = ''; var cmg_mmg_swf_html = ''; var cmg_game_modal_attached = false; function attachModalHtml(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='+game_height; 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"){ displayCmgCheerpxLoadingScreenResized(); } $('#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 (typeof browser !== "undefined" && browser == "Microsoft Internet Explorer") { if ("function" === typeof checkVersionBrowser) { ieVersion = checkVersionBrowser(); if (ieVersion == "IE 11" && !jQuery('#html5game').length) { jQuery("#swfgamewrapper").html(cmg_mmg_html); } } } }

Learn to Fly 2 | coolmathgames.com (2024)

FAQs

Learn to Fly 2 | coolmathgames.com? ›

Learn to Fly 2 - Play it Online at Coolmath Games.

Where can I still play Learn to Fly 2? ›

Learn to Fly 2 - Play it Online at Coolmath Games.

What are some 2 player games in Coolmath Games? ›

Co-Op Games You Can Play With Friends
  • Fireboy and Watergirl. Fireboy and Watergirl is one of the most popular games on Coolmath, and there's a good reason for it. ...
  • Four in a Row. Not all co-op games have to be very complicated. ...
  • Chess. ...
  • Dots and Boxes. ...
  • Black and White.
Jan 24, 2022

Is Learn to Fly 2 on mobile? ›

Learn 2 Fly, the sequel to the highly-rated Flash game Learn to Fly, played over 28 million times is now available for mobile and tablet.

How do I get Coolmath unblocked? ›

Blocked From Coolmath Games?
  1. Blocked From Coolmath Games?
  2. Don't worry, it's easy to fix.
  3. "Coolmath-Games.com" is now "CoolmathGames.com" (we got rid of the dash).
  4. You may need to have your IT administrator add "CoolmathGames.com" to your website list, along with "Coolmath-Games.com".

Can a 14 year old learn how do you fly? ›

You are eligible if: You are at least 16 years old. If you plan to pilot a glider or balloon, you must be at least 14 years old. You can read, speak, and understand English.

Is fly for fun still active? ›

The project was ceased because of various internal circ*mstances that the company had been through. In July 2022, The spiritual successor to Flyff, Flyff Universe, launched.

What age is Coolmath for? ›

Coolmath.com offers "math learning for ages 13-100" -- lessons, tools and learning that are easy to grasp on topics like algebra, pre-calculus and more.

Is Coolmath Games safe for kids? ›

Parents need to know that Coolmath.com is a one-stop math shop for middle and high school students, and also has a helpful section for parents and teachers. There are a lot of ads, but other than that, it's a suitable place for kids to learn math and play educational games.

How old is Coolmath Games? ›

Cool Math Games is operated by Coolmath LLC and first went online in 1997 with the slogan: "Where logic & thinking meets fun & games.".

Who made Learn 2 fly? ›

"Learn to Fly" is a song by American rock band Foo Fighters. It was released as the lead single from their third studio album There Is Nothing Left to Lose (1999) in October 1999.

Is Learn to Fly 3 free? ›

Play Learn to Fly 3, a free online game on Kongregate.

When did Learn to Fly 2 come out? ›

Learn to Fly 2
GenreSports & Racing
Published2011-06-16
In-Game Awards?Yes
Gameplay StyleLauncher
5 more rows
Jun 16, 2011

Why do schools block Coolmath Games? ›

Coolmath is an old website filled with malware and spyware. Students previously used this website on the school equipment and it caused 70 laptops to crash. Equipment invested with viruses must be completely wiped and reformatted.

Why is Coolmath blocked? ›

Like Newsweek said, Flash would be shutting down to begin with,after all, they've most likely used Flash so many times to play the games on Coolmath. The answer is simple, it was a risk. Back before all of this,Adobe Flash was starting to become a security risk.

How to play any blocked games at school? ›

How to unblock games on a school computer with VPN
  1. Get a reputable VPN that unblocks games at school. We recommend NordVPN, now 63% off.
  2. Download and install the VPN client on the school computer.
  3. Connect to a server of your choice.
  4. Play unblocked games on a school computer endlessly!
Apr 18, 2023

Can a 12 year old fly by herself? ›

Some airlines permit this for kids as young as 12. When a child has reached this minimum age for traveling alone without unaccompanied-minor procedures, the airline does not require evidence of parental permission to travel alone. If the child has a passport, he or she can even travel internationally.

Can a 17 year old fly by himself? ›

Child age at the time of unaccompanied travel

Children ages 15-17 are permitted to travel as a standard passenger, Go to footer note, provided they can present a valid ID to security personnel. If parents or guardians prefer, they can also travel as an unaccompanied minor.

Is 70 too old to learn how to fly? ›

The answer is no. While some airlines have an age requirement before you can fly a commercial flight, there's no age limit in wanting to become a pilot. Many think that at age 40, they have missed their opportunity to become a pilot.

Does Fly PLAY have TV? ›

For example, PLAY does not offer inflight entertainment, onboard power, or free inflight meals and drinks, while other airlines with similarly restricted fares may still offer, free of charge, so be sure to compare not only similarities between fare restrictions, but also similarities and differences between the ...

Can you fly a plane for fun? ›

While it is a demanding hobby to have, flying is exceedingly rewarding and can endow you with some great skills. Generally referred to as recreational flying, hobby-related aviation is a great way to truly enjoy the art and experience of aviation.

Is there a PLAY Airlines? ›

PLAY is a new Icelandic low-cost airline operating flights between North America and Europe. PLAY offers low-cost flights and a safe and pleasant journey in our new and comfortable Airbus aircraft. At PLAY, safety is the name of the game.

What games were removed from Coolmath? ›

Coolmath Games is no longer hosting Ittle Dew, Membrane, Another Perspective, or Ellipsis. These games were originally part of the Coolmath Games Store. Unfortunately, the Coolmath Games Store has shut down, and we will not be adding more games in the future.

Is Coolmath actually math? ›

The site is also linked to a math games site (Coolmath Games) where some of the games could be used to teach strategy or practice concepts. However, many of the games aren't really math-focused -- they're described as "brain-training" -- and may be more useful as a reward or break for students.

When did Run 3 come out? ›

June 5, 2014

Is Coolmath Games shutting down? ›

We've seen a crazy rumor flying around that Coolmath Games is shutting down, but don't worry: There's no truth to it. The concern seemed to be about Flash games, because Flash has no longer been supported since the end of 2020.

How do I block Coolmath? ›

Click the Ad Blocker extension icon in the upper right area of your browser window. Choose “Don't run on this domain” or similar option to disable it for all Coolmath Pages.

Is Roblox on Coolmath Games? ›

Don't worry if you've never done it before, you've come to the right place to learn! With the right tools, coding your own Roblox game will be a breeze. Not only does Coolmath Games have some pretty fantastic games, but we also have one of the best coding tutorials out there, especially when it comes to Roblox.

What are the top 10 Coolmath Games? ›

Top 10 Games
  • Run 3. Run, skate and jump through a brand new galaxy! ...
  • Papa's Freezeria. Mix up a frozen concoction! ...
  • Chess. Play Chess against the computer or your friends!
  • Mr. Mine. Mine to the center of the Earth! ...
  • Tiny Fishing. ...
  • Moto X3M. ...
  • Fireboy and Watergirl in the Forest Temple. ...
  • Hangman.

Is Coolmath coding free? ›

For $4.99 per month, children can learn to code via Minecraft mods and Roblox games, utilizing a beginner-friendly drag-and-drop code editor. Coolmath Coding provides all the tools and tutorials to write Java code to create Minecraft games or to write Lua code to create custom Roblox games.

How much does Coolmath cost? ›

$5.99/month membership.

Where can I play Learn to Fly 3? ›

Learn to Fly 3 on Steam.

How can I Learn to Fly a plane? ›

7 Steps to Beginning to Fly
  1. Take an Introductory Flight. ...
  2. Start your lessons. ...
  3. Get an aviation Medical Certificate. ...
  4. Make your first solo flight. ...
  5. Fine-tune your skills, build time and gain experience. ...
  6. Take the written exam. ...
  7. Take your check ride. ...
  8. After earning your certificate.

When was fly guy invented? ›

Since its 2005 debut with Hi! Fly Guy, this paper-over-board series has added 12 installments, spawned the nonfiction Fly Guy Presents series, and has more than 8.5 million copies in print.

What is the age limit to learn to fly? ›

The minimum age for obtaining a PPL is 17, as per the CAA, but candidates can enrol and start training from the age of 16. However, in the case of a Commercial Pilot License (CPL), the candidate must be 18 years of age.

Can everyone learn to fly? ›

Virtually anyone can learn to fly—a lot depends on what kind of flying you want to do. If you keep it simple, and fly a basic airplane for your own enjoyment, as a sport pilot or private pilot, the cost doesn't have to be that much—and you can pay for the training as you go.

Can penguins fly 3? ›

No, technically penguins cannot fly.

Penguins swim underwater at speeds of up to 15 to 25 miles per hour . As adept swimmers, penguins spend a lot of time in the water. Some penguins spend up to 75 percent of their lives in the water. Like other birds, penguins do lay eggs and they raise their chicks on land.

What is the penguin flying game called? ›

Racing Penguin is a physics based slide and fly game!

What happened in The Fly 2? ›

Several months after the events of The Fly, Veronica Quaife gives birth to a larval sac and dies. The sac splits open to reveal a seemingly normal baby boy. Anton Bartok, the owner of the company that financed Seth Brundle's teleportation experiments, adopts the child and names him Martin.

Did they make a fly 2 movie? ›

The original film was remade in 1986, The Fly directed by David Cronenberg. The remake film received the Academy Award for Best Makeup in 1987. Its sequel, The Fly II, was released in 1989. All five films within the series were distributed by 20th Century Fox.

Why did school block Spotify? ›

By blocking the service, schools can ensure that students are not exposed to inappropriate content during school hours. Another reason is that Spotify uses a significant amount of bandwidth, which can slow down the school's internet connection.

Why do schools block everything? ›

The goal of these rules and restrictions is simple: to protect kids from harmful and distracting content on the internet. School is a place where kids should be learning.

Is 2048 a math game? ›

2048 is absolutely a math game.

Can you still play Coolmath Games without Flash? ›

We've been totally focused on HTML5 games for years now, and these don't use Flash. We have over a thousand great HTML5 games, and we add several new ones every week. We've also converted over 100 of our older Flash games to HTML5, including favorites such as Run 3 and Bloxorz.

Are unblocked games safe? ›

Therefore, unblocked games are used as backups when you are unable to access some of your favorite games. And these games are completely safe at school, college and in your free time.

How to play Minecraft at school when its blocked? ›

Here is a step-by-step guide on how to get around these restrictions by setting up a VPN:
  1. Choose a VPN. ...
  2. Download the VPN app and install it on your device.
  3. Login or set up a new account.
  4. Find the nearest server and connect. ...
  5. Download the Minecraft app from the official Minecraft website and get to playing!
Mar 22, 2023

Why is POKI blocked at school? ›

Poki is a popular online gaming website that offers a wide range of games that people of all ages can enjoy. However, many schools block access to Poki on their computers due to concerns about productivity and distractions.

What is the old game where you play as a fly? ›

In Time Flies, you play as a fly, zooming through a small open world, in order to complete a bucket list of whimsical tasks before your inevitable death.

How do you launch Learn to Fly 2? ›

Learn to Fly has three main control buttons. First, the right arrow key is used to adjust the angle of the penguin downwards. Second, the left arrow key is used to adjust the angle of the penguin upwards. Third, the spacebar key is used to activate the rocket which uses fuel.

Did game fly shut down? ›

GameFly shut down the streaming service on August 31, 2018.

How do you play fly guy? ›

Players take turns drawing a card from the red deck, reading the word aloud and then trying to make a match with a blue card they hold. It they match, they yell "Swat!" and put the matching cards back in the can by dropping them through Fly Guy's mouth.

What was the bug game in the 70s? ›

Cootie was one of many revamped traditional games cast in plastic by the Schaper company. Several games had bug titles such as Tickle Bee, Inch Worm, and Tumble Bug. The company eventually produced Cootie spinoffs such as Giant Cootie and Deluxe 6 Cootie, a game with six cooties instead of four.

How can I learn flying? ›

Here are the steps you take to become a pilot:
  1. Research Pilot Schools. ...
  2. Take an Admissions Flight. ...
  3. Apply for FAA Medical Certificate. ...
  4. Apply for FAA Student Pilot Certificate. ...
  5. Start Flight Training Lessons. ...
  6. Pass Private Pilot Knowledge Test. ...
  7. Pass Private Pilot Practical Exam.

How do you unlock the sandbox in Learn to Fly 2? ›

Sandbox Mode is obtainable by clicking and holding title in the title screenverify or by completing Classic mode for the first time.

How do you unlock first to fly? ›

You won't be able to progress with First to Fly until you've completed The Wings of the Ten. If you've finished that quest then head north of Stone Crest, override a Sunwing, and fly to the top of the mountain.

What is the oldest you can learn to fly? ›

The answer is no. While some airlines have an age requirement before you can fly a commercial flight, there's no age limit in wanting to become a pilot. Many think that at age 40, they have missed their opportunity to become a pilot.

Can kids Learn how do you fly? ›

“I tell everyone that kids can be ready at any age as long as they're mature enough to listen and take direction,” said Dahline, who owns and operates Crosswinds Aviation. “I've had kids as young as 6 or 7 come out and they're really gung-ho, excited and interested.” “It's just a matter of making sure they're ready.”

Can you learn to fly for fun? ›

While it is a demanding hobby to have, flying is exceedingly rewarding and can endow you with some great skills. Generally referred to as recreational flying, hobby-related aviation is a great way to truly enjoy the art and experience of aviation.

References

Top Articles
Latest Posts
Article information

Author: Fredrick Kertzmann

Last Updated:

Views: 5677

Rating: 4.6 / 5 (66 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Fredrick Kertzmann

Birthday: 2000-04-29

Address: Apt. 203 613 Huels Gateway, Ralphtown, LA 40204

Phone: +2135150832870

Job: Regional Design Producer

Hobby: Nordic skating, Lacemaking, Mountain biking, Rowing, Gardening, Water sports, role-playing games

Introduction: My name is Fredrick Kertzmann, I am a gleaming, encouraging, inexpensive, thankful, tender, quaint, precious person who loves writing and wants to share my knowledge and understanding with you.