123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- Namespace.register("U.F.S");
- U.F.S.SearchPostion; //搜索的时候判断位置
- /**
- * 搜索好友
- *
- * @param {object} 用户信息
- * @param {element} 打印显示的元素
- * @param {object} 回调函数
- * @param {object} 搜索的类型
- * F 好友
- * G 群
- * "" 好友和群
- */
- U.F.S.SearchFriendsOrGroupForm = function (inputs, el, cb, typename) {
- var _searchfriendinfo = [], //搜索好友的数组
- _searchvalue = inputs.value, //获取搜索的内容
- _isserch = U.F.S.SearchFriendsKeyboardHandle(el, inputs) //是否允许搜索
- ;
- //判断用户键盘输入的内容,是否需要进行搜索
- if (_isserch) {
- _searchfriendinfo;
- //获取搜索好友的值
- if (!typename || typename == "F") {
- _searchfriendinfo = _searchfriendinfo.concat(_$(US.Friend[1]).Like({ "FriendsDescript": _searchvalue, "UserNickName": _searchvalue, "UserName": _searchvalue })); //获取用户好友
- }
- //获取搜索群的值
- if (!typename || typename == "G") {
- _searchfriendinfo = _searchfriendinfo.concat(_$(US.Friend[2]).Like({ "GroupManageName": _searchvalue })); //获取好友群
- }
- //显示清空
- el.style.display = "block";
- el.innerText = "";
- //搜索好友的打印
- U.F.S.PrintSearchFriends(_searchfriendinfo, el, cb);
- };
- }
- /**
- * 搜索键盘的处理
- *
- * @param {object} 用户信息
- */
- U.F.S.SearchFriendsKeyboardHandle = function (el, inputs) {
- var _keycode = event ? event.keyCode : 0, //获取键盘的值
- _childs = $(el).Child(), //搜索的内容子元素
- _searchvalue = inputs.value, //搜索的值
- _position = U.F.S.SearchPostion, //搜索的位置
- _searchel = _childs[_position] //搜索得到的元素
- ;
- //判断搜索的值是否存在,不存在则隐藏
- if (_searchvalue == "" || _searchvalue == inputs.defaultValue) {
- el.style.display = "none";
- }
- //如果搜索的内容存在,同时用户执行了回车处理
- else if (_position > -1 && _keycode == 13 || _keycode == 10 && _childs[_position].onmousedown) {
- _childs[_position].onmousedown();
- }
- //如果不是上下键,那么允许用户继续搜索
- else if (_keycode != 38 && _keycode != 40) {
- U.F.S.SearchPostion = -1; //搜索选择的位置设置为-1
- return true;
- }
- return false;
- }
- /**
- * 打印搜索好友
- *
- * @param {object} 用户信息
- */
- U.F.S.PrintSearchFriends = function (friendinfo, el, cb) {
- var i,
- _name,
- _tempel,
- _temponeel,
- _temptwoel,
- _frag = $$("frag"),
- _childs = $(el).Child();
- //没有搜索到好友的提示
- if (!friendinfo[0]) {
- $$("div", { "className": "UD_SYSSZJDB", "innerText": "很抱歉,没有找到您搜索的好友" }, el);
- }
- else {
- //循环打印搜索的好友
- for (i = 0; i < friendinfo.length; i++) {
- //搜索的名字
- _name = (friendinfo[i].GroupManageName || friendinfo[i].FriendsDescript || friendinfo[i].UserNickName || friendinfo[i].UserName);
- //打印的样式
- _tempel = $$("div", { "title": "点击查看", "className": "UD_SYSSZJD UTDF", "onmousemove": [[U.F.S.SwitchSearchFriendsOrGroup, [el, i + _childs.length]]], "onmousedown": [[(cb || U.F.W.PopupFriendsForm), [friendinfo[i]]], [U.F.S.HideSearchFriendsOrGroupForm, [el]]] }, _frag);
- _temponeel = $$("div", { "className": "UD_SYSSZJDZ" }, _tempel);
- _temptwoel = $$("div", { "className": "UD_SYSSZJDA", "title": _name }, _temponeel);
- if (friendinfo[i].GroupManageID) {
- U.F.PrintGroupHeadImage(friendinfo[i], _temptwoel);
- }
- else {
- $$("img", { "onerror": U.M.ImgError, "className": "UD_SYSSZJDAO", "src": U.M.GetImgU(friendinfo[i].UserThumbnailImageHead) }, _temptwoel);
- }
- $$("div", { "className": "UD_SYSSZJDN", "innerHTML": _name }, _temponeel);
- }
- el.appendChild(_frag);
- }
- U.F.S.SearchPostion = -1; //搜索选择的位置设置为-1
- return _childs;
- }
- /**
- * 上下切换搜索的好友或者群
- *
- * @param {element} 切换元素
- * @param {number} 当前所在的位置
- */
- U.F.S.SwitchSearchFriendsOrGroup = function (el, switchposition) {
- var _switchel,
- _top,
- _scrolltop,
- _keycode = event.keyCode, //键盘码
- _childs = $(el).Child(), //获取所有搜索的值
- _isswitch = _keycode == 38 ? -1 : _keycode == 40 ? 1 : null, //如果键盘向上则-1 向下+1
- _postion = U.F.S.SearchPostion, //当前选择好友或者去的位置
- _nowswitchel = _childs[switchposition] //之前聚焦显示的元素
- ;
- //判断是否需要重新选择
- if (_isswitch || (switchposition != null && switchposition != _postion)) {
- //如果需要指定切换到那个位置
- if (switchposition != null) {
- U.F.S.SearchPostion = switchposition;
- }
- //上下切换的处理
- else {
- U.F.S.SearchPostion += _isswitch; //加上上下的处理 如果键盘向上则-1 向下+1
- switchposition = U.F.S.SearchPostion;
- }
- _switchel = _childs[switchposition]; //判断选择好友或者群有没有元素
- //选择的位置
- if (_switchel) {
- _switchel.className = "UD_SYSSZJD UTDF UD_SYSSZJDO"; //取消上一个
- _nowswitchel.className = "UD_SYSSZJD UTDF"; //当前聚焦的元素设置
- //下面计算需要显示的元素是否在滚动条可见范围,如果不在,那么滚动滚动条设置
- _top = _switchel.offsetTop;
- _scrolltop = el.scrollTop;
- if (_top > el.offsetHeight + _scrolltop - 40) {
- el.scrollTop = _top + _UDTD.offsetHeight - el.offsetHeight;
- }
- if (_top < el.scrollTop) {
- el.scrollTop = _top; //滚动条的位置
- }
- }
- else {
- //如果位置大于最后一个,则位置设置为最后一个
- if (switchposition > _childs.length - 1) {
- U.F.S.SearchPostion = _childs.length - 1;
- }
- if (switchposition < 0) {
- U.F.S.SearchPostion = 0; //设置位置
- }
- }
- }
- }
- /**
- * 隐藏
- *
- * @param {element} 切换元素
- * @param {number} 当前所在的位置
- */
- U.F.S.HideSearchFriendsOrGroupForm = function (el) {
- $("body")[0].focus();
- el.style.display = "none";
- }
- //#region 窗体搜索
- //弹出群搜索
- U.F.S.TCSS = function () {
- var _UDTD, _UDOD,
- _UDE = U.UI.Form({ resize: U.F.S.SSCTSize, id: "UD_SYF_S",
- "style": { "width": "70%", "height": "70%" },
- "content": "<div class='UD_SYF_SCT'>群文档查看</div><div class='UD_SYF_SCX'></div><div class='UD_SYF_SCD'></div>",
- "title": '<div class="UD_SYF_STO UD_SYF_STR">群文档搜索查看区域</div><div class="UD_SYF_STD" onmousedown="U.M.StopBubble();"><div class="UD_SYF_STDL"><input value="群文档搜索" onblur="U.MR.InputTip(this,[\'\',\'群文档搜索\']);" onfocus="U.MR.InputTip(this,[\'群文档搜索\',\'\']);" placeholder="群文档搜索" onkeyup="U.M.returnkeylogin([{\'obj\': $(this).parentg(2).Child()[1],\'event\':\'onclick\'}])" /></div><div class="UD_SYF_STDR" onclick="U.F.S.SSCT(this, 1, 1)">搜索</div></div>'
- }); //生成窗体
- _UDOD = _UDE.PSO;
- $(_UDOD).find("input")[0].focus();
- U.F.S.SSCTSize(_UDE.be);
- U.F.S.QHSSCT($(_UDE.body).Child()[1], 1);
- return _UDE.be;
- }
- //Ftp弹出搜索
- U.F.S.FTCSS = function () {
- var _UDTD, _UDOD,
- _UDE = U.UI.Form({ resize: U.F.S.SSCTSize, id: "UD_SYF_F",
- "style": { "width": "70%", "height": "70%" },
- "content": "<div class='UD_SYF_SCT'>FTP查看</div><div class='UD_SYF_SCX'></div><div class='UD_SYF_SCD'></div>",
- "title": '<div class="UD_SYF_STO UD_SYF_STR">FTP共享区域查看</div><div class="UD_SYF_STD" onmousedown="U.M.StopBubble();"><div class="UD_SYF_STDL"><input value="FTP搜索" onblur="U.MR.InputTip(this,[\'\',\'FTP搜索\']);" onfocus="U.MR.InputTip(this,[\'FTP搜索\',\'\']);" placeholder="FTP搜索" onkeyup="U.M.returnkeylogin([{\'obj\': $(this).parentg(2).Child()[1],\'event\':\'onclick\'}])" /></div><div class="UD_SYF_STDR" onclick="U.F.S.SSCT(this, 1, 0)">搜索</div></div>'
- }); //生成窗体
- _UDOD = _UDE.PSO;
- $(_UDOD).find("input")[0].focus();
- U.F.S.SSCTSize(_UDE.be);
- U.F.S.QHSSCT($(_UDE.body).Child()[1], 0);
- return _UDOD;
- }
- //点击切换查看
- U.F.S.QHSSCT = function (UDOD, UIE) {
- var _UDID = $(UDOD).parentg(3).find("input")[0],
- _searchvalue = _UDID.value;
- if (_searchvalue != "" && _searchvalue != _UDID.defaultValue) {
- U.F.S.SSCT($("#UD_SYF_S").find(".UD_SYF_STDR")[0], 1);
- }
- else {
- U.F.S.RMQY(1, UIE, UDOD);
- }
- }
- //热门信息滚动加载
- U.F.S.RMQYGD = function (UTF, UDOD) {
- U.F.S.RMQY(this.P + 2, UTF, UDOD); //滚动加载
- }
- //获取热门的群或者好友
- U.F.S.RMQY = function (UP, UTF, UDOD) {
- UP = UP || this.P + 2;
- var i, _UE = UP * 80,
- _US = _UE - 79;
- (UP == 1) && ($(UDOD).Parent().onscroll = U.M.SSCH({ "AF": U.M.apply(null, [[U.F.S.RMQYGD, [UTF, UDOD]]]) }).SCH());
- if (UTF) {
- U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "RecommendGroups", _US, _UE], U.F.S.AsynRMQY, [UP > 1 ? [$(UDOD).parentg().Child()[2], 1] : [UDOD, true], UDOD, UTF]);
- }
- else {
- U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetFtpHotUser", _US, _UE], U.F.S.AsynRMQY, [UP > 1 ? [$(UDOD).parentg().Child()[2], 1] : [UDOD, true], UDOD, UTF]);
- }
- }
- //热门群或者好友获取异步
- U.F.S.AsynRMQY = function (r) {
- var context = r.context,
- _UDOD = context[1],
- _UTF = context[2];
- r = r.value;
- U.F.S.PSSCT(r, _UDOD, _UTF);
- if (r.length < 80) { $(_UDOD).Parent().onscroll = null; }
- }
- //滚动加载
- U.F.S.GDSSCT = function (UDOD) {
- var _UDE = UDOD.PT,
- _UIE = (_UDE[1]++) + 1;
- U.F.S.SSCT($(UDOD).parentg(2).find(".UD_SYF_STDR")[0], _UIE);
- }
- //搜索框点击
- U.F.S.SSCT = function (UDOD, UP, UTF) {
- UDOD = $(UDOD);
- var _UE = UP * 80, _US = _UE - 79,
- _UDTD = UDOD.parentg(3).find(".UD_SYF_SCX")[0],
- _UDID = UDOD.parentg().find("input")[0], _searchvalue = UP > 1 ? _UDTD.PT[0] : _UDID.value,
- _UME = [_searchvalue, _US, _UE];
- _UDTD.PT = UP == 1 ? [_searchvalue, 1, UTF] : _UDTD.PT; (UP == 1) && (_UDTD.innerHTML = "");
- if (_searchvalue != "" && _searchvalue != _UDID.defaultValue) {
- (!UTF && _UME.unshift(US.userInfo.userid || US.NU));
- if (UTF) {
- U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SearchGroupInfo", _searchvalue, _US, _UE], U.F.S.AsynSSCT, [UP > 1 ? [$("#UD_SYF_SCD")[0], 1] : [_UDTD, true], UP, _searchvalue, _UDTD, UTF]);
- }
- else {
- U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SearchFriendInfo", US.userInfo.userid || US.NU, _searchvalue, _US, _UE], U.F.S.AsynSSCT, [UP > 1 ? [$("#UD_SYF_SCD")[0], 1] : [_UDTD, true], UP, _searchvalue, _UDTD, UTF]);
- }
- // U.A.Request(US.Auth,"UseStudioManage." + (UTF ? "bygroupnameselsectgroup" : "SelectUserByKeyWord"), _UME, U.F.S.AsynSSCT, ([UP > 1 ? [$("#UD_SYF_SCD")[0], 1] : [_UDTD, true], UP, _searchvalue, _UDTD, UTF]));
- $(_UDTD).Parent().onscroll = U.M.SSCH({ "AF": U.M.apply(null, [[U.F.S.GDSSCT, [_UDTD[0], UTF]]]) }).SCH();
- }
- else { U.F.S.RMQY(1, UTF, _UDTD); } //热门查看
- }
- //搜索异步
- U.F.S.AsynSSCT = function (r) {
- var context = r.context,
- _UP = context[1],
- _searchvalue = context[2],
- _UDOD = context[3],
- _UTF = context[4]; r = r.value;
- (_UP == 1) && (_UDOD.innerHTML = "", (!r || !r.length) && (_UDOD.innerHTML = "", U.F.S.SSCTNull(_UDOD)));
- if (r && r.length) { U.F.S.PSSCT(r, _UDOD, _UTF) }
- else { _UDOD.PT[1]--; };
- }
- //大小变化使用
- U.F.S.SSCTSize = function (UDOD) {
- var _UDTD = $(UDOD).find(".UD_SYF_SCX"),
- _UDPD = _UDTD.parentg();
- _UDTD.css({ "width": Math.floor(_UDPD.width() / 155) * 155 + "px" });
- }
- //打印搜索内容
- U.F.S.PSSCT = function (UDE, UDOD, UTF) {
- var i, UDSD, _UDKD, _UDXD,
- _userid = US.userInfo.userid || "",
- _UDTD = $$("frag"), _
- _UCE = UTF ? ["GroupManageName", "GroupManageRemark", "UD_SYF_SCXODT", "点击加入"] : ["UserNickName", "UserIndividualitysignature", "UD_SYF_SCXODO", "点击追随"];
- for (i = 0; i < UDE.length; i++) {
- _UDSD = $$("div", { "className": "UD_SYF_SCXO", "onclick": UTF ? [[U.M.StopBubble], [U.F.J.OAddGroup, [UDE[i], [[U.D.DT.YYDK, ["Disk", { "userid": _userid, "directoryid": UDE[i].GroupManageID}]]]]]] : [[U.M.StopBubble], [U.D.DT.YYDK, (["Disk", { "userid": UDE[i].UserId, "directoryid": US.FG}])]] }, _UDTD);
- _UDKD = $$("div", { "className": "UD_SYF_SCXOT" }, _UDSD);
- _UDXD = $$("div", { "className": "UD_SYF_SCXOTL" }, _UDKD);
- $$("img", { "onerror": U.M.ImgError, "src": U.M.GetImgU(UDE[i]["UserThumbnailImageHead"]), "title": UDE[i][_UCE[0]], "onclick": UTF ? null : [[U.M.StopBubble], [U.U.I.ViewOtherUserInfo, [UDE[i].UserId]]] }, _UDXD);
- $$("div", { "className": "UD_SYF_SCXOTR UTDF", "innerHTML": UDE[i][_UCE[0]] }, _UDKD);
- _UDKD = $$("div", { "className": "UD_SYF_SCXOZ" }, _UDSD);
- $$("div", { "className": "UD_SYF_SCXOZS", "innerHTML": UDE[i][_UCE[1]] || "暂无简介" }, _UDKD);
- $$("div", { "className": "UD_SYF_SCXOZZ", "innerHTML": "全部云分享:<span>" + (UDE[i]["DCount"] < 0 ? 0 : (UDE[i]["DCount"] || 0)) + "</span>" }, _UDKD);
- $$("div", { "className": "UD_SYF_SCXOZS", "innerHTML": "目前追随者:" + UDE[i]["FCount"] }, _UDKD);
- $$("div", { "className": "UD_SYF_SCXOD " + _UCE[2], "innerHTML": _UCE[3], "onclick": UTF ? [[U.M.StopBubble], [U.F.J.OAddGroup, [UDE[i], [[U.D.DT.YYDK, ["Disk", { "userid": _userid, "directoryid": UDE[i].GroupManageID}]]]]]] : [[U.M.StopBubble], [U.F.M.AddFriend, [UDE[i]]]] }, _UDSD);
- }
- UDOD.appendChild(_UDTD);
- }
- //查询群点击
- U.F.S.CXQDJ = function (UGID) {
- if (!U.U.L.isLogin(3)) {
- var _UFE = _$(US.Friend[2]).Select({ "GroupManageID": UGID })[0];
- if (_UFE) {
- U.D.DT.YYDK("Disk", { "userid": US.userInfo.userid, "directoryid": UGID });
- }
- else {
- U.Alert("请申请加入群查看群信息!");
- }
- }
- }
- //空查询
- U.F.S.SSCTNull = function (UDOD) {
- $$("div", { "className": "UD_SYF_SCXT", "innerHTML": "暂无搜索消息, 请稍候搜索。" }, UDOD);
- }
- //#endregion
|