contentview_InitObjects.js 28.9 KB
Newer Older
1

2 3 4
//名前空間用のオブジェクトを用意する
var CONTENTVIEW_INITOBJECT = {};

5
/* init Image memo */
6
CONTENTVIEW_INITOBJECT.initImageMemo = function() {
7 8 9 10 11 12 13 14 15 16 17 18 19
    if (ClientData.IsDisplayMemo() == true) {
        //change class
        $('#imgmemo').removeClass();
        $('#imgmemo').addClass('memoDisplay_hover');

    } else {
        //change class
        $('#imgmemo').removeClass();
        $('#imgmemo').addClass('memoDisplay');
    }
};

/* init Image add memo */
20
CONTENTVIEW_INITOBJECT.initImageAddMemo = function() {
21 22 23 24 25 26 27 28 29 30 31 32 33 34
    if (ClientData.IsAddingMemo() == true) {
        //change class
        $('#imgaddmemo').removeClass();
        $('#imgaddmemo').addClass('memoAdd_hover');

    } else {
        //change class
        $('#imgaddmemo').removeClass();
        $('#imgaddmemo').addClass('memoAdd');

    }
};

/*check display marking?? */
35
CONTENTVIEW_INITOBJECT.initDisplayMarking = function() {
36 37 38 39 40 41 42
    if (ClientData.IsDisplayMarking() == true) {
        // change class
        $('#imgmarking').removeClass();
        $('#imgmarking').addClass('marking_hover');

        if (ClientData.IsAddingMarking() == true) {
            if (ClientData.IsHideToolbar() == false) {
43
            	CONTENTVIEW_MARKING.ShowMarking();
44 45
            }

46
            CONTENTVIEW_GENERAL.disableAllControl();
47
        }
48
        else {
49 50

            //change image
51 52 53
            if(ClientData.serviceOpt_marking() == 'Y'){
                $('#imgmarkingtoolbar').removeClass();
                $('#imgmarkingtoolbar').addClass('markingToolbar');
54
            }
55
        }
56
    }
57 58 59 60 61 62 63 64 65
    else {
        $("#dlgMarking").hide();

        // change class
        $('#imgmarking').removeClass();
        $('#imgmarking').addClass('marking');

        $('#draw_canvas').css('display', 'none');

66
        //change image
67 68 69
        if(ClientData.serviceOpt_marking() == 'Y'){
            $('#imgmarkingtoolbar').removeClass();
            $('#imgmarkingtoolbar').addClass('markingToolbar');
70
        }
71 72 73 74 75 76

    }
};


/* init Image bookmark */
77 78
CONTENTVIEW_INITOBJECT.initImageBookmark = function() {
    if (CONTENTVIEW.isExistBookmark() == -1) {
79 80 81 82 83 84 85 86 87 88 89 90 91
        //change class
        $('#imgbookmark').removeClass();
        $('#imgbookmark').addClass('bmAdd_off');

    } else {
        //change class
        $('#imgbookmark').removeClass();
        $('#imgbookmark').addClass('bmAdd');
    }
};


/* init flag marking, memo when init page */
92
CONTENTVIEW_INITOBJECT.initFlagDisplay = function() {
93 94 95 96 97 98 99 100 101 102 103 104
    ClientData.IsDisplayMemo(false);
    ClientData.IsAddingMemo(false);
    if (ClientData.userOpt_makingDsp() == "1") {
        ClientData.IsDisplayMarking(true);
    } else {
        ClientData.IsDisplayMarking(false);
    }
    ClientData.IsAddingMarking(false);
};


/* set size bot toolbar for ipad */
105
CONTENTVIEW_INITOBJECT.initDisplayToolbarDevice = function() {
Masaru Abe committed
106
    if (CONTENTVIEW_GENERAL.avwUserEnvObj.isIos() || CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid()) {
107 108 109 110 111 112 113
        $('.transition').css('padding', '4px 0 0 0');
        $('.sizing').css('padding', '4px 0 0 2px');
        $('.toolbar').css('margin', '0 0 0 0');
    }
};

//START : TRB00034 - DATE : 09/11/2013 - Editor : Long  - Summary : Fix for center loading image
114
CONTENTVIEW_INITOBJECT.setLoadingSize = function(){
115 116 117 118
    var width = $(window).width() / 2;
    var objWidth = $('#divImageLoading').width() /2 ;
    var result = width - objWidth;

119
    $('#divImageLoading').css('left', result);
120 121
};
//END : TRB00034 - DATE : 09/11/2013 - Editor : Long  - Summary : Fix for center loading image
122
CONTENTVIEW_INITOBJECT.initPage = function() {
123

124
	CONTENTVIEW_INITOBJECT.setLoadingSize();
125 126 127 128 129
    $('#divImageLoading').css('display', 'block');

    /* init footer toolbar */
    $('#footer_toolbar_2').hide();
    $('#footer_toolbar_1').show();
130 131 132
    if(ClientData.isGetitsMode() == true){
    	$('#header_toolbar').show();
    }
133
    /* init pos bottom toolbar*/
134
    CONTENTVIEW_INITOBJECT.initDisplayToolbarDevice();
135 136

    // Lock screen
Masaru Abe committed
137
    //COMMON.LockScreen();
138

139
    CONTENTVIEW.StartTimerUpdateLog();
140 141

    /* set start log */
142
    COMMON.SetStartLog(CONTENTVIEW_GENERAL.contentID);
143 144

    /* get info of content */
145 146
    if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_Image){
    	CONTENTVIEW_GETDATA.getContentInfoTypeImage();
147
    }
148 149
    else if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_NoFile){
    	CONTENTVIEW_GETDATA.getPageTransitionConfig();
150
        CONTENTVIEW_CONTENTTYPENONE.getJsonContentInfoTyeNone(CONTENTVIEW_INITOBJECT.ajaxComplete4);
151 152
    }
    else{
153
    	CONTENTVIEW_CALLAPI.getJsonContentInfo(CONTENTVIEW_INITOBJECT.ajaxComplete8);
154
    	CONTENTVIEW_GETDATA.getPageTransitionConfig();
155
    }
156

157
    CONTENTVIEW_INITOBJECT.initializeViewerComponent('wrapper');
158 159

    /* handle display tooltip */
160
    CONTENTVIEW.handleTooltip();
161 162

    /* set text dialog confirm of audio */
163
    CONTENTVIEW_CREATEOBJECT.createTextConfirmAudio();
164 165

    /* handle toolbar */
166 167
    $('#control_screen').click(CONTENTVIEW.handleDisplayToolbar);
    $('#control_screen_2').click(CONTENTVIEW.handleDisplayToolbar);
168 169

    /* bookmark Page */
170 171
    $('#imgbookmark').click(CONTENTVIEW.bookmarkPage);
    $('#listbookmark').click(CONTENTVIEW_EVENTS.showListBookMark);
172
    $('#divListBookmark li').die();
173
    $('#divListBookmark li').live('click', CONTENTVIEW_EVENTS.clickBookmark);
174

175
    if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_PDF){
176
        /* page index */
177
        $('#listindex').click(CONTENTVIEW_EVENTS.showListPageIndex);
178
        $('#divSearchResult li').die();
179
        $('#divSearchResult li').live('click', CONTENTVIEW_EVENTS.clickSearchDetail);
180
        /* copy text */
181 182 183 184 185 186 187 188 189 190

        if(ClientData.serviceOpt_copy_text() == 'Y') {

        	$('#copytext').click(CONTENTVIEW_EVENTS.showCopyText);
        } else {
        	$('#copytext').unbind('click');
        	$('#copytext').removeClass();
            $('#copytext').addClass('copy_off');
        }
       // sessionStorage.removeItem('copy_text');
191
        /* close copy text dialog */
192 193 194 195 196 197 198 199 200 201 202
        //$("#copyTextClosing").click(CONTENTVIEW_EVENTS.closeCopyTextBox);
        $("#copyTextClosing").on({
        	'click touchend': function(ev){
        		CONTENTVIEW_EVENTS.closeCopyTextBox(ev);
        		return false;
        	},
        	'touchstart touchmove': function(){
        		//これを入れないと次にダイアログを開くと表示位置が大きくズレる
        		return false;
        	}
        });
203

204 205 206
    }

    /*event click next page button */
207 208
    $('#nextpage').click(CONTENTVIEW_EVENTS.nextPage_click);
    $('#button_next_canvas').click(CONTENTVIEW_EVENTS.nextPage_click);
209
    /*event click prev page button */
210 211
    $('#prevpage').click(CONTENTVIEW_EVENTS.prevPage_click);
    $('#button_pre_canvas').click(CONTENTVIEW_EVENTS.prevPage_click);
212
    /*event click fist page button */
213
    $('#firstpage').click(CONTENTVIEW_EVENTS.firstPage_click);
214
    /*event click last page button */
215
    $('#lastpage').click(CONTENTVIEW_EVENTS.lastPage_click);
216

217 218 219 220
    $("#imgBack").click(CONTENTVIEW_EVENTS.imgBack_click);
    $("#imgHome").click(CONTENTVIEW_EVENTS.imgHome_click);
    $("#btn_show_memo").click(CONTENTVIEW_CREATEOBJECT.showEditMemo);
    $("#btn_copy_memo").click(CONTENTVIEW_CREATEOBJECT.copyMemo);
221 222 223 224 225 226 227 228 229 230 231
    //$('#memoClosing').click(CONTENTVIEW_EVENTS.closePopUpCopyMemo);
    $("#memoClosing").on({
    	'click touchend': function(ev){
    		CONTENTVIEW_EVENTS.closePopUpCopyMemo(ev);
            return false;
    	},
    	'touchstart touchmove': function(){
    		//これを入れないと次にダイアログを開くと表示位置が大きくズレる
    		return false;
    	}
    });
232

233 234 235
    $('#liAddMemo').click(CONTENTVIEW_EVENTS.click_liAddMemo);
    $('#liCopyMemo').click(CONTENTVIEW_EVENTS.click_liCopyMemo);
    $('#liDeleteMemo').click(CONTENTVIEW_EVENTS.click_liDeleteMemo);
236

237
    if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_PDF){
238
        /*event search*/
239
    	CONTENTVIEW_EVENTS.showListSearchResult();
240
    }
241

242 243 244 245
    /* rotate event */
    $('#rotatebtnR').click(CONTENTVIEW.rotateR);
    $('#rotatebtnL').click(CONTENTVIEW.rotateR);

246
    /* zoom event */
247 248 249
    $('#zoomin').click(CONTENTVIEW.zoomIn);
    $('#zoomout').click(CONTENTVIEW.zoomOut);
    $('#zoomfit').click(CONTENTVIEW.screenFit);
250 251

    /* event memo */
252 253
    $('#imgmemo').click(CONTENTVIEW.handleMemo);
    $('#imgaddmemo').click(CONTENTVIEW_EVENTS.handleAddMemo);
254 255

    /* event marking */
256 257
    $('#imgmarking').click(CONTENTVIEW_EVENTS.imgmarking_click);
    $('#imgmarkingtoolbar').click(CONTENTVIEW.handleDrawCanvas);
258 259

    /*draw canvas*/
260
    CONTENTVIEW.drawOnCanvas();
261 262

    /*init flag */
263
    CONTENTVIEW_INITOBJECT.initFlagDisplay();
264

265
    CONTENTVIEW.sizingScreen();
266 267 268 269 270

    /* move image check marking*/
    $('#divCheckExistMarking').css('top', '70px');
    $('#divCheckExistMarking').hide();

271 272 273 274
    /* move image check memo*/
    $('#divCheckExistMemo').css('top', '125px');
    $('#divCheckExistMemo').hide();

275
    /* disable controls */
276 277
    CONTENTVIEW_GENERAL.isLoadingObject = true;
    CONTENTVIEW_GENERAL.disableAllControl();
278 279

    /* window resize event */
280
    $(window).resize(function () {
281
    	CONTENTVIEW.setViewportForWin8();
282 283

        CONTENTVIEW.sizingScreen();
284
        /* close dialog popuptext */
285 286
        CONTENTVIEW.closeDialogResize();
        CONTENTVIEW_INITOBJECT.setLoadingSize();
287
    });
288

289
};
290

291
CONTENTVIEW_INITOBJECT.ajaxComplete8 = function(){
292

293
    /* handle from bookmark page */
294
    //handleFromBookMarkPage();
295 296 297 298 299 300 301 302 303 304 305
    /* check move content */
    if (ClientData.bookmark_pageNo()) {
    	CONTENTVIEW.handleFromBookMarkPage();
    } else if (ClientData.common_prePageNo()) {
        /* handle from jump content */
    	CONTENTVIEW.handleFromJumpContent();
    } else if (ClientData.IsJumpBack() == true) {
        /* handle back */
    	CONTENTVIEW.oldContent_Back();
    } else {
        if (CONTENTVIEW_GETDATA.getPageIndex() == 0) {
306

307 308
        	//コンテンツ差し替えチェック
        	CONTENTVIEW.deleteMaxPageOverData();
309

310 311
            if(CONTENTVIEW_INITOBJECT.isHasPageBGM()){
            	CONTENTVIEW.isPendingContentBGM = true;
312
            } else {
313 314
            	CONTENTVIEW.isPendingContentBGM = false;
            }
315

316
            //console.log("CONTENTVIEW_GENERAL.isFullScreen:" + CONTENTVIEW_GENERAL.isFullScreen);
317

318 319 320
            CONTENTVIEW_GETDATA.getContent().setPageImages(CONTENTVIEW_GENERAL.totalPage, CONTENTVIEW_GENERAL.pageImages)
			 				.setPageObjects(CONTENTVIEW_GENERAL.pageObjects)
			 				.setUpPage(0);
321

322
            CONTENTVIEW_CREATEOBJECT.createPageBGM();
323 324

            //Get next
325 326 327 328 329 330 331 332 333 334 335 336
            if(CONTENTVIEW_GENERAL.totalPage > 1){
            	CONTENTVIEW_GETDATA.getNextPageObjectsByPageIndex(CONTENTVIEW_GENERAL.pageObjectsData, CONTENTVIEW_GETDATA.getPageIndex() + 1);
                //Render next page
                CONTENTVIEW_GETDATA.renderNextPage();
            }

            /* set pageTitle*/
            if (CONTENTVIEW_GENERAL.dataPageTitle[0]) {
                if (CONTENTVIEW_GENERAL.dataPageTitle[0] != '') {
                    document.title = CONTENTVIEW_GENERAL.contentName + '_' + CONTENTVIEW_GENERAL.dataPageTitle[0] + ' | ' + I18N.i18nText('sysAppTitle');
                } else {
                    document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
337
                }
338 339
            } else {
                document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
340 341
            }

342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
            /* handle slider bar */
            CONTENTVIEW.handleSliderBar();
        }
    }

    /* window resize event */
    $(window).resize(function () {
    	CONTENTVIEW_INITOBJECT.setLoadingSize();
        if (COMMON.isTouchDevice() == true) {
            if (CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid()) {
                var tempRatio = document.documentElement.clientWidth / window.innerWidth;
                if (tempRatio <= 1) {
                    // Adjust position for toolbar and footer bar
                    var top = window.innerHeight - $("#footer_toolbar_1").height();
                    $("#wrapper").css("width", window.innerWidth);
                    $("#wrapper").css("height", window.innerHeight);
                    $("#footer_toolbar_1").css("top", top + "px");
                    $("#footer_toolbar_2").css("top", top + "px");
                }
                else {
                    var top = $(window).height() - $("#footer_toolbar_1").height();
                    $("#wrapper").css("width", $(window).width());
                    $("#wrapper").css("height", $(window).height());
                    $("#footer_toolbar_1").css("top", top + "px");
                    $("#footer_toolbar_2").css("top", top + "px");
367
                }
368 369
            }
        }
370

371 372
        CONTENTVIEW.resizeScreen();
        CONTENTVIEW_GENERAL.isChangeSizeScreen = false;
373

374 375
        /* change position dialog */
        CONTENTVIEW.changePosDialog();
376

377 378
        /* close dialog popuptext */
        CONTENTVIEW.closeDialogResize();
379

380
    });
381

382 383
    /* check status button */
    CONTENTVIEW.checkExistNextPrePage();
384

385 386
    /*init Image Bookmark */
    CONTENTVIEW_INITOBJECT.initImageBookmark();
387

388 389 390 391
    $('#lblSlider').text('/ ' + CONTENTVIEW_GENERAL.totalPage);
    /* memo */
    CONTENTVIEW_INITOBJECT.initImageMemo();
    CONTENTVIEW_INITOBJECT.initImageAddMemo();
392

393 394
    /* init image had draw */
    CONTENTVIEW_INITOBJECT.initDisplayMarking();
395

396 397
    /* check status */
    CONTENTVIEW.checkStatusImageMarking();
398

399
    CONTENTVIEW.trackTransforms(CONTENTVIEW_GENERAL.context_main);
400

401 402 403 404 405 406
    if (COMMON.isTouchDevice() == true) {
        if (CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid()) {
        	CONTENTVIEW_GENERAL.standardRatio = document.documentElement.clientWidth / window.innerWidth;
            ZOOM_DETECTOR.startDetectZoom({ time: 500,
                callbackFunction: function (oldRatio, newRatio, oldW, oldH, newW, newH) {
                	CONTENTVIEW_GENERAL.currentRatio = newRatio;
407 408

                }
409 410 411 412 413 414 415
            });
            var top = window.innerHeight - $("#footer_toolbar_1").height();
            $("#wrapper").css("width", window.innerWidth);
            $("#wrapper").css("height", window.innerHeight);
            $("#footer_toolbar_1").css("top", top + "px");
            $("#footer_toolbar_2").css("top", top + "px");
            CONTENTVIEW.sizingScreen();
416
        }
417 418
    }
    CONTENTVIEW.setViewportForWin8();
419

420 421 422 423
    //console.log("ajaxComp8 end");
};

