_SWF_Window.html 6.08 KB
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="css/mediaWindow.css"/>
<title>鹿屋体育大学連携[RENKEI] :: ActiBook</title>
<meta name="keywords" content="鹿屋体育大学連携[RENKEI],電子ブック,ebook,デジタルカタログ,アクティブック,ActiBook,書籍" />
<meta name="description" content="鹿屋体育大学連携[RENKEI] :: ActiBook" />
<meta http-equiv="X-UA-Compatible" content="requiresActiveX=true" />
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
<script src="js/aws-sdk-2.1.10.min.js"></script>
<script language="javascript">
var isIE = navigator.appName.indexOf("Microsoft") != -1;
var isSWFActive = false;
var lostFocusflag = true;
function swfActivity(){
  thisMovie("ActiBook").focus();
  isSWFActive = true;
  checkWindow();
}

function thisMovie(movieName) {
  return (isIE) ? window[movieName] : document[movieName];
}

function checkWindow(){
  if(isSWFActive == true){
    var hf = document.hasFocus();
    if(hf == true){
      thisMovie("ActiBook").focus();
      thisMovie("ActiBook").hideProtectPanel();
      setFlagTrue();
    }else{
      if(lostFocusflag){
        thisMovie("ActiBook").showProtectPanel();
      }
    }
  }
}

function lostFocus(){
  if(isSWFActive == true && lostFocusflag){
    thisMovie("ActiBook").showProtectPanel();
  }
}

function catchFocus(){
  if(isSWFActive == true){
    thisMovie("ActiBook").focus();
    thisMovie("ActiBook").hideProtectPanel();
    setFlagTrue();
  }
}

function init(){
}
function setFlagFalse(){
	lostFocusflag = false;	
}
function setFlagTrue(){
	lostFocusflag = true;
}
</script>
</head>
<style type="text/css">
@media print {
    body { display: none !important; }
}
body { -ms-touch-action: manipulation; }
</style>
<script language="javascript">
setInterval('checkWindow()',250);
document.write('<body bgcolor="#ffffff" onLoad="init()">');
</script>
<script src="js/WindowOpen.js" language="javascript"></script>
<script language="javascript">
  var protocol = ("https:" == document.location.protocol) ? "https" : "http";
  if (AC_FL_RunContent == 0) {
    alert("このページでは \"AC_RunActiveContent.js\" が必要です。");
  } else {
    AC_FL_RunContent(
      'codebase', protocol + '://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
      'width', '100%',
      'height', '100%',
      'src', 'ActiBook',
      'quality', 'high',
      'pluginspage', protocol + '://get.adobe.com/jp/flashplayer',
      'align', 'center',
      'play', 'true',
      'loop', 'true',
      'scale', 'noborder',
      'wmode', 'window',
      'devicefont', 'false',
      'id', 'ActiBook',
      'bgcolor', '#ffffff',
      'name', 'ActiBook',
      'menu', 'true',
      'allowFullScreen', 'true',
      'allowScriptAccess','sameDomain',
      'movie', 'ActiBook',
      'salign', ''
      ); //end AC code
  }
  function sendToSwfInfo(){
    return location.href;
  }
  function getUserAgentInfo(){
  	return navigator.userAgent;
  }
  function getReferrer(){
    var url = encodeURIComponent(document.referrer);
    return url;
  }
</script>

<input type="button" id="open" name="open" value="open" style="display:none;" onClick="openMediaWindow(mediaWindow.params);" />

<script type="text/javascript">
	var secretAccessKey;
	var expiration;
	var accessKeyId;
	var sessionToken;
	var certificationNum = 0;
	function AccessRequest(str){
		try{
			if(accessKeyId == undefined){
				if(certificationNum <= 3){
					 Authentication(str);
				}else{
					return;
				}
			}else{
				var removeTimeT = expiration.replace("T"," ");
				var removeTimeZ = removeTimeT.replace("Z","");
				var removeTime = removeTimeZ.replace(/-/g,"/");
				var validTime = new Date(removeTime).getTime();
				var d = new Date();
				var hours = d.getTimezoneOffset()*60000;  
				var strTime = d.getFullYear()+"/"+(d.getMonth()+1)+"/"+d.getDate()+" "+d.getHours() +":"+d.getMinutes()+":"+d.getSeconds();
				var localTime = new Date(strTime).getTime();
				var strlocalTime = localTime + hours;
				if((validTime - strlocalTime)/60000 >= 10){
					putLog(str);
				}else{
					Authentication(str);
				}
			}
		}catch(e){
			AccessRequest(str);
			certificationNum++;
		}
	}
	
	function  Authentication(str){
		var URL = "https://token.heatmaplog.com/api/token.php";
		var params = "id=HeatMapLog&pass=xLAZsasTXQKm";
		var xmlhttp = new XMLHttpRequest();
		xmlhttp.open("POST",URL,true);
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlhttp.onreadystatechange = function(){AuthenticationParams(xmlhttp,str)};
		xmlhttp.send(params);
	}

	function AuthenticationParams(xmlhttp,str){
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			var jsonString = xmlhttp.responseText;
			var jsonValue = JSON.parse(jsonString);
			secretAccessKey = jsonValue.result.SecretAccessKey;
			expiration = jsonValue.result.Expiration;
			accessKeyId = jsonValue.result.AccessKeyId;
			sessionToken = jsonValue.result.SessionToken;
			putLog(str);
		}
	}
	
	function putLog(str){
		try{
			var kinesis = new AWS.Kinesis(options = {
				accessKeyId: accessKeyId,
				secretAccessKey: secretAccessKey,
				sessionToken: sessionToken,
				region: 'ap-northeast-1'
			});
			var guid='';
			for (var i=1; i<=32; i++){  
				var n = Math.floor(Math.random()*16.0).toString(16);  
				guid += n;  
				if((i==8)||(i==12)||(i==16)||(i==20))  
				guid += "-";  
			}  
			guid = guid.toUpperCase();
			var params = {
				Data: str,
				PartitionKey:guid,
				StreamName: 'prod-log-kinesis',
			}
			kinesis.putRecord(params,function(err,data){
				if(err){
					console.log(err,err.stack);
				}else{
					console.log(data);
				}
			});
		}catch(e){
			if(e.code == "ProvisionedThroughputExceeded"){
				return;
			}
		}
	}
</script>
</body>
</html>