﻿function SmallBlog() { } SmallBlog.PostSmallBlogIng = false; SmallBlog.TimeOut = null; function CheckSmallBlogPost(Obj) { var PObj; if (Obj != null) { PObj = $(Obj) } else { PObj = $("body") } if (PObj.find("input[name='AreaId']").val() == "") { Kitty.Alert("温馨提醒", '请选择位置！'); return false } if (PObj.find("input[name='Tag']").val() == "") { Kitty.Alert("温馨提醒", '请选择标签！'); return false } if (PObj.find("input[name='UserId']").val() == "") { Kitty.Alert("温馨提醒", '您登陆超时，请重新登陆！'); return false } if (PObj.find("textarea[name='SmallBlogContent']").val() == "") { Kitty.Alert("温馨提醒", '请输入您要发表的内容！'); return false } if (!CheckInputNum(Obj)) { Kitty.Alert("温馨提醒", '输入内容超过最大限制！'); return false } if (!SmallBlog.PostSmallBlogIng) { SmallBlog.PostSmallBlogIng = true; return true } else { Kitty.Alert("温馨提醒", '杯具啊，上条信息尚未发送完成，你歇会吧！'); return false } } function CheckInputNum(Obj) { var PObj; if (Obj != null) { PObj = $(Obj) } else { PObj = $("body") } var Len = PObj.find("textarea[name='SmallBlogContent']").val().length; if (Len > 140) { PObj.find("#EnableInputNum").html(140 - Len); Kitty.Alert("", "超出了字数范围~"); return false } else { PObj.find("#EnableInputNum").html(140 - Len); return true } } function ShowSmallBlogInDiv(_Sid) { $.ajax({ type: "post", url: "/Service/AjaxSmallBlogWS.asmx/LoadSmallBlog", data: { Sid: _Sid }, success: function(Msg) { $(".tc_box").hide(); var Json = eval("(" + $(Msg).find("string").text() + ")"); Kitty.Alert(Json.title, "<div class='TanChuDivContent'>" + Json.msg + "</div>", "<div style=\"display:none\"><input  type=\"button\" value=\"关闭\" onclick=\"$('.BG,.AlertDiv').hide();\" class=\"but m_r10 But1\"/></div>", 500) } }) } function AjaxFavorite_Del(_Uid, _Sid, Obj) { if (_Uid == null || _Uid == "") { _Uid = Eexin.UserId } $.ajax({ type: "post", url: "/Service/AjaxSmallBlogWS.asmx/Favorite", data: { Uid: _Uid, Sid: _Sid, Del: "Yes" }, success: function(Msg) { Kitty.Alert("", $(Msg).find("string").text()); Obj.parents(".pl_list").animate({ height: 0 }, 1000, function() { Obj.parents(".pl_list").remove() }) } }) } function AjaxFavorite(_Uid, _Sid) { if (_Uid == null || _Uid == "") { _Uid = Eexin.UserId } $.ajax({ type: "post", url: "/Service/AjaxSmallBlogWS.asmx/Favorite", data: { Uid: _Uid, Sid: _Sid }, success: function(Msg) { Kitty.Alert("", $(Msg).find("string").text()) } }) } SmallBlog.AjaxSmallBlog_Del_Back = function(_Id, Obj) { clearTimeout(SmallBlog.TimeOut); Obj.parents(".pl_list").show(1000); $.post("/Service/AjaxSmallBlogWS.asmx/SmallBlog_Del_Back", { Id: _Id }, function() { $("#CheXiao").remove() }) }; SmallBlog.AjaxSmallBlog_Del_True = function(_Id, Obj) { $.post("/Service/AjaxSmallBlogWS.asmx/AjaxSmallBlog_Del_True", { Id: _Id }, function() { Obj.parents(".pl_list").hide(1000) }) }; function AjaxSmallBlog_Del(_Id, Obj) { SmallBlog.AjaxSmallBlog_Del_True(_Id, Obj); return false; var TipObj = new Tip(); TipObj.Init({ TipText: "已经成功删除！", TipButText: "撤销" }); TipObj.Show(); TipObj.ButtunOnClick(function() { SmallBlog.AjaxSmallBlog_Del_Back(_Id, Obj) }); $.ajax({ type: "post", url: "/Service/AjaxSmallBlogWS.asmx/SmallBlog_Del", data: { Sid: _Id }, success: function() { Obj.parents(".pl_list").hide(1000); SmallBlog.TimeOut = setTimeout(function() { TipObj.Remove(); SmallBlog.AjaxSmallBlog_Del_True(_Id) }, 5000) } }) } function AjaxSmallBlogReply(Sid, Obj) { var Con = $("#ReplyContent" + Sid).val(); var OldBut = $(Obj).html(); if (Con.length < 1) { Kitty.Alert("温馨提醒", "请输入要回复的内容！"); return } $("#ReplyContent" + Sid).val(''); $(Obj).html(" <img src='/Content/Images/Icon/loader.gif'/>"); $.get("/Service/AjaxSmallBlogWS.asmx/AjaxReply", { SmallId: Sid, ReplyContent: Con }, function(Msg) { var Json = eval("(" + $(Msg).find("string").text() + ")"); if (Json.state == "Success") { $("#PlShow" + Sid).append(unescape(Json.msg)); $(".hf").hover(function() { $(this).find(".DoBut").show() }, function() { $(this).find(".DoBut").hide() }); $(Obj).html(OldBut) } else { alert(Json.state) } }) } SmallBlog.AjaxLoadReplyNull = function(Id, Obj) { $(Obj).hide(); $('#PlShow' + Id + ',#HuiFuInputDiv' + Id + ',#ShouQiPL' + Id).show(); $("#ReplyContent" + Id).focus() }; SmallBlog.AjaxLoadReply = function(Id, Obj) { $(Obj).hide(); $('#PlShow' + Id + ',#HuiFuInputDiv' + Id + ',#ShouQiPL' + Id).show(); $("#ReplyContent" + Id).focus(); if (Id != null) { var RongQi = $("#PlShow" + Id); if ($.trim(RongQi.html()) != "") { RongQi.show(); return } RongQi.html("<div class='center'><img src='/Content/Images/Icon/loader.gif'/></div>"); $.post("/Service/AjaxSmallBlogWS.asmx/LoadReply", { Sid: Id }, function(Msg) { RongQi.html($(Msg).find("string").text()); $(".MeHide_" + Eexin.UserId).hide(); $(".MeShow_" + Eexin.UserId).show(); $(".hf").hover(function() { $(this).find(".DoBut").show() }, function() { $(this).find(".DoBut").hide() }); if (Eexin.UserId == null || Eexin.UserId == "") { $(".MustLogin").find("a").removeAttr("onclick"); $(".MustLogin").find("*").focus(function() { $(this).blur(); $(".BG,.LoginDiv").show(); return false }) } }) } }; SmallBlog.ShouQiPL = function(Id) { $("#ShouQiPL" + Id + ',#PlShow' + Id + ',#HuiFuInputDiv' + Id + ',#ShouQiPL' + Id).hide(); $("#ZhanKaiPL" + Id).show() }; function AjaxDelReply(Id, Obj) { $.post("/Service/AjaxSmallBlogWS.asmx/DelReply", { Cid: Id }, function() { Obj.parents(".hf").fadeIn(1000).animate({ height: 2 }, 700, function() { Obj.parents(".hf").remove() }) }) } SmallBlog.CheckTopic = function() { var _Title = $("input[name='Title']").val(); if (_Title == "") { alert("请输入帖子的标题！"); return false } $("#TopicForm").submit() }; SmallBlog.DoBut_ShowOrHide = function(Obj) { $(Obj).hover(function() { $(this).find(".DoBut").show() }, function() { $(this).find(".DoBut").hide() }) }; SmallBlog.AjaxAddSubmitIng = false; SmallBlog.AjaxAddSubmit = function(Form, SearchTypes) { var Form = $(Form); var ValJsonStr = ""; $.each(Form.serializeArray(), function(i, Val) { ValJsonStr += Val.name + ":'" + APP.ConverStr(Val.value) + "'," }); var ValJsonObj = eval("({" + ValJsonStr.substr(0, ValJsonStr.length - 1) + "})"); setTimeout(function() { SmallBlog.PostSmallBlogIng = false }, 20000); $.post("/Service/AjaxSmallBlogWS.asmx/AjaxPostSmallBlog", ValJsonObj, function(re) { var restr = $(re).find("string").text(); if (restr == "Success") { SmallBlog.PostSmallBlogIng = SmallBlog.AjaxAddSubmitIng = false; $("#MySmallBlogCount").animate({ fontSize: '32px' }, 600, function() { $(this).html(eval($(this).html()) + 1).css("fontSize", "18px") }); Form.find("#SmallBlogContent").css("backgroundPosition", "0px -169px").val(''); setTimeout(function() { Form.find("#SmallBlogContent").css("backgroundPosition", "0 0") }, 1500); Page.GetNewMsg(SearchTypes, '.pinglun') } else { Kitty.Alert("", restr) } }) };