center.min.js
15.5 KB
(function(){localStorage.setItem("auto",false);e();function e(e){if(e){$(e).appendTo($("body .mask"))}var t=function(e){Module.call(this,e)};Core.inherit(t,Module);t.prototype.bind=function(){var e=this;e.$c.on("click","label.help, img",function(e){e.preventDefault();e.stopPropagation();if(Core.cur_mod=="help")return;Core.showMod("help");return false})};Core.registerMod("home",t);var o=function(e){Module.call(this,e)};Core.inherit(o,Module);Core.registerMod("help",o);var i=function(e){Module.call(this,e)};Core.inherit(i,Module);i.prototype.bind=function(){var e=this;e.$c.on("click","[type=submit]",function(t){t.preventDefault();Core.ajax_do(e.$c.find(".ajax"),e.mibao_cb,e);return false})};i.prototype.mibao_cb=function(e){var t=e.code;var o=e.msg;if(0==t){Core.Data.safe_question=o.question;Core.Data.safe_answer=o.answer}Core.showTips("成功设置密保!",true);Core.showMod("home")};Core.registerMod("mibao",i);var r=function(e){Module.call(this,e)};Core.inherit(r,Module);Core.registerMod("sub_menu",r);var a=function(e){Module.call(this,e)};Core.inherit(a,Module);a.prototype.bind=function(){var e=this;e.$c.on("click","[type=submit]",function(t){t.preventDefault();Core.ajax_do(e.$c.find(".ajax"),e.bind_cb,e);return false});e.$c.on("click","#bind-mobile",function(t){t.preventDefault();e.$c.find("#bind_phone_form").show();return false});e.$c.on("click","#bind-check",function(t){t.preventDefault();Core.ajax_do($(t.target),e.bind_ch,e);return false})};a.prototype.bind_ch=function(e){var t=e.code;Core.Data.bind_statu=e.msg.bind_statu;if(e.msg.bind_statu==1){Core.showTips("电话绑定未成功",false)}Core.updateMod("bind")};a.prototype.bind_cb=function(e){var t=e.code;if(t!=0)return;$(".bind_phone_tip").html(Core.Data.bind_mobile_tips);Core.Data.bind_statu=1;Core.Data.bind_phone=this.$c.find("input[name=mobile]").val();this.$c.find("span.text-info").html(this.$c.find("input[name=mobile]").val());Core.showTips("通过电话确认后可绑定手机!",true);this.$c.find("#bind_phone_form").hide();this.isValid=false;setTimeout(function(){Core.updateMod("bind")},1e3)};Core.registerMod("bind",a);var n=function(e){Module.call(this,e)};Core.inherit(n,Module);n.prototype.bind=function(){var e=this;e.$c.on("click","[type=submit]",function(t){t.preventDefault();Core.ajax_do(e.$c.find(".ajax"),e.mail_cb,e);return false});e.$c.on("click","#bind-mail",function(t){t.preventDefault();e.$c.find("#bind_mail_form").show();return false});e.$c.on("click",".op-primary",function(t){t.preventDefault();Core.ajax_do(e.$c.find(".ajax"),e.mail_cb,e);return false})};n.prototype.mail_cb=function(e){var t=e.code;Core.Data.bind_mail_statu=1;Core.Data.mail=this.$c.find("input[name=email]").val();this.$c.find("span.text-info").html(this.$c.find("input[name=email]").val());Core.showTips("请登录您的邮箱,完成邮箱认证功能。",true);this.$c.find("#bind_mail_form").hide();this.isValid=false;setTimeout(function(){Core.updateMod("mail")},1e3)};Core.registerMod("mail",n);var l=function(e){Module.call(this,e)};Core.inherit(l,Module);l.prototype.bind=function(){var e=this;e.$c.on("click","[type=submit]",function(t){t.preventDefault();Core.ajax_do(e.$c.find(".ajax"),e.modify_cb,e);return false})};l.prototype.modify_cb=function(e){var t=e.code;var o=e.msg;if(t==0){if(Core.Data.is_guest==1){localStorage.removeItem("guest_n");Core.showTips("账号升级成功, 请记住登录名和新密码。",true)}else{Core.showTips("成功修改密码, 请记住新密码。",true)}if(!Core.user_names)Core.user_names={};Core.user_names[o.username]=this.$c.find("input[name=newpwd]").val();localStorage.setItem("user_names",JSON.stringify(Core.user_names));Core.Data.is_guest=o.is_guest;Core.Data.username=o.username;Core.Data.nickname=o.nickname;this.isValid=false;Core.updateMod("home")}else{Core.showTips(o,false)}};l.prototype.show_after=function(){var e=Core.last_mod?Core.last_mod:"home";this.$c.find("a.btn.pull-left").attr("href","#"+e)};Core.registerMod("modify_pwd",l);var s=function(e){this.myScroll=null;this.cur_id=null;Module.call(this,e)};Core.inherit(s,Module);s.prototype.bind=function(){var e=this;e.$c.on("click","li>a.item",function(t){t.preventDefault();if(Core.cur_mod=="activity_detail")return;var o=$(t.target);if(!o.is("a"))o=o.parent();var i=o.attr("data-id");if(i==e.cur_id){Core.Data.activity_update=false;Core.showMod("activity_detail");return false}e.cur_id=i;Core.Data.activity_update=true;Core.showTips("加载中...",true,5e3);o.data("path","/sdk/notice/view/?id="+i);Core.load_json(o,function(e){Core.Data.activity_detail=e;Core.showTips("加载完成!",true,2e3);Core.updateMod("activity_detail")},e);return false});e.$c.on("click","li.more a",function(t){t.preventDefault();Core.load_html($(t.target),e.refresh,e);return false})};s.prototype.refresh=function(){this.myScroll.refresh()};s.prototype.show_after=function(){if(this.$c.find(".activity-list").children().length==0){Core.load_html(this.$c.find(".activity-list"),this.act_cb,this)}var e=this.$c.find(".badge");if(e.length==0){if(Core.Data.msg_count>0){var t=this.$c.find(".badge_msg");t.html('<span class="badge">'+Core.Data.msg_count+"</span>"+t.html())}}};s.prototype.act_cb=function(e){this.myScroll=new iScroll("activity_wrapper")};Core.registerMod("activity",s);var c=function(e){this.myScroll=null;Module.call(this,e)};Core.inherit(c,Module);c.prototype.bind=function(){var e=this};c.prototype.show_after=function(){var e=this;if(Core.Data.activity_update){console.log("new scroller");this.myScroll=new iScroll("detail_scroller");e.myScroll.refresh();this.$c.find(".scroll img").on("load",function(t){console.log("img loaded in scroll");e.myScroll.refresh()})}};Core.registerMod("activity_detail",c);var u=function(e){this.myScroll=null;this.cur_id=null;Module.call(this,e)};Core.inherit(u,Module);u.prototype.bind=function(){var e=this;e.$c.on("click","li>a.item",function(t){t.preventDefault();t.stopPropagation();if(Core.cur_mod=="question_detail")return;var o=$(t.target);while(!o.is("a"))o=o.parent();var i=o.attr("data-id");if(i==e.cur_id){Core.Data.question_update=false;Core.showMod("question_detail");return false}e.cur_id=i;Core.Data.question_update=true;o.data("path","/user/question/view?id="+i+"&format=json");Core.load_json(o,function(e){Core.Data.question_detail=e;Core.showTips("加载完成!",true,2e3);Core.updateMod("question_detail")},e);return false});e.$c.on("click","li.more a",function(t){t.preventDefault();Core.load_html($(t.target),e.refresh,e);return false})};u.prototype.refresh=function(){this.myScroll.refresh()};u.prototype.show_after=function(){if(this.$c.find(".kefu-list").children().length==0){$ol=this.$c.find(".kefu-list");if($ol.attr("data-params-url").indexOf("undefined")==-1)Core.load_html(this.$c.find(".kefu-list"),this.act_cb,this)}};u.prototype.act_cb=function(e){this.myScroll=new iScroll("kefu_wrapper")};Core.registerMod("kefu_list",u);var f=function(e){this.myScroll=null;Module.call(this,e)};Core.inherit(f,Module);f.prototype.bind=function(){var e=this;e.$c.on("click","li.more a",function(t){t.preventDefault();Core.load_html($(t.target),e.refresh,e);return false})};f.prototype.refresh=function(){this.myScroll.refresh()};f.prototype.show_after=function(){if(this.$c.find(".invite-list").children().length==0){Core.load_html(this.$c.find(".invite-list"),this.act_cb,this)}};f.prototype.act_cb=function(e){this.myScroll=new iScroll("invite_wrapper")};Core.registerMod("invite_list",f);var d=function(e){this.myScroll=null;this.cur_id=null;Module.call(this,e)};Core.inherit(d,Module);d.prototype.bind=function(){var e=this;e.$c.on("click","li>a.item",function(t){t.preventDefault();t.stopPropagation();if(Core.cur_mod=="message_detail")return;var o=$(t.currentTarget);var i=o.attr("data-id");if(i==e.cur_id){Core.showMod("message_detail");return false}e.cur_id=i;o.data("path","/message/"+i+".html?format=json");Core.load_json(o,function(e){Core.Data.message_detail=e;Core.showTips("加载完成!",true,2e3);Core.updateMod("message_detail")},e);return false});e.$c.on("click","li.more a",function(t){t.preventDefault();Core.load_html($(t.target),e.refresh,e);return false})};d.prototype.refresh=function(){this.myScroll.refresh()};d.prototype.show_after=function(){if(this.$c.find(".message-list").children().length==0){Core.load_html(this.$c.find(".message-list"),this.act_cb,this)}};d.prototype.act_cb=function(e){this.myScroll=new iScroll("message_wrapper")};Core.registerMod("message",d);var p=function(e){Module.call(this,e)};Core.inherit(p,Module);Core.registerMod("message_detail",p);var h=function(e){this.myScroll=null;this.cur_id=null;Module.call(this,e)};Core.inherit(h,Module);h.prototype.bind=function(){var e=this;e.$c.on("click","li>a.item",function(t){t.preventDefault();t.stopPropagation();if(Core.cur_mod=="topic_detail")return;var o=$(t.target);while(!o.is("a"))o=o.parent();var i=o.attr("data-id");if(i==e.cur_id){Core.Data.topic_update=false;Core.showMod("topic_detail");return false}e.cur_id=i;Core.Data.topic_update=true;Core.Data.topic_id=i;o.data("path","/topic/view?id="+i+"&order=recent&format=json");Core.load_json(o,function(e){Core.Data.topic_detail=e;Core.showTips("加载完成!",true,2e3);Core.updateMod("topic_detail")},e);return false});e.$c.on("click","li.more a",function(t){t.preventDefault();Core.load_html($(t.target),e.refresh,e);return false})};h.prototype.refresh=function(){this.myScroll.refresh()};h.prototype.show_after=function(){if(this.$c.find(".topic-list").children().length==0){this.cur_id=null;var e=this.$c.find(".topic-list");if(e.attr("data-params-url").indexOf("undefined")==-1)Core.load_html(e,this.act_cb,this)}};h.prototype.act_cb=function(e){this.myScroll=new iScroll("topic_wrapper")};Core.registerMod("topic_list",h);var m=function(e){this.myScroll=null;Module.call(this,e)};Core.inherit(m,Module);m.prototype.bind=function(){var e=this;e.$c.on("click","li.more a",function(t){t.preventDefault();Core.load_html($(t.target),e.refresh,e);return false});e.$c.on("click",".op-primary",function(e){e.preventDefault();Core.updateMod("topic_reply");return false})};m.prototype.refresh=function(){this.myScroll.refresh();var e=this;this.$c.find(".scroll img").on("load",function(t){e.myScroll.refresh()})};m.prototype.show_after=function(){if(Core.Data.topic_update){if(this.myScroll)this.myScroll.destroy();this.myScroll=new iScroll("topic_detail_scroller");this.refresh()}};Core.registerMod("topic_detail",m);var _=function(e){this.myScroll=null;Module.call(this,e)};Core.inherit(_,Module);_.prototype.bind=function(){var e=this;e.$c.on("click",".op-primary.submit",function(t){t.preventDefault();if(e.$c.find("textarea").val()==""){Core.showTips("请填写相应的描述!",false);return false}Core.ajax_do(e.$c.find(".ajax"),e.sq_cb,e);return false})};_.prototype.sq_cb=function(e){if(e.code==0){Core.showTips(e.msg,true,3e3);this.$c.find("input[name=title]").val("");this.$c.find("textarea").val("");setTimeout(function(){Core.updateMod("topic_list")},2e3)}else{Core.showTips(e.msg,false)}};Core.registerMod("topic",_);var C=function(e){this.myScroll=null;Module.call(this,e)};Core.inherit(C,Module);C.prototype.bind=function(){var e=this;e.$c.on("click",".op-primary.submit",function(t){t.preventDefault();if(e.$c.find("textarea").val().length>150){Core.showTips("帖子描述超出了150个字符!",false);return false}Core.ajax_do(e.$c.find(".ajax"),e.sq_cb,e);return false})};C.prototype.sq_cb=function(e){if(e.code==0){var t=this;Core.showTips(e.msg,true,2e3);var o=Core.Data.topic_id;var i=t.$c.find(".op-primary.submit");i.data("path","/topic/view?id="+o+"&order=recent&format=json");Core.load_json(i,function(e){Core.Data.topic_update=true;Core.Data.topic_detail=e;Core.showTips("回复成功!",true,2e3);Core.updateMod("topic_detail")},t)}else{Core.showTips(e.msg,false)}};Core.registerMod("topic_reply",C);var v=function(e){this.myScroll=null;this.$e=null;Module.call(this,e)};Core.inherit(v,Module);v.prototype.bind=function(){var e=this;e.$c.on("click","li>p>a",function(t){t.preventDefault();var o=$(t.target);e.$e=o;Core.ajax_do(o,e.post_cb,e);return false});e.$c.on("click","li.more a",function(t){t.preventDefault();Core.load_html($(t.target),e.refresh,e);return false})};v.prototype.refresh=function(){var e=this;setTimeout(function(){e.myScroll.refresh()},300)};v.prototype.show_after=function(){if(this.$c.find(".prize-list").children().length==0){Core.load_html(this.$c.find(".prize-list"),this.act_cb,this)}};v.prototype.post_cb=function(e){Core.showTips(e.msg.msg,e.code==0?true:false,2e3);if(e.code==0){console.log(this);this.$e.replaceWith('<sapn class="pull-right text-info btn-small">已经领取</span>')}};v.prototype.act_cb=function(e){this.myScroll=new iScroll("prize_wrapper")};Core.registerMod("prize_list",v);var y=function(e){this.myScroll=null;this.$score=null;Module.call(this,e)};Core.inherit(y,Module);y.prototype.bind=function(){var e=this;e.$c.on("click","li.more a",function(t){t.preventDefault();Core.load_html($(t.target),e.refresh,e);return false});e.$c.on("click","li p > a",function(t){t.preventDefault();e.$score=$(t.target);Core.ajax_do($(t.target),e.jude_cb,e);return false})};y.prototype.jude_cb=function(e){Core.showTips(e.msg);if(e.code==0){var t=this.$score.html();this.$score.parent().empty().html('您的评价: <span class="btn">'+t+"</span>")}};y.prototype.refresh=function(){var e=this;setTimeout(function(){e.myScroll.refresh()},300)};y.prototype.show_after=function(){if(Core.Data.question_update){if(this.myScroll)this.myScroll.destory();this.myScroll=new iScroll("question_detail_scroller")}};Core.registerMod("question_detail",y);var g=function(e){Module.call(this,e)};Core.inherit(g,Module);g.prototype.bind=function(){var e=this;e.$c.on("click",".op-primary.submit",function(t){t.preventDefault();if(e.$c.find("select").val()==""||e.$c.find("textarea").val()==""){Core.showTips("请选择问题类型,并填写相应的描述!",false);return false}if(e.$c.find("textarea").val().length>150){Core.showTips("问题描述超出了150个字符!",false);return false}Core.ajax_do(e.$c.find(".ajax"),e.sq_cb,e);return false})};g.prototype.sq_cb=function(e){Core.showTips(e.msg,true,2e3);this.isValid=false;Core.updateMod("kefu_list")};Core.registerMod("submit_question",g);var b=function(e){Module.call(this,e)};Core.inherit(b,Module);b.prototype.bind=function(){var e=this;e.$c.on("click","#share a",function(e){e.preventDefault();var t=$(e.target);var o=[];var i=t.attr("title");var r=t.attr("href");var a=Core.Data.game_icon;var n=Core.Data.invite_url;var l="title="+encodeURIComponent("我在玩"+Core.Data.game_name+",游戏很棒,一起来玩吧!");n="url="+encodeURIComponent(n);if(t.hasClass("s_tqq")){o.push("c=share");o.push("a=index")}if(t.hasClass("s_qzone")){a="pics="+encodeURIComponent(a)}else if(t.hasClass("s_tsina")){o.push("searchpic=true");o.push("style=number")}else{a="pic="+encodeURIComponent(a)}o.push(a);o.push(n);o.push(l);var s=t.attr("data-appkey");if(s){s="appkey="+s;o.push(s)}r=r+"?"+o.join("&");Core.Data.frame_title=i+"分享";Core.Data.frame_src=r;Core.updateMod("frame")})};Core.registerMod("invite_menu",b);var M=function(e){Module.call(this,e)};Core.inherit(M,Module);M.prototype.bind=function(){var e=this;e.$c.on("click",".go_frame",function(e){e.preventDefault();var t=$(e.target);var o=t.attr("data-url");var i=t.attr("data-title");Core.Data.frame_title=i;Core.Data.frame_src=o;Core.updateMod("frame")})};Core.registerMod("assistant",M);var w=function(e){Module.call(this,e)};Core.inherit(w,Module);w.prototype.show_after=function(){var e=this;var t=Core.last_mod?Core.last_mod:"home";this.$c.find("a.btn.pull-left").attr("href","#"+t);this.$c.find("iframe")[0].onload=function(){e.$c.find("#loading_frame").hide()}};Core.registerMod("frame",w);if(window.isGetData==1){$("#loading").hide();Core.init()}else{window.isGetData=1}}})();