Skip to content

Commit

Permalink
extension improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
federicobrancasi committed Mar 10, 2023
1 parent e88a96f commit 66f3063
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
32 changes: 20 additions & 12 deletions content.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
// initialize the header with the current directory name
var header = document.getElementById("header");
"use strict";

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

// if the title is empty, set it to ~
if (header.textContent == "") {
// Set the header text content to ~ if it is empty
if (header.textContent === "") {
header.textContent = "~";
}

// if there is something that has more then 40 characters, cut it off
var a = document.querySelectorAll("a");
for (strings in a) {
if (a[strings].textContent.length > 40) {
a[strings].textContent = a[strings].textContent.slice(0, 40) + "...";
}
// Set the width of the header to 100% in order to fill the space
header.style.width = "100%";

// Set the length of the header to 65 characters
if (header.textContent.length > 65) {
header.textContent = header.textContent.slice(0, 65) + "...";
}

// Shorten the text content of links that are too long
const links = document.querySelectorAll("a");
links.forEach((link) => {
if (link.textContent.length > 60) {
link.textContent = link.textContent.slice(0, 60) + "...";
}
});
File renamed without changes
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

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

"version": "1.0.0",
"version": "2.0.0",

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

Expand Down
1 change: 1 addition & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ h1 {
padding-left: 5px;
padding-right: 5px;
white-space: nowrap;
display: block !important;
}

a:link {
Expand Down

0 comments on commit 66f3063

Please sign in to comment.