• 全部
  • 问答

给CSDN化妆

wsj 2003-03-28 10:17:01
出于不可告人的目的,昨天顺手为csdn化了一下装
(另我喜欢先回复没有回复的帖子,当然要排序了)

hope this help, enjoy it:

list.htm
---------------------
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<div id=oList><h1 align=center>Loading...</h1></div>
<script>
//有兴趣的朋友可以改成带参数的
//我只要Web版就够了
urlList = "http://expert.csdn.net/Expert/ForumsList.asp?roomid=3&typenum=1";
window.o=new ActiveXObject("Microsoft.XMLHTTP")
o.onreadystatechange = checkState;
o.open("GET", urlList);
o.send();
function checkState()
{
if(o.readyState==4)
{
//strHTML = o.responseText;
strHTML = bytes2BSTR(o.responseBody)
//strBody = strHTML.replace(/\r\n/mig, "").replace(/(.*)<body(.*)<\/body>(.*)/i, "$2")
//strBody = strBody.substring(strBody.indexOf("table><table")+6, strBody.length)
strBody = strHTML.replace(/\r\n/mig, "").replace(/(.*)列表开始\/\/-->(.*)<!--列表结束(.*)/, "$2")

strBody = strBody.replace(/\/expert\/topicview1.asp/gi, "topicview.htm")
strBody = strBody.replace(/?|管理/g, "");
strBody = strBody.replace(/width="80"/gi, "width='100'");
strBody = strBody.replace(/width='80'/gi, "width='100'");
strBody = strBody.replace(/tbody>/gi, "tr>");
strBody = strBody.replace(/tr><\/table><table/gi, "tr><tr");
oList.innerHTML = strBody;
strBody = oList.innerHTML.replace(/<tbody>/gi, "<thead><tr bgColor='#eeeecc'><td>topic</td><td>score</td><td>reply</td><td>time</td><td></td></tr></thead><tbody>");
oList.innerHTML = strBody;
oList.children[0].style.behavior="url(sort.htc)";
}
}
</script>
<script language="vbscript">
Function bytes2BSTR(vIn)
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
</script>
</BODY>
</HTML>


topicview.htm
------------------------
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<link REL='Stylesheet' HREF='csdn.css' TYPE='text/css'/>
</HEAD>
<script>
function queryString(strURL, strParam)
{
var strVal = "";

try
{
// if strURL = "http://www.mySite.com/myPage.htm?param1=val1¶m2=val2"
var nIndex = strURL.indexOf("?");
if (nIndex > 0)
{
// cut strURL into "¶m1=val1¶m2=val2"
strURL = "&" + strURL.substring(nIndex + 1, strURL.length);
nIndex = strURL.indexOf("&"+ strParam + "=");
if(nIndex >= 0)
{
// jump to the position after the equal sign, if we're looking for
// param1, then strURL should contain 'val1¶m2=val2'
strURL = strURL.substring(nIndex + strParam.length + 2, strURL.length);

// in case there are other parameters followed
nIndex = strURL.indexOf("&");
if(nIndex == -1) //find the target
strVal = strURL;
else
strVal = strURL.substring(0, nIndex); // strVal should be 'val1' now
}
}
}
catch(e){}

return strVal;
}
</script>
<BODY>
<xml id=oXSL src=2.xsl></xml>
<div id=oList><h1 align=center>Loading...</h1></div>
<script>
urlTopic = "http://expert.csdn.net/Expert/TopicView1.asp?id=" + queryString(location.href, "id");
window.o=new ActiveXObject("Microsoft.XMLHTTP")
o.onreadystatechange = checkState;
o.open("GET", urlTopic);
o.send();
function checkState()
{
if(o.readyState==4)
{
oList.innerHTML = o.responseXML.transformNode(oXSL.XMLDocument);
}
}
</script>
<P> </P>
</BODY>
</HTML>

csdn.css
----------
TD
{
FONT-SIZE: 12px;
FONT-FAMILY: 宋体 Fixedsys
}
TEXTAREA.content
{
BORDER-RIGHT: 1px solid;
BORDER-TOP: 1px solid;
OVERFLOW-Y: visible;
FONT-SIZE: 16px;
OVERFLOW: visible;
BORDER-LEFT: 1px solid;
WIDTH: 98%;
LINE-HEIGHT: 150%;
BORDER-BOTTOM: 1px solid;
FONT-FAMILY: 宋体 Fixedsys;
HEIGHT: 40px
}

