JsExcelXml.js的源码

var JSXmlExcel = {
ConvertXmlDoc: function (text) {
var xmlDoc = null;
try {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.loadXML(text);
} catch (e) {
try {
parser = new DOMParser();
xmlDoc = parser.parseFromString(text, ‘text/xml‘);
}
catch (e) {
alert("无法创建Xml对象");
}
}
return xmlDoc;
},
BulidXml: function (dataOpts) {
var headerXml = "";
var titleXml = "";
var rowxml = "";
var footxml = "";
var Styles = [];

//用于记录列信息 字段Field 数据类型
var columnInfo = new Array();
var skipRowIndex = 0;
var ExpandedColumnCount = dataOpts.ColumStart - 1;
var ExpandedRowCount = dataOpts.RowStart - 1;
if (dataOpts.MainTitle.Displayname) { skipRowIndex = skipRowIndex + 1; ExpandedRowCount = ExpandedRowCount + 1 };
if (dataOpts.SecondTitle.Displayname) { skipRowIndex = skipRowIndex + 1; ExpandedRowCount = ExpandedRowCount + 1 };
//表头信息
var objhead = this.BuildHeadXml(dataOpts.HeadInfo, dataOpts.RowStart, dataOpts.ColumStart, skipRowIndex, Styles, dataOpts.DataStyle);
headerXml = objhead.headerXml;
ExpandedRowCount = objhead.rowcount + ExpandedRowCount;
ExpandedColumnCount = objhead.columnCount + ExpandedColumnCount;
columnInfo = objhead.columnInfo;
//创建表标题
if (dataOpts.MainTitle.Displayname) {
//构建主标题样式
Styles.push(this.BuildStyleFactory(‘MTitleDataStyle‘, dataOpts.MainTitle));
titleXml += this.BuildTitleXml(dataOpts.RowStart, dataOpts.ColumStart, ExpandedColumnCount, dataOpts.MainTitle.Displayname, ‘MTitleDataStyle‘);
}
var STitleDataStyle = ‘‘;
if (dataOpts.SecondTitle.Displayname) {
//dataOpts.RowStart + skipRowIndex - 1 处理只有副标题 行index混乱问题
//构建副标题样式
Styles.push(this.BuildStyleFactory(‘STitleDataStyle‘, dataOpts.SecondTitle));
titleXml += this.BuildTitleXml((dataOpts.RowStart + skipRowIndex - 1), dataOpts.ColumStart, ExpandedColumnCount, dataOpts.SecondTitle.Displayname, ‘STitleDataStyle‘);
}
//基本样式
Styles.push(this.BuildStyleFactory(‘TableDataStyle‘, dataOpts.DataStyle));
Styles.push(this.BuildStyleFactory(‘TableHeadStyle‘, dataOpts.HeadStyle));
//创建数据
var dataobj = this.BuildDataXml(dataOpts.RowInfo, columnInfo, dataOpts.ColumStart, dataOpts.MergeCells, dataOpts.CellStyles, Styles, dataOpts.DataStyle);
ExpandedRowCount = ExpandedRowCount + dataobj.rowCount;
rowxml = dataobj.rowxml;
//创建Footer
if (dataOpts.FooterInfo) {
Styles.push(this.BuildStyleFactory("TableFootStyle", dataOpts.FootStyle));
var FootObj = this.BuildFooterXml(dataOpts.FooterInfo, columnInfo, dataOpts.ColumStart, "TableFootStyle");
footxml = FootObj.footXml;
ExpandedRowCount = ExpandedRowCount + FootObj.rowCount;
}
//WorkSheet
var WorkSheet = ‘<Worksheet ss:Name="‘ + dataOpts.SheetName + ‘">‘ +
‘<Table ss:ExpandedColumnCount="‘ + ExpandedColumnCount +
‘" ss:ExpandedRowCount="‘ + ExpandedRowCount +
‘" x:FullColumns="1" x:FullRows="1" ss:DefaultColumnWidth="100" ss:DefaultRowHeight="16">‘ + titleXml + headerXml + rowxml + footxml +
‘</Table></Worksheet>‘;
return this.BuildAllXml(Styles.join(‘ ‘), WorkSheet);
},
//构建样式
BuildBorderStyle: function () {
//ss: Color = "‘ + colors + ‘"
var borders = ‘ <Borders> ‘ +
‘<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" /> ‘ +
‘<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> ‘ +
‘<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" /> ‘ +
‘<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" /> ‘ +
‘</Borders> ‘;
return borders;
},
BuildBackGound: function (colors) {
return ‘<Interior ss:Color="‘ + colors + ‘" ss:Pattern="Solid"/>‘
},
BuildFontStyle: function (fontSize, fontcolor, isBold, isUnderline) {
var fonts = [‘<Font ss:FontName="宋体" x:CharSet="134" ss:Size="‘ + fontSize + ‘" ss:Color="‘ + fontcolor + ‘" ‘];
if (isBold) { fonts.push(‘ ss:Bold="1" ‘); }
if (isUnderline) { fonts.push(‘ ss:Underline="Single" ‘) }
fonts.push(‘/>‘)
return fonts.join(‘‘);
},
BuildAlignment: function (alignment) {
var isWarp = arguments[1] ? arguments[1] : 1;
var al = ‘<Alignment ss:Horizontal="‘ + alignment + ‘" ss:Vertical="Center" ss:WrapText="‘ + isWarp + ‘"/>‘;
return al;
},
BuildStyleFactory: function (styleid, cfgData) {
var styles = [‘<Style ss:ID="‘ + styleid + ‘"> ‘];
var alg = this.BuildAlignment(cfgData.Alignment);
var font = this.BuildFontStyle(cfgData.FontSize, cfgData.FontColor, cfgData.IsBold, cfgData.IsUnderLine);
var border = this.BuildBorderStyle();
var bg = this.BuildBackGound(cfgData.BgColor);
styles = styles.concat([alg, font, border, bg, ‘</Style>‘]);
return styles.join(‘‘);
},
//构建数据XML
BuildTitleXml: function (rowStart, colStart, allColumn, displayText, styleID) {
var titleXml = ‘‘;
var Height = 26;
if (styleID === "MTitleDataStyle") {
Height = 40;
}
titleXml += ‘<Row ss:Index="‘ + rowStart + ‘" ss:AutoFitHeight="0" ss:Height="‘ + Height + ‘">‘;
titleXml += ‘<Cell ss:Index="‘ + colStart
+ ‘" ss:MergeAcross="‘ + (allColumn - colStart)
+ ‘" ss:StyleID="‘ + styleID + ‘"><Data ss:Type="String">‘ + displayText
+ ‘</Data></Cell></Row>‘;
return titleXml;
},
BuildHeadXml: function (headInfo, rowStart, columnStart, skipRowIndex, Styles, defaultseting) {
var columnInfo = new Array();
var headerXml = ‘‘;
var columnCount = 0;
var rowcount = 0;
(function (columns) {
for (var i = 0; i < columns.length; i++) {
for (var j = 0; j < columns[i].length; j++) {
if (j == 0) {
columns[i][j].pos = 1;
}
if (j > 0) {
if (columns[i][j - 1].colspan) {
columns[i][j].pos = columns[i][j - 1].pos + columns[i][j - 1].colspan;
}
else {
columns[i][j].pos = columns[i][j - 1].pos + 1;
}
}
if (i > 0) {
for (var p = 0; p < columns[i - 1].length; p++) {
if (columns[i - 1][p].pos == columns[i][j].pos) {
if (columns[i - 1][p].rowspan && columns[i - 1][p].rowspan > i) {
columns[i][j].pos += 1;
}
}
}
}
}
}
})(headInfo);
for (var i = 0; i < headInfo.length; i++) {
var rowindex = rowStart + i + skipRowIndex;
headerXml += ‘<Row ss:Index="‘ + rowindex + ‘" ss:AutoFitHeight="0">‘;
for (var cell = 0; cell < headInfo[i].length; cell++) {
var curcell = headInfo[i][cell];
if (curcell.hidden || curcell.checkbox)
continue;
var MergeDown = curcell.rowspan ? curcell.rowspan - 1 : 0;
var MergeAcross = curcell.colspan ? curcell.colspan - 1 : 0;
if (curcell.field) {
columnCount = columnCount + 1;
//判断是否单独设置列背景色
var cobj = { columnfield: curcell.field, columnType: curcell.datatype, formatter: curcell.formatter, pos: curcell.pos };
if (curcell.bgcolor) {
cobj.BgColor = curcell.bgcolor;
var cellstyle = this.BuildStyleFactory("col_" + curcell.field, $.extend(true, {}, defaultseting, { BgColor: cobj.BgColor }));
Styles.push(cellstyle);
}
columnInfo.push(cobj);
}
headerXml += ‘<Cell ss:StyleID="TableHeadStyle" ‘ + ‘ss:Index="‘ + (curcell.pos + columnStart - 1) + ‘"‘ +
‘ ss:MergeDown="‘ + MergeDown + ‘"‘ +
‘ ss:MergeAcross="‘ + MergeAcross + ‘"‘ +
‘ ><Data ss:Type="String">‘ + curcell.title + ‘</Data></Cell>‘;
}
headerXml += ‘</Row>‘;
rowcount = rowcount + 1;
}
columnInfo.sort(function (a, b) { return a.pos - b.pos });
return {
columnInfo: columnInfo,
columnCount: columnCount,
rowcount: rowcount,
headerXml: headerXml
}
},
BuildDataXml: function (rowInfo, columnInfo, columStart, mergeCells, CellStyles, Styles, defaultsetting) {
var rowCount = 0;
var rowxml = ‘‘;
for (var i = 0; i < rowInfo.length; i++) {
var Style = "TableDataStyle";
rowxml += ‘<Row ss:AutoFitHeight="0">‘;
if (rowInfo[i].BACKGROUND) {
var cfg = $.extend(true, {}, defaultsetting, { BgColor: rowInfo[i].BACKGROUND });
Styles.push(this.BuildStyleFactory("row_" + i, cfg));
Style = "row_" + i;
}
var resetStyle = Style;
for (var j = 0; j < columnInfo.length; j++) {
var col = columnInfo[j];
var value = rowInfo[i][col.columnfield];
if (col.formatter) {
value = col.formatter(value, null, null);
}
if (value != 0) {
value = value || ‘ ‘;
}
var type = columnInfo[j].columnType ? columnInfo[j].columnType : "String";
var cellindex = columStart + j;
if (col.BgColor) {
Style = "col_" + col.columnfield;
}
rowxml += ‘<Cell field="‘ + col.columnfield + ‘" ss:StyleID="‘ + Style + ‘" ss:Index="‘ + cellindex + ‘" ><Data ss:Type="‘ + type + ‘">‘ + value + ‘</Data></Cell>‘;
Style = resetStyle;
}
rowxml += ‘</Row> ‘;
rowCount = rowCount + 1;
};
//处理合并数据
if (mergeCells) {
var $xml = $(this.ConvertXmlDoc(‘<?xml version="1.0" encoding="utf-8" ?>\
<rows xmlns="urn:schemas-microsoft-com:office:spreadsheet"\
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">‘ + rowxml + ‘</rows>‘));
for (var i = 0; i < mergeCells.length; i++) {
var mginfo = mergeCells[i];
$xml.find("Row").each(function (index, row) {
if (index == mginfo.index) {
//找到行
var cell = $(row).find("Cell[field=" + mginfo.field + "]").first();
//列合并
if (mginfo.colspan) {
var ma = mginfo.colspan - 1;
cell.attr({
"ss:MergeAcross": ma
});
var cells = cell.nextAll(":lt(" + ma + ")");
if (!window.ActiveXObject) {
//删除后边的同伴
cells.remove();
} else {
cells.each(function (index, cell) {
$(row)[0].removeChild($(this)[0]);
});
}
}
// 行合并
if (mginfo.rowspan) {
var md = mginfo.rowspan - 1;
cell.attr({
"ss:MergeDown": md
});
//删除下一行中对应的列
$(row).nextAll(":lt(" + md + ")").each(function (index, currow) {
var curcell = $(currow).find("Cell[field=" + mginfo.field + "]").first();
var cells = null;
//存在列合并
if (mginfo.colspan) {
cells = curcell.nextAll(":lt(" + (mginfo.colspan - 1) + ")");
}
if (!window.ActiveXObject) {
if (cells) { cells.remove(); }
curcell.remove();
} else {
//IE
if (cells) {
cells.each(function (i, r) { $(currow)[0].removeChild($(this)[0]); });
}
$(currow)[0].removeChild(curcell[0]);
}
});
}
}
});
}
if (!window.ActiveXObject) {
//非IE
rowxml = $xml[0].getElementsByTagName("rows")[0].innerHTML;
rowxml = rowxml.replace(/xmlns="urn:schemas-microsoft-com:office:spreadsheet"|xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"/gi, ‘‘);
}
else {
//IE
var rows = $("Row", $xml[0]);
rowxml = "";
rows.each(function (index, row) {
rowxml = rowxml + row.xml.replace(/xmlns="urn:schemas-microsoft-com:office:spreadsheet"|xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"/gi, ‘‘);
});
}
}
//处理指定单元格样式
if (CellStyles) {
//todo
var $xml = $(this.ConvertXmlDoc(‘<?xml version="1.0" encoding="utf-8" ?>\
<rows xmlns="urn:schemas-microsoft-com:office:spreadsheet"\
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">‘ + rowxml + ‘</rows>‘));
for (var i = 0; i < CellStyles.length; i++) {
var cellinfo = CellStyles[i];
var cthis = this;
$xml.find("Row").each(function (index, row) {
if (index == cellinfo.index) { //找到行
//找列
var cell = $(row).find("Cell[field=" + cellinfo.field + "]").first();
var styleid = "Cell_" + index + "_" + cellinfo.field;
cell.attr("ss:StyleID", styleid);
//生成样式
var cfg = $.extend(true, {}, defaultsetting, { BgColor: cellinfo.BgColor });
Styles.push(cthis.BuildStyleFactory(styleid, cfg));
}
});
}
if (!window.ActiveXObject) {
rowxml = $xml[0].getElementsByTagName("rows")[0].innerHTML;
rowxml = rowxml.replace(/xmlns="urn:schemas-microsoft-com:office:spreadsheet"|xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"/gi, ‘‘);
} else {
var rows = $("Row", $xml[0]);
rowxml = "";
rows.each(function (index, row) {
rowxml = rowxml + row.xml.replace(/xmlns="urn:schemas-microsoft-com:office:spreadsheet"|xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"/g, ‘‘);
});
};
}
return { rowCount: rowCount, rowxml: rowxml };
},
BuildFooterXml: function (footInfo, columnInfo, columnStart, styleFootID) {
var footXml;
var rowCount = 0;
for (var i = 0; i < footInfo.length; i++) {
footXml += ‘<Row ss:AutoFitHeight="0">‘;
for (var j = 0; j < columnInfo.length; j++) {
var value = footInfo[i][columnInfo[j].columnfield];
var type = columnInfo[j].columnType ? columnInfo[j].columnType : "String";
footXml += ‘<Cell ss:StyleID="‘ + styleFootID + ‘" ‘ + (j === 0 ? ‘ss:Index="‘ + columnStart + ‘"‘ : ‘ ‘) +
‘ ><Data ss:Type="‘ + type + ‘">‘ + (value ? value : "") + ‘</Data></Cell>‘;
}
footXml += ‘</Row> ‘;
rowCount = rowCount + 1;
}
return { footXml: footXml, rowCount: rowCount };
},
BuildAllXml: function (styles, workSheet) {
var xmlInfo = ‘<?xml version="1.0" encoding="utf-8"?> ‘ +
‘<?mso-application progid="Excel.Sheet"?> ‘ +
‘<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" ‘ +
‘xmlns:o="urn:schemas-microsoft-com:office:office" ‘ +
‘xmlns:x="urn:schemas-microsoft-com:office:excel" ‘ +
‘xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" ‘ +
‘xmlns:html="http://www.w3.org/TR/REC-html40"> ‘ +
‘<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> ‘ +
‘</DocumentProperties> ‘ +
‘<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> ‘ +
‘<RemovePersonalInformation/> ‘ +
‘</OfficeDocumentSettings> ‘ +
‘<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> ‘ +
‘</ExcelWorkbook><Styles> ‘ + styles + ‘</Styles> ‘ +
workSheet + ‘ </Workbook>‘;
return xmlInfo;
},
//构建数据模板
// json{colnum:2,Start:0,end:10,datasource:[‘xx‘,‘xx‘]}
BuildDataValidation: function (colnum, start, end) {
var dvxml = ‘ <DataValidation xmlns="urn:schemas-microsoft-com:office:excel">\
<Range>C‘ + colnum + ‘</Range>\
<Type>List</Type>\
<Value>INDIRECT(&quot;enum!a‘ + start + ‘:a‘ + end + ‘&quot;)</Value>\
</DataValidation>‘;
return dvxml;
},
BuildTmpleteXml: function (dataOpts) {
var field = ‘ <Row ss:AutoFitHeight="0" ss:Hidden="1">‘;
var display = ‘<Row ss:AutoFitHeight="0" ss:Height="30">‘;
var dv = ‘‘; //数据有效性
var ds = []; //数据有效性数据源
var dsnum = 1;
var cols = dataOpts.HeadInfo;
for (var i = 0; i < cols.length; i++) {
var col = cols[i];
field = field + ‘<Cell ss:StyleID="hdbg"><Data ss:Type="String">‘ + col.field + ‘</Data></Cell>‘;
display = display + ‘<Cell ss:StyleID="hdbg"><Data ss:Type="String">‘ + col.title + ‘</Data></Cell>‘;
if (col.datasource) {
var obj = {
colnum: i + 1,
start: dsnum,
end: dsnum + col.datasource.length - 1,
datasource: col.datasource
};
dv = dv + this.BuildDataValidation(obj.colnum, obj.start, obj.end);
ds.push(obj);
dsnum = obj.end + 1;
}
}
field = field + ‘</Row>‘;
display = display + ‘</Row>‘;
var sheet = ‘<Worksheet ss:Name="‘ + dataOpts.SheetName + ‘">\
<Table ss:ExpandedColumnCount="‘ + cols.length + ‘" ss:ExpandedRowCount="2" x:FullColumns="1"\
x:FullRows="1" ss:DefaultColumnWidth="100" ss:DefaultRowHeight="13.5" ss:StyleID="tbbg">\
<Column ss:StyleID="bdbg" ss:Span="‘ + (cols.length - 1) + ‘"/>\
‘ + field + display + ‘</Table>\
‘ + dv + ‘</Worksheet>‘;
var dsSheet = this.BuildEnumSheet(ds);
var tbgstyle = [‘<Style ss:ID="tbbg">‘, this.BuildBackGound(‘#FFFFFF‘), ‘</Style>‘].join(‘‘);
var hdstyle = [‘<Style ss:ID="hdbg">‘, this.BuildBorderStyle(), this.BuildBackGound(‘#D8D8D8‘), ‘</Style>‘].join(‘‘);
var border = [‘<Style ss:ID="bdbg">‘, this.BuildBorderStyle(), this.BuildAlignment(‘Left‘, 1), ‘</Style>‘].join(‘‘);
var xml = this.BuildAllXml([tbgstyle, hdstyle, border].join(‘‘), [sheet, dsSheet].join(‘‘));
return xml;
},
BuildEnumSheet: function (dataList) {
var rownumber = 1;
var rows = ‘‘;
for (var i = 0; i < dataList.length; i++) {
var obj = dataList[i];
obj.startRow = rownumber;
for (var j = 0; j < obj.datasource.length; j++) {
rows = rows + ‘ <Row ss:AutoFitHeight="0"><Cell><Data ss:Type="String">‘ + obj.datasource[j] + ‘</Data></Cell></Row>‘;
rownumber++;
}
obj.endRow = rownumber;
}
var sheet = ‘<Worksheet ss:Name="enum">\
<Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="‘+ rownumber + ‘" x:FullColumns="1"\
x:FullRows="1" ss:DefaultColumnWidth="54" ss:DefaultRowHeight="13.5">\
‘ + rows + ‘</Table>\
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">\
<Visible>SheetHidden</Visible>\
</WorksheetOptions>\
</Worksheet>‘;
return sheet;
},

};

时间: 2024-10-10 22:20:28

JsExcelXml.js的源码的相关文章

学会读JQuery等JS插件源码

很多人觉得jquery.ext等一些开源js源代码 十分的晦涩,读不懂,遇到问题需要调试也很费劲.其实我个人感觉主要是有几个方面的原因: 1.对一些js不常用的语法.操作符不熟悉 2.某个function中又嵌套了一些内部的function,使得整个代码的层次结构不像java代码那么清晰. 3.js中允许变量先使用后定义,会造成我们看代码时候忽然冒出来一个变量.function,却找不到是在哪里定义的. 那么今天给大家分享一下我的经验,扫清你的障碍. 一.一些晦涩的操作符: 1.(functio

zepto.js动画源码

;(function($, undefined){ var prefix = '', eventPrefix, endEventName, endAnimationName, vendors = { Webkit: 'webkit', Moz: '', O: 'o' }, document = window.document, testEl = document.createElement('div'), supportedTransforms = /^((translate|rotate|sc

[百度地图] 用于类似 DWZ UI 框架的 百度地图 功能封装类 [MultiZMap.js] 实例源码

MultiZMap 功能说明 MultiZMap.js 本类方法功能大多使用 prototype 原型 实现,它是 ZMap 的多加载版本,主要用于类似 DWZ 这个 多标签的 UI 的框架: 包含的功能有:轨迹回放,圈画区域可编辑,判断几个坐标是否在一个圆圈内,生活服务查询,从经纬度获取地址信息,地图工具包括测距,获取面积,以积打印地图,地图全屏,实时路况,坐标是否在polygon区域内,打车方案,经过中间途经点,添加地图控件: 界面查看 : http://www.cnblogs.com/ed

node.js require() 源码解读

时至今日,Node.js 的模块仓库 npmjs.com ,已经存放了15万个模块,其中绝大部分都是 CommonJS 格式.这种格式的核心就是 require 语句,模块通过它加载.学习 Node.js ,必学如何使用 require 语句.本文通过源码分析,详细介绍 require 语句的内部运行机制,帮你理解 Node.js 的模块机制. 一.require() 的基本用法分析源码之前,先介绍 require 语句的内部逻辑.如果你只想了解 require 的用法,只看这一段就够了.下面的

在centos7上安装gcc、node.js(源码下载)

一.在centos7中安装node.js https://www.cnblogs.com/lpbottle/p/7733397.html 1.从源码下载Nodejs cd /usr/local/srcwget https://npm.taobao.org/mirrors/node/v8.7.0/node-v8.7.0.tar.gz 2.解压缩 nodejs 安装包 tar xvf node-v8.7.0.tar.gz 3.进入解压的node文件夹,安装必要的编译软件包 cd node-v8.7.

Vue.js 从源码理解v-for和v-if的优先级的高低

在vue.js里面,v-for和v-if是可以一起使用作用在某个元素上,网上看到一篇文章说永远不要把v-for和v-if同时用在同一个元素上,感觉有点瞎扯,官网也注明了可以一起使用的,还把两个指令的优先级给说明了: 当v-if和v-for一起使用时,v-for的优先级更高,为了方便理解举个栗子: <div id="app"> <ul> <li v-for="item in Nums" v-if="item%2==0"

ubuntu下安装Node.js(源码安装)

最近使用hexo的过程中出现了问题,中间载nodejs安装的时候也耽误了些许时间,所以在此记录一下安装的过程. 环境:ubuntu14.0.4LTS,安装nodejs版本node-v0.10.36.tar.gz.点我下载 这里选择源码包安装方式,下载之后,安装过程如下: $ sudo cp node-v0.10.36.tar.gz /usr/local/src/ $ tar xvf node-v0.10.36.tar.gz $ cd node-v0.10.36 $ ./configure $ m

ntv.js框架源码解读 - 4navigation.js

4navigation.js源代码: ntv.navigation类,处理页面焦点移动和确认.刷新等操作动作.

Bootstrap源码:dropdown.js

bootstrap的dropdown.js,封装了一个非常灵活易用的下拉组件,在各种下拉场景中稍加变换,都能实现目标效果,还能跟其他的组件良好地结合,比如前面的tab.js,搭配完成更强大的组件功能.这个组件除了js之外,html的结构和css的配合更是精妙,我从这个组件里面学到了不少有用的经验和技巧,下面是它的html结构: <div class="dropdown"> <a href="#" class="dropdown-toggl