~ubuntu-branches/ubuntu/wily/chora2/wily

« back to all changes in this revision

Viewing changes to js/tables.js

  • Committer: Bazaar Package Importer
  • Author(s): Gregory Colpart
  • Date: 2010-08-02 07:23:15 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100802072315-u3tq638qr4gm0w68
Tags: 2.1.1+debian0-1
* New upstream release.
* Repack source package to remove embeds prototype.js (Closes: #555253)
* Remove scriptaculous.js link (no more needed). 
* Update to standards version 3.9.1, no further required changes. 
* Improve watch file because source package is now repacked. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
var SORT_COLUMN_INDEX;function table_stripe(B){var A=["rowEven","rowOdd"];B.select("tbody tr").each(function(C){C.removeClassName(A[1]);C.addClassName(A[0]);A.reverse(true)})}function table_makeSortable(B){var A=0;B.down("tr").immediateDescendants().each(function(C){if(C.hasClassName("nosort")){++A;return }C.setAttribute("columnIndex",A++);C.setStyle({cursor:"pointer"});C.observe("click",function(E){var F=E.findElement("th");E.stop();var D=F.down("a");if(D&&!D.hasClassName("sortlink")){return true}table_resortTable(F);return false})})}function table_getSortValue(A){var B="";if(Object.isString(A)||Object.isUndefined(A)){return A}A=$(A);if(A.readAttribute("sortval")){return A.readAttribute("sortval")}if(A.innerText){return A.innerText}$A(A.childNodes).each(function(C){switch(C.nodeType){case 1:B+=table_getSortValue(C);break;case 3:B+=C.nodeValue;break}});return B}function table_resortTable(D){var C=D.up("table"),E=D.up().immediateDescendants(),B,A=0;E.each(function(G){if(D==G){if(G.hasClassName("sortup")){G.removeClassName("sortup");G.addClassName("sortdown")}else{if(G.hasClassName("sortdown")){G.removeClassName("sortdown");G.addClassName("sortup");A=1}else{G.addClassName("sortdown")}}}else{G.removeClassName("sortup");G.removeClassName("sortdown")}});if(E.size()<=1){return }SORT_COLUMN_INDEX=D.readAttribute("columnIndex");var F=table_getSortValue(C.down("tbody > tr").cells[SORT_COLUMN_INDEX]);if(F.match(/^\d\d[\/-]\d\d[\/-]\d\d\d\d$/)||F.match(/^\d\d[\/-]\d\d[\/-]\d\d$/)){B=table_sort_date}else{if(F.match(/^[?$]/)){B=table_sort_currency}else{if(F.match(/^[\d\.]+$/)){B=table_sort_numeric}else{B=table_sort_caseinsensitive}}}$A(C.getElementsByTagName("tbody")).each(function(H){var G=[],I=$A(H.getElementsByTagName("tr"));I.sort(B);if(A){I.reverse()}I.each(function(J){if(J.hasClassName("sortbottom")){G.push(J)}else{H.appendChild(J)}});G.each(function(J){H.appendChild(J)})});if(C.hasClassName("striped")){table_stripe(C)}if(typeof table_sortCallback!="undefined"&&Object.isFunction(table_sortCallback)){table_sortCallback(C.id,D.id,A)}}function table_sort_date(C,A){var F=table_getSortValue(C.cells[SORT_COLUMN_INDEX]),G=table_getSortValue(A.cells[SORT_COLUMN_INDEX]),D,B,E;if(F.length==10){D=F.substr(6,4)+F.substr(3,2)+F.substr(0,2)}else{E=F.substr(6,2);if(parseInt(E)<50){E="20"+E}else{E="19"+E}D=E+F.substr(3,2)+F.substr(0,2)}if(G.length==10){B=G.substr(6,4)+G.substr(3,2)+G.substr(0,2)}else{E=G.substr(6,2);if(parseInt(E)<50){E="20"+E}else{E="19"+E}B=E+G.substr(3,2)+G.substr(0,2)}if(D==B){return 0}else{if(D<B){return -1}}return 1}function table_sort_currency(B,A){var C=table_getSortValue(B.cells[SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,""),D=table_getSortValue(A.cells[SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,"");return parseFloat(C)-parseFloat(D)}function table_sort_numeric(B,A){var C=parseFloat(table_getSortValue(B.cells[SORT_COLUMN_INDEX]));if(isNaN(C)){C=0}var D=parseFloat(table_getSortValue(A.cells[SORT_COLUMN_INDEX]));if(isNaN(D)){D=0}return C-D}function table_sort_caseinsensitive(B,A){var C=table_getSortValue(B.cells[SORT_COLUMN_INDEX]).toLowerCase(),D=table_getSortValue(A.cells[SORT_COLUMN_INDEX]).toLowerCase();if(C==D){return 0}else{if(C<D){return -1}}return 1}function table_sort_default(B,A){var C=table_getSortValue(B.cells[SORT_COLUMN_INDEX]),D=table_getSortValue(A.cells[SORT_COLUMN_INDEX]);if(C==D){return 0}else{if(C<D){return -1}}return 1}document.observe("dom:loaded",function(){$$("table.striped").each(table_stripe);$$("table.sortable").each(table_makeSortable)})
 
 
b'\\ No newline at end of file'
 
1
var SORT_COLUMN_INDEX;function table_stripe(b){var a=["rowEven","rowOdd"];b.select("tbody tr").each(function(d){d.removeClassName(a[1]);d.addClassName(a[0]);a.reverse(true)})}function table_makeSortable(b){var a=0;b.down("tr").immediateDescendants().each(function(c){if(c.hasClassName("nosort")){++a;return}c.setAttribute("columnIndex",a++);c.setStyle({cursor:"pointer"});c.observe("click",function(f){var g=f.findElement("th");f.stop();var d=g.down("a");if(d&&!d.hasClassName("sortlink")){return true}table_resortTable(g);return false})})}function table_getSortValue(a){var b="";if(Object.isString(a)||Object.isUndefined(a)){return a}a=$(a);if(a.readAttribute("sortval")){return a.readAttribute("sortval")}if(a.innerText){return a.innerText}$A(a.childNodes).each(function(c){switch(c.nodeType){case 1:b+=table_getSortValue(c);break;case 3:b+=c.nodeValue;break}});return b}function table_resortTable(d){var c=d.up("table"),e=d.up().immediateDescendants(),b,a=0;e.each(function(g){if(d==g){if(g.hasClassName("sortup")){g.removeClassName("sortup");g.addClassName("sortdown")}else{if(g.hasClassName("sortdown")){g.removeClassName("sortdown");g.addClassName("sortup");a=1}else{g.addClassName("sortdown")}}}else{g.removeClassName("sortup");g.removeClassName("sortdown")}});if(e.size()<=1){return}SORT_COLUMN_INDEX=d.readAttribute("columnIndex");var f=table_getSortValue(c.down("tbody > tr").cells[SORT_COLUMN_INDEX]);if(f.match(/^\d\d[\/-]\d\d[\/-]\d\d\d\d$/)||f.match(/^\d\d[\/-]\d\d[\/-]\d\d$/)){b=table_sort_date}else{if(f.match(/^[�$]/)){b=table_sort_currency}else{if(f.match(/^[\d\.]+$/)){b=table_sort_numeric}else{b=table_sort_caseinsensitive}}}$A(c.getElementsByTagName("tbody")).each(function(h){var g=[],i=$A(h.getElementsByTagName("tr"));i.sort(b);if(a){i.reverse()}i.each(function(j){if(j.hasClassName("sortbottom")){g.push(j)}else{h.appendChild(j)}});g.each(function(j){h.appendChild(j)})});if(c.hasClassName("striped")){table_stripe(c)}if(typeof table_sortCallback!="undefined"&&Object.isFunction(table_sortCallback)){table_sortCallback(c.id,d.id,a)}}function table_sort_date(e,c){var h=table_getSortValue(e.cells[SORT_COLUMN_INDEX]),i=table_getSortValue(c.cells[SORT_COLUMN_INDEX]),f,d,g;if(h.length==10){f=h.substr(6,4)+h.substr(3,2)+h.substr(0,2)}else{g=h.substr(6,2);if(parseInt(g)<50){g="20"+g}else{g="19"+g}f=g+h.substr(3,2)+h.substr(0,2)}if(i.length==10){d=i.substr(6,4)+i.substr(3,2)+i.substr(0,2)}else{g=i.substr(6,2);if(parseInt(g)<50){g="20"+g}else{g="19"+g}d=g+i.substr(3,2)+i.substr(0,2)}if(f==d){return 0}else{if(f<d){return-1}}return 1}function table_sort_currency(d,c){var e=table_getSortValue(d.cells[SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,""),f=table_getSortValue(c.cells[SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,"");return parseFloat(e)-parseFloat(f)}function table_sort_numeric(d,c){var e=parseFloat(table_getSortValue(d.cells[SORT_COLUMN_INDEX]));if(isNaN(e)){e=0}var f=parseFloat(table_getSortValue(c.cells[SORT_COLUMN_INDEX]));if(isNaN(f)){f=0}return e-f}function table_sort_caseinsensitive(d,c){var e=table_getSortValue(d.cells[SORT_COLUMN_INDEX]).toLowerCase(),f=table_getSortValue(c.cells[SORT_COLUMN_INDEX]).toLowerCase();if(e==f){return 0}else{if(e<f){return-1}}return 1}function table_sort_default(d,c){var e=table_getSortValue(d.cells[SORT_COLUMN_INDEX]),f=table_getSortValue(c.cells[SORT_COLUMN_INDEX]);if(e==f){return 0}else{if(e<f){return-1}}return 1}document.observe("dom:loaded",function(){$$("table.striped").each(table_stripe);$$("table.sortable").each(table_makeSortable)});
 
 
b'\\ No newline at end of file'