Skip to content

Commit 66f3063

Browse files
extension improvements
1 parent e88a96f commit 66f3063

File tree

4 files changed

+22
-13
lines changed

4 files changed

+22
-13
lines changed

content.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
// initialize the header with the current directory name
2-
var header = document.getElementById("header");
1+
"use strict";
32

4-
// get the text of the header
5-
header.textContent = header.textContent.slice(9, -1);
3+
// Get header element and trim the text content
4+
const header = document.getElementById("header");
5+
header.textContent = header.textContent.trim();
66

7-
// if the title is empty, set it to ~
8-
if (header.textContent == "") {
7+
// Set the header text content to ~ if it is empty
8+
if (header.textContent === "") {
99
header.textContent = "~";
1010
}
1111

12-
// if there is something that has more then 40 characters, cut it off
13-
var a = document.querySelectorAll("a");
14-
for (strings in a) {
15-
if (a[strings].textContent.length > 40) {
16-
a[strings].textContent = a[strings].textContent.slice(0, 40) + "...";
17-
}
12+
// Set the width of the header to 100% in order to fill the space
13+
header.style.width = "100%";
14+
15+
// Set the length of the header to 65 characters
16+
if (header.textContent.length > 65) {
17+
header.textContent = header.textContent.slice(0, 65) + "...";
1818
}
19+
20+
// Shorten the text content of links that are too long
21+
const links = document.querySelectorAll("a");
22+
links.forEach((link) => {
23+
if (link.textContent.length > 60) {
24+
link.textContent = link.textContent.slice(0, 60) + "...";
25+
}
26+
});
File renamed without changes.

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
"name": "Better File Explorer for Chrome",
55

6-
"version": "1.0.0",
6+
"version": "2.0.0",
77

88
"description": "Better File Explorer for Chrome",
99

styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ h1 {
2323
padding-left: 5px;
2424
padding-right: 5px;
2525
white-space: nowrap;
26+
display: block !important;
2627
}
2728

2829
a:link {

0 commit comments

Comments
 (0)