mystyle-fiction-server/src/main/resources/static/plugins/fiction/js/reader.min.js

2 lines
14 KiB
JavaScript
Raw Normal View History

2024-02-04 10:28:38 +00:00
/* ZONGHENG PC 2018 Copyright (c) 2018 (ZONGHENG FETEAM) lastUpdate: 2022-08-02 15:45:47*/
define(["donate","widget","chapterForums","chapterReport"],function(e,r,o){var i=$("body").attr("bookId"),a=($("body").attr("chapterId"),$("body").attr("lastChapterId")),n=$("body").attr("nextChapterId"),s="chapterflow"===$("body").attr("scriptSign")?1:0,t=($("body").attr("forumid"),$(window).width()),d=CookieUtil,c="rSet",l=[1,3,1,14,1];t<1200?l[1]=1:t<1400&&(l[1]=2);var p=[0,640,800,960,1100,1440,1700],h=h||{save:function(e){e=e.join("_");d.setCookie({name:c,value:e,path:"/",domain:document.domain||"book.zongheng.com",expires:31536e3})},setDef:function(){this.save(l),d.getCookie("ui_read_setting")&&d.setCookie({name:"ui_read_setting",value:null,path:"/",domain:".zongheng.com",expires:-1})},getStatData:function(){var e=this.setting;return{setting_color:["0","默认","蓝色","绿色","粉色","浅灰","羊皮","纸纹","黑色"][parseInt(e[0])],setting_font:["0","宋体","黑体","微软雅黑","楷体"][parseInt(e[2])],setting_font_size:e[3],setting_page_breadth:["0","640","800","默认","1280"][parseInt(e[1])]}},setChange:function(e,t){this.setting[e]=t},color:function(e){document.body.className="rb_"+e,$('a[data-style="'+e+'"]').addClass("active").siblings().removeClass("active"),this.setChange(0,e)},serbarPos:function(e){$("#uiGPUserAct").css({"margin-left":Math.floor(e/2+10)+"px"}),$("#uiGPReaderAct").css({"margin-left":"-"+Math.floor(e/2+70)+"px"})},setGpdOffset:function(){var e=$(document).scrollTop(),t=$("#readerFt").height(),a=$(window).height(),r=$("#uiGPUserAct").height(),o=$("body").height(),i=$("#readerFt").eq(0).offset().top;i<=e?($("#uiGPReaderAct").css({position:"fixed",top:"0px"}),$(".chapter_forum").addClass("fixed")):($("#uiGPReaderAct").css({position:"absolute",top:i}),$(".chapter_forum").removeClass("fixed")),i+t-a<=e&&200<=o||o<a?$("#uiGPUserAct").css({position:"absolute",top:i+t-r,bottom:"auto"}):$("#uiGPUserAct").css({position:"fixed",bottom:"0px",top:"auto"})},width:function(e){var t=p[e];$("#reader_warp").hasClass("rw_comment_open")?($("#reader_warp").attr("class","rw_"+e+" rw_comment_open"),t+=400):$("#reader_warp").attr("class","rw_"+e),$('a[data-width="'+e+'"]').addClass("active").siblings().removeClass("active"),this.setChange(1,e),this.serbarPos(t)},fontFace:function(e){$("#readerFt").attr("class","rft_"+e),$('a[data-font="'+e+'"]').addClass("active").siblings().removeClass("active"),this.setChange(2,e)},fontSize:function(e){e<10&&(e=14),$("#readerFt").css("font-size",e+"px"),$(".sbw_font .nowfont").html(e),this.setChange(3,e+"")},comment:function(e){0==e?($("#j_selectCommentBtn").addClass("off").removeClass("on"),$(".reader_box").addClass("parCommentHide")):($("#j_selectCommentBtn").addClass("on").removeClass("off"),$(".reader_box").removeClass("parCommentHide")),this.setChange(4,e)},build:function(e){e=e||d.getCookie(c).split("_"),this.color(e[0]),this.width(e[1]),this.fontFace(e[2]),this.fontSize(e[3]),this.comment(e[4])},close:function(){$("#uiGPReaderAct").find('[data-pname="readerSetting"]').hide(),$("#uiGPReaderAct").find("a.readerSetting").removeClass("active")},jump:function(e,t){"chapterflow"!=this.type&&("0"!=a||0!==t?"0"!=n||1!==t?location.href=Domain.bookHostName+"/chapter/"+i+"/"+e+".html":$('[data-hook="pageEnd"]').click():$('[data-hook="pageStart"]').click())},end:function(){var e="",e="true"==$("body").attr("chapterDelayRelease")?"1":"0";this.endUrl=Domain.bookHostName+"/readmore1/"+i+"/"+e+".html"},autoScroll:function(e){var t,a,r=this;function o(){t=document.documentElement.scrollTop||document.body.scrollTop,t++,window.scroll(0,t),a=document.documentElement.scrollTop||document.body.scrollTop,t!=a&&i()}function i(){clearInterval(r.scrolltimer)}"start"==e&&function(){r.scrolltimer=setInterval(o,30);try{document.selection?document.selection.empty():document.getSelection().removeAllRanges()}catch(e){}}(),"stop"==e&&i()},sendFootPrint:function(e,t){!0===UserUtil.isLogin&&$.ajax({type:"get",url:"/api/footprint/trace",data:{bookId:e,chapterId:t},cache:!1,"async":!0,dataType:"json"})},init:function(){d.getCookie(c)||this.setDef(),this.setting=d.getCookie(c).split("_"),this.type