CONTENTVIEW_INITOBJECT.ajaxComplete4 = function(){
424

425 426 427
	if(CONTENTVIEW_GENERAL.contentType != COMMON.ContentTypeKeys.Type_NoFile){
		return;
	}
428

429
	/* handle from bookmark page */
430
	//handleFromBookMarkPage();
431 432 433 434 435 436 437 438 439 440 441 442
	/* check move content */
	if (ClientData.bookmark_pageNo()) {
		CONTENTVIEW.handleFromBookMarkPage();
	} else if (ClientData.common_prePageNo()) {
		/* handle from jump content */
		CONTENTVIEW.handleFromJumpContent();
	} else if (ClientData.IsJumpBack() == true) {
		/* handle back */
		CONTENTVIEW.oldContent_Back();
	} else {
		if (CONTENTVIEW_GETDATA.getPageIndex() == 0) {
			if(CONTENTVIEW_INITOBJECT.isHasPageBGM()){
443
				CONTENTVIEW.isPendingContentBGM = true;
444
			}
445

446 447 448 449
			CONTENTVIEW_GETDATA.getContent().setPageImages(CONTENTVIEW_GENERAL.totalPage, CONTENTVIEW_GENERAL.pageImages)
			.setPageObjects(CONTENTVIEW_GENERAL.pageObjects)
			.setUpPage(0);
			CONTENTVIEW_CREATEOBJECT.createPageBGM();
450

451 452 453 454 455
			if(CONTENTVIEW_GENERAL.totalPage > 1){
				CONTENTVIEW_GETDATA.getNextPageObjectsByPageIndex(CONTENTVIEW_GENERAL.pageObjectsData, CONTENTVIEW_GETDATA.getPageIndex() + 1);
				//Render next page
				CONTENTVIEW_GETDATA.renderNextPage();
			}
456

457 458 459 460 461 462 463 464 465 466
			/* set pageTitle*/
			if (CONTENTVIEW_GENERAL.dataPageTitle[0]) {
				if (CONTENTVIEW_GENERAL.dataPageTitle[0] != '') {
					document.title = CONTENTVIEW_GENERAL.contentName + '_' + CONTENTVIEW_GENERAL.dataPageTitle[0] + ' | ' + I18N.i18nText('sysAppTitle');
				} else {
					document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
				}
			} else {
				document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
			}
467

468 469 470 471
			/* handle slider bar */
			CONTENTVIEW.handleSliderBar();
		}
	}
472

473 474
	/* window resize event */
	$(window).resize(function () {
475

476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495
		if (COMMON.isTouchDevice() == true) {
			if (CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid()) {
				var tempRatio = document.documentElement.clientWidth / window.innerWidth;
				if (tempRatio <= 1) {
					// Adjust position for toolbar and footer bar
					var top = window.innerHeight - $("#footer_toolbar_1").height();
					$("#wrapper").css("width", window.innerWidth);
					$("#wrapper").css("height", window.innerHeight);
					$("#footer_toolbar_1").css("top", top + "px");
					$("#footer_toolbar_2").css("top", top + "px");
				}
				else {
					var top = $(window).height() - $("#footer_toolbar_1").height();
					$("#wrapper").css("width", $(window).width());
					$("#wrapper").css("height", $(window).height());
					$("#footer_toolbar_1").css("top", top + "px");
					$("#footer_toolbar_2").css("top", top + "px");
				}
			}
		}
496

497 498
		CONTENTVIEW.resizeScreen();
		CONTENTVIEW_GENERAL.isChangeSizeScreen = false;
499

500 501
		/* change position dialog */
		CONTENTVIEW.changePosDialog();
502

503
		/* close dialog popuptext */
504 505
		CONTENTVIEW.closeDialogResize();

506
	});
507

508 509
	/* check status button */
	CONTENTVIEW.checkExistNextPrePage();
510

511 512
	/*init Image Bookmark */
	CONTENTVIEW_INITOBJECT.initImageBookmark();
513

514 515 516 517
	$('#lblSlider').text('/ ' + CONTENTVIEW_GENERAL.totalPage);
	/* memo */
	CONTENTVIEW_INITOBJECT.initImageMemo();
	CONTENTVIEW_INITOBJECT.initImageAddMemo();
518

519 520
	/* init image had draw */
	CONTENTVIEW_INITOBJECT.initDisplayMarking();
521

522 523
	/* check status */
	CONTENTVIEW.checkStatusImageMarking();
524

525
	CONTENTVIEW.trackTransforms(CONTENTVIEW_GENERAL.context_main);
526

527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
	if (COMMON.isTouchDevice() == true) {
		if (CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid()) {
			CONTENTVIEW_GENERAL.standardRatio = document.documentElement.clientWidth / window.innerWidth;
			ZOOM_DETECTOR.startDetectZoom({ time: 500,
				callbackFunction: function (oldRatio, newRatio, oldW, oldH, newW, newH) {
					CONTENTVIEW_GENERAL.currentRatio = newRatio;
				}
			});
			var top = window.innerHeight - $("#footer_toolbar_1").height();
			$("#wrapper").css("width", window.innerWidth);
			$("#wrapper").css("height", window.innerHeight);
			$("#footer_toolbar_1").css("top", top + "px");
			$("#footer_toolbar_2").css("top", top + "px");
			CONTENTVIEW.sizingScreen();
		}
	}
543

544
	CONTENTVIEW.setViewportForWin8();
545 546 547 548

};

