📄 main.js
字号:
if (v==boardid)
{
sel = k;
}
if (nodes[i].getAttribute("depth")==0){
var outtext="╋";
}
else
{
var outtext="";
for (var j=0;j<(nodes[i].getAttribute("depth"));j++)
{
if (j>0){outtext+=" |"}
outtext+=" "
}
outtext+="├"
}
t = outtext + t
t = t.replace(/<[^>]*>/g, "")
t = t.replace(/&[^&]*;/g, "")
if(checknopost==1 && nodes[i].getAttribute("nopost")=='1')
{
t+="(不许转移)"
}
sObj.options[k++] = new Option(t, v);
}
sObj.options[sel].selected = true;
}
}
}
//SELECT表单选取 Obj 表单名,VAL所选的值
function ChkSelected(Obj,Val)
{
if (Obj)
{
for (i=0;i<Obj.length;i++){
if (Obj.options[i].value==Val){
Obj.options[i].selected=true;
break;
}
}
}
}
//单选表单选取 Obj 表单名,VAL所选的值
function chkradio(Obj,Val)
{
if (Obj)
{
for (i=0;i<Obj.length;i++){
if (Obj[i].value==Val){
Obj[i].checked=true;
break;
}
}
}
}
function readCookie(name){
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
};
return null;
};
function createCookie(name,value,days){
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
};
document.cookie = name+"="+value+expires+"; path=/";
};
//图片自动调整的模式,1为按比例调整 ,2 按大小调整。
var resizemode=1
function imgresize(o){
if (resizemode==2 || o.onmousewheel){
if(o.width > 500 ){
o.style.width='500px';
}
if(o.height > 800){
o.style.height='800px';
}
}else{
var parentNode=o.parentNode.parentNode
if (parentNode){
if (o.offsetWidth>=parentNode.offsetWidth) o.style.width='98%';
}else{
var parentNode=o.parentNode
if (parentNode){
if (o.offsetWidth>=parentNode.offsetWidth) o.style.width='98%';
}
}
}
}
//自动调用户图像,mode = 1为按比例调整 ,2 按大小调整
function repairface(o,mode)
{alert('');
if (mode == 2 || o.onmousewheel)
{
if(o.width > 128 )
{
o.style.width='128';
}
if(o.height > 128){
o.style.height='128px';
}
}
else
{
var parentNode=o.parentNode.parentNode
if (parentNode)
{
if (o.offsetWidth>=parentNode.offsetWidth) o.style.width='98%';
}
else
{
var parentNode=o.parentNode
if (parentNode)
{
if (o.offsetWidth>=parentNode.offsetWidth) o.style.width='98%';
}
}
}
}
function bbimg(o){
var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
return false;
}
/* by netty 2007-10-25
window.onload= new function()
{
setTimeout('activeOnline()',2000);
}
var xmlhttp;
try{
xmlhttp= new ActiveXObject('Msxml2.XMLHTTP');
}catch(e){
try{
xmlhttp= new ActiveXObject('Microsoft.XMLHTTP');
}catch(e){
try{
xmlhttp= new XMLHttpRequest();
}catch(e){}
}
}
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4){
if(xmlhttp.status==200){
setTimeout('activeOnline()',300000);
updateonline(xmlhttp.responseText);
}else{
setTimeout('activeOnline()',20000);
}
}
}
*/
//Colour pallete top offset
function getOffsetTop(elm) {
var mOffsetTop = elm.offsetTop;
var mOffsetParent = elm.offsetParent;
while(mOffsetParent){
mOffsetTop += mOffsetParent.offsetTop;
mOffsetParent = mOffsetParent.offsetParent;
}
return mOffsetTop;
}
//Colour pallete left offset
function getOffsetLeft(elm) {
var mOffsetLeft = elm.offsetLeft;
var mOffsetParent = elm.offsetParent;
while(mOffsetParent) {
mOffsetLeft += mOffsetParent.offsetLeft;
mOffsetParent = mOffsetParent.offsetParent;
}
return mOffsetLeft;
}
function postUrl(poststyle,act,bid,stype){
var thisUrl ="post.aspx?poststyle="+poststyle+"&action="+act+"&boardid="+bid+"&stype="+stype;
return thisUrl;
}
function close_postform(){
var obj=document.getElementById("post_div");
if (obj.style.display!="none"){
obj.style.display="none";
document.getElementById("post_iframe").src="";
}
}
function post_topic(buttonElement,pstyle,act,bid,stype){
var obj=document.getElementById("post_div");
var buttonElement = document.getElementById("postbutton");
if (pstyle!="1"){
return this.location = postUrl(pstyle,act,bid,stype);
}
if (obj.style.display=="none")
{
//obj.style.top = (getOffsetTop(buttonElement)+buttonElement.offsetHeight)+"px";
//obj.style.left = (getOffsetLeft(buttonElement)+buttonElement.offsetWidth)+"px";
//obj.style.left = "20px";
obj.style.display="block";
document.getElementById("post_iframe").style.height="760px";
document.getElementById("post_iframe").src=postUrl(pstyle,act,bid,stype);
}else {
obj.style.display="none";
document.getElementById("post_iframe").src="";
}
};
function activeOnline()
{
xmlhttp.open("get","activeonline.aspx?state="+escape(document.title.toString())+"&boardid="+boardid);
xmlhttp.send(null);
}
function updateonline(XMLstr)
{
eval(XMLstr);
var AllOnlie=document.getElementById("allonline");
if(AllOnlie) AllOnlie.innerHTML=allonline.toString();
var UserOnlie=document.getElementById("useronline");
if(UserOnlie) UserOnlie.innerHTML=useronline.toString();
var GuestOnlie=document.getElementById("guestonline");
if(GuestOnlie) GuestOnlie.innerHTML=guestonline.toString();
if(boardid!=0)
{
var Board_UserOnline=document.getElementById("boarduser");
if(Board_UserOnline) Board_UserOnline.innerHTML=boarduser.toString();
var Board_GuestOnline=document.getElementById("boardguest");
if(Board_GuestOnline) Board_GuestOnline.innerHTML=boardguest.toString();
}
}
/**
* New BoardJumpList by lfow
*/
function New_BoardJumpList(destBoardId, boardList)
{
if (destBoardId < 0 || !boardList)
{
return '';
}
var dest_list = {};
if (0 == destBoardId)
{
dest_list = boardList;
}
else
{
for (var boardid in boardList)
{
if (!boardList[boardid])
{
continue;
}
if (destBoardId == boardList[boardid].ParentId)
{
dest_list['' + boardid] = boardList[boardid];
}
}
}
if (!dest_list)
{
return '';
}
var retvl = '';
for (var boardid in dest_list)
{
if (0 == boardid || !dest_list[boardid])
{
continue;
}
if (0 == dest_list[boardid].Depth)
{
retvl += '╋<a href="' + dest_list[boardid].urlpath + '" style="padding-left: 1px;">' + dest_list[boardid].BoardType + '</a><br />';
}
else
{
var repeat_str = RepeatString(' ', 2);
retvl += repeat_str + '├<a href="'+ dest_list[boardid].urlpath +'" style="padding-left: 1px;">' + dest_list[boardid].BoardType + '</a>' + repeat_str + '<br />';
}
}
if ('' !== retvl)
{
retvl = '<div class="menuitems">' + retvl + '</div>';
}
return retvl;
}
/**
* by lfow
*/
function RepeatString(str, repeatCount)
{
if (typeof(str) != 'string')
{
return '';
}
if (typeof(repeatCount) != 'number' || repeatCount <= 0)
{
return '';
}
var retvl = str;
for (var i = 0; i < repeatCount; i++)
{
retvl += retvl;
}
return retvl;
}
/*
主页底部在线名单的显隐控制过程 by xu
*/
function disiframe()
{
if(document.getElementById('online3u').style.display=='')
{
document.getElementById('checkdis').innerText='显示详细列表'
document.getElementById('online3u').style.display='none';
var id = document.getElementById('hiddenframe');
if (id && !id.src)
{
id.src = 'onlineuserlist.aspx';
}
}
else
{
document.getElementById('checkdis').innerText='关闭详细列表'
document.getElementById('online3u').style.display='';
}
}
//浮动窗口效果
var ShadeDiv = {
objid : null,
Shade : document.createElement('div'),
ShadeID : 'Shade',
width : 400,
height : 300,
Position : function(){
if (!ShadeDiv.objid){
ShadeDiv.objid = null;
return;
}
var de = document.documentElement;
var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
var ch = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
if (self.pageYOffset) {
var st = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict
var st = document.documentElement.scrollTop;
} else if (document.body) {// all other Explorers
var st = document.body.scrollTop;
}
if (window.innerHeight && window.scrollMaxY) {
var sh = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
var sh = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
var sh = document.body.offsetHeight;
}
ShadeDiv.Shade.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=60,finishOpacity=100,style=0)';
ShadeDiv.Shade.style.height = (sh > ch ? sh : ch) + 'px';
ShadeDiv.Shade.style.width = w + 'px';
var pos = [], pw;
pw = ShadeDiv.width;
pos[0] = (w-pw)/2;
pos[1] = (ch-(ShadeDiv.height || 300))/2 -100+st;
//window.status="ch:"+ch+"st:"+st+"post[1]:"+pos[1]+"ShadeDiv.clientHeight"+ShadeDiv.objid.clientHeight;
if (navigator.product && navigator.product == 'Gecko'){
pw -= 40;
}
ShadeDiv.objid.style.width = ShadeDiv.width + 'px';
ShadeDiv.objid.style.height = ShadeDiv.height + 'px';
ShadeDiv.objid.style.left = pos[0] + 'px';
ShadeDiv.objid.style.top = pos[1] + 'px';
ShadeDiv.Shade.style.display = 'block';
ShadeDiv.objid.style.display = 'block';
},
Show : function(id,w,h){
ShadeDiv.height = parseInt(h);
ShadeDiv.width = parseInt(w);
ShadeDiv.Shade.id = ShadeDiv.ShadeID;
ShadeDiv.objid = document.getElementById(id);
document.body.insertBefore(ShadeDiv.Shade,null);
ShadeDiv.Position();
},
Close : function(){
if (ShadeDiv.objid==null){
return;
}
ShadeDiv.Confirmed();
},
Confirmed : function() {
ShadeDiv.objid.style.display = 'none';
ShadeDiv.Shade.style.display = 'none';
document.body.removeChild(ShadeDiv.Shade);
}
}
function fixImagesWidth(_id,_maxwidth)
{
var elem=document.getElementById(_id);
var images=elem.getElementsByTagName("img");
for(var i=0;i<images.length;i++)
{
if(images[i].offsetWidth > _maxwidth)
{
images[i].style.width=_maxwidth+"px";
}
}
}
// 无刷新换肤用到
function SetActiveStyle(_index,title)
{
var i, a,
head = document.getElementsByTagName("head")[0],
s=document.createElement("link");
s.rel="stylesheet";
s.type="text/css";
s.title=title;
s.href="templates/default/skins/"+_index+"/style.css"; //csslist[_index][1];
s.disabled = true;
/*for(i=0; i<head.childNodes.length; i++)
{
// head最多可以添加35个子结点
if(head.childNodes[i].tagName.toLowerCase() == "link"){
head.removeChild(head.childNodes[i]);
}
//alert(head.childNodes[i].tagName);
}*/
head.appendChild(s);
s.disabled = false;
setCookie(styleStr,_index);
for(i=0; (a = head.getElementsByTagName("link")[i]); i++)
{
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title"))
{a.disabled = true; break;};
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -