”
”
var deviceReady = false; var initCalled = false ; var initialized = false;
function onBodyLoad() { if(typeof window.device === 'undefined') { document.addEventListener("deviceready", onDeviceReady, false); } else { onDeviceReady(); } } function isLivePreview() { return ( window.location.pathname.indexOf("\/livepreview") === 0 ); }
function onDeviceReady() { deviceReady = true ; if(initCalled === true) initializeCP(); }
function isLivePreviewDirty() { var reqUrl = window.location.protocol + "//" + window.location.host + "/livepreview/isLivePreviewDirty?folder=" + cp.previewFolder; var request = new XMLHttpRequest(); request.open('GET', reqUrl); request.responseType = 'text'; request.onload = function() { var response = JSON.parse(request.response); if(response.isDirty == false) { return; } window.location.href = window.location.protocol + "//" + window.location.host + "/livepreview/" + response.folder + "/index.html"; }; request.send(); }
function initializeCP() { if(initialized) return; initCalled = true ; if(cp.pg && deviceReady === false) return;
function cpInit() { document.body.innerHTML = "
Loading...
|
"; cp.DoCPInit(); var lCpExit = window["DoCPExit"]; window["DoCPExit"] = function() { if(cp.UnloadActivties) cp.UnloadActivties(); lCpExit(); };
if( window.CPYTAPINeeded ) { var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; document.getElementsByTagName('head')[0].appendChild(tag); }
if( window.CPVimeoAPINeeded ) { var tag = document.createElement('script'); tag.src = "https://player.vimeo.com/api/player.js"; document.getElementsByTagName('head')[0].appendChild(tag); } }
cpInit(); initialized = true; if(isLivePreview() === true) { cp.previewFolder = window.location.href.split("\/")[4]; setInterval(isLivePreviewDirty, 1000); } }
var imagesJSONFiles = [ 'dr/imgmd.json' ]; cpXHRJSLoader.loadImagesJSON(imagesJSONFiles,function(imageToJSONPathMap){ cp.imageToJSONPathMap = imageToJSONPathMap; var imageJSONFiles = [ 'dr/img1.json' ]; if(window.location.protocol.substr(0,4) == "file") cpXHRJSLoader.preloadURLs(imageJSONFiles, constructDIVs); lJSLoaded = true; if(window.location.protocol.substr(0,4) != "file" || !imageJSONFiles.length) constructDIVs(); }); }); } document.getElementsByTagName('head')[0].appendChild(script); },1); },false); })();