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
    $('#control_screen_2').hide();
131 132 133
    if(ClientData.isGetitsMode() == true){
    	$('#header_toolbar').show();
    }
134
    /* init pos bottom toolbar*/
135
    CONTENTVIEW_INITOBJECT.initDisplayToolbarDevice();
136 137

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

140
    CONTENTVIEW.StartTimerUpdateLog();
141 142

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

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

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

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

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

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

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

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

        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');
192
        /* close copy text dialog */
193 194 195 196 197 198 199 200 201 202 203
        //$("#copyTextClosing").click(CONTENTVIEW_EVENTS.closeCopyTextBox);
        $("#copyTextClosing").on({
        	'click touchend': function(ev){
        		CONTENTVIEW_EVENTS.closeCopyTextBox(ev);
        		return false;
        	},
        	'touchstart touchmove': function(){
        		//これを入れないと次にダイアログを開くと表示位置が大きくズレる
        		return false;
        	}
        });
204

205 206 207
    }

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

218 219 220 221
    $("#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);
222 223 224 225 226 227 228 229 230 231 232
    //$('#memoClosing').click(CONTENTVIEW_EVENTS.closePopUpCopyMemo);
    $("#memoClosing").on({
    	'click touchend': function(ev){
    		CONTENTVIEW_EVENTS.closePopUpCopyMemo(ev);
            return false;
    	},
    	'touchstart touchmove': function(){
    		//これを入れないと次にダイアログを開くと表示位置が大きくズレる
    		return false;
    	}
    });
233

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

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

243
    /* zoom event */
244 245 246
    $('#zoomin').click(CONTENTVIEW.zoomIn);
    $('#zoomout').click(CONTENTVIEW.zoomOut);
    $('#zoomfit').click(CONTENTVIEW.screenFit);
247 248

    /* event memo */
249 250
    $('#imgmemo').click(CONTENTVIEW.handleMemo);
    $('#imgaddmemo').click(CONTENTVIEW_EVENTS.handleAddMemo);
251 252

    /* event marking */
253 254
    $('#imgmarking').click(CONTENTVIEW_EVENTS.imgmarking_click);
    $('#imgmarkingtoolbar').click(CONTENTVIEW.handleDrawCanvas);
255 256

    /*draw canvas*/
257
    CONTENTVIEW.drawOnCanvas();
258 259

    /*init flag */
260
    CONTENTVIEW_INITOBJECT.initFlagDisplay();
261

262
    CONTENTVIEW.sizingScreen();
263 264 265 266 267

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

268 269 270 271
    /* move image check memo*/
    $('#divCheckExistMemo').css('top', '125px');
    $('#divCheckExistMemo').hide();

272
    /* disable controls */
273 274
    CONTENTVIEW_GENERAL.isLoadingObject = true;
    CONTENTVIEW_GENERAL.disableAllControl();
275 276

    /* window resize event */
277
    $(window).resize(function () {
278
    	CONTENTVIEW.setViewportForWin8();
279 280

        CONTENTVIEW.sizingScreen();
281
        /* close dialog popuptext */
282 283
        CONTENTVIEW.closeDialogResize();
        CONTENTVIEW_INITOBJECT.setLoadingSize();
284
    });
285

286
};
287

