Skip to content

Commit

Permalink
Update Logging (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
smashedr authored May 14, 2024
1 parent 2efe907 commit 352adbb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
17 changes: 7 additions & 10 deletions src/js/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,19 @@ function genUrl(url) {
* @function initLinks
*/
async function initLinks() {
console.log('initLinks:', urlParams)
console.debug('initLinks:', urlParams)
try {
const tabIds = urlParams.get('tabs')
const tabs = tabIds?.split(',')
console.log('tabs:', tabs)
console.debug('tabs:', tabs)
const selection = urlParams.has('selection')

const allLinks = []
if (tabs?.length) {
console.log('processing tabs:', tabs)
console.debug('processing tabs:', tabs)
// const tabId = parseInt(tabs[0])
for (const tabId of tabs) {
console.log('tabId:', tabId)
const action = selection ? 'selection' : 'all'
console.log('action:', action)
const links = await chrome.tabs.sendMessage(
parseInt(tabId),
action
Expand Down Expand Up @@ -97,11 +95,10 @@ async function initLinks() {
async function processLinks(links) {
console.debug('processLinks:', links)
const urlFilter = urlParams.get('filter')
// console.debug(`urlFilter: ${urlFilter}`)
const onlyDomains = urlParams.has('domains')
console.debug(`urlFilter: ${urlFilter}`)
console.debug(`onlyDomains: ${onlyDomains}`)
// console.debug(`onlyDomains: ${onlyDomains}`)
const { options } = await chrome.storage.sync.get(['options'])
console.debug('options:', options)

// Filter links by :// if not disabled by user
if (options.defaultFilter) {
Expand Down Expand Up @@ -201,7 +198,7 @@ function updateTable(data, selector) {
}

function dtDraw(event) {
console.debug('dtDraw:', event)
// console.debug('dtDraw:', event)
const tbody = event.target.children[3]
let length = tbody.rows.length
if (tbody.rows.length === 1) {
Expand Down Expand Up @@ -245,7 +242,7 @@ function downloadFileClick(event) {
let links = target?.innerText?.trim()
const name =
event.target.dataset.filename || target.dataset.filename || 'links.txt'
console.info('name', name)
console.log('name', name)
if (links) {
textFileDownload(name, links)
showToast('Download Started.')
Expand Down
2 changes: 1 addition & 1 deletion src/js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ async function deleteFilter(event, index = undefined) {
if (!index) {
const anchor = event.target.closest('a')
const filter = anchor?.dataset?.value
console.debug(`filter: ${filter}`)
console.log(`filter: ${filter}`)
if (filter && patterns.includes(filter)) {
index = patterns.indexOf(filter)
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ async function linksForm(event) {
})
} else if (event.submitter.id === 'open-text') {
let text = value.split(/\s+/).filter((s) => s !== '')
console.debug('text:', text)
// console.debug('text:', text)
text.forEach(function (url) {
// links without a : get prepended the web extension url by default
if (!url.includes(':')) {
Expand Down

0 comments on commit 352adbb

Please sign in to comment.