sort.htc
----------------

<public:attach event=oncontentready onevent="init();" />

<script>
//
// global variables
//
var tbody=null;
var theadrow=null;
var colCount = null;


var reverse = false;
var lastclick = -1; // stores the object of our last used object

var oTR = null;
var oStatus = null;
var none = 0;

function init() {

// get TBODY - take the first TBODY for the table to sort
tbody = element.tBodies(0);
if (!tbody) return;

//Get THEAD
var thead = element.tHead;
if (!thead) return;

theadrow = thead.children[0]; //Assume just one Head row
if (theadrow.tagName != "TR") return;

theadrow.runtimeStyle.cursor = "hand";

colCount = theadrow.children.length;

var l, clickCell;
for (var i=0; i<colCount; i++)
{
// Create our blank gif
l=document.createElement("IMG");
l.src="blank.gif";
l.id="srtImg";
l.width=25;
l.height=11;

clickCell = theadrow.children[i];
clickCell.selectIndex = i;
clickCell.insertAdjacentElement("beforeEnd", l)
clickCell.attachEvent("onclick", doClick);
}

}

//
// doClick handler
//
//
function doClick(e)
{
var clickObject = e.srcElement;

while (clickObject.tagName != "TD")
{
clickObject = clickObject.parentElement;
}


// clear the sort images in the head
var imgcol= theadrow.all('srtimg');
for(var x = 0; x < imgcol.length; x++)
imgcol[x].src = "blank.gif";

if(lastclick == clickObject.selectIndex)
{
if(reverse == false)
{
clickObject.children[0].src = "down.gif";
reverse = true;
}
else
{
clickObject.children[0].src = "up.gif";
reverse = false;
}
}
else
{
reverse = false;
lastclick = clickObject.selectIndex;
clickObject.children[0].src = "up.gif";
}

insertionSort(tbody, tbody.rows.length-1, reverse, clickObject.selectIndex);
}

function insertionSort(t, iRowEnd, fReverse, iColumn)
{


var iRowInsertRow, iRowWalkRow, current, insert;
for ( iRowInsert = 0 + 1 ; iRowInsert <= iRowEnd ; iRowInsert++ )
{
if (iColumn) {
if( typeof(t.children[iRowInsert].children[iColumn]) != "undefined")
textRowInsert = t.children[iRowInsert].children[iColumn].innerText;
else
textRowInsert = "";
} else {
textRowInsert = t.children[iRowInsert].innerText;
}

for ( iRowWalk = 0; iRowWalk <= iRowInsert ; iRowWalk++ )
{
if (iColumn) {
if(typeof(t.children[iRowWalk].children[iColumn]) != "undefined")
textRowCurrent = t.children[iRowWalk].children[iColumn].innerText;
else
textRowCurrent = "";
} else {
textRowCurrent = t.children[iRowWalk].innerText;
}

//
// We save our values so we can manipulate the numbers for
// comparison
//
current = textRowCurrent;
insert = textRowInsert;


// If the value is not a number, we sort normally, else we evaluate
// the value to get a numeric representation
//
if ( !isNaN(current) || !isNaN(insert))
{
current= eval(parseInt(current));
insert= eval(parseInt(insert));
}
else
{
current = current.toLowerCase();
insert = insert.toLowerCase();
}


if ( ( (!fReverse && insert < current)
|| ( fReverse && insert > current) )
&& (iRowInsert != iRowWalk) )
{
eRowInsert = t.children[iRowInsert];
eRowWalk = t.children[iRowWalk];
t.insertBefore(eRowInsert, eRowWalk);
iRowWalk = iRowInsert; // done
}
}
}
}

</script>
...全文
33 点赞 收藏 11
写回复
11 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
:P
回复
zgpp 2003-03-31
关注
回复
fason 2003-03-28
good!
回复
meizz 2003-03-28
:)
回复
emu_ston 2003-03-28
:O
回复
ssm1226 2003-03-28
试试:)
回复
wangxj0600 2003-03-28
up
回复
wsj 2003-03-28

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="show();">
<!--头信息//-->

<div align="center">

<!--头结束//-->

