BOLOXRZ
BOLOXRZ
BOLOXRZ
DOCTYPE html>
<!--
NOTES:
1. All tokens are represented by '$' sign in the template.
2. You can write your code only wherever mentioned.
3. All occurrences of existing tokens will be replaced by their appropriate
values.
4. Blank lines will be removed automatically.
5. Remove unnecessary comments before creating your template.
-->
<html>
<head><base
href='//www.coolmathgames.com/sites/default/files/public_games/48807/' /><meta
name='robots' content='noindex'><link rel='canonical'
href='https://www.coolmathgames.com/0-bloxorz' />
<meta charset="UTF-8">
<meta name="authoring-tool" content="Adobe_Animate_CC">
<title>bloxorz</title>
<!-- write your code here -->
<style>
#animation_container, #_preload_div_ {
position:absolute;
margin:auto;
left:0;right:0;
top:0;bottom:0;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></
script>
<script type="text/javascript"
src="https://www.coolmathgames.com/sites/default/files/cmg-ads.js"></script>
<script>
let isAdBreakActive = false;
let wasMuted = false;
let onAdBreakCompleteCallback = null;
// To trigger the event Listener adBreakStart
document.addEventListener("adBreakStart", () => {
console.log("AdBreak Started")
//TODO: Developer needs to add the logic to pause the game and sound
here
isAdBreakActive = true;
try {
wasMuted = createjs.Sound.muted;
createjs.Sound.muted = true;
createjs.Ticker.setPaused(true);
} catch (e) { }
});
// To trigger the event Listener adBreakComplete
document.addEventListener("adBreakComplete", () => {
console.log("adBreak Complete")
//TODO: Developer needs to add the logic to resume the game and sound
here
isAdBreakActive = false;
if (onAdBreakCompleteCallback) onAdBreakCompleteCallback();
try {
createjs.Sound.muted = wasMuted;
createjs.Ticker.setPaused(false);
} catch (e) { }
});
function cmgAdBreakCall() {
try {
let _cmgAdBreak = parent.cmgAdBreak ?? cmgAdBreak;
if (_cmgAdBreak) {
_cmgAdBreak();
} else {
console.warn('cmgAdBreak not foud!');
}
} catch (e) { }
}
</script>
<script src="https://code.createjs.com/createjs-2015.11.26.min.js"></script>
<script src="bloxorz.js"></script>
<script>
var canvas, stage, exportRoot, anim_container, dom_overlay_container,
fnStartAnimation;
function init() {
canvas = document.getElementById("canvas");
anim_container = document.getElementById("animation_container");
dom_overlay_container = document.getElementById("dom_overlay_container");
var comp=AdobeAn.getComposition("FE31B685947E79408F0C8768D6EC8517");
var lib=comp.getLibrary();
var loader = new createjs.LoadQueue(false);
loader.installPlugin(createjs.Sound);
loader.addEventListener("fileload", function(evt){handleFileLoad(evt,comp)});
loader.addEventListener("complete", function(evt){handleComplete(evt,comp)});
var lib=comp.getLibrary();
loader.loadManifest(lib.properties.manifest);
}
function handleFileLoad(evt, comp) {
var images=comp.getImages();
if (evt && (evt.item.type == "image")) { images[evt.item.id] = evt.result; }
}
function handleComplete(evt,comp) {
//This function is always called, irrespective of the content. You can use
the variable "stage" after it is created in token create_stage.
var lib=comp.getLibrary();
var ss=comp.getSpriteSheet();
var queue = evt.target;
var ssMetadata = lib.ssMetadata;
for(i=0; i<ssMetadata.length; i++) {
ss[ssMetadata[i].name] = new createjs.SpriteSheet( {"images":
[queue.getResult(ssMetadata[i].name)], "frames": ssMetadata[i].frames} )
}
var preloaderDiv = document.getElementById("_preload_div_");
preloaderDiv.style.display = 'none';
dom_overlay_container.style.display = canvas.style.display = 'block';
exportRoot = new lib.bloxorzhtml();
stage = new lib.Stage(canvas);
stage.enableMouseOver();
//Registers the "tick" event listener.
fnStartAnimation = function() {
stage.addChild(exportRoot);
createjs.Ticker.setFPS(lib.properties.fps);
createjs.Ticker.addEventListener("tick", function(event) {
if (isAdBreakActive) return;
stage.update(event);
});
}
//Code to support hidpi screens and responsive scaling.
function makeResponsive(isResp, respDim, isScale, scaleType) {
var lastW, lastH, lastS=1;
window.addEventListener('resize', resizeCanvas);
resizeCanvas();
function resizeCanvas() {
var w = lib.properties.width, h = lib.properties.height;
}
else if(scaleType==1) {
sRatio = Math.min(xRatio, yRatio);
}
else if(scaleType==2) {
sRatio = Math.max(xRatio, yRatio);
}
}
canvas.width = w*pRatio*sRatio;
canvas.height = h*pRatio*sRatio;
canvas.style.width = anim_container.style.width =
dom_overlay_container.style.width = preloaderDiv.style.width = w*sRatio+'px';
canvas.style.height = anim_container.style.height =
dom_overlay_container.style.height = preloaderDiv.style.height = h*sRatio+'px';
stage.scaleX = pRatio*sRatio;
stage.scaleY = pRatio*sRatio;
lastW = iw; lastH = ih; lastS = sRatio;
stage.tickOnUpdate = false;
stage.update();
stage.tickOnUpdate = true;
}
}
makeResponsive(true,'both',true,1);
AdobeAn.compositionLoaded(lib.properties.id);
fnStartAnimation();
}
function playSound(id, loop) {
return createjs.Sound.play(id, createjs.Sound.INTERRUPT_EARLY, 0, 0, loop);
}
</script>
<!-- write your code here -->
<style type="text/css">
.no-select {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently supported by
Chrome, Edge, Opera and Firefox */
}
</style>
<script type="text/javascript">
setTimeout(function(){
if(document.getElementsByTagName("canvas").length) {
document.getElementsByTagName("body")[0].classList.add("no-select")
}
}, 2000);
</script>
<script src="/sites/default/files/cmg-h5gameads.js?v3"></script>
<script type="text/javascript">
function receiveMessage(e) {
if(e.data == "invokeCMGAdBreak") {
cmgGoogleAdBreak("next",function cmgAdBreakCompleted() {
console.log("cmgAdBreakCompleted is invoked in the iframe.
invoke the next game functionality like resume or play next level etc" );
});
}
}
addEventListener("message", receiveMessage, true);
function setUserAgent(window, userAgent) {
// Works on Firefox, Chrome, Opera and IE9+
if (navigator.__defineGetter__) {
navigator.__defineGetter__("userAgent", function () {
return userAgent;
});
} else if (Object.defineProperty) {
Object.defineProperty(navigator, "userAgent", {
get: function () {
return userAgent;
}
});
}
// Works on Safari
if (window.navigator.userAgent !== userAgent) {
var userAgentProp = {
get: function () {
return userAgent;
}
};
try {
Object.defineProperty(window.navigator, "userAgent",
userAgentProp);
} catch (e) {
window.navigator = Object.create(navigator, {
userAgent: userAgentProp
});
}
}
}
if(window.navigator.userAgent.indexOf("Safari")>=0 && "ontouchstart" in
window && !/iPhone|Android/.test(window.navigator.userAgent)) {
//var userAgent = window.navigator.userAgent.replace("Macintosh",
"iPad");
var userAgent = "Mozilla/5.0 (iPad; CPU OS 13_1_2 like Mac OS X)
AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.1 Mobile/15E148
Safari/604.1";
setUserAgent(window,userAgent);
}
//GA event helper functions
function getCookie(key) {
var keyValue = document.cookie.match("(^|;) ?" + key + "=([^;]*)(;|
$)");
return keyValue ? keyValue[2] : null;
}
function setCookie2(key, value, exptime, domain) {
//document.cookie = key + "=" + value + ";";
var d = new Date();
d.setTime(d.getTime() + exptime);
var expires = "expires=" + d.toUTCString();
document.cookie = key + "=" + value + "; " + expires + "; path=/;
domain=" +domain;
}
function cmg_is_mobile_device() {
var sUsrAg = navigator.userAgent;
//if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera
Mini/i.test(sUsrAg)){
if(/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera
Mini/i.test(sUsrAg)){
return true;
}
else {
if(navigator.maxTouchPoints == 5) {
return true;
}
else if (sUsrAg.indexOf("Safari")>=0 && "ontouchstart" in window &&
sUsrAg.indexOf("iPhone")== -1) {
return true;
}
else {
return false;
}
}
}
var enableDebug=false;
function debugOut(msg){
if (typeof getParameterByName === "function" &&
getParameterByName("debug") !== "") { enableDebug = getParameterByName("debug");}
if(enableDebug){console.log(msg);}
}
function getParameterByName(name) {
var regexS = "[\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(location.href);
if (results !== null) {
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
//Check the parent window
var results = regex.exec(window.top.location.href);
if (results === null) {
return "";
}
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
function getBrowserNameVer() {
var sBrowser, sUsrAg = navigator.userAgent;
// The order matters here, and this may report false positives for
unlisted browsers.
if (sUsrAg.indexOf("Firefox") > -1) {
sBrowser = "Mozilla Firefox";
// "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101
Firefox/61.0"
} else if (sUsrAg.indexOf("SamsungBrowser") > -1) {
sBrowser = "Samsung Internet";
// "Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-G955F
Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/9.4
Chrome/67.0.3396.87 Mobile Safari/537.36
} else if (sUsrAg.indexOf("Opera") > -1 || sUsrAg.indexOf("OPR") > -1)
{
sBrowser = "Opera";
// "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
OPR/57.0.3098.106"
} else if (sUsrAg.indexOf("Trident") > -1) {
sBrowser = "Microsoft Internet Explorer";
// "Mozilla/5.0 (Windows NT 10.0; WOW64;
Trident/7.0; .NET4.0C; .NET4.0E; Zoom 3.6.0; wbx 1.0.0; rv:11.0) like Gecko"
} else if (sUsrAg.indexOf("Edge") > -1) {
sBrowser = "Microsoft Edge (Legacy)";
// "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299"
} else if (sUsrAg.indexOf("Edg") > -1) {
sBrowser = "Microsoft Edge (Chromium)";
// Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.64
} else if (sUsrAg.indexOf("Chrome") > -1) {
sBrowser = "Google Chrome or Chromium";
// "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like
Gecko) Ubuntu Chromium/66.0.3359.181 Chrome/66.0.3359.181 Safari/537.36"
} else if (sUsrAg.indexOf("Safari") > -1) {
sBrowser = "Apple Safari";
// "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X)
AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1
980x1306"
} else if (!/Safari|CriOS/.test(sUsrAg) && /iPhone|iPad\
iPod/.test(sUsrAg) ) {
//( /iPhone|iPad\iPod/.test(sUsrAg) && /Safari/.test(sUsrAg) )
sBrowser = "iPhone Safari WebView";
} else {
sBrowser = "unknown";
}
sUsrAgArr = navigator.userAgent.split(" ")
sBrowser = sBrowser + " " + sUsrAgArr[0] + " " +
sUsrAgArr[sUsrAgArr.length -1]
debugOut("You are using: " + sBrowser);
return sBrowser;
}
function trackEvent(category, action, label, value) {
if(typeof value === "undefined" || value === null) { value = 0; }
if(typeof __gaTracker !== "undefined") {
__gaTracker("send", {hitType: "event", eventCategory: category,
eventAction: action, eventLabel: label, eventValue: value});
}
}
//Category: GamePlayPage, Action: DesktopiFrame / DesktopToplevel /
DesktopImmersive / MobileToplevel / MobileImmersive, Label: Game title
var pCategory = "GamePlayPageRedirect";
var pAction = "Mobile "+ getBrowserNameVer();
var pLabel = location.pathname;
if(pLabel.startsWith("/")) {
pLabel = pLabel.substr(1);
}
function ga4ObjInit(event) {
ga4Obj = {};
var ckeEn = navigator.cookieEnabled;
//Required
var event = (typeof event === "undefined" || event === null || event
=== "") ? "page_load" : event;
var userType = (!ckeEn || getCookie("cmg_l") == null) ?
"AnonymousUser" : "FreeUser";
if (ckeEn && getCookie("cmg_sx") != null) {
userType = "PremiumUser";
}
var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
var adBlock = (typeof ad_blocker_detected !== "undefined") ?
ad_blocker_detected : false;
if (typeof gamePage != "undefined" && gamePage && typeof
hide_preroll_ads != "undefined" && !hide_preroll_ads &&
(document.getElementById("randomAdBlockDiv") == null || typeof google ==
"undefined" || typeof cmgpbjs == "undefined")) {
adBlock = true;
}
//DeviceType
var deviceType = "Desktop"; //Default
var ua = navigator.userAgent;
if (/Android|webOS|iPhone|BlackBerry|IEMobile|Opera Mini/i.test(ua)
|| navigator.maxTouchPoints == 5) {
deviceType = "Mobile";
}
if (/Android/.test(ua) && /Chrome\/[.0-9]* Mobile/.test(ua)) {
//Phone pattern: "Android" + "Chrome/[.0-9]* Mobile"
deviceType = "Mobile";
} else if (/Android/.test(ua) && /Chrome\/[.0-9]* (?!
Mobile)/.test(ua)) { //Tablet pattern: "Android" + "Chrome/[.0-9]* (?!Mobile)"
deviceType = "Tablet";
} else if (/iPad/.test(ua) && /Mobile\/[0-9A-Z]* Safari\/[.0-
9]*/.test(ua)) {
deviceType = "Tablet";
} else if (/iPhone|iPod/.test(ua) && /Mobile\/[0-9A-Z]* Safari\/[.0-
9]*/.test(ua)) {
deviceType = "Mobile";
}
return ga4Obj;
}
function ga4_trackEvent(event, pArr, vArr) {
if (typeof dataLayer !== "undefined" && typeof dataLayer.push ===
"function") {
ga4Obj = ga4ObjInit(event);
if (typeof pArr != "undefined" && typeof vArr != "undefined") {
var aLen = pArr.length;
for (var i = 0; i < aLen; i++) {
ga4Obj[pArr[i]] = vArr[i];
}
}
debugOut("CMGga4: track :" + event + " " + JSON.stringify(ga4Obj) +
" " + new Date());
var ga4Response = dataLayer.push(ga4Obj);
debugOut("CMGga4: track :" + event + " dataLayer.push response = "
+ JSON.stringify(ga4Response) + " " + new Date());
} else {
debugOut("CMGga4: dataLayer does not exist : " + new Date());
}
}
//GA Trackevent and then Redirect the user to game landing page
//Check if we can use GA
//GA Loading
(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||
function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new
Date();a=s.createElement(o),
m=s.getElementsByTagName(o)
[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,"script","//www.google-analytics.com/analytics.js","__gaTracker"
);
var ga_dev_host = /(stage|stage2|dev|dev2|dev3|d9\-test)(\-
edit)?\.coolmathgames\.(com|local)/.test(window.location.host);
if(ga_dev_host || window.location.host == "d9-test-
coolmathgames.local") {
__gaTracker("create", "UA-1192998-21", "auto");
} else {
__gaTracker("create", "UA-1192998-2", "auto");
}
//End of GA loading
if(cmg_is_mobile_device()){
setTimeout(function () {
//Load and fire GA event
trackEvent(pCategory, pAction, pLabel);
var sUsrAg = navigator.userAgent;
//Exclude iPads, iphone/iPod App and Android App
if(document.querySelector("link[rel='canonical']").href &&
!/iPad/.test(sUsrAg) && ( (/iPhone|iPod/.test(sUsrAg) && /Safari/.test(sUsrAg) ) ||
( /Android/.test(sUsrAg) && !/wv/.test(sUsrAg) ) ) ) {
window.location.href =
document.querySelector("link[rel='canonical']").href;
}
}, 100);
}
var isValidDevice = true;
var browserInfo = navigator.userAgent;
if((browserInfo.includes === "iPhone" && browserInfo.includes ===
"mobile") && (browserInfo.includes === "Chrome" || browserInfo.includes
==="Safari")){
isValidDevice = false;
}
if(isValidDevice){
trackEvent("gamePlayPage", "userVisit", location.pathname);
ga4_trackEvent("gamePlayPage", ["action","path"],
["userVisit",location.pathname]);
}
}
//GA4 AEG
setInterval(function() {
if(!document.hidden) {
if(typeof window.parent.postMessage == "function") {
debugOut(new Date()+ " cmgGameHeartbeat: Active tab. parent
postMsg");
window.parent.postMessage({"cmgGameHeartbeat" :
document.hasFocus()}, "*");
} else if(typeof window.top.postMessage == "function" && window.top !
= window.self) {
debugOut(new Date()+ " cmgGameHeartbeat: Active tab. top postMsg");
window.top.postMessage({"cmgGameHeartbeat" : document.hasFocus()},
"*");
}
} else {
debugOut(new Date()+ " cmgGameHeartbeat: Inactive tab. No event");
}
}, 60000);
</script>
</head>
<body onload="init();" style="margin:0px;">
<div id="animation_container" style="background-color:rgba(0, 0, 0, 1.00);
width:550px; height:300px">
<canvas id="canvas" width="550" height="300" style="position: absolute;
display: none; background-color:rgba(0, 0, 0, 1.00);"></canvas>
<div id="dom_overlay_container" style="pointer-events:none;
overflow:hidden; width:550px; height:300px; position: absolute; left: 0px; top:
0px; display: none;">
</div>
</div>
<div id='_preload_div_' style='position:absolute; top:0; left:0; display:
inline-block; height:300px; width: 550px; text-align: center;'> <span
style='display: inline-block; height: 100%; vertical-align: middle;'></span> <img
src=images/_preloader.gif style='vertical-align: middle; max-height: 100%'/></div>
<script>function fnSendMsg(evt){
if(typeof window.parent.postMessage == 'function') {
window.parent.postMessage('keypress-from-game', '*');
} else if(typeof window.top.postMessage == 'function' && window.top !=
window.self) {
window.top.postMessage('keypress-from-game', '*');
}
}
document.body.addEventListener('click', function(event) {
fnSendMsg(event);
});
document.addEventListener('keypress', function(event) {
fnSendMsg(event);
});
document.addEventListener('keydown', function (e) {
fnSendMsg(event);
});
document.addEventListener('keyup', function (e) {
fnSendMsg(event);
});
</script></body>
</html>