/*
Copyright 2008-2011 Clipperz Srl
This file is part of Clipperz's Javascript Crypto Library.
Javascript Crypto Library provides web developers with an extensive
and efficient set of cryptographic functions. The library aims to
obtain maximum execution speed while preserving modularity and
reusability.
For further information about its features and functionalities please
refer to http://www.clipperz.com
* Javascript Crypto Library is free software: you can redistribute
it and/or modify it under the terms of the GNU Affero General Public
License as published by the Free Software Foundation, either version
3 of the License, or (at your option) any later version.
* Javascript Crypto Library is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
License along with Javascript Crypto Library. If not, see
.
*/
addEvent(window, "load", sortables_init);
var SORT_COLUMN_INDEX;
function sortables_init() {
// Find all tables with class sortable and make them sortable
if (!document.getElementsByTagName) return;
tbls = document.getElementsByTagName("table");
for (ti=0;ti 0) {
var firstRow = table.rows[0];
}
if (!firstRow) return;
// We have a first row: assume it's the header, and make its contents clickable links
for (var i=0;i' +
txt+' ';
}
}
function ts_getInnerText(el) {
if (typeof el == "string") return el;
if (typeof el == "undefined") { return el };
if (el.innerText) return el.innerText; //Not needed but it is faster
var str = "";
var cs = el.childNodes;
var l = cs.length;
for (var i = 0; i < l; i++) {
switch (cs[i].nodeType) {
case 1: //ELEMENT_NODE
str += ts_getInnerText(cs[i]);
break;
case 3: //TEXT_NODE
str += cs[i].nodeValue;
break;
}
}
return str;
}
function ts_resortTable(lnk,clid) {
// get the span
var span;
for (var ci=0;ci0){
var bdytr = tbl.insertRow(true);
var vals = [_clipperz_profile_pns[x], prf.iters, prf.min, parseInt(Math.round(prf.total/prf.iters)), prf.max, prf.total];
for(var y=0; y0){
textAlign = "right";
borderRight = "1px solid gray";
}else{
borderRight = "1px solid black";
}
}
}
}
}
if(appendToDoc){
var ne = document.createElement("div");
ne.id = "profileOutputTable";
with(ne.style){
fontFamily = "Courier New, monospace";
fontSize = "12px";
lineHeight = "16px";
borderTop = "1px solid black";
padding = "10px";
}
if(document.getElementById("profileOutputTable")){
MochiKit.DOM.swapDOM("profileOutputTable", ne);
}else{
document.body.appendChild(ne);
}
ne.appendChild(tbl);
}
return tbl;
},
//-------------------------------------------------------------------------
'profileData': function(aName, aKey) {
var result;
if (typeof(aName) == 'undefined') {
result = _clipperz_profile_profiles;
} else {
if (typeof(_clipperz_profile_profiles[aName]) != 'undefined') {
result = _clipperz_profile_profiles[aName];
} else {
result = {};
}
}
if (typeof(aKey) != 'undefined') {
if (aKey == "average") {
result = Math.round(Clipperz.Profile.profileData(aName, 'total')/Clipperz.Profile.profileData(aName, 'iters'));
} else {
if (typeof(result[aKey]) != 'undefined') {
result = result[aKey];
} else {
result = 0;
}
}
}
return result;
},
//-------------------------------------------------------------------------
'resetProfileData': function() {
_clipperz_profile_profiles = {};
_clipperz_profile_pns = [];
},
//-------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
}