var auto_view; function imgGet(novel_idx,volume_idx,PageNo,pageview) { $.ajax({ type : "post", url : "txt_get_prev.asp", data : {"novel_idx":novel_idx,"volume_idx":volume_idx,"pageNo":PageNo,"pageview":pageview}, dataType : "json", success : function(oResult){ if (oResult.RESULT =="Y"){ txtShow(oResult); }else{ alert(oResult.MSG); top.window.close(); //alert("ERROR"); } } }); } function txtShow(oResult) { var size = oResult.IMGSET.length; var pageview = $("#pageview").val(); var PageNo = $("#PageNo").val(); if(parseInt(pageview) < 2) { $("#imgViewer_"+pageview+"_1").html(oResult.IMGSET[0].VIEWIMG); //$("#pageViewer_"+pageview+"_1").text(PageNo); }else { for (var i = 0; i < size; i++) { var j = i + 1; $("#imgViewer_"+pageview+"_"+j).html(oResult.IMGSET[i].VIEWIMG); } } } function GoToNext() { var pageview = $("#pageview").val(); var totalpage = $("#totalpage").val(); var autopvt = $("#autopvt").val(); var PageNo = $("#PageNo").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) { $("#divHidden").show(); $("#layer_pop").show(); /** if (confirm("미리보기가 끝났습니다.\n이어서 보시겠습니까?")){ var fm=document.viewer; fm.PageNo.value=parseInt(totalpage)+1; fm.action=pageAction; fm.submit(); }else{ text_view(totalpage); } **/ } else { text_view(next_PageNo); if(autopvt >0) { AutoPage(); } } } function GoToPrev() { 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 ){ alert('첫 페이지 입니다.'); } else{ text_view(prev_PageNo); } } function text_view(PageNo) { var novel_idx = $("#novel_idx").val(); var totalpage = $("#totalpage").val(); var pageview = $("#pageview").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(novel_idx,volume_idx,PageNo,pageview); $("#PageNo").val(PageNo); $("#viewpagetxt").val(PageNo+" / "+totalpage); } 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 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 ){ resizeTo(520, 875); } $("#tdsize").css("width","97px"); }else{ var s_width = screen.width; if(s_width-50 >= width ){ resizeTo(955, 875); } $("#tdsize").css("width","250px"); } /** $("#pagechoice1").toggle(); $("#pagechoice2").toggle(); **/ $("#div_viewer_1").toggle(); if (parseInt(ori_pv) == 2){ $("#div_viewer_2").toggle(); }else if(parseInt(ori_pv) == 3){ $("#div_viewer_3").toggle(); } if(parseInt(pageview) > 1) { $("#pageview").val("1"); }else{ $("#pageview").val(ori_pv); } text_view(PageNo); return; } function Gosubmit(){ viewer.action=pageAction; viewer.submit(); } function pev_Gosubmit(){ viewer.method = "get"; viewer.action=pageAction; viewer.submit(); } function closelayer(){ $("#divHidden").hide(); $("#layer_pop").hide(); } function BookMark(){ alert("맛보기에서는 책갈피가 지원되지 않습니다."); } function fullscr(){ var winLeft = window.screenLeft ? window.screenLeft : window.screenX; var winTop = window.screenTop ? window.screenTop : window.screenY; var width = screen.width; var height = screen.height; moveTo(0, 0); resizeTo(width, height); $("#full_original").html("원본보기"); $("#onefull_original").html(""); } function original(l,t){ resizeTo(955, 875); moveTo(l,t); $("#full_original").html("전체보기"); $("#onefull_original").html(""); } function two_original(){ moveTo(0, 0); var width = wid_hei("w"); var height = wid_hei("h"); resizeTo(955, 875); } function onefullscr(){ var winLeft = window.screenLeft ? window.screenLeft : window.screenX; var winTop = window.screenTop ? window.screenTop : window.screenY; var width = screen.width; var height = screen.height; moveTo(0, 0); resizeTo(width, height); $("#full_original").html("원본보기"); $("#onefull_original").html(""); } function oneoriginal(l,t){ resizeTo(520, 875); moveTo(l,t); $("#full_original").html("전체보기"); $("#onefull_original").html(""); } function WINDOW_WH(wh){ if(Modernizr.canvas) { var w_width=window.innerWidth; var w_height=window.innerHeight; }else{ var w_width=document.body.clientWidth; var w_height=document.body.clientHeight; } if(wh =="w"){ return w_width; }else{ return w_height; } } $(document).on('touchstart touchend touchmove click', '#divHidden', function(e) { if(e.type == 'touchmove' || e.type == 'click') { closelayer(); } });