Commit cdc165ad by Masaru Abe

テスト対応

parent c24693d5
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
<script type="text/javascript" src="./js/bookmark.js?__UPDATEID__" ></script> <script type="text/javascript" src="./js/bookmark.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./common/js/thickbox.js?__UPDATEID__"></script> <script type="text/javascript" src="./common/js/thickbox.js?__UPDATEID__"></script>
<script type="text/javascript" src="./common/js/scrolltopcontrol.js?__UPDATEID__"></script> <script type="text/javascript" src="./common/js/scrolltopcontrol.js?__UPDATEID__"></script>
<script type="text/javascript" src="./js/contentview_FileSystem.js?__UPDATEID__"></script>
</head> </head>
<body id="bookmark" oncontextmenu="return false;"> <body id="bookmark" oncontextmenu="return false;">
......
...@@ -26,6 +26,8 @@ COMMON.ThumbnailForOtherType = { ...@@ -26,6 +26,8 @@ COMMON.ThumbnailForOtherType = {
Thumbnail_LinkType : 'img/thumb_default_link.png' Thumbnail_LinkType : 'img/thumb_default_link.png'
}; };
//1メガのバイト数定数
COMMON.MB_BYTE = 1048576;
// ============================================================================================= // =============================================================================================
// Constants [start] // Constants [start]
......
...@@ -13,5 +13,6 @@ ...@@ -13,5 +13,6 @@
"anonymousLoginPath" : "test", "anonymousLoginPath" : "test",
"anonymousLoginId" : "nologin", "anonymousLoginId" : "nologin",
"appName" : "ABookWebCL", "appName" : "ABookWebCL",
"appVersion" : "0.0.1" "appVersion" : "0.0.1",
"movieCacheLimitMB" : 200
} }
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
<script type="text/javascript" src="./common/js/screenLock.js?__UPDATEID__" ></script> <script type="text/javascript" src="./common/js/screenLock.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./js/detail.js?__UPDATEID__" ></script> <script type="text/javascript" src="./js/detail.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./common/js/scrolltopcontrol.js?__UPDATEID__"></script> <script type="text/javascript" src="./common/js/scrolltopcontrol.js?__UPDATEID__"></script>
<script type="text/javascript" src="./js/contentview_FileSystem.js?__UPDATEID__"></script>
</head> </head>
<body id="contentsearch" oncontextmenu="return false;"> <body id="contentsearch" oncontextmenu="return false;">
......
...@@ -1265,12 +1265,33 @@ div .ui-slider-range, .ui-widget-header, .ui-slider-range-max { ...@@ -1265,12 +1265,33 @@ div .ui-slider-range, .ui-widget-header, .ui-slider-range-max {
} }
#divImageLoading img{ #divImageLoading img{
/*
padding-left: 1px;
padding-top: 1px;
*/
}
#divCacheLoading{
/*bottom: 65px; */
top: 65px;
right: 20px;
position: fixed;
display: none;
/*
width:30px;
height:30px;
*/
z-index: 3;
}
#divCacheLoading img{
padding-left: 3px; padding-left: 3px;
padding-top: 3px; padding-top: 3px;
} }
/* loading image [end]*/ /* loading image [end]*/
/* navigate button [start]*/ /* navigate button [start]*/
#button_pre_canvas{ #button_pre_canvas{
position:absolute; position:absolute;
......
...@@ -1038,6 +1038,19 @@ div .ui-slider-range, .ui-widget-header, .ui-slider-range-max { ...@@ -1038,6 +1038,19 @@ div .ui-slider-range, .ui-widget-header, .ui-slider-range-max {
#divImageLoading img{ #divImageLoading img{
} }
#divCacheLoading{
/*
background-color:#ccc;
border-radius: 10px;
opacity: 0.7;
*/
}
#divCacheLoading img{
}
/* loading image [end]*/ /* loading image [end]*/
/* navigate button [start]*/ /* navigate button [start]*/
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
<script type="text/javascript" src="./common/js/tab.js?__UPDATEID__"></script> <script type="text/javascript" src="./common/js/tab.js?__UPDATEID__"></script>
<script type="text/javascript" src="./common/js/screenLock.js?__UPDATEID__" ></script> <script type="text/javascript" src="./common/js/screenLock.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./js/detail.js?__UPDATEID__" ></script> <script type="text/javascript" src="./js/detail.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./js/contentview_FileSystem.js?__UPDATEID__"></script>
</head> </head>
<body id="history" oncontextmenu="return false;"> <body id="history" oncontextmenu="return false;">
......
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
<script type="text/javascript" src="./common/js/jquery.treeview.js?__UPDATEID__" ></script> <script type="text/javascript" src="./common/js/jquery.treeview.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./common/js/screenLock.js?__UPDATEID__" ></script> <script type="text/javascript" src="./common/js/screenLock.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./js/detail.js?__UPDATEID__" ></script> <script type="text/javascript" src="./js/detail.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./js/contentview_FileSystem.js?__UPDATEID__"></script>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
......
...@@ -84,6 +84,9 @@ ...@@ -84,6 +84,9 @@
<div id="divImageLoading"> <div id="divImageLoading">
<img src="img/view_loading.gif" width="64px" height="64px"> <img src="img/view_loading.gif" width="64px" height="64px">
</div> </div>
<div id="divCacheLoading">
<img src="img/data2_loading.gif" >
</div>
<!-- ================================================================================== --> <!-- ================================================================================== -->
<!-- Marking group [start] <!-- Marking group [start]
<!-- ================================================================================== --> <!-- ================================================================================== -->
...@@ -385,7 +388,6 @@ ...@@ -385,7 +388,6 @@
<script type="text/javascript" src="./js/contentview_3d.js?__UPDATEID__"></script> <script type="text/javascript" src="./js/contentview_3d.js?__UPDATEID__"></script>
<script type="text/javascript" src="./js/contentview_ContentTypeNone.js?__UPDATEID__"></script> <script type="text/javascript" src="./js/contentview_ContentTypeNone.js?__UPDATEID__"></script>
<script type="text/javascript" src="./js/contentview_ImagePreview.js?__UPDATEID__"></script> <script type="text/javascript" src="./js/contentview_ImagePreview.js?__UPDATEID__"></script>
<script type="text/javascript" src="./js/contentview_FileSystem.js?__UPDATEID__"></script>
<script type="text/javascript" src="./common/js/zoomDetector.js?__UPDATEID__" ></script> <script type="text/javascript" src="./common/js/zoomDetector.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./common/js/jquery.powertip.js?__UPDATEID__"></script> <script type="text/javascript" src="./common/js/jquery.powertip.js?__UPDATEID__"></script>
<script type="text/javascript" src="./common/js/script.js?__UPDATEID__"></script> <script type="text/javascript" src="./common/js/script.js?__UPDATEID__"></script>
......
...@@ -894,9 +894,6 @@ BOOKMARK.IsExistContent = function(strContentId) { ...@@ -894,9 +894,6 @@ BOOKMARK.IsExistContent = function(strContentId) {
authCode: ClientData.authCode() authCode: ClientData.authCode()
}; };
var method = "GET";
if( ClientData.authCode()
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params, AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params,
function (data) { function (data) {
isExisted = true; isExisted = true;
......
...@@ -1018,8 +1018,8 @@ CONTENTVIEW.changePage = function(page_index) { ...@@ -1018,8 +1018,8 @@ CONTENTVIEW.changePage = function(page_index) {
// ファイル取得 // ファイル取得
var pageNoTmp = page_index + 1; var pageNoTmp = page_index + 1;
var fileName = CONTENTVIEW_GENERAL.contentID + "/page_" + pageNoTmp + ".dat"; var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/page_" + pageNoTmp + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false }, CONTENTVIEW_FILESYSTEM.fs.root.getFile( fileName, { create: false },
function(fileEntry){ function(fileEntry){
fileEntry.file( fileEntry.file(
function(file){ function(file){
...@@ -2014,8 +2014,8 @@ CONTENTVIEW.changePageWithoutSlide = function(pageMove) { ...@@ -2014,8 +2014,8 @@ CONTENTVIEW.changePageWithoutSlide = function(pageMove) {
// ファイル取得 // ファイル取得
var pageNoTmp = pageMove + 1; var pageNoTmp = pageMove + 1;
var fileName = CONTENTVIEW_GENERAL.contentID + "/page_" + pageNoTmp + ".dat"; var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/page_" + pageNoTmp + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false }, CONTENTVIEW_FILESYSTEM.fs.root.getFile( fileName, { create: false },
function(fileEntry){ function(fileEntry){
fileEntry.file( fileEntry.file(
function(file){ function(file){
...@@ -2646,6 +2646,32 @@ CONTENTVIEW.downloadResourceById = function(contentId){ ...@@ -2646,6 +2646,32 @@ CONTENTVIEW.downloadResourceById = function(contentId){
return resourceUrl; return resourceUrl;
}; };
CONTENTVIEW.getVideoContentResourceId = function(contentId){
if(CONTENTVIEW_GENERAL.contentType != COMMON.ContentTypeKeys.Type_Video){
return null;
}
var params = {
sid: ClientData.userInfo_sid(),
contentId: contentId,
getType: '2',
authCode: ClientData.authCode()
};
var resourceId;
CONTENTVIEW_CALLAPI.abapi('webGetContent', params, 'GET', function (data) {
$.each(data.contentData , function(i, n){
if(typeof n == "object"){
resourceId = n.resourceId;
}
});
//Get resource
});
return resourceId;
};
//Start : TRB00015 - Editor : Long - Date : 08/28/2013 - Summary : For win 8 rotate handling. //Start : TRB00015 - Editor : Long - Date : 08/28/2013 - Summary : For win 8 rotate handling.
CONTENTVIEW.setViewportForWin8 = function(){ CONTENTVIEW.setViewportForWin8 = function(){
if (window.navigator.msPointerEnabled) { if (window.navigator.msPointerEnabled) {
...@@ -4682,7 +4708,8 @@ CONTENTVIEW.showVideoObject = function(x, y, width, height, src, isFullscreen) { ...@@ -4682,7 +4708,8 @@ CONTENTVIEW.showVideoObject = function(x, y, width, height, src, isFullscreen) {
'width="' + (pt2.x - pt1.x) + '" ' + 'width="' + (pt2.x - pt1.x) + '" ' +
'height="' + (pt2.y - pt1.y) + '" ' + 'height="' + (pt2.y - pt1.y) + '" ' +
'autoplay controls loop>' + 'autoplay controls loop>' +
' <source src="' + src + '&key=' + (new Date()).toIdString() + '" type="video/mp4"> ' + ' <source src="' + src + '" type="video/mp4"> ' +
//' <source src="' + src + '&key=' + (new Date()).toIdString() + '" type="video/mp4"> ' +
//' <source src="' + src + '&key=' + (new Date()).toIdString() + '" type="video/ogg"> ' + //' <source src="' + src + '&key=' + (new Date()).toIdString() + '" type="video/ogg"> ' +
'</video>' '</video>'
); );
...@@ -4692,7 +4719,8 @@ CONTENTVIEW.showVideoObject = function(x, y, width, height, src, isFullscreen) { ...@@ -4692,7 +4719,8 @@ CONTENTVIEW.showVideoObject = function(x, y, width, height, src, isFullscreen) {
'width="' + (pt2.x - pt1.x) + '" ' + 'width="' + (pt2.x - pt1.x) + '" ' +
'height="' + (pt2.y - pt1.y) + '" ' + 'height="' + (pt2.y - pt1.y) + '" ' +
'autoplay controls>' + 'autoplay controls>' +
' <source src="' + src + '&key=' + (new Date()).toIdString() + '" type="video/mp4"> ' + //' <source src="' + src + '&key=' + (new Date()).toIdString() + '" type="video/mp4"> ' +
' <source src="' + src + '" type="video/mp4"> ' +
'</video>' '</video>'
); );
} }
...@@ -5463,7 +5491,7 @@ CONTENTVIEW.cssInit = function(){ ...@@ -5463,7 +5491,7 @@ CONTENTVIEW.cssInit = function(){
'font-family': '"メイリオ", "Meiryo", "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "MS Pゴシック", "MS P Gothic", "Osaka", Verdana, Arial, Helvetica, sans-serif', 'font-family': '"メイリオ", "Meiryo", "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "MS Pゴシック", "MS P Gothic", "Osaka", Verdana, Arial, Helvetica, sans-serif',
'font-size':'', 'font-size':'',
'background':'#898989', 'background':'#898989',
'background-image':'url(../../img/viewer/article_bg.png)', 'background-image':'url(./img/viewer/article_bg.png)',
'color':'', 'color':'',
'margin':'0', 'margin':'0',
'padding':'0' 'padding':'0'
...@@ -5477,6 +5505,14 @@ CONTENTVIEW.screenMove = function(){ ...@@ -5477,6 +5505,14 @@ CONTENTVIEW.screenMove = function(){
//戻る処理 //戻る処理
CONTENTVIEW.screenBack = function(){ CONTENTVIEW.screenBack = function(){
//後始末
$('#dialog').hide();
$('#dialog').empty();
$('#dialog').removeClass();
$('#dialog').removeAttr('style');
$('#dialog').addClass('web_dialog');
$('#divCacheLoading').hide();
$("#viewer").hide(); $("#viewer").hide();
if( $('#bookshelf').length || $('#list').length ){ if( $('#bookshelf').length || $('#list').length ){
HOME.cssInit(); HOME.cssInit();
...@@ -5588,114 +5624,126 @@ CONTENTVIEW.ready = function(){ ...@@ -5588,114 +5624,126 @@ CONTENTVIEW.ready = function(){
CONTENTVIEW.marginY = 65; CONTENTVIEW.marginY = 65;
} }
/* check login */ //画面初期化
if (!AVWEB.avwCheckLogin(COMMON.ScreenIds.Login)) return; $('#dialog').hide();
// Set event to prevent leave $('#dialog').empty();
COMMON.ToogleLogoutNortice(); $('#dialog').removeClass();
//START TRB00048 - EDITOR : Long - Date : 09/18/2013 - Summary : Fix Jumpcontent $('#dialog').removeAttr('style');
CONTENTVIEW_GETDATA.getContentID(); $('#dialog').addClass('web_dialog');
$('#divCacheLoading').hide();
var params = {
contentId: CONTENTVIEW_GENERAL.contentID, /* check login */
sid: ClientData.userInfo_sid(), if (!AVWEB.avwCheckLogin(COMMON.ScreenIds.Login)) return;
getType: 1, // Set event to prevent leave
isStreaming: ClientData.isStreamingMode(), COMMON.ToogleLogoutNortice();
authCode: ClientData.authCode() //START TRB00048 - EDITOR : Long - Date : 09/18/2013 - Summary : Fix Jumpcontent
}; CONTENTVIEW_GETDATA.getContentID();
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(), var params = {
"webGetContent", contentId: CONTENTVIEW_GENERAL.contentID,
"GET", sid: ClientData.userInfo_sid(),
params, getType: 1,
function (data) { isStreaming: ClientData.isStreamingMode(),
authCode: ClientData.authCode()
console.log("data.contentData.contentType:" + data.contentData.contentType); };
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(),
"webGetContent",
"GET",
params,
function (data) {
//AVWEB.avwLog("json.txt:" + window.JSON.stringify(data) );
CONTENTVIEW_FILESYSTEM.checkUpdate(CONTENTVIEW_GENERAL.contentID, data, CONTENTVIEW.webGetContentApi_funcOk);
},
function (xmlHttpRequest, txtStatus, errorThrown) {
//ページジャンプ設定をクリア
ClientData.JumpQueue([]);
ClientData.IsJumpBack(false);
var moveScreen = null;
if(!ClientData.isStreamingMode()){
moveScreen = COMMON.ScreenIds.Home;
}
if (xmlHttpRequest.status == 404) {
CONTENTVIEW.showAlertScreen(I18N.i18nText('msgContentNotExist'), moveScreen);
}
else if(xmlHttpRequest.status == 403) {
//認証エラー
CONTENTVIEW.showAlertScreen(I18N.i18nText('sysErrorCallApi02'), moveScreen);
}
else {
// Show system error
AVWEB.showSystemError();
}
}
);
};
CONTENTVIEW.webGetContentApi_funcOk = function(data){
CONTENTVIEW_GENERAL.contentType = data.contentData.contentType;
if(ClientData.isStreamingMode()){
//リンク、その他は表示出来ないのでここでブロックする
if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_Link || CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_Others){
CONTENTVIEW.showAlertScreen(I18N.i18nText('msgStreamingOpenError'), null);
return;
}
}
if (CONTENTVIEW_GENERAL.avwUserEnvObj.isIos()) {
CONTENTVIEW_GENERAL.contentType = data.contentData.contentType; if(ClientData.isStreamingMode()){
//ClientData.IsRefresh(true);
if(ClientData.isStreamingMode()){ } else {
//リンク、その他は表示出来ないのでここでブロックする //ストリーミング対応以外では元の設定活かす
if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_Link || CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_Others){ CONTENTVIEW.setViewportForTouchDevice();
CONTENTVIEW.showAlertScreen(I18N.i18nText('msgStreamingOpenError'), null); }
return;
} if (ClientData.IsRefresh() == true) {
} //Check if is pdf content
if(CONTENTVIEW.isMediaAndHTMLContent()){
if (CONTENTVIEW_GENERAL.avwUserEnvObj.isIos()) { CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType();
document.title = data.contentData.contentName + ' | ' + I18N.i18nText('sysAppTitle');
if(ClientData.isStreamingMode()){
//ClientData.IsRefresh(true);
} else {
//ストリーミング対応以外では元の設定活かす
CONTENTVIEW.setViewportForTouchDevice();
}
if (ClientData.IsRefresh() == true) {
//Check if is pdf content
if(CONTENTVIEW.isMediaAndHTMLContent()){
CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType();
document.title = data.contentData.contentName + ' | ' + I18N.i18nText('sysAppTitle');
}
else{
CONTENTVIEW_INITOBJECT.initPage();
}
//ストリーミングならデバイス側に初期表示済通知
if(ClientData.isStreamingMode()){
CONTENTVIEW_STREAMING.initPageView()
}
} else {
//この処理がないと初回画面描画が出来ない けど点滅する
$('body, html').hide();
ClientData.IsRefresh(true);
location.reload();
}
} }
else { else{
CONTENTVIEW_INITOBJECT.initPage();
//Check if is pdf content }
if(CONTENTVIEW.isMediaAndHTMLContent()){
CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType(); //ストリーミングならデバイス側に初期表示済通知
if(ClientData.isStreamingMode()){
//START TRB00059 - EDITOR: Long - Date : 09/19/2013 - Summary : Add title for media and html type CONTENTVIEW_STREAMING.initPageView()
document.title = data.contentData.contentName + ' | ' + I18N.i18nText('sysAppTitle'); }
//END TRB00059 - EDITOR: Long - Date : 09/19/2013 - Summary : Add title for media and html type
} } else {
else{ //この処理がないと初回画面描画が出来ない けど点滅する
CONTENTVIEW_INITOBJECT.initPage(); $('body, html').hide();
} ClientData.IsRefresh(true);
location.reload();
//ストリーミングならデバイス側に初期表示済通知 }
if(ClientData.isStreamingMode()){ }
CONTENTVIEW_STREAMING.initPageView() else {
}
//Check if is pdf content
} if(CONTENTVIEW.isMediaAndHTMLContent()){
},
function (xmlHttpRequest, txtStatus, errorThrown) { CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType();
//ページジャンプ設定をクリア //START TRB00059 - EDITOR: Long - Date : 09/19/2013 - Summary : Add title for media and html type
ClientData.JumpQueue([]); document.title = data.contentData.contentName + ' | ' + I18N.i18nText('sysAppTitle');
ClientData.IsJumpBack(false); //END TRB00059 - EDITOR: Long - Date : 09/19/2013 - Summary : Add title for media and html type
}
var moveScreen = null; else{
if(!ClientData.isStreamingMode()){ CONTENTVIEW_INITOBJECT.initPage();
moveScreen = COMMON.ScreenIds.Home; }
}
//ストリーミングならデバイス側に初期表示済通知
if (xmlHttpRequest.status == 404) { if(ClientData.isStreamingMode()){
CONTENTVIEW.showAlertScreen(I18N.i18nText('msgContentNotExist'), moveScreen); CONTENTVIEW_STREAMING.initPageView()
} }
else if(xmlHttpRequest.status == 403) {
//認証エラー }
CONTENTVIEW.showAlertScreen(I18N.i18nText('sysErrorCallApi02'), moveScreen);
}
else {
// Show system error
AVWEB.showSystemError();
}
}
);
}; };
...@@ -25,8 +25,8 @@ CONTENTVIEW_CALLAPI.getJsonContentInfo = function( doneFunc ) { ...@@ -25,8 +25,8 @@ CONTENTVIEW_CALLAPI.getJsonContentInfo = function( doneFunc ) {
); );
} else { } else {
// 1ページ目のファイル取得 // 1ページ目のファイル取得
var fileName = contentID + "/page_1.dat"; var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/page_1.dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false }, CONTENTVIEW_FILESYSTEM.fs.root.getFile( fileName, { create: false },
function(fileEntry){ function(fileEntry){
fileEntry.file(function(file){ fileEntry.file(function(file){
var reader = new FileReader(); var reader = new FileReader();
...@@ -43,7 +43,7 @@ CONTENTVIEW_CALLAPI.getJsonContentInfo = function( doneFunc ) { ...@@ -43,7 +43,7 @@ CONTENTVIEW_CALLAPI.getJsonContentInfo = function( doneFunc ) {
function(err){ function(err){
// 失敗時のコールバック関数 // 失敗時のコールバック関数
AVWEB.avwLog("NotRead FileSystem"); AVWEB.avwLog("NotRead FileSystem");
avwGrabContentPageImage( AVWEB.avwGrabContentPageImage(
ClientData.userInfo_accountPath(), ClientData.userInfo_accountPath(),
{ contentId: CONTENTVIEW_GENERAL.contentID, sid: ClientData.userInfo_sid(), pageNo: 1 }, { contentId: CONTENTVIEW_GENERAL.contentID, sid: ClientData.userInfo_sid(), pageNo: 1 },
function (data) { function (data) {
......
...@@ -787,7 +787,7 @@ CONTENTVIEW_CREATEOBJECT.trigger = function (mediaType, actionType, id, imageUrl ...@@ -787,7 +787,7 @@ CONTENTVIEW_CREATEOBJECT.trigger = function (mediaType, actionType, id, imageUrl
objectLog.resourceId = CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].resourceId; objectLog.resourceId = CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].resourceId;
} else { /* video */ } else { /* video */
CONTENTVIEW.stopAllAudio(); CONTENTVIEW.stopAllAudio();
CONTENTVIEW_FILESYSTEM.showVideoObjectCache(objType4_5[nIndex].x, objType4_5[nIndex].y, objType4_5[nIndex].width, objType4_5[nIndex].height, objType4_5[nIndex].dataObjects[nIndex1].fileName, false, contentID, objType4_5[nIndex].dataObjects[nIndex1].resourceId); CONTENTVIEW_FILESYSTEM.showVideoObjectCache(CONTENTVIEW.objType4_5[nIndex].x, CONTENTVIEW.objType4_5[nIndex].y, CONTENTVIEW.objType4_5[nIndex].width, CONTENTVIEW.objType4_5[nIndex].height, CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].fileName, false, CONTENTVIEW_GENERAL.contentID, CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].resourceId);
//CONTENTVIEW.showVideoObject(CONTENTVIEW.objType4_5[nIndex].x, CONTENTVIEW.objType4_5[nIndex].y, CONTENTVIEW.objType4_5[nIndex].width, CONTENTVIEW.objType4_5[nIndex].height, CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].fileName, false); //CONTENTVIEW.showVideoObject(CONTENTVIEW.objType4_5[nIndex].x, CONTENTVIEW.objType4_5[nIndex].y, CONTENTVIEW.objType4_5[nIndex].width, CONTENTVIEW.objType4_5[nIndex].height, CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].fileName, false);
if(ClientData.isStreamingMode()){ if(ClientData.isStreamingMode()){
...@@ -1448,7 +1448,7 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image ...@@ -1448,7 +1448,7 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image
CONTENTVIEW.stopAllAudio(); CONTENTVIEW.stopAllAudio();
if (embed == "1") { if (embed == "1") {
CONTENTVIEW_FILESYSTEM.showVideoObjectCache(x, y, w, h, mediaFile, false, contentID, media ); CONTENTVIEW_FILESYSTEM.showVideoObjectCache(x, y, w, h, mediaFile, false, CONTENTVIEW_GENERAL.contentID, media );
//CONTENTVIEW.showVideoObject(x, y, w, h, mediaFile, false); //CONTENTVIEW.showVideoObject(x, y, w, h, mediaFile, false);
if(ClientData.isStreamingMode()){ if(ClientData.isStreamingMode()){
...@@ -1522,8 +1522,8 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image ...@@ -1522,8 +1522,8 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image
} else { } else {
//キャッシュが存在するか確認 //キャッシュが存在するか確認
var fileName = CONTENTVIEW_GENERAL.contentID + "/res_" + media + ".dat"; var fileName = '/abook/' +CONTENTVIEW_GENERAL.contentID + "/res_" + media + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false }, CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){ function(fileEntry){
fileEntry.file( fileEntry.file(
function(file){ function(file){
...@@ -1531,7 +1531,7 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image ...@@ -1531,7 +1531,7 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image
var resSrc = url.createObjectURL(file); var resSrc = url.createObjectURL(file);
AVWEB.avwLog("read cache: createObjectURL " + resSrc); AVWEB.avwLog("read cache: createObjectURL " + resSrc);
createVideoFulScreen(resSrc, id); CONTENTVIEW_CREATEOBJECT.createVideoFulScreen(resSrc, id);
$("#btnCloseVideo").on({ $("#btnCloseVideo").on({
'click touchend': function(ev){ 'click touchend': function(ev){
//時間記録 //時間記録
...@@ -1554,6 +1554,9 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image ...@@ -1554,6 +1554,9 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image
function(err){ // 失敗時のコールバック関数 function(err){ // 失敗時のコールバック関数
AVWEB.avwLog("NotRead FileSystem"); AVWEB.avwLog("NotRead FileSystem");
CONTENTVIEW_FILESYSTEM.createMovieCache(mediaFile,fileName);
/*
//キャッシュ化 //キャッシュ化
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){ xhr.onreadystatechange = function(){
...@@ -1603,6 +1606,7 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image ...@@ -1603,6 +1606,7 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image
} else { } else {
AVWEB.avwLog("xhr is busy."); AVWEB.avwLog("xhr is busy.");
} }
*/
//タグは書き出し //タグは書き出し
CONTENTVIEW_CREATEOBJECT.createVideoFulScreen(mediaFile, id); CONTENTVIEW_CREATEOBJECT.createVideoFulScreen(mediaFile, id);
...@@ -1693,8 +1697,8 @@ CONTENTVIEW_CREATEOBJECT.videoType1 = function (mediaType, actionType, id, image ...@@ -1693,8 +1697,8 @@ CONTENTVIEW_CREATEOBJECT.videoType1 = function (mediaType, actionType, id, image
} else { } else {
//キャッシュが存在するか確認 //キャッシュが存在するか確認
var fileName = CONTENTVIEW_GENERAL.contentID + "/res_" + mediaResourceId + ".dat"; var fileName = '/abook/' +CONTENTVIEW_GENERAL.contentID + "/res_" + mediaResourceId + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false }, CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){ function(fileEntry){
fileEntry.file( fileEntry.file(
function(file){ function(file){
...@@ -1728,6 +1732,9 @@ CONTENTVIEW_CREATEOBJECT.videoType1 = function (mediaType, actionType, id, image ...@@ -1728,6 +1732,9 @@ CONTENTVIEW_CREATEOBJECT.videoType1 = function (mediaType, actionType, id, image
function(err){ // 失敗時のコールバック関数 function(err){ // 失敗時のコールバック関数
AVWEB.avwLog("NotRead FileSystem"); AVWEB.avwLog("NotRead FileSystem");
CONTENTVIEW_FILESYSTEM.createMovieCache(mediaFile,fileName);
/*
//キャッシュ化 //キャッシュ化
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){ xhr.onreadystatechange = function(){
...@@ -1778,6 +1785,7 @@ CONTENTVIEW_CREATEOBJECT.videoType1 = function (mediaType, actionType, id, image ...@@ -1778,6 +1785,7 @@ CONTENTVIEW_CREATEOBJECT.videoType1 = function (mediaType, actionType, id, image
} else { } else {
AVWEB.avwLog("xhr is busy."); AVWEB.avwLog("xhr is busy.");
} }
*/
//タグは書き出し //タグは書き出し
CONTENTVIEW_CREATEOBJECT.createVideoFulScreen(mediaFile, id); CONTENTVIEW_CREATEOBJECT.createVideoFulScreen(mediaFile, id);
......
...@@ -389,8 +389,8 @@ CONTENTVIEW_EVENTS.firstPage_click = function() { ...@@ -389,8 +389,8 @@ CONTENTVIEW_EVENTS.firstPage_click = function() {
} else { } else {
// ファイル取得 // ファイル取得
var fileName = CONTENTVIEW_GENERAL.contentID + "/page_1.dat"; var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/page_1.dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false }, CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){ function(fileEntry){
fileEntry.file( fileEntry.file(
function(file){ function(file){
...@@ -516,8 +516,8 @@ CONTENTVIEW_EVENTS.lastPage_click = function() { ...@@ -516,8 +516,8 @@ CONTENTVIEW_EVENTS.lastPage_click = function() {
} else { } else {
// ファイル取得 // ファイル取得
var fileName = contentID + "/page_" + totalPage + ".dat"; var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/page_" + CONTENTVIEW_GENERAL.totalPage + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false }, CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){ function(fileEntry){
fileEntry.file( fileEntry.file(
function(file){ function(file){
......
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
//名前空間用のオブジェクトを用意する //名前空間用のオブジェクトを用意する
var CONTENTVIEW_FILESYSTEM = {}; var CONTENTVIEW_FILESYSTEM = {};
CONTENTVIEW_FILESYSTEM.initFS = function( func ) { CONTENTVIEW_FILESYSTEM.initFS = function( func ) {
CONTENTVIEW_FILESYSTEM.fs = null; CONTENTVIEW_FILESYSTEM.fs = null;
CONTENTVIEW_FILESYSTEM.isXhrBusy = false;
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
// Initiate filesystem on page load. // Initiate filesystem on page load.
...@@ -20,7 +22,7 @@ CONTENTVIEW_FILESYSTEM.initFS = function( func ) { ...@@ -20,7 +22,7 @@ CONTENTVIEW_FILESYSTEM.initFS = function( func ) {
window.TEMPORARY, window.TEMPORARY,
1024*1024, 1024*1024,
function(filesystem) { function(filesystem) {
//AVWEB.avwLog("initFS window.requestFileSystem"); AVWEB.avwLog("initFS window.requestFileSystem");
CONTENTVIEW_FILESYSTEM.fs = filesystem; CONTENTVIEW_FILESYSTEM.fs = filesystem;
CONTENTVIEW_FILESYSTEM.fs.root.getDirectory( CONTENTVIEW_FILESYSTEM.fs.root.getDirectory(
'abook', 'abook',
...@@ -121,7 +123,7 @@ CONTENTVIEW_FILESYSTEM.checkUpdate = function(contentId, data, func) { ...@@ -121,7 +123,7 @@ CONTENTVIEW_FILESYSTEM.checkUpdate = function(contentId, data, func) {
} }
//既にjson.txtが存在するか //既にjson.txtが存在するか
var fileName = contentID + "/json.txt"; var fileName = contentId + "/json.txt";
CONTENTVIEW_FILESYSTEM.fs.root.getFile( CONTENTVIEW_FILESYSTEM.fs.root.getFile(
'/abook/' + fileName, '/abook/' + fileName,
{ create: false }, { create: false },
...@@ -264,33 +266,36 @@ CONTENTVIEW_FILESYSTEM.showVideoObjectCache = function(x, y, width, height, src, ...@@ -264,33 +266,36 @@ CONTENTVIEW_FILESYSTEM.showVideoObjectCache = function(x, y, width, height, src,
if (!CONTENTVIEW_FILESYSTEM.fs) { if (!CONTENTVIEW_FILESYSTEM.fs) {
//AVWEB.avwLog('CONTENTVIEW_FILESYSTEM.fs is null. id=' + contentId); //AVWEB.avwLog('CONTENTVIEW_FILESYSTEM.fs is null. id=' + contentId);
showVideoObject(x, y, width, height, src, isFullscreen, true); CONTENTVIEW.showVideoObject(x, y, width, height, src, isFullscreen, true);
return; return;
} }
//キャッシュが存在するか確認 //キャッシュが存在するか確認
var fileName = contentID + "/res_" + resourceId + ".dat"; var fileName = '/abook/' + contentId + "/res_" + resourceId + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false }, CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){ function(fileEntry){
fileEntry.file( fileEntry.file(
function(file){ function(file){
//AVWEB.avwLog("read cache"); //AVWEB.avwLog("read cache");
var url = window.URL || window.webkitURL; var url = window.URL || window.webkitURL;
var resSrc = url.createObjectURL(file); var resSrc = url.createObjectURL(file);
showVideoObject(x, y, width, height, resSrc, isFullscreen, false); CONTENTVIEW.showVideoObject(x, y, width, height, resSrc, isFullscreen, false);
} }
); );
}, },
function(err){ // 失敗時のコールバック関数 function(err){ // 失敗時のコールバック関数
//AVWEB.avwLog("NotRead FileSystem"); //AVWEB.avwLog("NotRead FileSystem");
CONTENTVIEW_FILESYSTEM.createMovieCache(src, fileName);
/*
//キャッシュ化 //キャッシュ化
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){ xhr.onreadystatechange = function(){
if (this.readyState == 4 && this.status == 200){ if (this.readyState == 4 && this.status == 200){
var size = xhr.getResponseHeader('Content-Length') //var size = xhr.getResponseHeader('Content-Length')
console.log("size:" + size); //console.log("size:" + size);
CONTENTVIEW_FILESYSTEM.isXhrBusy = false; CONTENTVIEW_FILESYSTEM.isXhrBusy = false;
$('#divImageLoading').css('display', 'none'); $('#divImageLoading').css('display', 'none');
...@@ -337,16 +342,137 @@ CONTENTVIEW_FILESYSTEM.showVideoObjectCache = function(x, y, width, height, src, ...@@ -337,16 +342,137 @@ CONTENTVIEW_FILESYSTEM.showVideoObjectCache = function(x, y, width, height, src,
} else { } else {
//AVWEB.avwLog("xhr is busy."); //AVWEB.avwLog("xhr is busy.");
} }
*/
//タグは書き出し //タグは書き出し
showVideoObject(x, y, width, height, src, isFullscreen, true); CONTENTVIEW.showVideoObject(x, y, width, height, src, isFullscreen, true);
}
);
};
CONTENTVIEW_FILESYSTEM.createMovieCache = function(resourceUrl, fileName) {
if (!CONTENTVIEW_FILESYSTEM.fs) {
return;
}
//キャッシュ化
var downloadSize = null;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if (this.readyState == 2 ){
downloadSize = xhr.getResponseHeader('Content-Length');
console.log("Content-Length:" + downloadSize);
console.log("limit:" + AVWEB.avwSysSetting().movieCacheLimitMB);
//制限値チェック
if(downloadSize){
if( downloadSize > AVWEB.avwSysSetting().movieCacheLimitMB * COMMON.MB_BYTE ){
console.log("abort");
xhr.abort();
}
}
}
if (this.readyState == 4 && this.status == 200){
CONTENTVIEW_FILESYSTEM.isXhrBusy = false;
$('#divCacheLoading').css('display', 'none');
//this.response is what you're looking for
//AVWEB.avwLog(this.response, typeof this.response);
CONTENTVIEW_FILESYSTEM.fs.root.getFile(
fileName,
{create: true},
function(fileEntry){
fileEntry.createWriter(
function(fileWriter) {
fileWriter.onwriteend = function(e) {
AVWEB.avwLog('RES書き込み完了 size=' + fileWriter.length);
if(downloadSize){
if( downloadSize > AVWEB.avwSysSetting().movieCacheLimitMB * COMMON.MB_BYTE ){
CONTENTVIEW_FILESYSTEM.deleteMovieCache(fileName);
} else if( downloadSize != fileWriter.length ){
CONTENTVIEW_FILESYSTEM.deleteMovieCache(fileName);
}
}
};
fileWriter.onerror = function(e) {
//AVWEB.avwLog('RES書き込みエラー: ' + e.toString());
};
var blobData = new Blob([xhr.response], {type:"application/octet-stream"});
fileWriter.write(blobData);
}
);
},
CONTENTVIEW_FILESYSTEM.errorHandler
);
} else {
if( this.readyState == 2 ){
//AVWEB.avwLog("onreadystatechange:" + this.readyState + " " + this.status);
downloadSize = xhr.getResponseHeader('Content-Length');
console.log("Content-Length:" + downloadSize);
console.log("limit:" + AVWEB.avwSysSetting().movieCacheLimitMB);
//制限値チェック
if( downloadSize && downloadSize > AVWEB.avwSysSetting().movieCacheLimitMB * COMMON.MB_BYTE ){
console.log("abort");
xhr.abort();
} else {
CONTENTVIEW_FILESYSTEM.isXhrBusy = true;
$('#divCacheLoading').css('z-index', '99999');
$('#divCacheLoading').css('display', 'block');
}
}
//AVWEB.avwLog("onreadystatechange:" + this.readyState + " " + this.status);
} }
};
xhr.onabort = function(e){
console.log("XHR 通信中止");
CONTENTVIEW_FILESYSTEM.isXhrBusy = false;
$('#divCacheLoading').css('display', 'none');
};
//var resourceUrl = CONTENTVIEW.downloadResourceById(CONTENTVIEW_GENERAL.contentID);
if( !CONTENTVIEW_FILESYSTEM.isXhrBusy ){
xhr.open('GET', resourceUrl);
xhr.responseType = 'blob';
xhr.send();
} else {
//AVWEB.avwLog("xhr is busy.");
}
};
CONTENTVIEW_FILESYSTEM.deleteMovieCache = function(fileName) {
if (!CONTENTVIEW_FILESYSTEM.fs) {
return;
}
CONTENTVIEW_FILESYSTEM.fs.root.getFile(
'/abook/' + fileName,
{ create: false },
function(fileEntry) {
fileEntry.remove(
function() {
AVWEB.avwLog('File removed. path=' + fileName);
},
null
);
},
null
); );
}; };
CONTENTVIEW_FILESYSTEM.errorHandler = function(e) { CONTENTVIEW_FILESYSTEM.errorHandler = function(e) {
var msg = ''; var msg = '';
switch (e.code) { switch (e.code) {
...@@ -379,7 +505,7 @@ $(function () { ...@@ -379,7 +505,7 @@ $(function () {
}); });
CONTENTVIEW_FILESYSTEM.ready = function(){ CONTENTVIEW_FILESYSTEM.ready = function(){
CONTENTVIEW_FILESYSTEM.fs = null; //CONTENTVIEW_FILESYSTEM.fs = null;
CONTENTVIEW_FILESYSTEM.isXhrBusy = false; //CONTENTVIEW_FILESYSTEM.isXhrBusy = false;
}; };
...@@ -1273,8 +1273,8 @@ CONTENTVIEW_GETDATA.renderNextPage = function(){ ...@@ -1273,8 +1273,8 @@ CONTENTVIEW_GETDATA.renderNextPage = function(){
} else { } else {
// ファイル取得 // ファイル取得
var fileName = contentID + "/page_" + pageNo + ".dat"; var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/page_" + pageNo + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false }, CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){ function(fileEntry){
fileEntry.file( fileEntry.file(
function(file){ function(file){
...@@ -1348,8 +1348,8 @@ CONTENTVIEW_GETDATA.renderPrevPage = function(){ ...@@ -1348,8 +1348,8 @@ CONTENTVIEW_GETDATA.renderPrevPage = function(){
} else { } else {
// ファイル取得 // ファイル取得
var fileName = contentID + "/page_" + pageNo + ".dat"; var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/page_" + pageNo + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false }, CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){ function(fileEntry){
fileEntry.file( fileEntry.file(
function(file){ function(file){
......
...@@ -547,6 +547,8 @@ CONTENTVIEW_INITOBJECT.isHasPageBGM = function(){ ...@@ -547,6 +547,8 @@ CONTENTVIEW_INITOBJECT.isHasPageBGM = function(){
CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){
console.log("CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType");
//$('#divImageLoading').css('display', 'block'); //$('#divImageLoading').css('display', 'block');
/* init footer toolbar */ /* init footer toolbar */
...@@ -581,14 +583,14 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){ ...@@ -581,14 +583,14 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){
var resourceId = CONTENTVIEW.getVideoContentResourceId(CONTENTVIEW_GENERAL.contentID); var resourceId = CONTENTVIEW.getVideoContentResourceId(CONTENTVIEW_GENERAL.contentID);
//キャッシュが存在するか確認 //キャッシュが存在するか確認
var fileName = CONTENTVIEW_GENERAL.contentID + "/res_" + resourceId + ".dat"; var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/res_" + resourceId + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false }, CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){ function(fileEntry){
fileEntry.file( fileEntry.file(
function(file){ function(file){
var url = window.URL || window.webkitURL; var url = window.URL || window.webkitURL;
var resSrc = url.createObjectURL(file); var resSrc = url.createObjectURL(file);
//AVWEB.avwLog("read cache: createObjectURL " + resSrc); AVWEB.avwLog("read cache: createObjectURL " + resSrc);
CONTENTVIEW.displayOverlayForSpecifyContentType(resSrc); CONTENTVIEW.displayOverlayForSpecifyContentType(resSrc);
...@@ -598,9 +600,28 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){ ...@@ -598,9 +600,28 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){
function(err){ // 失敗時のコールバック関数 function(err){ // 失敗時のコールバック関数
//AVWEB.avwLog("NotRead FileSystem"); //AVWEB.avwLog("NotRead FileSystem");
var resourceUrl = CONTENTVIEW.downloadResourceById(CONTENTVIEW_GENERAL.contentID);
CONTENTVIEW_FILESYSTEM.createMovieCache(resourceUrl,fileName);
/*
//キャッシュ化 //キャッシュ化
var downloadSize = null;
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){ xhr.onreadystatechange = function(){
if (this.readyState == 2 ){
downloadSize = xhr.getResponseHeader('Content-Length');
console.log("Content-Length:" + downloadSize);
console.log("limit:" + AVWEB.avwSysSetting().movieCacheLimitMB);
//制限値チェック
if(downloadSize){
if( downloadSize > AVWEB.avwSysSetting().movieCacheLimitMB * COMMON.MB_BYTE ){
console.log("abort");
xhr.abort();
}
}
}
if (this.readyState == 4 && this.status == 200){ if (this.readyState == 4 && this.status == 200){
CONTENTVIEW_FILESYSTEM.isXhrBusy = false; CONTENTVIEW_FILESYSTEM.isXhrBusy = false;
...@@ -615,7 +636,14 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){ ...@@ -615,7 +636,14 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){
fileEntry.createWriter( fileEntry.createWriter(
function(fileWriter) { function(fileWriter) {
fileWriter.onwriteend = function(e) { fileWriter.onwriteend = function(e) {
//AVWEB.avwLog('RES書き込み完了'); AVWEB.avwLog('RES書き込み完了 size=' + fileWriter.length);
if(downloadSize){
if( downloadSize > AVWEB.avwSysSetting().movieCacheLimitMB * COMMON.MB_BYTE ){
CONTENTVIEW_FILESYSTEM.deleteMovieCache(fileName);
} else if( downloadSize != fileWriter.length ){
CONTENTVIEW_FILESYSTEM.deleteMovieCache(fileName);
}
}
}; };
fileWriter.onerror = function(e) { fileWriter.onerror = function(e) {
//AVWEB.avwLog('RES書き込みエラー: ' + e.toString()); //AVWEB.avwLog('RES書き込みエラー: ' + e.toString());
...@@ -633,13 +661,29 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){ ...@@ -633,13 +661,29 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){
} else { } else {
if( this.readyState == 2 ){ if( this.readyState == 2 ){
//AVWEB.avwLog("onreadystatechange:" + this.readyState + " " + this.status); //AVWEB.avwLog("onreadystatechange:" + this.readyState + " " + this.status);
CONTENTVIEW_FILESYSTEM.isXhrBusy = true;
$('#divImageLoading').css('z-index', '99999'); downloadSize = xhr.getResponseHeader('Content-Length');
$('#divImageLoading').css('display', 'block'); console.log("Content-Length:" + downloadSize);
console.log("limit:" + AVWEB.avwSysSetting().movieCacheLimitMB);
//制限値チェック
if( downloadSize && downloadSize > AVWEB.avwSysSetting().movieCacheLimitMB * COMMON.MB_BYTE ){
console.log("abort");
xhr.abort();
} else {
CONTENTVIEW_FILESYSTEM.isXhrBusy = true;
$('#divImageLoading').css('z-index', '99999');
$('#divImageLoading').css('display', 'block');
}
} }
//AVWEB.avwLog("onreadystatechange:" + this.readyState + " " + this.status); //AVWEB.avwLog("onreadystatechange:" + this.readyState + " " + this.status);
} }
}; };
xhr.onabort = function(e){
console.log("XHR 通信中止");
CONTENTVIEW_FILESYSTEM.isXhrBusy = false;
$('#divImageLoading').css('display', 'none');
};
var resourceUrl = CONTENTVIEW.downloadResourceById(CONTENTVIEW_GENERAL.contentID); var resourceUrl = CONTENTVIEW.downloadResourceById(CONTENTVIEW_GENERAL.contentID);
if( !CONTENTVIEW_FILESYSTEM.isXhrBusy ){ if( !CONTENTVIEW_FILESYSTEM.isXhrBusy ){
...@@ -649,6 +693,7 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){ ...@@ -649,6 +693,7 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){
} else { } else {
//AVWEB.avwLog("xhr is busy."); //AVWEB.avwLog("xhr is busy.");
} }
*/
//タグは書き出し //タグは書き出し
CONTENTVIEW.displayOverlayForSpecifyContentType(resourceUrl); CONTENTVIEW.displayOverlayForSpecifyContentType(resourceUrl);
......
...@@ -112,6 +112,9 @@ $(document).ready(function () { ...@@ -112,6 +112,9 @@ $(document).ready(function () {
$('#authGroupBox').hide(); $('#authGroupBox').hide();
} }
//chromeキャッシュ対応
CONTENTVIEW_FILESYSTEM.initFS(null);
}); });
//グループ認証 戻る //グループ認証 戻る
......
...@@ -197,7 +197,8 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate ...@@ -197,7 +197,8 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate
} }
htmlTemp = htmlTemp.replace(/\{download\}/g, downloadHtml); htmlTemp = htmlTemp.replace(/\{download\}/g, downloadHtml);
$('#content-grid').append(htmlTemp); //効率化
//$('#content-grid').append(htmlTemp);
} }
} }
...@@ -224,8 +225,9 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate ...@@ -224,8 +225,9 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate
HISTORY.contentTypeArr.push({ contentId: post.contentId, contentType: post.contentType }); HISTORY.contentTypeArr.push({ contentId: post.contentId, contentType: post.contentType });
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage. //End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage.
//効率化
//Check if user has read this content or not. //Check if user has read this content or not.
HISTORY.checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion); //HISTORY.checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion);
//assign version to array //assign version to array
COMMON.resourceVersionArr.push({ contentid: post.contentId, resourceversion: post.resourceVersion }); COMMON.resourceVersionArr.push({ contentid: post.contentId, resourceversion: post.resourceVersion });
...@@ -236,7 +238,8 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate ...@@ -236,7 +238,8 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate
//Check if content has marking or memo //Check if content has marking or memo
HISTORY.checkContentMarkingMemoOption(post.contentId); HISTORY.checkContentMarkingMemoOption(post.contentId);
$('#lblVdate' + post.contentId).html(viewdate); //効率化
//$('#lblVdate' + post.contentId).html(viewdate);
HISTORY.addReadContentToArray(post.contentId, post.resourceVersion, post.metaVersion, post.contentThumbnail, post.contentTitle, HISTORY.returnContentTitleKana(post.contentId), post.contentDeliveryDate,post.contentType, post.readerShare, post.download ); HISTORY.addReadContentToArray(post.contentId, post.resourceVersion, post.metaVersion, post.contentThumbnail, post.contentTitle, HISTORY.returnContentTitleKana(post.contentId), post.contentDeliveryDate,post.contentType, post.readerShare, post.download );
...@@ -1124,6 +1127,9 @@ HISTORY.formatDate = function(originDate){ ...@@ -1124,6 +1127,9 @@ HISTORY.formatDate = function(originDate){
}; };
HISTORY.sortByViewDateDesc = function(){ HISTORY.sortByViewDateDesc = function(){
console.log("HISTORY.sortByViewDateDesc");
var sortArr = HISTORY.contentViewData; var sortArr = HISTORY.contentViewData;
var temp; var temp;
...@@ -1367,6 +1373,9 @@ HISTORY.sortByTitleKanaDesc = function(){ ...@@ -1367,6 +1373,9 @@ HISTORY.sortByTitleKanaDesc = function(){
HISTORY.renderContentAfterSort = function(contentSortArr){ HISTORY.renderContentAfterSort = function(contentSortArr){
console.log("HISTORY.renderContentAfterSort");
HISTORY.refreshGrid(); HISTORY.refreshGrid();
//var htmlTemp = ""; //var htmlTemp = "";
for(var i = 0; i < contentSortArr.length; i++) { for(var i = 0; i < contentSortArr.length; i++) {
......
...@@ -2766,6 +2766,7 @@ HOME.showContentView = function(){ ...@@ -2766,6 +2766,7 @@ HOME.showContentView = function(){
CONTENTVIEW.cssInit(); CONTENTVIEW.cssInit();
$("#viewer").show(); $("#viewer").show();
//CONTENTVIEW_FILESYSTEM.initFS(CONTENTVIEW.ready);
CONTENTVIEW.ready(); CONTENTVIEW.ready();
}; };
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
<script type="text/javascript" src="./common/js/screenLock.js?__UPDATEID__" ></script> <script type="text/javascript" src="./common/js/screenLock.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./js/header.js?__UPDATEID__" ></script> <script type="text/javascript" src="./js/header.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./js/settings.js?__UPDATEID__" ></script> <script type="text/javascript" src="./js/settings.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./js/contentview_FileSystem.js?__UPDATEID__"></script>
<style> <style>
#slidebar-animation{ #slidebar-animation{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment