You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
3.5 KiB
HTML
104 lines
3.5 KiB
HTML
<html window-resizable="false" window-icon="themepicsingle:add.contact">
|
|
<head>
|
|
<include src="common.htm" />
|
|
<style src="addcontact.css" />
|
|
<style id="dyncss" />
|
|
<script>
|
|
var uin = $("#uin"),
|
|
query = $("#query"),
|
|
addBtn = $("#add"),
|
|
searchBtn = $(".search > .searchbtn"),
|
|
locally = $("#locally"),
|
|
mgrouplist = $("#mgrouplist");
|
|
|
|
setupWindow(false, false, false);
|
|
translateWindow("span, checkbox");
|
|
if (view.parameters.nick === null) animateWindow();
|
|
|
|
function showMenu() {
|
|
if (!MainNative.CheckAddUIN(uin.value)) return;
|
|
renderGroupLists(mgrouplist, locally.value);
|
|
addBtn.popup(mgrouplist, {
|
|
anchorAt: 9,
|
|
popupAt: 7
|
|
});
|
|
}
|
|
|
|
function searchContact(keyword) {
|
|
if (!keyword || keyword == "") return;
|
|
var res = $(".results");
|
|
res.patch(<div><span>{_("Searching…")}</span></div>, true);
|
|
var contact = MainNative.SearchContact(keyword);
|
|
if (contact) {
|
|
res.patch(<div><div class="anketa"><img src={contact.AvatarURL} />
|
|
<div>
|
|
<span class="friendly">{contact.Friendly}</span> |
|
<span class="nick">@{contact.Nick}</span> |
|
<span class="uid">{contact.UID}</span>
|
|
</div>
|
|
</div></div>, true);
|
|
uin.value = contact.UID;
|
|
} else {
|
|
res.patch(<div><span>{_("Nothing can be found")}</span></div>, true);
|
|
}
|
|
}
|
|
|
|
var isOnline = CommonNative.IsOnline();
|
|
locally.state.disabled = !isOnline;
|
|
locally.value = !isOnline;
|
|
|
|
addBtn.on("click", () => showMenu());
|
|
|
|
searchBtn.on("click", function() {
|
|
var [w0, h0] = document.body.state.box("dimension", "border");
|
|
this.remove();
|
|
var hiddens = $$(".row.hidden");
|
|
for (var hidden of hiddens) hidden.classList.remove("hidden");
|
|
document.flushPaint();
|
|
var [x, y] = view.box("position", "client", "desktop");
|
|
var [w, h] = document.body.state.box("dimension", "border");
|
|
view.move(x, y + h0 / 2 - h / 2, w, h, "client");
|
|
query.state.focus = true;
|
|
});
|
|
|
|
setMenuListener(mgrouplist, function() {
|
|
view.close();
|
|
MainNative.AddContact(uin.value, parseInt(this.attr["groupid"]));
|
|
});
|
|
|
|
var dyncss = $("style#dyncss");
|
|
dyncss.text = ".search > .searchbtn:hover { foreground-image-transformation: colorize(" + (View.share.activeClr ? View.share.activeClr.toString("RGB") : "#666") + ") brightness(0.05); }";
|
|
|
|
document.on("keydown", (e) => {
|
|
if (e.keyCode == Event.VK_ESCAPE || (e.ctrlKey && e.keyCode == Event.VK_W)) view.close();
|
|
else if (e.keyCode == Event.VK_RETURN)
|
|
if (e.target == uin) {
|
|
if (e.ctrlKey)
|
|
searchBtn.dispatchEvent(new Event("click"));
|
|
else
|
|
showMenu();
|
|
} else if (e.target == query) {
|
|
searchContact(query.value);
|
|
}
|
|
});
|
|
|
|
if (view.parameters.nick !== null) document.post(() => {
|
|
query.value = view.parameters.nick;
|
|
searchBtn.dispatchEvent(new Event("click"));
|
|
if (isOnline) searchContact(query.value);
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="row"><span>Type the UIN number you want to add</span></div>
|
|
<div class="row search"><input uwp wide id="uin" /><div class="searchbtn" title="Find contact [Ctrl+Enter]"></div></div>
|
|
<div class="row bottom hidden"><span>Search contact by nick or UIN</span></div>
|
|
<div class="row hidden"><input uwp wide id="query" /></div>
|
|
<div class="row bottom hidden results"><span>Enter search keyword into the field above</span></div>
|
|
<div class="row bottom">
|
|
<checkbox small id="locally">Locally</checkbox>
|
|
<button uwp withpic id="add"><div auto pic="add.contact"></div><span>Add</span><img src="resource:arrow_right" /></button>
|
|
</div>
|
|
<menu id="mgrouplist" class="context custom"></menu>
|
|
</body>
|
|
</html> |