Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix URL display style #14

Merged
merged 1 commit into from Oct 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 1 addition & 39 deletions js/script.js
Expand Up @@ -7,7 +7,6 @@
* last modified: 9/24/2018
*/

getDownloads()

let localPdfCount = 0
let onlineCount = 0
Expand All @@ -18,42 +17,6 @@ let fileElement = document.getElementById('file-list') // offline (local) file l
loadSettings() // load the user settings
searchHistory()

function getDownloads () {
let pdfList = []
chrome.downloads.search({
finalUrlRegex: '.+.pdf$', // regex for .pdf files
limit: 500,
orderBy: ['-startTime']
},
(data) => {
data.forEach((page) => {
if (!pdfList.includes(page)) { // check if page already in list
pdfList.push(page) // add it to the array list

if (!(page.url).search('.pdf')) {
console.error('Pushed file to list which does not end in \'.pdf\'')
console.groupCollapsed('url')
console.error(`url: ${page.url}`)
console.groupEnd()
}
} else {
console.info(`Duplicate file not pushed to file list.`)
console.groupCollapsed('url')
console.info(page.url)
console.groupEnd()
}
})
console.info(`${pdfList.length} PDF files found.`)

pdfList.forEach((page) => {
if (page.finalUrl !== page.url) {
console.groupCollapsed(`page.url does not match page.finaUrl.`)
console.info(`url: ${page.url}\nfinalUrl: ${page.finalUrl}`)
console.groupEnd()
}
})
})
}

function searchHistory () {
chrome.history.search({
Expand Down Expand Up @@ -149,8 +112,7 @@ function searchDownloads () {

let linkUrl = document.createElement('p')
linkUrl.classList.add('link-url')
linkUrl.innerHTML =
file.filename.substring(0, file.filename.lastIndexOf('\\') + 1)
linkUrl.innerHTML = file.filename;

leftDiv.appendChild(icon)
leftDiv.appendChild(title)
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Expand Up @@ -30,4 +30,4 @@
"content_security_policy": "img-src data: chrome://favicon; script-src 'self'; object-src 'self'",
"offline_enabled": true,
"options_page": "src/options/options.html"
}
}
3 changes: 1 addition & 2 deletions src/browser_action/style.css
Expand Up @@ -67,7 +67,6 @@ body {

.list-div {
float: left;
height: 42px;
margin: 0;
overflow: hidden;
padding: 0 0px 0 0px;
Expand Down Expand Up @@ -194,4 +193,4 @@ li {
#count-display {
height: inherit;
margin: 0 0 0 3px;
}
}