/**************************************************************************** * * LiveAct(R) PRO * EmbedInternal * * Copyright (c) 2016 CRI Middleware Co., Ltd. * Version : 1.99.674.0 * ****************************************************************************/ "use strict"; (function(){var e=location.search;e=e[0]==="?"?e.substring(1):"";var i=CriLaData.Dict.fromString("&","=",e);var h=document.getElementById("create-div");var k=h.getAttribute("data-ljt-url");i["ljt-url"]=k;var p=document.createElement("div");p.classList.add("cri-liveact-player");for(var t in i){if(t==="ljt-variable"){continue}var j="data-"+t;var u=i[t];u=decodeURIComponent(u);p.setAttribute(j,u)}p.style.width="100vw";p.style.height="100vh";p.style.overflow="hidden";document.body.appendChild(p);function f(v){return CriLaRectangle.createFromXYWH(v.x,v.y,v.w,v.h)}var o=-1;function b(v){o=v.detail.index}function a(x){var v=CriLaFw.getPlayerByIndex(0);if(!v){return}var w=x.detail;v.notifyPositionChange(f(w.viewport),f(w.player))}function c(w){var v=CriLaFw.getPlayerByIndex(0);if(!v){return}(v.resizeCanvasContain||v.resizeCanvasFill).call(v,w.detail.fullscreen);if(!w.detail.fullscreen&&v.implPlayer_!=null){v.implPlayer_.resizeFromHistory_()}v.notifyFullscreenChange(w.detail.fullscreen)}function q(y,x){for(var v=0;v<x.length;v++){var w=x[v];g(w,y*0.16875)}}function g(w,v){w.style.fontSize=v+"px"}function n(A){var G=CriLaFw.getPlayerByIndex(0);if(!G){return}if(CriUAChecker.isMobile()){var D="liveact-controls";var v=["liveact-controls--audio","liveact-controls--swipe","liveact-controls--no-seekbar"];var C=A.detail;var F=C.viewport.w;var B=C.viewport.h;var H=document.getElementsByClassName(D);var y=F<B?F:B;for(var z=0;z<H.length;z++){var x=H[z];var E=0.1125;if(CriUAChecker.isTablet()){E=0.035}g(x,y*E)}v.forEach(function(I){var w=document.getElementsByClassName(I);q(y,w)})}var C=A.detail;G.notifyFullscreenChange(A.detail.fullscreen)}function m(v){var w={type:"fullscreen",index:o,detail:{fullscreen:v}};window.parent.postMessage(JSON.stringify(w),"*")}function r(){var v={type:"load",index:o,detail:{}};window.parent.postMessage(JSON.stringify(v),"*")}function l(){var v={type:"canplay",index:o,detail:{}};window.parent.postMessage(JSON.stringify(v),"*")}function d(v,x){var w={type:"link",detail:{url:v,target:x}};window.parent.postMessage(JSON.stringify(w),"*")}window.addEventListener("message",function(v){var w=JSON.parse(v.data);switch(w.type){case"initialize":b(w);break;case"scrollPlay":a(w);break;case"notifyFullscreenChange":c(w);break;case"OrientationChange":n(w);break;default:console.warn("embed internal -- undefined message type: ",w.type)}});var s=CriLaFw.setupPlayer;CriLaFw.setupPlayer=function(v){s(v);v.setIframeMode(true);v.addEventListener(CriLaEvent.FULLSCREEN_REQUESTED,function(w){m(w.detail.fullscreen)});document.querySelector(".cri-liveact-player").addEventListener("click",function(w){if(w.eventPhase===2){m(false)}});window.addEventListener("keydown",function(w){if(w.key==="Esc"||w.keyCode===27){m(false)}});v.addEventListener(CriLaEvent.LINK_REQUESTED,function(w){d(w.detail.url,w.detail.target)});v.addEventListener(CriLaEvent.CAN_PLAY,function(){l()});v.addEventListener(CriLaEvent.LJT_LOADED,function(w){r()})}})();