<DIV id="listing">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><h2>主  题:<xsl:value-of select="Topic/Issue/TopicName"/></h2></td>
</tr>
<tr>
<td width="100%" valign="top" align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="200" align="left">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right">作  者:</td>
<td align="right"></td>
<td>
<xsl:element name="a">
<xsl:attribute name="href">/Message_Board/Send.asp?sendto=<xsl:value-of select="Topic/Issue/PostUserName"/></xsl:attribute>
<xsl:attribute name="target">_blank</xsl:attribute>
<xsl:value-of select="Topic/Issue/PostUserName"/> (<xsl:value-of select="Topic/Issue/PostUserNickName"/>)
</xsl:element>
</td>
</tr>
<tr>
<td align="right">等  级:</td>
<td align="right"></td>
<td>
<xsl:value-of select="Topic/Issue/rank"/>
</td>
</tr>
<tr>
<td align="right">信 誉 值:</td>
<td align="right"></td>
<td><xsl:value-of select="Topic/Issue/credit"/></td>
</tr>
<tr>
<td align="right">所属论坛:</td>
<td align="right"></td>
<td><xsl:value-of select="Topic/Issue/RoomName"/></td>
</tr>
<tr>
<td align="right">问题点数:</td>
<td align="right"></td>
<td><xsl:value-of select="Topic/Issue/Point"/></td>
</tr>
<tr>
<td align="right">回复次数:</td>
<td align="right"></td>
<td><xsl:value-of select="Topic/Issue/ReplyNum"/></td>
</tr>
<tr>
<td align="right">发表时间:</td>
<td align="right"></td>
<td><xsl:value-of select="Topic/Issue/PostDateTime"/></td>
</tr>
</table>
</td>
<td colspan="2" valign="top"><xsl:apply-templates select="Topic/Issue/Content" /> </td>
</tr>
<tr>
<tr height="10">
<td align="right"> </td>
<td align="right"></td>
<td> </td>
</tr>
<tr bgcolor="#666666">
<td colspan="3" height="1"> </td>
</tr>
<tr height="10">
<td align="right"> </td>
<td align="right"></td>
<td> </td>
</tr>
</tr>
</table>

<!--已有回复开始//-->
<xsl:apply-templates select="Topic/Replys"/>
<!--已有回复结束//-->

<xsl:if test="/Topic/Issue/EndState[.> 0]">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" height="1" bgcolor="#999999"></td>
</tr>
<tr>
<td width="100%" ><br/>该问题已经结贴
<xsl:if test="/Topic/Issue/Point[.> 0]">
,得分记录:
<xsl:for-each select="Topic/Replys/Reply" >
<xsl:if test="Point [.> 0]">
<xsl:value-of select="PostUserName"/>
(<xsl:value-of select="Point"/>)、
</xsl:if>
</xsl:for-each>
</xsl:if>
</td>
</tr>
<tr>
<td width="100%" height="10"> </td>
</tr>
</table>
</xsl:if>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" height="10" ></td>
</tr>
<tr>
<td height="1" bgcolor="#999999"></td>
</tr>
<tr>
<td >

<a name="reply"/>


<xsl:element name="IFRAME">
<xsl:attribute name="name">XmlReply</xsl:attribute>
<xsl:attribute name="marginWidth">0</xsl:attribute>
<xsl:attribute name="marginHeight">0</xsl:attribute>
<xsl:attribute name="frameBorder">0</xsl:attribute>

<xsl:attribute name="SCROLLING">no</xsl:attribute>

<xsl:attribute name="width">600</xsl:attribute>
<xsl:attribute name="height">300</xsl:attribute>
<xsl:attribute name="src">
http://expert.csdn.net/Expert/xsl/Reply_Xml.asp?Topicid=<xsl:value-of select="Topic/Issue/TopicId"/>
</xsl:attribute> 
</xsl:element>

</td>
</tr>
<tr>
<td >
</td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="1" bgcolor="#FF6633" colspan="2"></td>
</tr>
<tr>
<td align="right"> <b></b></td>
<td width="100" align="right" height="20">
<xsl:element name="a">
<xsl:attribute name="href">http://expert.csdn.net/expert/Topicview2.asp?id=<xsl:value-of select="Topic/Issue/TopicId"/></xsl:attribute>
管理
</xsl:element> |
<a href="javascript:window.close()">关闭窗口</a>
</td>
</tr>

<tr>
<td height="15" colspan="2"></td>
</tr>
<tr>
<td colspan="2" ></td>
</tr>
</table>
</td>
</tr>
</table>