288
CONTENTVIEW_INITOBJECT.ajaxComplete8 = function(){
289

290
    /* handle from bookmark page */
291
    //handleFromBookMarkPage();
292 293 294 295 296 297 298 299 300 301 302
    /* 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) {
303

304 305
        	//コンテンツ差し替えチェック
        	CONTENTVIEW.deleteMaxPageOverData();
306

307 308
            if(CONTENTVIEW_INITOBJECT.isHasPageBGM()){
            	CONTENTVIEW.isPendingContentBGM = true;
309
            } else {
310 311
            	CONTENTVIEW.isPendingContentBGM = false;
            }
312

313
            //console.log("CONTENTVIEW_GENERAL.isFullScreen:" + CONTENTVIEW_GENERAL.isFullScreen);
314

315 316 317
            CONTENTVIEW_GETDATA.getContent().setPageImages(CONTENTVIEW_GENERAL.totalPage, CONTENTVIEW_GENERAL.pageImages)
			 				.setPageObjects(CONTENTVIEW_GENERAL.pageObjects)
			 				.setUpPage(0);
318

319
            CONTENTVIEW_CREATEOBJECT.createPageBGM();
320 321

            //Get next
322 323 324 325 326 327 328 329 330 331 332 333
            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');
334
                }
335 336
            } else {
                document.title = CONTENTVIEW_GENERAL.contentName + ' | ' + I18N.i18nText('sysAppTitle');
337 338
            }

339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
            /* 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");
364
                }
365 366
            }
        }
367

368 369
        CONTENTVIEW.resizeScreen();
        CONTENTVIEW_GENERAL.isChangeSizeScreen = false;
370

371 372
        /* change position dialog */
        CONTENTVIEW.changePosDialog();
373

374 375
        /* close dialog popuptext */
        CONTENTVIEW.closeDialogResize();
376

377
    });
378

379 380
    /* check status button */
    CONTENTVIEW.checkExistNextPrePage();
381

382 383
    /*init Image Bookmark */
    CONTENTVIEW_INITOBJECT.initImageBookmark();
384

385 386 387 388
    $('#lblSlider').text('/ ' + CONTENTVIEW_GENERAL.totalPage);
    /* memo */
    CONTENTVIEW_INITOBJECT.initImageMemo();
    CONTENTVIEW_INITOBJECT.initImageAddMemo();
389

390 391
    /* init image had draw */
    CONTENTVIEW_INITOBJECT.initDisplayMarking();
392

393 394
    /* check status */
    CONTENTVIEW.checkStatusImageMarking();
395

396
    CONTENTVIEW.trackTransforms(CONTENTVIEW_GENERAL.context_main);
397

398 399 400 401 402 403
    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;
404 405

                }
406 407 408 409 410 411 412
            });
            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();
413
        }
414 415
    }
    CONTENTVIEW.setViewportForWin8();
416

417 418 419 420
    //console.log("ajaxComp8 end");
};

CONTENTVIEW_INITOBJECT.ajaxComplete4 = function(){
421

422 423 424
	if(CONTENTVIEW_GENERAL.contentType != COMMON.ContentTypeKeys.Type_NoFile){
		return;
	}
425

426
	/* handle from bookmark page */
427
	//handleFromBookMarkPage();
428 429 430 431 432 433 434 435 436 437 438 439
	/* 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()){
440
				CONTENTVIEW.isPendingContentBGM = true;
441
			}
442

443 444 445 446
			CONTENTVIEW_GETDATA.getContent().setPageImages(CONTENTVIEW_GENERAL.totalPage, CONTENTVIEW_GENERAL.pageImages)
			.setPageObjects(CONTENTVIEW_GENERAL.pageObjects)
			.setUpPage(0);
			CONTENTVIEW_CREATEOBJECT.createPageBGM();
447

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

454 455 456 457 458 459 460 461 462 463
			/* 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');
			}
464

465 466 467 468
			/* handle slider bar */
			CONTENTVIEW.handleSliderBar();
		}
	}
469

470 471
	/* window resize event */
	$(window).resize(function () {
472

473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
		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");
				}
			}
		}
493

494 495
		CONTENTVIEW.resizeScreen();
		CONTENTVIEW_GENERAL.isChangeSizeScreen = false;
496

497 498
		/* change position dialog */
		CONTENTVIEW.changePosDialog();
499

500
		/* close dialog popuptext */
501 502
		CONTENTVIEW.closeDialogResize();

503
	});
504

505 506
	/* check status button */
	CONTENTVIEW.checkExistNextPrePage();
507

508 509
	/*init Image Bookmark */
	CONTENTVIEW_INITOBJECT.initImageBookmark();
510

511 512 513 514
	$('#lblSlider').text('/ ' + CONTENTVIEW_GENERAL.totalPage);
	/* memo */
	CONTENTVIEW_INITOBJECT.initImageMemo();
	CONTENTVIEW_INITOBJECT.initImageAddMemo();
515

516 517
	/* init image had draw */
	CONTENTVIEW_INITOBJECT.initDisplayMarking();
518

519 520
	/* check status */
	CONTENTVIEW.checkStatusImageMarking();
521

522
	CONTENTVIEW.trackTransforms(CONTENTVIEW_GENERAL.context_main);
523

524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
	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();
		}
	}
540

541
	CONTENTVIEW.setViewportForWin8();
542 543 544 545

};

//START TRB00069
546
CONTENTVIEW_INITOBJECT.isHasPageBGM = function(){
547

548
    var iResult = false;
549 550 551
    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') {
552 553 554 555
            iResult = true;
            break;
        }
    }
556 557

    return iResult;
558 559 560 561
};

//END TRB00069

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

    // Lock screen
573 574 575
    if(ClientData.serviceOpt_encryption() != 'Y') {
   	 	COMMON.LockScreen();
    }
576

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

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

590
    //enable SpecifyControl
591
    CONTENTVIEW.enableSpecifyControl();
592

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

601 602
    //Resize window
    $(window).resize(function () {
603

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

610 611
            //$container.css('height', h);
            //$container.css('width', w);
612
        }
613
    });
614

615
    CONTENTVIEW.handleSliderBar();
616
    $('#lblSlider').text('/ ' + 1);
617

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

Masaru Abe committed
622
    COMMON.disable('#txtSearch', '#txtSlider');
623 624
};

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

628
	if ($('#canvasWrapper').length) {
629

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

635 636 637 638 639 640 641 642 643 644 645 646 647 648
		$('#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('');
	}
649

650 651
};

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

656 657 658 659 660
	if ($('#canvasWrapper').length) {
		CONTENTVIEW_INITOBJECT.clearViewerComponent();
	} else {
	    /* add some tags we need.*/
	    $('#' + viewId).prepend(
661 662
            '<div id="canvasWrapper">' +
            '<div id="hiddenArea"></div>' +
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678
	        '<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>'
	        );
	}
679 680


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

689 690
        }
    );
691

692
    //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
693 694
                                                                            //to avoid draw duplicate canvas bug.

Masaru Abe committed
695
    if(CONTENTVIEW_GENERAL.avwUserEnvObj.isIos()){
696 697
        $('#wrapper').css('overflow', 'hidden');
    }
698

699
    //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
700 701
                                                                            //to avoid draw duplicate canvas bug.

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

711
        }
712 713 714
    );


715
    if(CONTENTVIEW_GENERAL.animateType == CONTENTVIEW_GENERAL.animateTypeKeys.Type_Slide){
716 717
        $('#mainNext').css(
            {
718

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

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

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

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

768 769 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
    $('#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',
809 810
            'top': CONTENTVIEW.marginY + 'px',
            'left': CONTENTVIEW.marginX + 'px',
811 812 813 814 815
            'z-index': 0
        }
    );

    //set default event
816
    CONTENTVIEW.setDefaultEvent();
817 818

    /*init canvas value */
819 820 821 822 823 824 825 826
    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');
827 828 829 830
};
//End: Function: No.4 - Editor : Long - Date : 08/09/2013 - Summary : Create next and previous canvas

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

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

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


849
    for (var nIndex = 0; nIndex < dataMarking.length; nIndex++) {
850
        if (dataMarking[nIndex].contentid == CONTENTVIEW_GENERAL.contentID
851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868
		&& 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();
        }
    }
};

869 870 871 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
/* 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();
        }
    }
};

908 909 910
CONTENTVIEW_INITOBJECT.ready = function(){
};