Commit cdc165ad by Masaru Abe

テスト対応

parent c24693d5
......@@ -55,6 +55,7 @@
<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/scrolltopcontrol.js?__UPDATEID__"></script>
<script type="text/javascript" src="./js/contentview_FileSystem.js?__UPDATEID__"></script>
</head>
<body id="bookmark" oncontextmenu="return false;">
......
......@@ -26,6 +26,8 @@ COMMON.ThumbnailForOtherType = {
Thumbnail_LinkType : 'img/thumb_default_link.png'
};
//1メガのバイト数定数
COMMON.MB_BYTE = 1048576;
// =============================================================================================
// Constants [start]
......
......@@ -13,5 +13,6 @@
"anonymousLoginPath" : "test",
"anonymousLoginId" : "nologin",
"appName" : "ABookWebCL",
"appVersion" : "0.0.1"
"appVersion" : "0.0.1",
"movieCacheLimitMB" : 200
}
......@@ -57,6 +57,7 @@
<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="./common/js/scrolltopcontrol.js?__UPDATEID__"></script>
<script type="text/javascript" src="./js/contentview_FileSystem.js?__UPDATEID__"></script>
</head>
<body id="contentsearch" oncontextmenu="return false;">
......
......@@ -1265,12 +1265,33 @@ div .ui-slider-range, .ui-widget-header, .ui-slider-range-max {
}
#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-top: 3px;
}
/* loading image [end]*/
/* navigate button [start]*/
#button_pre_canvas{
position:absolute;
......
......@@ -1038,6 +1038,19 @@ div .ui-slider-range, .ui-widget-header, .ui-slider-range-max {
#divImageLoading img{
}
#divCacheLoading{
/*
background-color:#ccc;
border-radius: 10px;
opacity: 0.7;
*/
}
#divCacheLoading img{
}
/* loading image [end]*/
/* navigate button [start]*/
......
......@@ -60,6 +60,7 @@
<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="./js/detail.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./js/contentview_FileSystem.js?__UPDATEID__"></script>
</head>
<body id="history" oncontextmenu="return false;">
......
......@@ -68,6 +68,7 @@
<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="./js/detail.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./js/contentview_FileSystem.js?__UPDATEID__"></script>
<script type="text/javascript">
$(function () {
......
......@@ -84,6 +84,9 @@
<div id="divImageLoading">
<img src="img/view_loading.gif" width="64px" height="64px">
</div>
<div id="divCacheLoading">
<img src="img/data2_loading.gif" >
</div>
<!-- ================================================================================== -->
<!-- Marking group [start]
<!-- ================================================================================== -->
......@@ -385,7 +388,6 @@
<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_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/jquery.powertip.js?__UPDATEID__"></script>
<script type="text/javascript" src="./common/js/script.js?__UPDATEID__"></script>
......
......@@ -894,9 +894,6 @@ BOOKMARK.IsExistContent = function(strContentId) {
authCode: ClientData.authCode()
};
var method = "GET";
if( ClientData.authCode()
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params,
function (data) {
isExisted = true;
......
......@@ -1018,8 +1018,8 @@ CONTENTVIEW.changePage = function(page_index) {
// ファイル取得
var pageNoTmp = page_index + 1;
var fileName = CONTENTVIEW_GENERAL.contentID + "/page_" + pageNoTmp + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false },
var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/page_" + pageNoTmp + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile( fileName, { create: false },
function(fileEntry){
fileEntry.file(
function(file){
......@@ -2014,8 +2014,8 @@ CONTENTVIEW.changePageWithoutSlide = function(pageMove) {
// ファイル取得
var pageNoTmp = pageMove + 1;
var fileName = CONTENTVIEW_GENERAL.contentID + "/page_" + pageNoTmp + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false },
var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/page_" + pageNoTmp + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile( fileName, { create: false },
function(fileEntry){
fileEntry.file(
function(file){
......@@ -2646,6 +2646,32 @@ CONTENTVIEW.downloadResourceById = function(contentId){
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.
CONTENTVIEW.setViewportForWin8 = function(){
if (window.navigator.msPointerEnabled) {
......@@ -4682,7 +4708,8 @@ CONTENTVIEW.showVideoObject = function(x, y, width, height, src, isFullscreen) {
'width="' + (pt2.x - pt1.x) + '" ' +
'height="' + (pt2.y - pt1.y) + '" ' +
'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"> ' +
'</video>'
);
......@@ -4692,7 +4719,8 @@ CONTENTVIEW.showVideoObject = function(x, y, width, height, src, isFullscreen) {
'width="' + (pt2.x - pt1.x) + '" ' +
'height="' + (pt2.y - pt1.y) + '" ' +
'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>'
);
}
......@@ -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-size':'',
'background':'#898989',
'background-image':'url(../../img/viewer/article_bg.png)',
'background-image':'url(./img/viewer/article_bg.png)',
'color':'',
'margin':'0',
'padding':'0'
......@@ -5477,6 +5505,14 @@ CONTENTVIEW.screenMove = function(){
//戻る処理
CONTENTVIEW.screenBack = function(){
//後始末
$('#dialog').hide();
$('#dialog').empty();
$('#dialog').removeClass();
$('#dialog').removeAttr('style');
$('#dialog').addClass('web_dialog');
$('#divCacheLoading').hide();
$("#viewer").hide();
if( $('#bookshelf').length || $('#list').length ){
HOME.cssInit();
......@@ -5588,114 +5624,126 @@ CONTENTVIEW.ready = function(){
CONTENTVIEW.marginY = 65;
}
/* check login */
if (!AVWEB.avwCheckLogin(COMMON.ScreenIds.Login)) return;
// Set event to prevent leave
COMMON.ToogleLogoutNortice();
//START TRB00048 - EDITOR : Long - Date : 09/18/2013 - Summary : Fix Jumpcontent
CONTENTVIEW_GETDATA.getContentID();
var params = {
contentId: CONTENTVIEW_GENERAL.contentID,
sid: ClientData.userInfo_sid(),
getType: 1,
isStreaming: ClientData.isStreamingMode(),
authCode: ClientData.authCode()
};
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(),
"webGetContent",
"GET",
params,
function (data) {
console.log("data.contentData.contentType:" + data.contentData.contentType);
//画面初期化
$('#dialog').hide();
$('#dialog').empty();
$('#dialog').removeClass();
$('#dialog').removeAttr('style');
$('#dialog').addClass('web_dialog');
$('#divCacheLoading').hide();
/* check login */
if (!AVWEB.avwCheckLogin(COMMON.ScreenIds.Login)) return;
// Set event to prevent leave
COMMON.ToogleLogoutNortice();
//START TRB00048 - EDITOR : Long - Date : 09/18/2013 - Summary : Fix Jumpcontent
CONTENTVIEW_GETDATA.getContentID();
var params = {
contentId: CONTENTVIEW_GENERAL.contentID,
sid: ClientData.userInfo_sid(),
getType: 1,
isStreaming: ClientData.isStreamingMode(),
authCode: ClientData.authCode()
};
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()){
//リンク、その他は表示出来ないのでここでブロックする
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()) {
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();
}
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 {
//Check if is pdf content
if(CONTENTVIEW.isMediaAndHTMLContent()){
CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType();
//START TRB00059 - EDITOR: Long - Date : 09/19/2013 - Summary : Add title for media and html type
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{
CONTENTVIEW_INITOBJECT.initPage();
}
//ストリーミングならデバイス側に初期表示済通知
if(ClientData.isStreamingMode()){
CONTENTVIEW_STREAMING.initPageView()
}
}
},
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();
}
}
);
else{
CONTENTVIEW_INITOBJECT.initPage();
}
//ストリーミングならデバイス側に初期表示済通知
if(ClientData.isStreamingMode()){
CONTENTVIEW_STREAMING.initPageView()
}
} else {
//この処理がないと初回画面描画が出来ない けど点滅する
$('body, html').hide();
ClientData.IsRefresh(true);
location.reload();
}
}
else {
//Check if is pdf content
if(CONTENTVIEW.isMediaAndHTMLContent()){
CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType();
//START TRB00059 - EDITOR: Long - Date : 09/19/2013 - Summary : Add title for media and html type
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{
CONTENTVIEW_INITOBJECT.initPage();
}
//ストリーミングならデバイス側に初期表示済通知
if(ClientData.isStreamingMode()){
CONTENTVIEW_STREAMING.initPageView()
}
}
};
......@@ -25,8 +25,8 @@ CONTENTVIEW_CALLAPI.getJsonContentInfo = function( doneFunc ) {
);
} else {
// 1ページ目のファイル取得
var fileName = contentID + "/page_1.dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false },
var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/page_1.dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile( fileName, { create: false },
function(fileEntry){
fileEntry.file(function(file){
var reader = new FileReader();
......@@ -43,7 +43,7 @@ CONTENTVIEW_CALLAPI.getJsonContentInfo = function( doneFunc ) {
function(err){
// 失敗時のコールバック関数
AVWEB.avwLog("NotRead FileSystem");
avwGrabContentPageImage(
AVWEB.avwGrabContentPageImage(
ClientData.userInfo_accountPath(),
{ contentId: CONTENTVIEW_GENERAL.contentID, sid: ClientData.userInfo_sid(), pageNo: 1 },
function (data) {
......
......@@ -787,7 +787,7 @@ CONTENTVIEW_CREATEOBJECT.trigger = function (mediaType, actionType, id, imageUrl
objectLog.resourceId = CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].resourceId;
} else { /* video */
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);
if(ClientData.isStreamingMode()){
......@@ -1448,7 +1448,7 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image
CONTENTVIEW.stopAllAudio();
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);
if(ClientData.isStreamingMode()){
......@@ -1522,8 +1522,8 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image
} else {
//キャッシュが存在するか確認
var fileName = CONTENTVIEW_GENERAL.contentID + "/res_" + media + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false },
var fileName = '/abook/' +CONTENTVIEW_GENERAL.contentID + "/res_" + media + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){
fileEntry.file(
function(file){
......@@ -1531,7 +1531,7 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image
var resSrc = url.createObjectURL(file);
AVWEB.avwLog("read cache: createObjectURL " + resSrc);
createVideoFulScreen(resSrc, id);
CONTENTVIEW_CREATEOBJECT.createVideoFulScreen(resSrc, id);
$("#btnCloseVideo").on({
'click touchend': function(ev){
//時間記録
......@@ -1554,6 +1554,9 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image
function(err){ // 失敗時のコールバック関数
AVWEB.avwLog("NotRead FileSystem");
CONTENTVIEW_FILESYSTEM.createMovieCache(mediaFile,fileName);
/*
//キャッシュ化
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
......@@ -1603,6 +1606,7 @@ CONTENTVIEW_CREATEOBJECT.videoType2 = function (mediaType, actionType, id, image
} else {
AVWEB.avwLog("xhr is busy.");
}
*/
//タグは書き出し
CONTENTVIEW_CREATEOBJECT.createVideoFulScreen(mediaFile, id);
......@@ -1693,8 +1697,8 @@ CONTENTVIEW_CREATEOBJECT.videoType1 = function (mediaType, actionType, id, image
} else {
//キャッシュが存在するか確認
var fileName = CONTENTVIEW_GENERAL.contentID + "/res_" + mediaResourceId + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false },
var fileName = '/abook/' +CONTENTVIEW_GENERAL.contentID + "/res_" + mediaResourceId + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){
fileEntry.file(
function(file){
......@@ -1728,6 +1732,9 @@ CONTENTVIEW_CREATEOBJECT.videoType1 = function (mediaType, actionType, id, image
function(err){ // 失敗時のコールバック関数
AVWEB.avwLog("NotRead FileSystem");
CONTENTVIEW_FILESYSTEM.createMovieCache(mediaFile,fileName);
/*
//キャッシュ化
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
......@@ -1778,6 +1785,7 @@ CONTENTVIEW_CREATEOBJECT.videoType1 = function (mediaType, actionType, id, image
} else {
AVWEB.avwLog("xhr is busy.");
}
*/
//タグは書き出し
CONTENTVIEW_CREATEOBJECT.createVideoFulScreen(mediaFile, id);
......
......@@ -389,8 +389,8 @@ CONTENTVIEW_EVENTS.firstPage_click = function() {
} else {
// ファイル取得
var fileName = CONTENTVIEW_GENERAL.contentID + "/page_1.dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false },
var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/page_1.dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){
fileEntry.file(
function(file){
......@@ -516,8 +516,8 @@ CONTENTVIEW_EVENTS.lastPage_click = function() {
} else {
// ファイル取得
var fileName = contentID + "/page_" + totalPage + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false },
var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/page_" + CONTENTVIEW_GENERAL.totalPage + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){
fileEntry.file(
function(file){
......
......@@ -2,9 +2,11 @@
//名前空間用のオブジェクトを用意する
var CONTENTVIEW_FILESYSTEM = {};
CONTENTVIEW_FILESYSTEM.initFS = function( func ) {
CONTENTVIEW_FILESYSTEM.fs = null;
CONTENTVIEW_FILESYSTEM.isXhrBusy = false;
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
// Initiate filesystem on page load.
......@@ -20,7 +22,7 @@ CONTENTVIEW_FILESYSTEM.initFS = function( func ) {
window.TEMPORARY,
1024*1024,
function(filesystem) {
//AVWEB.avwLog("initFS window.requestFileSystem");
AVWEB.avwLog("initFS window.requestFileSystem");
CONTENTVIEW_FILESYSTEM.fs = filesystem;
CONTENTVIEW_FILESYSTEM.fs.root.getDirectory(
'abook',
......@@ -121,7 +123,7 @@ CONTENTVIEW_FILESYSTEM.checkUpdate = function(contentId, data, func) {
}
//既にjson.txtが存在するか
var fileName = contentID + "/json.txt";
var fileName = contentId + "/json.txt";
CONTENTVIEW_FILESYSTEM.fs.root.getFile(
'/abook/' + fileName,
{ create: false },
......@@ -264,33 +266,36 @@ CONTENTVIEW_FILESYSTEM.showVideoObjectCache = function(x, y, width, height, src,
if (!CONTENTVIEW_FILESYSTEM.fs) {
//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;
}
//キャッシュが存在するか確認
var fileName = contentID + "/res_" + resourceId + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false },
var fileName = '/abook/' + contentId + "/res_" + resourceId + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){
fileEntry.file(
function(file){
//AVWEB.avwLog("read cache");
var url = window.URL || window.webkitURL;
var resSrc = url.createObjectURL(file);
showVideoObject(x, y, width, height, resSrc, isFullscreen, false);
CONTENTVIEW.showVideoObject(x, y, width, height, resSrc, isFullscreen, false);
}
);
},
function(err){ // 失敗時のコールバック関数
//AVWEB.avwLog("NotRead FileSystem");
CONTENTVIEW_FILESYSTEM.createMovieCache(src, fileName);
/*
//キャッシュ化
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if (this.readyState == 4 && this.status == 200){
var size = xhr.getResponseHeader('Content-Length')
console.log("size:" + size);
//var size = xhr.getResponseHeader('Content-Length')
//console.log("size:" + size);
CONTENTVIEW_FILESYSTEM.isXhrBusy = false;
$('#divImageLoading').css('display', 'none');
......@@ -337,16 +342,137 @@ CONTENTVIEW_FILESYSTEM.showVideoObjectCache = function(x, y, width, height, src,
} else {
//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) {
var msg = '';
switch (e.code) {
......@@ -379,7 +505,7 @@ $(function () {
});
CONTENTVIEW_FILESYSTEM.ready = function(){
CONTENTVIEW_FILESYSTEM.fs = null;
CONTENTVIEW_FILESYSTEM.isXhrBusy = false;
//CONTENTVIEW_FILESYSTEM.fs = null;
//CONTENTVIEW_FILESYSTEM.isXhrBusy = false;
};
......@@ -1273,8 +1273,8 @@ CONTENTVIEW_GETDATA.renderNextPage = function(){
} else {
// ファイル取得
var fileName = contentID + "/page_" + pageNo + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false },
var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/page_" + pageNo + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){
fileEntry.file(
function(file){
......@@ -1348,8 +1348,8 @@ CONTENTVIEW_GETDATA.renderPrevPage = function(){
} else {
// ファイル取得
var fileName = contentID + "/page_" + pageNo + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false },
var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/page_" + pageNo + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){
fileEntry.file(
function(file){
......
......@@ -547,6 +547,8 @@ CONTENTVIEW_INITOBJECT.isHasPageBGM = function(){
CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){
console.log("CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType");
//$('#divImageLoading').css('display', 'block');
/* init footer toolbar */
......@@ -581,14 +583,14 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){
var resourceId = CONTENTVIEW.getVideoContentResourceId(CONTENTVIEW_GENERAL.contentID);
//キャッシュが存在するか確認
var fileName = CONTENTVIEW_GENERAL.contentID + "/res_" + resourceId + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false },
var fileName = '/abook/' + CONTENTVIEW_GENERAL.contentID + "/res_" + resourceId + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile(fileName, { create: false },
function(fileEntry){
fileEntry.file(
function(file){
var url = window.URL || window.webkitURL;
var resSrc = url.createObjectURL(file);
//AVWEB.avwLog("read cache: createObjectURL " + resSrc);
AVWEB.avwLog("read cache: createObjectURL " + resSrc);
CONTENTVIEW.displayOverlayForSpecifyContentType(resSrc);
......@@ -598,9 +600,28 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){
function(err){ // 失敗時のコールバック関数
//AVWEB.avwLog("NotRead FileSystem");
var resourceUrl = CONTENTVIEW.downloadResourceById(CONTENTVIEW_GENERAL.contentID);
CONTENTVIEW_FILESYSTEM.createMovieCache(resourceUrl,fileName);
/*
//キャッシュ化
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;
......@@ -615,7 +636,14 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){
fileEntry.createWriter(
function(fileWriter) {
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) {
//AVWEB.avwLog('RES書き込みエラー: ' + e.toString());
......@@ -633,13 +661,29 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){
} else {
if( this.readyState == 2 ){
//AVWEB.avwLog("onreadystatechange:" + this.readyState + " " + this.status);
CONTENTVIEW_FILESYSTEM.isXhrBusy = true;
$('#divImageLoading').css('z-index', '99999');
$('#divImageLoading').css('display', 'block');
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;
$('#divImageLoading').css('z-index', '99999');
$('#divImageLoading').css('display', 'block');
}
}
//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);
if( !CONTENTVIEW_FILESYSTEM.isXhrBusy ){
......@@ -649,6 +693,7 @@ CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){
} else {
//AVWEB.avwLog("xhr is busy.");
}
*/
//タグは書き出し
CONTENTVIEW.displayOverlayForSpecifyContentType(resourceUrl);
......
......@@ -112,6 +112,9 @@ $(document).ready(function () {
$('#authGroupBox').hide();
}
//chromeキャッシュ対応
CONTENTVIEW_FILESYSTEM.initFS(null);
});
//グループ認証 戻る
......
......@@ -197,7 +197,8 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate
}
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
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.
//効率化
//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
COMMON.resourceVersionArr.push({ contentid: post.contentId, resourceversion: post.resourceVersion });
......@@ -236,7 +238,8 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate
//Check if content has marking or memo
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 );
......@@ -1124,6 +1127,9 @@ HISTORY.formatDate = function(originDate){
};
HISTORY.sortByViewDateDesc = function(){
console.log("HISTORY.sortByViewDateDesc");
var sortArr = HISTORY.contentViewData;
var temp;
......@@ -1367,6 +1373,9 @@ HISTORY.sortByTitleKanaDesc = function(){
HISTORY.renderContentAfterSort = function(contentSortArr){
console.log("HISTORY.renderContentAfterSort");
HISTORY.refreshGrid();
//var htmlTemp = "";
for(var i = 0; i < contentSortArr.length; i++) {
......
......@@ -2766,6 +2766,7 @@ HOME.showContentView = function(){
CONTENTVIEW.cssInit();
$("#viewer").show();
//CONTENTVIEW_FILESYSTEM.initFS(CONTENTVIEW.ready);
CONTENTVIEW.ready();
};
......
......@@ -42,6 +42,7 @@
<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/settings.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./js/contentview_FileSystem.js?__UPDATEID__"></script>
<style>
#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