var auto_view; function imgGet(comic_idx,volume_idx,PageNo,pageview) { var totalpage = $("#totalpage").val(); if(parseInt(totalpage) >= parseInt(PageNo)){ $.ajax({ type : "post", url : "img_get_prev.asp", data : {"comic_idx":comic_idx,"volume_idx":volume_idx,"pageNo":PageNo,"pageview":pageview,"TIPR":TIPR}, dataType : "json", success : function(oResult){ if (oResult.RESULT =="Y"){ imgShow(oResult); }else{ alert("다시 접속해 주세요"); location.replace('/comic/detailview_comic.asp?comic_idx='+comic_idx); } } }); } } function imgShow(oResult) { var size = oResult.IMGSET.length; var pageview = $("#pageview").val(); var PageNo = $("#PageNo").val(); var viewtype = $("#viewtype").val(); var slider = $( "#slider" ).slider( "value" ); if (slider != PageNo){ $('#slider').slider('value', PageNo); } if(parseInt(pageview) < 2) { //$("#vtd").addClass("vtd_cls"); //$("#imgViewer_"+pageview+"_1").attr("src",oResult.IMGSET[0].VIEWIMG);//.css('max-height', $(window).height()-50); $("#imgViewer_"+pageview+"_1").attr("src",oResult.IMGSET[0].VIEWIMG);//.css('height', $(window).height()-30); }else { for (var i = 0; i < size; i++) { var j = i + 1; if(oResult.IMGSET[i].VIEWIMG == ""){ var viewImg = "/viewer2/images/de.jpg"; }else{ var viewImg = oResult.IMGSET[i].VIEWIMG; } $("#imgViewer_"+viewtype+"_"+j).attr("src",viewImg);//.css('height', $(window).height()-30); } } } function GoToNext(slideviewyn) { var pageview = $("#pageview").val(); var totalpage = $("#totalpage").val(); var autopvt = $("#autopvt").val(); var PageNo = $("#PageNo").val(); var freetype = $("#freetype").val(); if (PageNo == ""){ alert('페이지 숫자를 입력해 주세요.'); return false; } PageNo =parseInt(PageNo); var next_PageNo; if(parseInt(pageview) == 1) { next_PageNo = PageNo + 1; }else { next_PageNo = PageNo + 2; } if(next_PageNo > totalpage) { var nextvol=$("#nextvol").val(); if (nextvol !=""){ goCost(nextvol,"now"); }else{ alert("마지막 권입니다."); } }else { //comic_page_view(next_PageNo); $('#slider').slider('value', next_PageNo); if(autopvt >0) { AutoPage(); } } if(slideviewyn == "Y"){ allshow(); }else{ allhide();; } } function GoToPrev(slideviewyn) { var pageview = parseInt($("#pageview").val()); var PageNo = $("#PageNo").val(); if (PageNo == ""){ alert('페이지 숫자를 입력해 주세요.'); return false; } PageNo =parseInt(PageNo); var prev_PageNo; if(pageview == 1) { prev_PageNo = PageNo - 1; } else { prev_PageNo = PageNo - 2; } if(PageNo < 2 ){ //chkpageCon(); alert("첫번째 페이지 입니다."); }else{ $('#slider').slider('value', prev_PageNo); } if(slideviewyn == "Y"){ allshow(); }else{ allhide();; } } function comic_page_view(PageNo) { var comic_idx = $("#comic_idx").val(); var totalpage = $("#totalpage").val(); var pageview = $("#pageview").val(); var volume_idx = $("#volume_idx").val(); //var volume_idx = $("#volume_idx option:selected").val(); if (parseInt(PageNo) > parseInt(totalpage)){ PageNo=totalpage; } if (parseInt(PageNo) == 0){ PageNo=1; } if ((pageview != "1") && (parseInt(PageNo)%2 ==0)){ PageNo = parseInt(PageNo)-1; } imgGet(comic_idx,volume_idx,PageNo,pageview); $("#PageNo").val(PageNo); } function AutoPage() { var autopvt = parseInt($("#autopvt").val()) * 1000; var tmp = $("#tmp").val(); var totalPage = $("#totalpage").val(); if (totalPage == tmp) { tmp++; } if (totalPage > tmp) { if (autopvt > 0) { clearTimeout(auto_view); auto_view = setTimeout("GoToNext()", autopvt); } } } function page_view_num(){ var PageNo = $("#PageNo").val(); var ori_pv = $("#oripageview").val(); var pageview = $("#pageview").val(); var viewtype = $("#viewtype").val(); var width=WINDOW_WH("w"); var height=WINDOW_WH("h"); $("#vtab2").toggle(); $("#vtab1").toggle(); $("#vtit").toggle(); if(parseInt(pageview) > 1) { var s_width = screen.width; if(s_width-50 >= width ){ resizeBy(-(width/2), 0); } $("#tdsize").css("width","97px"); }else{ resizeBy(width, 0); $("#tdsize").css("width","290px"); } $("#div_viewer_1").toggle(); $("#div_viewer_cursor_1").toggle(); if (parseInt(ori_pv) == 2 && viewtype=="R"){ $("#div_viewer_R").toggle(); $("#div_viewer_cursor_R").toggle(); }else if(parseInt(ori_pv) == 2 && viewtype=="L"){ $("#div_viewer_L").toggle(); $("#div_viewer_cursor_L").toggle(); } if(parseInt(pageview) > 1) { $("#pageview").val("1"); }else{ $("#pageview").val(ori_pv); } comic_page_view(PageNo); return; } function Gosubmit(){ var fm=document.viewer; fm.PageNo.value="1"; fm.action=pageAction; fm.submit(); } function closelayer(){ $("#divHidden").hide(); $("#layer_pop").hide(); } function BookMark(){ alert("맛보기에서는 책갈피가 지원되지 않습니다."); } function viewhide(){ $("#viewer_top_wrap").toggle(); $("#viewer_bottom_wrap").toggle(); $("#sliderPage").toggle(); } function allshow(){ $("#viewer_top_wrap").show(); $("#viewer_bottom_wrap").show(); $("#sliderPage").show(); } function allhide(){ $("#viewer_top_wrap").hide(); $("#viewer_bottom_wrap").hide(); $("#sliderPage").hide(); } function WINDOW_WH(wh){ var w_width=window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var w_height= window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; if(wh =="w"){ return w_width; }else{ return w_height; } } $(window).resize(function(){ var w_height=WINDOW_WH("h"); $("#imgViewer_1_1").css("height",w_height-70); $("#imgViewer_R_1").css("height",w_height-70); $("#imgViewer_R_2").css("height",w_height-70); $("#imgViewer_L_1").css("height",w_height-70); $("#imgViewer_L_2").css("height",w_height-70); }).resize(); // 2017.08.07 최종준 추가 // 새로고침 또는 새로운 만화로드시 이미지 사이즈를 다시 맞춤 function new_resize(){ var w_height=WINDOW_WH("h"); $("#imgViewer_1_1").css("height",w_height-70); $("#imgViewer_R_1").css("height",w_height-70); $("#imgViewer_R_2").css("height",w_height-70); $("#imgViewer_L_1").css("height",w_height-70); $("#imgViewer_L_2").css("height",w_height-70); } function viewerPage(pagenum){ var PageNo = $("#PageNo").val(); var pageview = $("#pageview").val(); var viewtype = $("#viewtype").val(); if (pagenum != pageview){ if (parseInt(pagenum) == 2){ $( "#slider" ).slider("option","step",2); }else{ $( "#slider" ).slider("option","step",1); } if (parseInt(pagenum) == 2){ $("#div_viewer_1").hide(); $("#div_viewer_cursor_1").hide(); if (viewtype=="R"){ $("#div_viewer_R").show(); $("#div_viewer_cursor_R").show(); $("#div_viewer_L").hide(); $("#div_viewer_cursor_L").hide(); }else if(viewtype=="L"){ $("#div_viewer_L").show(); $("#div_viewer_cursor_L").show(); $("#div_viewer_R").hide(); $("#div_viewer_cursor_R").hide(); } $("#vp2").addClass("view_choice_on"); $("#vp1").removeClass("view_choice_on"); $("#vpimg2").attr("src","images/ico_controll_2page_on.png"); $("#vpimg1").attr("src","images/ico_controll_1page_off.png"); }else{ $("#div_viewer_1").show(); $("#div_viewer_cursor_1").show(); $("#div_viewer_L").hide(); $("#div_viewer_cursor_L").hide(); $("#div_viewer_R").hide(); $("#div_viewer_cursor_R").hide(); $("#vp2").removeClass("view_choice_on"); $("#vp1").addClass("view_choice_on"); $("#vpimg2").attr("src","images/ico_controll_2page_off.png"); $("#vpimg1").attr("src","images/ico_controll_1page_on.png"); } $("#pageview").val(pagenum); comic_page_view(PageNo); } }