var jtFrame = function(){ } //作品列表模块 jtFrame.prototype.booklist = function(){ return{ const:{ 'url':'', 'id':0, "page":1, 'totalPage':0, "able":"true" }, init:function(url, id){ this.const.url=url; if(id)this.const.id=id; this.listRq(1); this.getPage(); }, //请求并渲染 listRq:function(page){ var that = this; that.complete(""); that.const.able = false; var moli = $(".AT li").clone(); moli.addClass('book_loading'); moli.find('.detail a').html('
'); $('.book_list').append(moli); $.ajax({ url:that.const.url, type:"POST", data: {page:page, id:that.const.id}, success:function(data) { $('.book_list').find('.book_loading').remove(); that.const.totalPage = data.totalPage; if(that.const.totalPage>0){ var data = data.data; $(data).each(function(index,val){ var moli = $(".AT li").clone(); moli.find("h2 a").html(val.title); moli.find("h2 a").attr('href', '/read/'+val.bookid+'.html'); moli.find(".mauthor a").html(val.nick_name); moli.find(".mauthor a").attr('href', '/'+val.uid+'/book.html'); if(val.is_qy>0)moli.find('.mauthor').after(''); var ntime = qs_c_obj.rendTime(val.utimestamp); //var ntime = qs_c_obj.rendTime(val.gxtime); moli.find(".mtime em").html(ntime); var gxtime = qs_c_obj.rendTime(val.gxtime, 1); moli.find(".gxtime span").html(gxtime); moli.find(".detail a").html(val.indu.replace(/\r?\n/g, ''+text+'
').show(); }else{ $(".load_more").hide(); } } } } //轮播图模块 jtFrame.prototype.slide = function(){ $('.flexslider').flexslider({ directionNav: true, pauseOnAction: true }); qs_c_obj.bindEvent({ 'mouseenter|.flexslider': function mouseenterFlexslider(){ if($('ul.slides li').length>1){ //$(".flex-direction-nav').show(); $('.flexslider').flexslider('pause'); } }, 'mouseleave|.flexslider': function mouseleaveFlexslider(){ //$(".flex-direction-nav').hide(); $('.flexslider').flexslider('play'); }, 'click|.flex-next': function clickFlexNext(){ $('.flexslider').flexslider('next'); }, 'mouseover|.flex-next': function clickFlexNext(){ $('.flexslider').flexslider('next'); }, 'click|.flex-prev': function clickFlexPrev(){ $('.flexslider').flexslider('prev'); } }); } //热门 jtFrame.prototype.hot=function(data){ if(data.length>0){ $(data).each(function(index,val){ var moli=$(".hot_tpl .hot_book").clone(); moli.find("h2 a").html(val.name); moli.find("h2 a").attr('href', '/read/'+val.id+'.html'); if(val.theme_id>0)moli.find("h2 a").addClass('zhongchuang'); moli.find(".hot_book_author a").html(val.nick_name); moli.find(".hot_book_author a").attr('href', '/'+val.uid+'/book.html'); if(val.is_qy>0)moli.find('.hot_book_author').after(''); var ntime = qs_c_obj.rendTime(val.utime); //var ntime = qs_c_obj.rendTime(val.gxtime); //moli.find(".hot_book_time").html(ntime); moli.find(".mtime em").html(ntime); var gxtime = qs_c_obj.rendTime(val.gxtime, 1); moli.find(".gxtime span").html(gxtime); moli.find(".hot_book_read em").html(val.read_cnt); if(val.pic!=null && val.pic!=''){ moli.find(".hot_book_cover").attr("href",'/read/'+val.id+'.html'); moli.find(".hot_book_cover").attr("style",'background-image:url('+val.pic+');'); }else{ moli.find(".hot_book_cover").remove(); moli.find(".hot_book_l").attr("class",'hot_book_l width_100'); } moli.appendTo($(".right_hot")); var l=Math.round((moli.find('.mtime em').width()-moli.find('.gxtime').outerWidth())/2)+moli.find('.mtime').outerWidth()-moli.find('.mtime em').width(); moli.find('.gxtime').css('left', l+'px'); }); } }