//START TRB00069
549
CONTENTVIEW_INITOBJECT.isHasPageBGM = function(){
550

551
    var iResult = false;
552 553 554
    CONTENTVIEW_GETDATA.getPageObjectsByPageIndex(CONTENTVIEW_GENERAL.pageObjectsData, 0);
    for (var nIndex = 0; nIndex < CONTENTVIEW_GENERAL.pageObjects.length; nIndex++) {
        if (CONTENTVIEW_GENERAL.pageObjects[nIndex].mediaType == '3' && CONTENTVIEW_GENERAL.pageObjects[nIndex].playType == '2') {
555 556 557 558
            iResult = true;
            break;
        }
    }
559 560

    return iResult;
561 562 563 564
};

//END TRB00069

565
CONTENTVIEW_INITOBJECT.initPageMediaAndHtmlType = function(){
566
	
567
    //$('#divImageLoading').css('display', 'block');
568 569 570 571
	/* init footer toolbar */
    $('#footer_toolbar_2').hide();
    $('#footer_toolbar_1').show();
	
572
    /* init pos bottom toolbar*/
573
    CONTENTVIEW_INITOBJECT.initDisplayToolbarDevice();
574 575

    // Lock screen
576 577 578
    if(ClientData.serviceOpt_encryption() != 'Y') {
   	 	COMMON.LockScreen();
    }
579

580
    //PdfコンテンツでメディアとHTMLボタンなどをクリックするprePageNoを消す
vietdo committed
581 582 583 584
    if(ClientData.common_prePageNo()){
    	
    	ClientData.common_prePageNo(null);
    }
585
    
586
    //START TRB00094 - Editor : Long - Date : 09/26/2013 - Summary : Setting log
587
    CONTENTVIEW.StartTimerUpdateLog();
588 589

    /* set start log */
590
    COMMON.SetStartLog(CONTENTVIEW_GENERAL.contentID);
591
    //END TRB00094 - Editor : Long - Date : 09/26/2013 - Summary : Setting log
592

593
    //enable SpecifyControl
594
    CONTENTVIEW.enableSpecifyControl();
595

596 597 598 599 600
    //PdfコンテンツからメディアとHTMLコンテンツに遷移する時に既存pdfコンテンツを消す
    if ($('#canvasWrapper').length) {
		CONTENTVIEW_INITOBJECT.clearViewerComponent();
    }
    
601
    //Display overlay dialog for specify content type
602
    CONTENTVIEW.displayOverlayForSpecifyContentType();
603

604 605
    //Resize window
    $(window).resize(function () {
606

607
        //Check if content is zooming
608
        if(CONTENTVIEW.isZoomingContent){
609 610 611
            //var $container = $("#dialog");
           // var w = window.innerWidth;
            //var h = window.innerHeight;
612

613 614
            //$container.css('height', h);
            //$container.css('width', w);
615
        }
616
    });
617

618
    CONTENTVIEW.handleSliderBar();
619
    $('#lblSlider').text('/ ' + 1);
620

Masaru Abe committed
621
    if (CONTENTVIEW_GENERAL.avwUserEnvObj.isAndroid() == false) {
622 623 624
        $("#slider_page").slider("option", "disabled", true);
    }

Masaru Abe committed
625
    COMMON.disable('#txtSearch', '#txtSlider');
626 627
};

628 629
//ビュアーのキャンバスの表示領域をクリアする
CONTENTVIEW_INITOBJECT.clearViewerComponent = function(){
630

631
	if ($('#canvasWrapper').length) {
632

633 634 635 636
		//次回開いた時に残るので消す
		var canvas = document.getElementById('main');
		var context = canvas.getContext('2d');
		context.clearRect(0, 0, canvas.width, canvas.height);
637

638 639 640 641 642 643 644 645 646 647 648 649 650 651
		$('#mainPre').html('');
		$('#main').html('');
		$('#mainNext').html('');
		$('#playvideo').html('');
		$('#offscreenPre').html('');
		$('#offscreen').html('');
		$('#offscreenNext').html('');
		$('#draw_canvas').html('');
		$('#marker_canvas').html('');
		$('#playaudio').html('');
		$('#playaudiopage').html('');
		$('#playaudioallpage').html('');
		$('#text').html('');
	}
652

653 654
};

655 656
//Start: Function: No.4 - Editor : Long - Date : 08/09/2013 - Summary : Create next and previous canvas
/* Initialize PageViewer Component */
657
CONTENTVIEW_INITOBJECT.initializeViewerComponent = function(viewId) {
658

659 660 661 662 663
	if ($('#canvasWrapper').length) {
		CONTENTVIEW_INITOBJECT.clearViewerComponent();
	} else {
	    /* add some tags we need.*/
	    $('#' + viewId).prepend(
664 665
            '<div id="canvasWrapper">' +
            '<div id="hiddenArea"></div>' +
666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681
	        '<canvas id="mainPre"></canvas>' +
	        '<canvas id="main"></canvas>' +
	        '<canvas id="mainNext"></canvas>' +
	        '<div id="playvideo"></div>' +
	        '</div>' +
	        '<canvas id="offscreenPre"></canvas>' +
	        '<canvas id="offscreen"></canvas>' +
	        '<canvas id="offscreenNext"></canvas>' +
	        '<canvas id="draw_canvas"></canvas>' +
	        '<canvas id="marker_canvas"></canvas>' +
	        '<div id="playaudio" style="width:0px; height:0px;"></div>' +
	        '<div id="playaudiopage" style="width:0px; height:0px;"></div>' +
	        '<div id="playaudioallpage" style="width:0px; height:0px;"></div>' +
	        '<div id="text"></div>'
	        );
	}
682 683


684 685 686 687 688 689 690
    /* apply css style */
    $('#canvasWrapper').css(
        {
            'position': 'absolute',
            'height' : '100%',
            'width' : '100%',
            'left': '0px'
691

692 693
        }
    );
694

695
    //Start : Function : No.20 - Editor : Le Long - Date: 27/08/2013 - Summary : For performing on ipad. On Android 4.1.x do not use overflow : hidden in parent canvas
696 697
                                                                            //to avoid draw duplicate canvas bug.

Masaru Abe committed
698
    if(CONTENTVIEW_GENERAL.avwUserEnvObj.isIos()){
699 700
        $('#wrapper').css('overflow', 'hidden');
    }
701

702
    //End: Function : No.20 - Editor : Le Long - Date: 27/08/2013 - Summary : For performing on ipad. On Android 4.1.x do not use overflow : hidden in parent canvas
703 704
                                                                            //to avoid draw duplicate canvas bug.

705 706 707
    $('#main').css(
        {
            'position': 'absolute',
708 709
            'top': CONTENTVIEW.marginY + 'px',
            'left': CONTENTVIEW.marginX + 'px',
710 711 712
            'box-shadow': '3px 3px 14px #333',
            'border-radius': '4px',
            'z-index' : '0'
713

714
        }
715 716 717
    );


718
    if(CONTENTVIEW_GENERAL.animateType == CONTENTVIEW_GENERAL.animateTypeKeys.Type_Slide){
719 720
        $('#mainNext').css(
            {
721

722
                'position': 'absolute',
723 724
                'top': CONTENTVIEW.marginY + 'px',
                'left': CONTENTVIEW.marginX + 'px',
725 726 727 728 729 730 731 732
                'box-shadow': '3px 3px 14px #333',
                'border-radius': '4px',
                'display': 'none',
                'z-index' : '0'
            }
        );
        $('#mainPre').css(
            {
733

734
                'position': 'absolute',
735 736
                'top': CONTENTVIEW.marginY + 'px',
                'left': CONTENTVIEW.marginX + 'px',
737 738 739 740 741 742 743 744 745 746
                'box-shadow': '3px 3px 14px #333',
                'border-radius': '4px',
                'display': 'none',
                'z-index' : '0'
            }
        );
    }
    else{
        $('#mainNext').css(
            {
747

748
                'position': 'absolute',
749 750
                'top': CONTENTVIEW.marginY + 'px',
                'left': CONTENTVIEW.marginX + 'px',
751 752 753 754 755 756 757 758
                'box-shadow': '3px 3px 14px #333',
                'border-radius': '4px',
                'display': 'none',
                'z-index' : '0'
            }
        );
        $('#mainPre').css(
            {
759

760
                'position': 'absolute',
761 762
                'top': CONTENTVIEW.marginY + 'px',
                'left': CONTENTVIEW.marginX + 'px',
763 764 765 766 767 768 769
                'box-shadow': '3px 3px 14px #333',
                'border-radius': '4px',
                'display': 'none',
                'z-index' : '0'
            }
        );
    }
770

771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811
    $('#offscreen').css(
        {
            'visibility': 'hidden',
            'display': 'none'
        }
    );
     $('#offscreenPre').css(
        {
            'visibility': 'hidden',
            'display': 'none'
        }
    );
     $('#offscreenNext').css(
        {
            'visibility': 'hidden',
            'display': 'none'
        }
    );

    $('#marker_canvas').css(
        {
            'display': 'none',
            'position': 'absolute',
            'cursor': 'default',
            'z-index' : '0'

        }
    );

    $('#draw_canvas').css(
        {
            'display': 'none',
            'position': 'absolute',
            'cursor': 'default',
            'z-index' : '0'
        }
    );

    $('#playvideo').css(
        {
            'position': 'absolute',
812 813
            'top': CONTENTVIEW.marginY + 'px',
            'left': CONTENTVIEW.marginX + 'px',
814 815 816 817 818
            'z-index': 0
        }
    );

    //set default event
819
    CONTENTVIEW.setDefaultEvent();
820 821

    /*init canvas value */
822 823 824 825 826 827 828 829
    CONTENTVIEW_GENERAL.canvas_marker = document.getElementById('marker_canvas');
    CONTENTVIEW_GENERAL.context_marker = CONTENTVIEW_GENERAL.canvas_marker.getContext('2d');
    CONTENTVIEW_GENERAL.canvas_draw = document.getElementById('draw_canvas');
    CONTENTVIEW_GENERAL.context_draw = CONTENTVIEW_GENERAL.canvas_draw.getContext('2d');
    CONTENTVIEW_GENERAL.canvas_main = document.getElementById('main');
    CONTENTVIEW_GENERAL.context_main = CONTENTVIEW_GENERAL.canvas_main.getContext('2d');
    CONTENTVIEW_GENERAL.canvas_offscreen = document.getElementById('offscreen');
    CONTENTVIEW_GENERAL.context_offscreen = CONTENTVIEW_GENERAL.canvas_offscreen.getContext('2d');
830 831 832 833
};
//End: Function: No.4 - Editor : Long - Date : 08/09/2013 - Summary : Create next and previous canvas

