var Base=require("baseMobile"),Dialog=require("./../lib/js/dialogMobile.js"),MUI=require("./../mui/js/mui.js"),UIKit=require("./../uikit/uikit.js"),Fastclick=require("./../lib/js/fastclick.js"),JqueryTimeago=require("./../lib/js/jqueryTimeago.js"),Lazyload=require("./../lib/js/jqueryLazyload.js"),ScrollUpBar=require("./../lib/js/scrollUpBar.js"),ImageWidget=require("./../lib/js/imageWidget.js"),ImageSelectDialogMobile=require("./../lib/js/imageSelectDialogMobile.js"),muiFix=function(){$(".mui-bar-tab").on("tap",".mui-tab-item",function(){var o=$(this).attr("href");if(o&&0!==o.indexOf("#"))return window.location.href=$(this).attr("href"),!1})},apiInit=function(){window.api={},window.api.base=Base,window.api.dialog=Dialog,window.api.mui=MUI},callbackInit=function(){window.callback={},window.callback.imageWidgetSelectImage=function(o){new ImageSelectDialogMobile({imageListServer:"/data/image_select_dialog/simple_list",imageUploadServer:"/data/image_select_dialog/upload_file",callback:function(i){o([i])}}).show()}},noteSnsInit=function(){if($(document).on("click",".topic-follow-box",function(){var o=$(this).attr("data-topic-id");$.post("/topic/follow",{topicId:o},function(i){Base.defaultFormCallback(i,{success:function(i){"followed"==i.data.action?($(".topic-follow-box[data-topic-id="+o+"] .follow").removeClass("show"),$(".topic-follow-box[data-topic-id="+o+"] .unfollow").addClass("show")):($(".topic-follow-box[data-topic-id="+o+"] .unfollow").removeClass("show"),$(".topic-follow-box[data-topic-id="+o+"] .follow").addClass("show"))}})})}),$(document).on("click",".user-follow-box",function(){var o=$(this).attr("data-user-id");$.post("/member/follow",{memberUserId:o},function(i){Base.defaultFormCallback(i,{success:function(i){"followed"==i.data.action?($(".user-follow-box[data-user-id="+o+"] .follow").removeClass("show"),$(".user-follow-box[data-user-id="+o+"] .unfollow").addClass("show")):($(".user-follow-box[data-user-id="+o+"] .unfollow").removeClass("show"),$(".user-follow-box[data-user-id="+o+"] .follow").addClass("show"))}})})}),$(document).on("click",".note-like-box",function(){$.post("/note/like",{noteId:$(this).attr("data-note-id")},function(o){Base.defaultFormCallback(o,{success:function(o){"liked"==o.data.action?$(".note-like-box").addClass("liked"):$(".note-like-box").removeClass("liked"),$(".note-like-box .count").html(o.data.count)}})})}),$("[data-member-notification-count]").length){var o=$("[data-member-notification-count]"),i=window.document.title,a=function(){setTimeout(function(){$.post("/member/message_notification",{},function(t){Base.defaultFormCallback(t,{success:function(a){o.html(a.data.count),a.data.count>0?(o.addClass("show"),window.document.title="有"+a.data.count+"条新消息 | "+i):(o.removeClass("show"),window.document.title=i)}}),a()})},3e4)};a()}};module.exports={Base:Base,Dialog:Dialog,init:function(){apiInit(),callbackInit(),muiFix(),Base.init(),ImageWidget.init(),$(function(){$.timeago.settings.allowFuture=!0,$("[datetime]").timeago(),$("[data-src]").lazyload({data_attribute:"src"}),Fastclick.attach(document.body)}),noteSnsInit()}};