<!--//-->
</DIV>
</div>
</body>
</html>
</xsl:template>





<xsl:template match="Replys" >
<xsl:for-each select="Reply" >
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td colspan="3" height="5"></td>
</tr>
<tr>
<td width="100" valign="top">
<xsl:element name="a">
<xsl:value-of select="PostUserName"/>(<xsl:value-of select="PostUserNickName "/>)
</xsl:element><br/><xsl:value-of select="rank"/>|<xsl:value-of select="credit"/>
<br/><font color="#000000"><xsl:value-of select="PostDateTime" /> </font>
<br/><font color="#000000"><xsl:value-of select="Point"/></font>
</td>
<td valign="top"><xsl:apply-templates select="Content" /></td>
</tr>
<tr>
<td height="5"></td>
</tr>
</table>
</xsl:for-each>
</xsl:template>

<xsl:template match="Content">
<table style="TABLE-LAYOUT: fixed" width="100%" cellpadding="3" >
<tr><td>
<xsl:element name="textarea">
<xsl:attribute name="class">content</xsl:attribute>
<xsl:attribute name="readonly">true</xsl:attribute>
<xsl:apply-templates />
</xsl:element>
</td></tr></table>

</xsl:template>

<xsl:template match="br">
<br/>
</xsl:template>


<xsl:template match="ranknum" >
<xsl:value-of select="Topic/Issue/rank"/>
<xsl:value-of select="ranknum"/>
</xsl:template>


</xsl:stylesheet>
回复
wsj 2003-03-28
2.xsl
-------------
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="text()" >
<xsl:value-of/>
</xsl:template>
<xsl:template match="/">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312"/>
<title><xsl:value-of select="Topic/Issue/TopicName"/></title>
<link REL='Stylesheet' HREF='csdn.css' TYPE='text/css'/>
<style>
.WithBreaks { word-wrap:break-word;width:580;white-Space:pre;}
.WithBreaks2 { word-wrap:break-word;width:500}
.NormalValue { word-wrap:normal; width:600}