/* init image if exist marking in page */
834
CONTENTVIEW_INITOBJECT.initImageCheckMarking = function() {
835 836 837
    /* set draw image if exist */
    var dataMarking = ClientData.MarkingData();
    var isExistMarking = false;
838

839
    //Start Function: No.12 - Editor : Long
840

841
    var tempPageNo = 0;
842
    if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_Image)
843 844 845 846
    {
        tempPageNo = 1;
    }
    else{
847
        tempPageNo = CONTENTVIEW.changePageIndex(CONTENTVIEW_GETDATA.getPageIndex());
848 849
    }
    //End Function: No.12 - Editor : Long
850 851


852
    for (var nIndex = 0; nIndex < dataMarking.length; nIndex++) {
853
        if (dataMarking[nIndex].contentid == CONTENTVIEW_GENERAL.contentID
854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871
		&& dataMarking[nIndex].pageNo == tempPageNo) {
            isExistMarking = true;
            break;
        }
    }

    /* init image display or not */
    if (ClientData.IsAddingMarking() == true) {
        $('#divCheckExistMarking').hide();
    } else {
        if (isExistMarking == true) {
            $('#divCheckExistMarking').show();
        } else {
            $('#divCheckExistMarking').hide();
        }
    }
};

872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910
/* init image if exist memo in page */
CONTENTVIEW_INITOBJECT.initImageCheckMemo = function() {
    /* set draw image if exist */
    var dataMemo = ClientData.MemoData();
    var isExistMemo = false;

    //Start Function: No.12 - Editor : Long

    var tempPageNo = 0;
    if(CONTENTVIEW_GENERAL.contentType == COMMON.ContentTypeKeys.Type_Image)
    {
        tempPageNo = 1;
    }
    else{
        tempPageNo = CONTENTVIEW.changePageIndex(CONTENTVIEW_GETDATA.getPageIndex());
    }
    //End Function: No.12 - Editor : Long


    for (var nIndex = 0; nIndex < dataMemo.length; nIndex++) {
        if (dataMemo[nIndex].contentid == CONTENTVIEW_GENERAL.contentID
		&& dataMemo[nIndex].pageNo == tempPageNo) {
            isExistMemo = true;
            break;
        }
    }

    /* init image display or not */
    if (ClientData.IsAddingMemo() == true) {
        $('#divCheckExistMemo').hide();
    } else {
        if (isExistMemo == true) {
            $('#divCheckExistMemo').show();
        } else {
            $('#divCheckExistMemo').hide();
        }
    }
};

911 912 913
CONTENTVIEW_INITOBJECT.ready = function(){
};