📄 all.js
字号:
}
function SetMailType(type, isspam, isgroup) {
var f = mail_frm;
f.action = "/cgi-bin/mail_mgr?sid=" + GetSid();
f.mailaction.value = "mail_spam";
f.templatename.value = "setmailspam";
var str = type == "cheat" ? "spam" : type;
f.subtmpl.value = "readmail_" + (isspam ? (isgroup ? "group" : type) : ("not" + type)) + (newwinflag ? "_newwin" : "");
f.isspam.value = isspam;
f.reporttype.value = type == "cheat" ? "1" : "";
SubmitToActionFrm(f);
}
function SetSpamMail(isspam, isgroup) {
SetMailType("spam", isspam, isgroup);
}
function SetCheatMail(isspam, isgroup) {
SetMailType("cheat", isspam, isgroup);
}
function doReject(isspam, isgroup) {
if(confirm(msgRejectAlert)) SetMailType("reject", isspam, isgroup);
}
function MoveMail(obj) {
var dfid = obj.value;
obj.selectedIndex = 0;
if (dfid < 1 && dfid != -1) return ;
var f = mail_frm;
if(dfid == -1) {
var nameValue;
while((nameValue=prompt("请输入文件夹名字", "")) != null){
if(nameValue != "") break;
}
if(nameValue == null){
obj.selectedIndex = 0;
return ;
}
f.foldername.value=nameValue;
}
var sfid = (f.srcfolderid.value == 0 ? 1 : f.srcfolderid.value);
if(dfid == sfid) {
obj.selectedIndex = 0;
showError(msgMoveMailSameFldErr);
return ;
}
f.destfolderid.value = dfid;
f.mailaction.value = "mail_move";
f.templatename.value = "mail_move_readmail";
f.subtmpl.value = (newwinflag ? "newwin" : "");
f.action = "/cgi-bin/mail_mgr?sid=" + GetSid();
SubmitToActionFrm(f);
}
function LinkMaker(htmlCode, linkNum, type)
{
var linkStr = htmlCode[linkNum], prevStr = htmlCode[linkNum - 1], nextStr = htmlCode[linkNum + 1];
prevStr = Trim(prevStr).toLowerCase();
var pos1 = prevStr.lastIndexOf("<a ");
var pos2 = prevStr.lastIndexOf("</a>");
//在<a>..</a>里面
if (pos2 < pos1) return linkStr;
pos1 = prevStr.lastIndexOf("<");
pos2 = prevStr.lastIndexOf(">");
//在<...>里面
if (pos2 < pos1) return linkStr;
nextStr = Trim(nextStr).toLowerCase();
pos1 = nextStr.indexOf("<a ");
pos2 = nextStr.indexOf("</a>");
//在<a>..</a>里面
if (pos2 < pos1 || (pos2 != -1 && pos1 == -1)) return linkStr;
pos1 = nextStr.indexOf("<");
pos2 = nextStr.indexOf(">");
//在<...>里面
if (pos2 < pos1 || (pos2 != -1 && pos1 == -1)) return linkStr;
if (type == 0 && nextStr)
{
if (nextStr)
{
var tmps = htmlCode[linkNum + 1].split(" ");
if (nextStr.charAt(0) == "&" && tmps[0] != "")
{
var result = tmps.shift().replace(/([ \f\n\r\t\v\"\\:><\[\]\u2100-\uFFFF])/i, '<&&>$1<&&>').split("<&&>");
linkStr += result.shift();
htmlCode[linkNum + 1] = result.join("") + tmps.join(" ");
}
}
var lastChar = linkStr.charAt(linkStr.length - 1);
if (lastChar.replace(/[\.,!?]/, "") == "")
{
linkStr = linkStr.slice(0, -1);
htmlCode[linkNum + 1] = lastChar + htmlCode[linkNum + 1];
}
}
linkStr = '<a href="' + (type == 0 ? "" : "mailto:") + linkStr + '">' + linkStr + '</a>';
return linkStr;
}
//0:http 1:email
function LinkIdentify(htmlCode, type) {
if (!htmlCode) return htmlCode;
if (!type) type = 0;
htmlCode = type == 0 ? htmlCode.replace(/(http:\/\/[\w.]+[^ \f\n\r\t\v\"\\:><\[\]&\u2100-\uFFFF]*)/ig, '<&url&>$1<&url&>').split("<&url&>") :
htmlCode.replace(/([a-zA-Z_0-9.-]+@[a-zA-Z_0-9.-]+\.\w+)/ig, '<&url&>$1<&url&>').split("<&url&>");
for (var i = 1; i < htmlCode.length; i+=2) {
htmlCode[i] = LinkMaker(htmlCode, i, type);
}
return htmlCode.join("");
}
//readmail rewrite link to target
function SwapLink(id) {
var obj = S(id);
if (!obj) return;
//识别链接以及邮箱地址
var code = obj.innerHTML;
code = LinkIdentify(code, 0);
obj.innerHTML = "<div style='display:none;'> </div>" + LinkIdentify(code, 1);
var as = GelTags("a", obj);
for (var i = as.length - 1; i >= 0; i--) {
if (as[i].name != "_QQMail_ReferenceGroupMail_" && as[i].name != "_QQMail_DownloadGroupMailAttach_") {
as[i].target = "_blank";
as[i].onclick = function() {
return OpenExtLink(this);
};
}
}
}
function SwapImg(id, ajustValue)
{
var as = GelTags("img", S(id));
var BW = document.body.offsetWidth - (ajustValue ? ajustValue : 90);
var styles = ["点击查看实际尺寸", "zoom+.cur", "缩小图片到适应窗口", "zoom_.cur"];
for (var i = as.length - 1; i >= 0; i--)
{
if (as[i].getAttribute("ow"))
{
var TW = parseInt(as[i].getAttribute("ow"));
}
else
{
var TW = as[i].width;
as[i].setAttribute("ow", TW);
}
if (TW > BW)
{
as[i].width = BW;
as[i].style.cursor = GetPath("image")+styles[1];
as[i].title = styles[0];
as[i].onclick = function()
{
this.width = parseInt(this.width) > BW ? BW : (this.getAttribute("ow"));
this.title = styles[parseInt(this.width) > BW ? 2 : 0];
this.style.cursor = GetPath("image") + styles[parseInt(this.width) > BW ? 3 : 1];
}
}
}
}
function OpenExtLink(a) {
if (a.href.indexOf("mailto:") == 0 && a.href.indexOf("@") != -1) {
window.open("/cgi-bin/readtemplate?sid="+GetSid()+"&templatename=compose&subtmpl=cliwrite&newwin=true&email="+a.href.split("mailto:")[1]);
return false;
}
else if (a.className == "qqmail_card_reply") {
GetMainWin().location = "/cgi-bin/cardlist?sid=" + GetSid() + "&templatename=compose_card&ListType=No" + (a.name ? "&email=" + a.name : "");
return false;
}else if (a.className == "groupmail_open") {
GetMainWin().location = "/cgi-bin/grouplist?sid=" + GetSid() + "&templatename=compose_group";
return false;
}else if (a.className == "reg_alias"){
GetMainWin().location = "/cgi-bin/readtemplate?reg_step=1&templatename=regalias_announce&sid="+GetSid();
return false;
}
return true;
}
//readmail go next mail
function GoNextMail(mode, subtmpl, msg, oth) {
var w = GetMainWin();
//var r = (mode == 2 ? [] : ["prevmail", "nextmail"]);
var r = (["prevmail", "nextmail"]);
for (var i = r.length - 1; i >= 0; i --) {
var a = w.Gel(r[i]);
if (a && !a.getAttribute("disabled")) {
w.location = a.href + (msg ? ("&msg=" + msg) : "");
return ;
}
}
w.location = (top.bnewwin ? "/cgi-bin/readtemplate?templatename=compose_send_newwin&subtmpl=" + subtmpl : "/cgi-bin/mail_list?") + "&sid=" + GetSid() + (oth ? oth : "");
}
function GoPrevOrNextMail(mode) {
var w = GetMainWin();
var a = S(["prevmail", "nextmail"][mode?1:0], w);
var a2 = S(["prevpage", "nextpage"][mode?1:0], w);
if (a && !a.getAttribute("disabled")) w.location = a.href;
else if (a2 && !a2.getAttribute("disabled")) w.location = a2.href;
}
function GoBackHistory() {
var btn = S("btnBack",GetMainWin());
if (btn && btn.style.display != "none") try{btn.onclick();return true;}catch(e){};
return false;
}
//quick readmail
function QuickReadMail(obj, nofun)
{
var w = GetMainWin();
if (obj == null)
{
try
{
obj = GelTags("p", w.gReadedBeforeImg.parentNode.parentNode);
obj = obj[obj.length - 1];
}
catch (e)
{
return false;
}
}
var c = obj.parentNode;
var n = c.nextSibling;
var input = GelTags("input", c)[0];
var id = input.value;
if (!n || !n.className || n.className.indexOf("QRM") == -1) {
var d = w.gd.createElement("div");
d.className = "qqshowbd QRM";
d.style.height = "244px";
d.style.margin = "4px 0";
Show(d, 0);
try {
var subtmpl = (g_subtmpl == "newmail_list" ? "&subtmpl=newmail_list" : "");
}catch(e) {
var subtmpl = "";
}
var url = "/cgi-bin/readmail?mailid=" + id + "&templatename=quickreadmail" + (nofun ? "&nofun=1" : "") + "&sid=" + GetSid() + subtmpl;
d.innerHTML = "<div id='err_" + id + "' style='background:#ffffe9;padding:7px 0 5px 0;border-bottom:1px solid #e3e6eb;text-align:center;display:none' >邮件读取不成功, <a href='javascript:ReQuickReadMail(\"" + id + "\")'>点击重试</a>。</div><div id='load_" + id + "' style='background:#4b981d;color:#fff;padding:3px 8px;position:absolute;left:40%;margin-top:90px'><img width='16px' height='16px' src='" + GetPath("image") + "ico_loading.gif' style='margin:0 3px 0 0;' align='absmiddle'/>邮件正在读取中...</div><iframe id='frame_" + id + "' frameborder=0 width=100% height=100% src='" + url + "' onload='var o=Gel(\"load_" + id + "\");if(o.style.display == \"\"){Show(Gel(\"err_" + id + "\"), 1);Show(o, 0);Show(o.nextSibling, 0);}'></iframe>";
n = n ? n.parentNode.insertBefore(d, n) : c.parentNode.appendChild(d);
d = null;
}
else if (obj.className == "K" && S("err_" + id, w).style.display == "") {
ReQuickReadMail(id);
}
if (w.gQRMOldObj) {
var oldObj = w.gQRMOldObj.parentNode.parentNode;
if (oldObj.nextSibling != n) {
Show(oldObj.nextSibling, 0);
oldObj = GelTags("p", oldObj);
oldObj = oldObj[oldObj.length - 1];
oldObj.className = "K";
}
}
var b = w.document.body;
var r = c.offsetTop + c.offsetHeight - b.scrollTop;
if (r < 0 || r > b.clientHeight) c.scrollIntoView(true);
SetItemReadedBefore(c);
Show(n, n.style.display != "");
if (n.style.display == "") {
r = n.offsetTop + n.offsetHeight - b.scrollTop;
if (r < 0 || r > b.clientHeight) n.scrollIntoView(false);
}
obj.className = (obj.className == "K" ? "K1" : "K");
if (w.gQRMOldObj && w.gQRMOldObj != input) SetListCheck(w.gQRMOldObj, w.gQRMListSelectObj == w.gQRMOldObj);
if (w.gQRMListSelectObj != input || n.style.display == "") {
w.gQRMListSelectObj = input.checked ? input : null;
SetListCheck(input, n.style.display == "");
}
w.gQRMOldObj = w.gQRMOldObj == input ? null : input;
return true;
}
function ReQuickReadMail(id) {
var w = GetMainWin();
Show(S("err_" + id, w), 0);
Show(S("frame_" + id, w), 0);
Show(S("load_" + id, w), 1);
ReloadFrm(F("frame_" + id, w));
}
function ScrollQuickReadedMail(bUp)
{
try
{
var w = GetMainWin();
var c = w.gReadedBeforeImg.parentNode.parentNode;
var n = c.nextSibling;
if (!IsShow(n))
{
return false;
}
var frame = GelTags("iframe", n)[0];
return F(frame.id, w).ScrollPage(bUp);
}
catch (e)
{
return false;
}
}
var gMailListArr = [];
function ListIni() {
var d = GelTags("div");
var fs = [
function() {this.className=top.StrReplace(this.className," noroll"," rollbg");}
,function() {this.className=top.StrReplace(this.className," rollbg"," noroll");}
];
var obj = null;
var cObj = null;
for (var i = 0; i < d.length; i++) {
var o = d[i];
if (o.className == "M" || o.className == "F") {
o.className += " noroll";
if (gIsIE) {
o.onmouseenter = fs[0];
o.onmouseleave = fs[1];
}
else {
o.onmousemove = fs[0];
o.onmouseout = fs[1];
}
var t = GelTags("input", o)[0];
t.onclick = DoCheck;
t.title = "按住shift点击不同邮件的勾选框 可方便快捷多选邮件";
if (t.name == "mailid") gMailListArr.push(o);
if (top.gReadedMailId == t.value) obj = o;
if (top.gSelectedMailId == t.value) {
SetListCheck(t, true);
cObj = o;
top.gSelectedMailId=null;
}
o = GelTags("p", o);
o = o[o.length - 1];
if (o.className == "K") {
o.onclick = function() {QuickReadMail(this);};
o.title = "预览邮件";
}
}
}
setTimeout(function() {
if (obj) {
if (top.gReadedPosition != null) {
GetMainWin().document.body.scrollTop = top.gReadedPosition;
ScrollIntoMidView(obj, document.body);
}
else {
ScrollIntoMidView(obj, document.body, true);
}
SetItemReadedBefore(obj);
}
RecordReadedMailId(null);
if(cObj) {
ScrollIntoMidView(cObj, document.body, true);
}
}, 0);
}
function ReadMailFinish(id, type, fid) {
try{
var m = GetMainWin();
try {
var o = m.Gel("load_" + id);
Show(o, 0);
o = o.parentNode.previousSibling;
}
catch (e) {
var o = GelTags("input");
for (var i = o.length - 1; i >= 0; i --) {
if (o[i].type == "checkbox" && o[i].value == id) break;
}
// if find no -> throw e and exit
o = o[i].parentNode.parentNode;
}
if (o.className.indexOf("F") == 0) {
o.className = StrReplace(o.className, "F", "M");
o = GelTags("p", o)[0];
o.className = StrReplace(o.className, "Ru", type == "r" ? "Rh" : (type == "f" ? "Rz" : "Rr"));
o = m.Gel("_ur_c");
if (o) {
o.innerHTML = parseInt(o.innerHTML) - 1;
Show(S("_ur", m), o.innerHTML != "0");
if (!IsShow(S("_ur", m)) && !IsShow(S("_ui", m))) Show(S("_ua", m), false);
}
//if no left win -> throw e and exit
SetFolderUnread(fid, GetFolderUnread(fid) - 1);
}
}catch(e){}
}
//mp3 player
function GetFlash(id) {
return gIsIE ? window[id] : document[id];
}
function SetPlayer(container, url, name) {
var d = S(container);
if (!d) return;
if (url) url = encodeURI(url);
d.innerHTML = '<object id="qqmailmp3player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width=255 height=78><param name="wmode" value="opaque"><param name="movie" value="/zh_CN/htmledition/images/player/QQMailPlayer.swf"><param name="quality" value="high">'+(url ? ('<param name="FlashVars" value="ini_url='+url+(name?('&ini_name='+name):'')+'">') : '')+'<embed src="/zh_CN/htmledition/images/player/QQMailPlayer.swf" quality=high width=255 height=78 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" swLiveConnect="true" wmode="opaque" name="qqmailmp3player" '+(url ? ('FlashVars="ini_url='+url+(name?('&ini_name='+name):'')+'"') : '')+'></embed></object>';
Show(d, 1);
}
function PlayMp3(url, name) {
var p = GetFlash("qqmailmp3player");
if (!p) return SetPlayer("mp3player_container", url, name);
p.SetVariable("music_url", encodeURI(url));
if (name) p.SetVariable("music_name", name);
p.SetVariable("opt_value", "play");
}
//为所有控件去掉ESC的捕获
function fDropEscKey(e) {
var e = e ? e : event;
var el = gIsIE ? e.srcElement : e.target;
if (e.keyCode == 27) {
el.blur();
}
}
function fDropSpaceKey(e) {
var e = e ? e : event;
var el = gIsIE ? e.srcElement : e.target;
if (e.keyCode == 32) {
fPreventDefault(e);
}
}
function fIniAllInput(doc) {
var o = GelTags("input", doc);
for (var i = o.length - 1; i >= 0; i--) {
if (o[i].type == "text") {
fAddEvent(o[i], "keydown", fDropEscKey);
}
else if (o[i].type == "button") {
fAd
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -