skin/js/superTables.js

(开头部分) 10KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

///////////////////////////////////////////////////////////////////////////////////////// 
// SUPER TABLES - VERSION 0.25 - MIT Style License
// Copyright (c) 2008 MATT MURPHY --- visit www.matts411.com
///////////////////////////////////////////////////////////////////////////////////////// 
// TO CALL: 
// new superTable([string] tableId, { options });
//
// OPTIONS: (order does not matter )
// cssSkin : string
// headerRows : integer
// fixedCols : integer
// colWidths : integer array ( -1 for auto sizing )
// onFinish : function ( all this.variableNameHere variables created in this script can be used in this function, eg. this.columnWidths )
//
// EXAMPLES:
// myST = new superTable("myTableId");
//
// myST = new superTable("myTableId", {
//      cssSkin : "Sky",
//      fixedCols : 2,
//      colWidths : [100, 230, 220, -1, 120, -1, -1, 120],
//      onFinish : function () {
//          alert(this.tBodyRowCount + " rows, " + this.columnCount + " columns converted.");
//      }
//  });
///////////////////////////////////////////////////////////////////////////////////////// 
// ISSUES / NOTES:
// 1. Does not check to see if rows are horizontally aligned if fixedCols > 0
// 2. colSpan not supported
// 3. No quirksmode support
///////////////////////////////////////////////////////////////////////////////////////// 

var superTables = [];
var superTable = function (tableId) {
    // add this instance to the supertables array
    var x = superTables.length; 
    this.index = x;
    superTables[x] = this;

    // initialize the parameters
    this.sourceTable = document.getElementById(tableId);
    this.hasOptions = (arguments.length > 1) ? true : false;
    this.skin = (this.hasOptions && arguments[1].cssSkin) ? "_" + arguments[1].cssSkin : "_Default";
    this.headerRows = (this.hasOptions && arguments[1].headerRows) ? parseInt(arguments[1].headerRows) : 1;
    this.fixedCols = (this.hasOptions && arguments[1].fixedCols) ? parseInt(arguments[1].fixedCols) : 0;
    this.columnWidths = (this.hasOptions && arguments[1].colWidths) ? arguments[1].colWidths : [];
    this.callbackFunc = (this.hasOptions && arguments[1].onFinish) ? arguments[1].onFinish : function () { return this; };
    var i, j, k;

    // get the column widths
    this.columnCount = (this.sourceTable.tHead) ? this.sourceTable.tBodies[0].rows[0].cells.length : this.sourceTable.tBodies[0].rows[this.headerRows].cells.length;
    this.columnWidthSum = 0;
    this.sourceTable.className = "sTempTable";
    for (i=0; i<this.columnCount; i++) {
        if (!this.columnWidths[i] || this.columnWidths[i] === -1) {
            this.columnWidths[i] = (this.sourceTable.tHead) ? this.sourceTable.tBodies[0].rows[0].cells[i].offsetWidth : this.sourceTable.tBodies[0].rows[this.headerRows].cells[i].offsetWidth;
        }
        this.columnWidthSum += this.columnWidths[i];
    }

后面还有 187 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。