📄 www2-main.js
字号:
if (hasMail) newmailnotice(); gTimer.refreshTime = (new Date()).getTime() + 540000;}function getFindBox(board) { /* TODO: sfocus here might conflict with others */ var s = '<form action="bbsbfind.php" method="GET" class="medium"><input type="hidden" name="q" value="1"/>\ <fieldset><legend>版内文章搜索 <span id="bbbHide"></span></legend>\ <div class="inputs">\ <label>版面名称:</label><input type="text" maxlength="24" size="24" name="board" value="' + board + '"/><br/>\ <label>标题含有:</label><input type="text" maxlength="50" size="20" name="title" id="sfocus" /> AND<br/>\ <label> </label><input type="text" maxlength="50" size="20" name="title2"/><br/>\ <label>标题不含:</label><input type="text" maxlength="50" size="20" name="title3"/><br/>\ <label>作者帐号:</label><input type="text" maxlength="12" size="12" name="userid"/><br/>\ <label>时间范围:</label><input type="text" maxlength="4" size="4" name="dt" value="7"/> 天以内<br/>\ <input type="checkbox" name="mg" id="mg"><label for="mg" class="clickable">精华文章</label>\ <input type="checkbox" name="ag" id="ag"><label for="ag" class="clickable">带附件文章</label>\ <input type="checkbox" name="og" id="og"><label for="og" class="clickable">不含跟贴</label>\ </div>\ </fieldset>\ <div class="oper"><input type="submit" value="查询"/></div>\ </form>'; return s;}function showFindBox(board) { if (!gIE6Fx || !www2dev) return true; var divID = "articleFinder"; var div = getObj(divID); if (!div) { div = document.createElement("div"); div.id = divID; div.innerHTML = getFindBox(board); div.className = "float"; div.style.top = "5em"; div.style.left = "20em"; div.style.padding = "0.5em"; div.style.zIndex = 2; div.style.backgroundColor = "lightyellow"; div.style.display = "none"; if (gIE) { div.style.filter = "alpha(opacity=0)"; } document.body.appendChild(div); var o = getObj("bbbHide"); o.innerHTML = "(隐藏)"; o.className = "clickable"; o.title = "隐藏搜索窗口"; o.onclick = function() { div.style.display = "none"; } } if (gIE) { div.filters[0].opacity = 0; } else { div.style.opacity = 0; } div.style.display = ""; getObj("sfocus").focus(); /* TODO: general fade-in fade-out effect control */ var opa = 0; var fn = function() { opa += 10; if (gIE) { div.filters[0].opacity = opa; } else { div.style.opacity = opa / 100.0; } if (opa < 90) { setTimeout(fn, 10); } }; fn(); return false;}function dosubmit() { var p = document.postform; p.post.value='发表中,请稍候...'; p.post.disabled=true; p.submit();}var hotBoard = '', hotBid = 0, hotMove = true, hotFn = null;function setHots(h) { var i,hots = new Array(); for(i=0; i<h.length; i++) { if (h[i]) { hots.push('<a href="bbscon.php?bid=' + hotBid + '&id=' + h[i][0] + '">' + h[i][1] + '</a>' + '[<a href="bbstcon.php?board=' + hotBoard + '&gid=' + h[i][0] + '">同主题</a>](' + h[i][2] + ')'); } } if (gIE) { var str = ''; for(i=0; i<hots.length; i++) { if (hots[i]) str+= hots[i] + ' '; } getObj('hotTopics').innerHTML = str; } else { var index = -1; hotFn = function() { var ii = ''; if (hots.length) { var move = 1; if (!hotMove) { if (arguments.length) move = arguments[0]; else return; } if (move > 0) { index++; if (index >= hots.length) index = 0; } else { index--; if (index < 0) index = hots.length - 1; } if (hots.length > 1) { ii += '<span class="clickable" onclick="hotFn(-1)" title="上一条"><</span> ' + '<span class="clickable" onclick="hotFn(1)" title="下一条">></span> '; } ii += (index+1) + "/" + hots.length + ": " + hots[index]; } getObj('hotTopics').innerHTML = ii; }; hotFn(); setInterval("hotFn()", 5000); }}function hotTopic(board, bid) { /* TODO: no table, use AJAX */ /* clear: both is for stupid Firefox */ var str = '<table cellspacing="0" cellpadding="5" border="0" width="100%" style="margin: 0.5em auto 0 auto;clear:both;"><tr>' + '<td width="100" align="center">[<span class="red">热门话题</span>]</td><td>'; if (gIE) { str += '<marquee onmouseover="this.stop()" onmouseout="this.start()"><span id="hotTopics">载入中...</span></marquee>'; } else { str += '<span id="hotTopics" onmouseover="hotMove=false;" onmouseout="hotMove=true;">载入中...</span>'; } str += '</td></tr></table>'; w(str + '<iframe width=0 height=0 src="images/img.gif" frameborder="0" scrolling="no" id="hiddenframe" name="hiddenframe"></iframe>'); hotBoard = escape(board); hotBid = bid; addBootFn(function() { window.frames["hiddenframe"].document.location.href = "bbshot.php?board=" + board; });}function getURLPath(url) { var pos = url.indexOf("://"); if (pos != -1) { var uri = url.substr(pos + 3); if ((pos = uri.indexOf("/")) != -1) { url = uri.substr(pos); } } return(url);}function checkFrame() { var msg = '<div id="fontSizer"'; if (!(readParaCookie() & 8)) { msg += ' style="display:none"'; } msg += '>' + '<span class="clickable" onclick="sizer(1)" title="字体大大大...大点">+</span> ' + '<span class="clickable" onclick="sizer(-1)" title="字体小小小...小点">-</span> ' + '<span class="clickable" onclick="sizer(0)" title="字体变变变...变回去">R</span></div>'; w(msg); if (top == self) { /* TODO: use better way */ var url = getURLPath(document.location.toString()); var ex = '(<a href="frames.html?mainurl=' + escape(url) + '">展开完整界面</a>)'; var o = getObj("idExp"); if (o) o.innerHTML = ex; }}var bfsI, bfsD = 4;var bfsArr = [0,11,12,13,14,16,18,20];var bfsSma = [0,11,12,12,12,14,15,17];function sizer(flag) { if (flag == 1) { if (bfsI < 7) bfsI++; } else if (flag == -1) { if (bfsI > 1) bfsI--; } else bfsI = bfsD; saveParaCookie(bfsI, 7); document.body.style.fontSize = bfsArr[bfsI] + 'px'; /* here's the trick/test part: change .smaller definition! */ var i, t; if (!(t = document.styleSheets)) return; for(i = 0; i < t.length; i++) { if (t[i].title == "myStyle") { t = t[i]; if (t.cssRules) t = t.cssRules; else if (t.rules) t = t.rules; else return; for (i = 0; i < t.length; i++) { if (t[i].selectorText == ".smaller") { t[i].style.fontSize = bfsSma[bfsI] + 'px'; break; } } return; } }}function getCssID() { return ((readParaCookie() & 0xF80) >> 7); }function replaceCssFile(file) { var reg = /images\/([0-9]+)\//; if (file.match(reg)) { return file.replace(reg, 'images/'+getCssID()+'/'); } return false;}function getCssFile(file) { return ('images/' + getCssID() + '/' + file + '.css');}function writeCssFile(file) { w('<link rel="stylesheet" type="text/css" href="' + getCssFile(file) + '" />'); if (showUnread()) { w('<script type="text/javascript" src="kbsrc/content/kbsrc.js"></script>'); //for now. readystatechange event might trigger IE bug "operation aborted" addBootFn(function() { try { kbsrcIEEntry(); } catch(e) { } }); }}function resetCss() { var i, h, t = document.getElementsByTagName("img"); if (t) { for(i = 0; i < t.length; i++) { if(t[i].id.substr(0,10) != "stylethumb") { h = replaceCssFile(t[i].src); if (h) t[i].src = h; } } } t = document.getElementsByTagName("link"); if (t) { for(i = 0; i < t.length; i++) { h = replaceCssFile(t[i].getAttribute("href")); if (h) { t[i].setAttribute("href", h); return; } } } location.reload();}function writeCss() { writeCssFile('www2-default'); bfsI = readParaCookie() & 7; if (bfsI <= 0 || bfsI >= bfsArr.length) bfsI = bfsD; var ret = '<style type="text/css" title="myStyle"><!--'; ret += 'body{font-size:' + bfsArr[bfsI] + 'px;}'; ret += '.smaller{font-size:' + bfsSma[bfsI] + 'px;}'; ret += '--></style>'; w(ret);}function writeCssLeft() { writeCssFile('bbsleft'); }function writeCssMainpage() { writeCssFile('mainpage'); }function putImageCode(filename,otherparam) { return('<img src="images/'+getCssID()+'/'+filename+'" '+otherparam+'>');}function putImage(filename,otherparam){ w(putImageCode(filename,otherparam));}function writeBM_html(bmstr, firstBM) { if (bmstr.length == 0) return '诚征版主中'; if (!/^[A-Za-z]/.test(bms)) return bms; var bms = bmstr.split(" "); var len = firstBM ? 1 : bms.length; for(var i=0; i<len; i++) { bms[i] = '<a href="bbsqry.php?userid=' + bms[i] + '">' + bms[i] + '</a>'; } return firstBM ? bms[0] : bms.join(" ");}function writeBMs(bmstr) { w(writeBM_html(bmstr, false));}function isBM(bid) { var mbids = getCookie("MANAGEBIDS", "0"); if (mbids == "A") return 1; mbids = "." + mbids + "."; return (mbids.indexOf("." + bid + ".") != -1);}var dir_modes = {"FIND": -2, "ANNOUNCE": -1, "NORMAL": 0, "DIGEST": 1, "MARK": 3, "DELETED": 4, "ORIGIN": 6, "ZHIDING": 11};function dir_name(ftype) { switch(ftype) { case -1: return "(精华区)"; case 1: return "(文摘区)"; case 3: return "(保留区)"; case 6: return "(主题模式)"; default: return ""; }}/* man - 1: 普通管理模式,2: 回收站模式 */function docWriter(board, bid, start, man, ftype, page, total, apath, showHot, normalB) { this.monthStr = ["January","February","March","April","May","June","July","August","September","October","November","December"]; this.board = escape(board); this.bid = bid; this.ids = new Array(); this.start = start; this.page = page; this.total = total; this.apath = apath; this.man = man; this.ftype = ftype; this.num = 0; this.baseurl = "bbsdoc.php?board=" + this.board; this.showHot = showHot; this.normalB = normalB; this.hotOpt = (readParaCookie() & 0x60) >> 5; if (this.man) this.baseurl += "&manage=1"; if (this.ftype) this.baseurl += "&ftype=" + this.ftype; if (showHot && this.hotOpt == 1) hotTopic(this.board, this.bid); var str = '<div class="doc"><div class="docTab smaller">'; if (!ftype && isLogin()) { var url = 'bbspst.php?board=' + this.board; str += '<div class="post"><a href="' + url + '">' + putImageCode('postnew.gif','alt="发表话题" class="flimg" onclick="location.href=\'' + url + '\';"') + '</a></div>'; } var mls = [[ftype || man, "普通模式", "bbsdoc.php?board=" + this.board], [ftype != dir_modes["DIGEST"], "文摘区", "bbsdoc.php?board=" + this.board + "&ftype=" + dir_modes["DIGEST"]], [ftype != dir_modes["MARK"], "保留区", "bbsdoc.php?board=" + this.board + "&ftype=" + dir_modes["MARK"]], [ftype != dir_modes["ORIGIN"], "同主题", "bbsdoc.php?board=" + this.board + "&ftype=" + dir_modes["ORIGIN"]], [apath && ftype != dir_modes["ANNOUNCE"], "精华区", "bbs0an.php?path=" + escape(apath)], [ftype != dir_modes["FIND"], "查询", "bbsbfind.php?board=" + this.board, "showFindBox('" + this.board + "')"]]; var mls_bm = [[ftype != dir_modes["DELETED"], "回收站", "bbsdoc.php?manage=1&board=" + this.board + "&ftype=" + dir_modes["DELETED"]]]; if (isBM(bid)) mls = mls.concat(mls_bm); for (var i = mls.length - 1; i >= 0; i--) { links = mls[i]; if (links[0]) { if (links[3]) { str += '<a onclick="return ' + links[3] + ';" href="' + links[2] + '">' + links[1] + '</a>'; } else { str += '<a href="' + links[2] + '">' + links[1] + '</a>'; } } else if (ftype != dir_modes["FIND"]) { str += '<b>' + links[1] + '</b>'; } else { str += '<b class="clickable" onclick="location.href=\''+links[2]+'\';">' + links[1] + '</b>'; } } str += '</div>'; if (ftype >= 0) { if (man) { str += '<form name="manage" id="manage" method="post" action="bbsdoc.php?manage=1&board=' + this.board + '&page=' + page; if (man == 2) str += '&ftype=' + dir_modes["DELETED"]; str += '">'; } str += '<table class="main wide">'; str += '<col width="50"/><col width="50"/>'; if (man) { str += '<col width="50"/>'; } str += '<col width="85"/><col width="60"/><col width="*"/>'; str += '<tbody><tr><th>序号</th><th>标记</th>'; if (man) { str += '<th>管理</th>'; } var links = '标题'; if (readParaCookie() & 16) { links = '<div class="relative">标题<div class="pagerlink">'; if (this.page > 1) { links += '<a href="' + this.baseurl + '&page=1" title="第一页"><<</a>'; links += ' <a href="' + this.baseurl + '&page=' + (this.page - 1) + '" title="上一页"><</a>'; } else { links += '<< <'; } if (this.start <= this.total - 20) { links += ' <a href="' + this.baseurl + '&page=' + (this.page + 1) + '" title="下一页">></a>'; links += ' <a href="' + this.baseurl + '" title="最后一页">>></a>'; } else { links += ' > >>'; } links += '</div></div>'; } str += '<th>作者</th><th>日期</th><th>' + links + '</th></tr>'; } w(str);}docWriter.prototype.o = function(id, gid, author, flag, time, title, size, imported, is_tex) { var rowclass; if (www2dev && top.hlInfo && !this.man) { var info = top.hlInfo.split(','); if (this.bid == info[0] && gid == info[2]) rowclass = (id==info[1])?'rowReading':((id==gid)?'rowTopic':'rowRe'); else rowclass = (this.num%2)?'even':'odd'; } else rowclass = (this.num%2)?'even':'odd'; var str = '<tr class="' + rowclass + '">'; var cb_value = (this.man == 2) ? (this.start + this.num) : id; /* 回收站中以序号代替id */ var bf = flag.charAt(0); if (bf.toLowerCase() == 'd') { /* 置顶 */ str += '<td class="center red strong">提示</td><td class="center">' + putImageCode('istop.gif','alt="提示"') + '</td>'; if (this.man) { str += '<td class="center"><input type="checkbox" name="ding' + this.num + '" value="' + cb_value + '" /></td>'; } } else { if (!this.man && this.normalB && (bf == 'N' || bf == '*')) flag = ' ' + flag.charAt(1); this.ids.push(id); flag = '<span id="kbsrc' + id + '">' + flag + '</span>'; if (this.man && (imported == 1)) flag += putImageCode('imported.gif', ''); str += '<td class="center">' + (this.num + this.start) + '</td><td class="center">' + flag + '</td>'; if (this.man) { str += '<td class="center"><input type="checkbox" name="art' + this.num + '" value="' + cb_value + '" /></td>'; } } str += '<td class="center"><a href="bbsqry.php?userid=' + author + '">' + author + '</a></td>'; var fd = new Date((time+8*3600) * 1000); // assume Beijing timezone here str += '<td><nobr>' + this.monthStr[fd.getUTCMonth()].substr(0,3) + " " var dd = fd.getUTCDate(); str += ((dd < 10) ? ' ' : '') + dd + '</nobr></td>'; str += '<td>'; if (title.substr(0,4)!="Re: ") title = "● " + title; switch (this.ftype) { case dir_modes["ORIGIN"]: str += '<a href="bbstcon.php?board=' + this.board + '&gid=' + gid + '">' + title + '</a>';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -