|
6 | 6 | * |__/ |___/
|
7 | 7 | *
|
8 | 8 | * This file is part of kristuff/apache-fancy-pages.
|
9 |
| - * Version 0.1.6 - Copyright (c) 2021 Kristuff <[email protected]> |
| 9 | + * Version 0.1.7 - Copyright (c) 2021 Kristuff <[email protected]> |
10 | 10 | *
|
11 | 11 | * For the full copyright and license information, please view the LICENSE
|
12 | 12 | * file that was distributed with this source code.
|
|
34 | 34 | let titleText, breadcrumbHtml = '', index = 0, origin = window.location.origin + '/';
|
35 | 35 |
|
36 | 36 | if (cleanPath) {
|
37 |
| - const parts = cleanPath.split('/'); |
| 37 | + let parts = cleanPath.split('/'); |
38 | 38 | cleanPath = parts[parts.length - 1];
|
39 | 39 | titleText = titleize(cleanPath).replace(/-|_/g, ' ');
|
40 | 40 |
|
|
60 | 60 | const titleContainer = document.querySelector('h1#title');
|
61 | 61 | const breadContainer = document.querySelector('div#breadcrumb');
|
62 | 62 |
|
63 |
| - titleContainer.innerHTML = titleText; |
64 |
| - breadContainer.innerHTML = breadcrumbHtml; |
| 63 | + if (titleContainer) titleContainer.innerHTML = titleText; |
| 64 | + if (breadContainer) breadContainer.innerHTML = breadcrumbHtml; |
65 | 65 | document.title = titleText;
|
66 | 66 | }
|
67 | 67 |
|
| 68 | + // Add sort icon according to query search |
| 69 | + function setSortIcon(){ |
| 70 | + let args = window.location.search; |
| 71 | + let sortIcon = '▾'; |
| 72 | + let column = document.querySelector('th.indexcolname'); |
| 73 | + |
| 74 | + if (args.includes('O=D')) sortIcon = '▴'; |
| 75 | + if (args.includes('C=M')) column = document.querySelector('th.indexcollastmod'); |
| 76 | + if (args.includes('C=S')) column = document.querySelector('th.indexcolsize'); |
| 77 | + if (args.includes('C=D')) column = document.querySelector('th.indexcoldesc'); |
| 78 | + if (column){ |
| 79 | + column.innerHTML = column.innerHTML + '<span class="sorticon">' + sortIcon + '</span>'; |
| 80 | + } |
| 81 | + } |
| 82 | + |
| 83 | + // table filtering |
68 | 84 | var tableFilter = (function(Arr) {
|
69 | 85 |
|
70 | 86 | var _input;
|
|
95 | 111 | // Go
|
96 | 112 | documentReady(function(){
|
97 | 113 | setTitle();
|
| 114 | + setSortIcon(); |
98 | 115 | tableFilter.init();
|
99 | 116 | });
|
100 | 117 |
|
|
0 commit comments