Bug 392760, Provide keyboard-accessibility for sorting headers FTP/File/Jar/Gopher dir listing, p=dao@design-noir.de, r+sr+a=bz

This commit is contained in:
Olli.Pettay%helsinki.fi 2007-08-24 10:12:46 +00:00
Родитель 863a34f106
Коммит c647e83dbf
1 изменённых файлов: 15 добавлений и 4 удалений

Просмотреть файл

@ -290,6 +290,9 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
" text-align: left;\n"
" white-space: nowrap;\n"
"}\n"
"th > a {\n"
" color: inherit;\n"
"}\n"
"table[order] th {\n"
" cursor: pointer;\n"
"}\n"
@ -369,18 +372,26 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
"var gTable, gOrderBy, gTBody, gRows, gUI_showHidden;\n"
"document.addEventListener(\"DOMContentLoaded\", function() {\n"
" gTable = document.getElementsByTagName(\"table\")[0];\n"
" gTBody = gTable.tBodies[0];\n"
" if (gTBody.rows.length < 2)\n"
" return;\n"
" gUI_showHidden = document.getElementById(\"UI_showHidden\");\n"
" var headCells = gTable.tHead.rows[0].cells,\n"
" hiddenObjects = false;\n"
" function rowAction(i) {\n"
" return function() {\n"
" return function(event) {\n"
" event.preventDefault();\n"
" orderBy(i);\n"
" }\n"
" }\n"
" for (var i = headCells.length - 1; i >= 0; i--)\n"
" headCells[i].addEventListener(\"click\", rowAction(i), false);\n"
" for (var i = headCells.length - 1; i >= 0; i--) {\n"
" var anchor = document.createElement(\"a\");\n"
" anchor.href = \"\";\n"
" anchor.appendChild(headCells[i].firstChild);\n"
" headCells[i].appendChild(anchor);\n"
" headCells[i].addEventListener(\"click\", rowAction(i), true);\n"
" }\n"
" gOrderBy = gTable.getAttribute(\"order-by\");\n"
" gTBody = gTable.tBodies[0];\n"
" gRows = [];\n"
" for (var row, i = gTBody.rows.length - 1; i >= 0; i--) {\n"
" row = gTBody.rows[i];\n"