textarea.content
{
overflow-y:visible;
border:0px;
font-size:12px;
font-family: 宋体 Fixedsys;
line-height:150%;
overflow:visible;
border-width:0px;

width:550px;
height:40px;
}
</style>
<SCRIPT LANGUAGE="javascript"><xsl:comment><![CDATA[

function GetIEVersion()
{
try
{
if(!window.clientInformation)return false;
if(window.clientInformation.appName.toLowerCase()!="microsoft internet explorer")return false;
if(window.clientInformation.appVersion.toLowerCase().indexOf("msie")==-1)return false;
var a=window.clientInformation.appVersion.toLowerCase().split(";");
for(var i=0;i<a.length;i++)
{
a[i]=a[i].replace(" ","");
if(a[i].indexOf("msie")==0)
{
var version=a[i].substr(4,a[i].indexOf(".")-2);
return version;
}
}
}
catch(exception)
{
}
return false;
}


window.IEVersion=GetIEVersion();

if(parseInt(window.IEVersion)<6)document.write("<style>textarea.content { behavior:url('/Expert/xsl/tacontent.htc')}</style>");
function mailto1()
{
document.mailto.email.value='';
var tmpText=prompt('请输入您朋友的EMail:',document.mailto.email.value);
if(tmpText){
document.mailto.email.value = tmpText;
document.mailto.submit();
}
}


function changeFontSize(size,lineheight)
{
obj = document.getElementById('listing');
if (!obj) alert('not found');
for (var ii=0; ii < obj.all.tags('TD').length; ii++) {
var td = obj.all.tags("TD").item(ii);
td.style.fontSize = size;
td.style.lineHeight = lineheight;
}
}

function getcookieval(offset) {
var endstr = document.cookie.indexOf(";",offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape (document.cookie.substring(offset,endstr));
}

function getcookie(name) {
var arg = name + '=';
var alen = arg.length;
var clen = document.cookie.length;
var j = 0;
while (j< clen) {
var k = j + alen;
if(document.cookie.substring(j,k) == arg) return getcookieval(k);
j = document.cookie.indexOf("",j)+1;
if (j ==0 ) break;
}
return null;
}

// 从url 字符串中提取变量的值
function GetQueryValue(sorStr,panStr)
{
var vStr="";
if (sorStr==null || sorStr=="" || panStr==null || panStr=="") return vStr;
sorStr = sorStr.toLowerCase();
panStr += "=";
var itmp=sorStr.indexOf(panStr);
if (itmp<0){return vStr;}
sorStr = sorStr.substr(itmp + panStr.length);
itmp=sorStr.indexOf("&");
if (itmp<0)
{
return sorStr;
}
else
{
sorStr=sorStr.substr(0,itmp);
return sorStr;
}
}


function AddToFavorite()
{
if (confirm("您确认把这个问题放到收藏夹吗?")){
document.Favorite.submit();
}
}

function AddToSubjectTopic()
{
if (confirm("您确认把这个问题放到专题吗?提示:只有很少的人有这个权限!!!")){
document.SubjectTopic.submit();
}
}

function AddToRoomBoard()
{
if (confirm("您确认把这个问题放到分论坛公告中吗?提示:只有版主、总版主有这个权限!!!")){
document.RoomBoard.submit();
}
}

var currentpos,timer;
function initialize()
{
timer=setInterval('scrollwindow()',10);
}
function sc(){
clearInterval(timer);
}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scroll(0,++currentpos);
if (currentpos != document.body.scrollTop)
sc();
}
document.onmousedown=sc
document.ondblclick=initialize



function Subject_FAQ(iiii)
{
var helpmess;
helpmess= "你确认要整理FAQ么???\r\n\r\n"+
"---------------FAQ整理优惠制度(提交的FAQ被审核通过后)---------------\r\n\r\n"+
"1.FAQ整理人增加信誉分1分,可用分5分\r\n\r\n"+
"2.FAQ审核人增加可用分1分\r\n\r\n"+
"3.FAQ回答中主要回答人增加信誉分5分,可用分10分\r\n\r\n";
if (confirm(helpmess))
{
window.location = "/expert/FAQ/FAQ_Manage.asp?id=0&Topicid="+iiii;
}
}


function saveas(id)
{
var filename = "/expert/topic/"+Math.floor((parseInt(id)-1)/1000).toString()+"/"+id+".xml"
//alert(filename);
var csdnxml=new ActiveXObject("Microsoft.XMLDOM");
var csdnxsl=new ActiveXObject("Microsoft.XMLDOM");
csdnxml.async=false;
csdnxsl.async=false;
try
{
//alert("11");
csdnxml.load(filename);
if(csdnxml.parseError.errorCode)
{
alert(filename+"解析错误\n"+csdnxml.parseError.reason);
}

csdnxsl.load("/expert/xsl/100.xsl");
if(csdnxsl.parseError.errorCode)
{
alert("解析错误\n"+csdnxsl.parseError.reason);
}
var html=csdnxml.transformNode(csdnxsl);
//alert(html);
}
catch(x)
{
alert("无法保存!!")
return;
}

var winSave = window.open();
winSave.document.open ("text/html","gb2312");
winSave.document.write (html);
winSave.document.execCommand ("SaveAs",true,"csdn_"+id+".htm");
winSave.close();
}


function submit1()
{

var types=document.alogon.type.options[document.alogon.type.selectedIndex].value;
if (types!="1")
document.alogon.action="http://www.csdn.net/member/logon.asp";
else
document.alogon.action="/member/logon.asp";
//document.alogon.submit();
}

// 获得url字符串
var strGetQuery = document.location.search;
// 获得csdnstyle 参数的值
var stylevalue = GetQueryValue(strGetQuery,'csdnstyle')

// 如果url 中
if (stylevalue == '')
{
stylevalue = getcookie('csdnstyle');
}
//alert(stylevalue);
//确定选择的css
switch(stylevalue)
{
case '1':
document.write('<link rel="stylesheet" type="text/css" href="/Expert/style/1.css" >');
break;
case '2':
document.write('<link rel="stylesheet" type="text/css" href="/Expert/style/2.css" >');
break;
case '3':
document.write('<link rel="stylesheet" type="text/css" href="/Expert/style/3.css" >');
break;
default:
document.write('<link rel="stylesheet" type="text/css" href="/Expert/style/0.css" >');
}

]]>//</xsl:comment></SCRIPT>

</head>

回复
nik_Amis 2003-03-28
up
回复
逍遥小贼 2003-03-28
不错
回复
发帖
JavaScript
创建于2007-09-28

8.5w+

社区成员

Web 开发 JavaScript
申请成为版主
帖子事件
创建了帖子
2003-03-28 10:17
社区公告
暂无公告