Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

2 righe
9.5 KiB

  1. /** PTNovelSearch-v4.1.2 LPPL License By http://www.ptcms.com/ */
  2. ;function changeFontStyle(t,e,o){$(".pt-read-cont").css({"font-size":t+"rem"}).css({"line-height":e+"rem"}),$(".pt-pop-set .pt-lined").css({width:o+"rem"}),window.localStorage.setItem("mobilenovel.chapter.read.fontsize",t),window.localStorage.setItem("mobilenovel.chapter.read.lh",e),window.localStorage.setItem("mobilenovel.chapter.read.lined",o)}function play(t){t=void 0===t?null:t,playBtn.text("播放中"),null===t?(audios[playIndex].playbackRate=$(".pt-pop-tts .pt-tts-spd").data("value"),audios[playIndex].volume=$(".pt-pop-tts .pt-tts-vol").data("value"),audios[playIndex].play()):($("#pt-pop p:eq("+(t+1)+")").length&&loadAudit(t+1),audios[t].playbackRate=$(".pt-pop-tts .pt-tts-spd").data("value"),audios[t].volume=$(".pt-pop-tts .pt-tts-vol").data("value"),audios[t].play(),$("#pt-pop p:eq("+(t-1)+")").css("text-decoration","none"),$("#pt-pop p:eq("+t+")").css("text-decoration","underline"),$(window).scrollTop($("#pt-pop p:eq("+playIndex+")").offset().top),playIndex=t)}function pause(){playBtn.text("已暂停"),audios[playIndex].pause()}function loadAudit(t,e){e=void 0!==e&&e,"object"==typeof audios[t]?(startTime=audios[t].currentTime,audios[t].pause(),document.body.removeChild(audios[t])):startTime=0,audios[t]=document.createElement("audio"),audios[t].onended=function(){"undefined"!=typeof audios[t+1]?play(t+1):playBtn.text("播放结束"),document.body.removeChild(audios[t])},audios[t].volume=1,audios[t].style.display="none",document.body.append(audios[t]),audios[t].setAttribute("src","http://ai.baidu.com/aidemo?type=tns&spd=5&pit=5&vol=15&dt=1&per="+$(".pt-tts-pre .pt-tts-select").data("value")+"&tex="+encodeURIComponent(encodeURIComponent($("#pt-pop p:eq("+t+")").text()))),audios[t].currentTime=startTime,e&&play(t)}var loading=null,color=window.localStorage.getItem("mobilenovel.chapter.read.color"),fontsize=window.localStorage.getItem("mobilenovel.chapter.read.fontsize"),lh=window.localStorage.getItem("mobilenovel.chapter.read.lh"),lined=window.localStorage.getItem("mobilenovel.chapter.read.lined");color=null===color||$.isNumeric(color)?"#ffffff":color,fontsize=null===fontsize?.14:parseFloat(fontsize),lh=null===lh?.3:parseFloat(lh),lined=null===lined?.7:parseFloat(lined),1!=window.localStorage.getItem("read_tip")&&(console.log(window.localStorage.getItem("mobilenovel.read_tip")),$(".tishi").show()),changeFontStyle(fontsize,lh,lined),$(".pt-read").css("background-color",color).data("color",color),color==$(".pt-night").data("color")&&($(".pt-read-cont").css({color:"#898989"}),$(".pt-night").hide(),$(".pt-daytime").show()),$(".tishi").on("click",function(){window.localStorage.setItem("read_tip",1),$(this).hide()}),$.cssHooks.backgroundColor={get:function(t){function e(t){return("0"+parseInt(t).toString(16)).slice(-2)}if(t.currentStyle)var o=t.currentStyle.backgroundColor;else if(window.getComputedStyle)var o=document.defaultView.getComputedStyle(t,null).getPropertyValue("background-color");return o.search("rgb")==-1?o:(o=o.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/),"#"+e(o[1])+e(o[2])+e(o[3]))}},$(".pt-read-cont").on("touchstart",function(){longClick=0,timeOutEvent=setTimeout(function(){longClick=1},300)}),$(".pt-read-cont").on("touchmove",function(t){clearTimeout(timeOutEvent),timeOutEvent=0}),$(".pt-read-cont").on("touchend",function(){clearTimeout(timeOutEvent),0!=timeOutEvent&&0==longClick&&($(".pt-pop-tts").hide(),$(".pt-mask").toggle())}),$(".pt-catalogue-btn").click(function(){$.ajax(__API_NOVEL_DIR,{type:"get",dataType:"json",data:{novelid:__NOVEL_ID,siteid:__SITE_ID_QUERY,withurl:1},beforeSend:function(){null==loading&&(loading=layer.open({type:2}))},complete:function(){null!=loading&&(layer.close(loading),loading=null)},success:function(t){laytpl($("#dirTpl").html()).render(t.data,function(t){$(".dir-content").html(t),$(".pt-pop-catalogue-list").scrollTop($(".pt-pop-catalogue-item[data-chapter-id="+__CHAPTER_ID+"]")[0].offsetTop-90)})},error:function(){layer.alert("加载失败,请刷新页面后重试!",{icon:2})}}),$(".pt-pop-catalogue-shade").toggle(),$(".pt-pop-set").hide()}),$(".pt-pop-catalogue-close").click(function(){$(".pt-pop-catalogue-shade").toggle()}),$(".pt-pop-catalogue-item").click(function(){$(this).addClass("pt-pop-catalogue-select").siblings().removeClass("pt-pop-catalogue-select"),$(this).siblings().children(".pt-current-reading").hide(),$(this).children(".pt-current-reading").show()}),$(".pt-source-btn").click(function(){$.ajax(__API_CHAPTER_SAME,{type:"get",dataType:"json",data:{novelid:__NOVEL_ID,chapterid:__CHAPTER_ID,withurl:1},beforeSend:function(){null==loading&&(loading=layer.open({type:2}))},complete:function(){null!=loading&&(layer.close(loading),loading=null)},success:function(t){laytpl($("#sourceTpl").html()).render(t.data,function(t){$(".source-content").html(t)})},error:function(){layer.alert("加载其他源失败,请刷新页面后重试!",{icon:2})}}),$(".pt-pop-source-shade").toggle(),$(".pt-pop-set").hide()}),$(".pt-pop-source-close").click(function(){$(".pt-pop-source-shade").toggle()}),$(".pt-set-btn").click(function(){$(".pt-pop-set").toggle(),$(".pt-bgcolor .pt-bgcolor-select").hide(),$('.pt-bgcolor div[data-color="'+$(".pt-read").css("backgroundColor")+'"] .pt-bgcolor-select').show()}),$(".pt-font-add").click(function(){return fontsize+=.02,fontsize>.32?void(fontsize=.32):(lh+=.03,lined+=.2,void changeFontStyle(fontsize,lh,lined))}),$(".pt-font-reduce").click(function(){return fontsize-=.02,fontsize<.08?void(fontsize=.08):(lh-=.03,lined-=.2,void changeFontStyle(fontsize,lh,lined))}),$(".pt-bgcolor>div").click(function(){var t=$(this).data("color");$(".pt-night").show(),$(".pt-daytime").hide(),$(this).children(".pt-bgcolor-select").show(),$(this).siblings().children(".pt-bgcolor-select").hide(),$(".pt-read").removeClass("bg-1a color89").css("background-color",t).data("color",t),window.localStorage.setItem("mobilenovel.chapter.read.color",t)}),$(".pt-night").click(function(){var t=$(this).data("color");$(".pt-read").css("background-color",t).data("color",t),window.localStorage.setItem("mobilenovel.chapter.read.color",t),$(this).hide(),$(".pt-daytime").show()}),$(".pt-daytime").click(function(){var t=$(this).data("color");$(".pt-read").css("background-color",t).data("color",t),window.localStorage.setItem("mobilenovel.chapter.read.color",t),$(this).hide(),$(".pt-night").show()}),$(".pt-feedback-btn").click(function(){$(".pt-pop-feedback-shade").toggle(),$(".pt-pop-set").hide()}),$(".pt-pop-feedback-close").click(function(){$(".pt-pop-feedback-shade").toggle()}),$(".pt-collect").click(function(){$(this).data("is-mark")||$.ajax(__ADD_MARK,{type:"post",dataType:"json",data:{novelid:__NOVEL_ID,chapterid:__CHAPTER_ID},success:function(t){t.code?(alert(t.msg),t.data.redirect&&(window.location.href=t.data.redirect)):($(".pt-collect").data("is-mark",1),$(".pt-collect").text("已收藏"))},error:function(){alert("收藏失败,请刷新页面后重试!")}})}),$(".pt-pop-catalogue").on("click",".pt-pop-catalogue-sort",function(){var t=$(".pt-pop-catalogue-list .pt-pop-catalogue-item");t.sort(function(){return-1}),t.detach().appendTo(".pt-pop-catalogue-list"),$(this).html("反序"==$(this).html()?"正序":"反序"),$(".pt-pop-catalogue-list").scrollTop($(".pt-pop-catalogue-item[data-chapter-id="+__CHAPTER_ID+"]")[0].offsetTop-90)}),$("#pt-feedback-submit").click(function(){content=$("#pt-feedback-content"),content.val().length&&$.ajax(__ADD_FEEDBACK,{type:"post",dataType:"json",data:{novelid:__NOVEL_ID,chapterid:__CHAPTER_ID,content:content.val()},success:function(t){t.code?(alert(t.msg),t.data.redirect&&(window.location.href=t.data.redirect)):(alert("操作成功"),content.val(""),$(".pt-pop-feedback-close").click())},error:function(){alert("操作失败,请刷新页面后重试!")}})}),2===parseInt(__SHOW_TYPE)&&$.get(__API_CHAPTER_TRANSCODE,{page:__CHAPTER_PAGE},function(t){t.code?alert(t.msg):$("#pt-pop").html(t.data.chapter.content)},"json");var audios=[],playIndex=0,playBtn=$(".pt-pop-tts .play");$(".headset").click(function(){$(".pt-pop-tts").toggle(),$(".pt-mask").hide()}),$(".pt-tts-pre div").click(function(){$(this).addClass("pt-tts-select").siblings().removeClass("pt-tts-select"),"播放中"!==playBtn.text()&&"已暂停"!==playBtn.text()||("播放中"===playBtn.text()?loadAudit(playIndex,!0):loadAudit(playIndex,!1))}),$(".pt-pop-tts .pt-lined").each(function(t,e){var o=parseFloat($(e).parents(".pt-tts-spd,.pt-tts-vol").data("value")),a=parseFloat($(e).parents(".pt-tts-spd,.pt-tts-vol").data("max"));$(this).css({width:o/a*100+"%"})}),$(".pt-pop-tts .plus,.pt-pop-tts .minus").click(function(){var t=parseFloat($(this).parent().data("value")),e=parseFloat($(this).parent().data("step")),o=parseFloat($(this).parent().data("min")),a=parseFloat($(this).parent().data("max"));t=$(this).hasClass("plus")?t+e>a?a:t+e:t-e<o?o:t-e,$(this).parent().data("value",t),$(this).siblings(".pt-line").find(".pt-lined").css({width:t/a*100+"%"}),"播放中"!==playBtn.text()&&"已暂停"!==playBtn.text()||($(this).parent().hasClass("pt-tts-spd")?audios[playIndex].playbackRate=t:$(this).parent().hasClass("pt-tts-vol")&&(audios[playIndex].volume=t))}),playBtn.click(function(){"开始播放"===playBtn.text()||"播放结束"===playBtn.text()?(playBtn.text("加载中"),loadAudit(0,!0)):audios[playIndex].paused||audios[playIndex].ended?play():audios[playIndex].paused||(playBtn.text("加载中"),pause())}),$(".pt-read-toll a").click(function(){$(this).attr("href",$(this).attr("href")+($("#auto_subscribe").prop("checked")?"&autosubscribe=1":"")),"1"===$(this).data("subscribe")&&$(this).attr("href",$(this).attr("href")+($("#auto_subscribe").prop("checked")?"&autosubscribe=1":""))});