Skip to content

Commit

Permalink
Supress Inspections and Update Dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
smashedr committed Aug 27, 2024
1 parent 9f6b08e commit bc6648b
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 60 deletions.
102 changes: 56 additions & 46 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
"@fortawesome/fontawesome-free": "^6.6.0",
"bootstrap": "^5.3.3",
"clipboard": "^2.0.11",
"datatables.net": "^2.0.7",
"datatables.net-bs5": "^2.1.3",
"datatables.net": "^2.1.4",
"datatables.net-bs5": "^2.1.4",
"datatables.net-buttons": "^3.0.2",
"datatables.net-buttons-bs5": "^3.1.1",
"jquery": "^3.7.1",
"pdfjs-dist": "^4.5.136"
},
"devDependencies": {
"@types/chrome": "^0.0.268",
"@types/chrome": "^0.0.270",
"eslint": "^8.57.0",
"gulp": "^4.0.2",
"json-merger": "^1.1.10",
"prettier": "^3.3.3",
"puppeteer": "^22.15.0",
"puppeteer": "^23.2.0",
"web-ext": "^8.2.0"
}
}
3 changes: 3 additions & 0 deletions src/js/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ export function openURL(url, lazy = false) {
if (lazy) {
const lazyURL = new URL(chrome.runtime.getURL('/html/lazy.html'))
lazyURL.searchParams.append('url', url)
// noinspection JSIgnoredPromiseFromCall
chrome.tabs.create({ active: false, url: lazyURL.href })
} else {
// noinspection JSIgnoredPromiseFromCall
chrome.tabs.create({ active: false, url })
}
}
Expand Down Expand Up @@ -274,6 +276,7 @@ export function textFileDownload(filename, text) {
*/
export async function grantPerms(event, close = false) {
console.debug('grantPerms:', event)
// noinspection ES6MissingAwait
requestPerms()
if (close) {
window.close()
Expand Down
6 changes: 5 additions & 1 deletion src/js/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ document

const urlParams = new URLSearchParams(window.location.search)

// noinspection JSUnusedGlobalSymbols
const dtOptions = {
info: false,
processing: true,
Expand All @@ -42,6 +43,7 @@ const dtOptions = {
},
stateSave: false,
stateSaveParams: function (settings, data) {
// noinspection JSValidateTypes
data.search.search = ''
},
}
Expand Down Expand Up @@ -316,7 +318,8 @@ function copyLinksClick(event) {
const links = getTableLinks('#links-body')
// console.debug('links:', links)
if (links) {
navigator.clipboard.writeText(links).then()
// noinspection JSIgnoredPromiseFromCall
navigator.clipboard.writeText(links)
showToast('Links Copied', 'success')
} else {
showToast('No Links to Copy', 'warning')
Expand Down Expand Up @@ -374,6 +377,7 @@ function getTableLinks(selector) {
const table = document.querySelector(selector)
const urls = []
for (const row of table.rows) {
// noinspection JSUnresolvedReference
urls.push(row.cells[0].textContent.trim())
}
return urls.join('\n').trim()
Expand Down
4 changes: 4 additions & 0 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,22 @@ if (backToTop) {
})
}

// noinspection TypeScriptUMDGlobal
if (typeof ClipboardJS !== 'undefined') {
document
.querySelectorAll('.clip')
.forEach((el) =>
el.addEventListener('click', (e) => e.preventDefault())
)
// noinspection TypeScriptUMDGlobal
const clipboard = new ClipboardJS('.clip')
clipboard.on('success', function (event) {
// console.debug('clipboard.success:', event)
// const text = event.text
// console.debug(`text: "${text}"`)
// noinspection JSUnresolvedReference
if (event.trigger.dataset.toast) {
// noinspection JSUnresolvedReference
showToast(event.trigger.dataset.toast, 'success')
} else {
showToast('Copied to Clipboard', 'success')
Expand Down
3 changes: 3 additions & 0 deletions src/js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ const faGrip = document.querySelector('.d-none .fa-grip')
*/
async function initOptions() {
console.debug('initOptions')
// noinspection ES6MissingAwait
updateManifest()
// noinspection ES6MissingAwait
setShortcuts()
// noinspection ES6MissingAwait
checkPerms()
chrome.storage.sync.get(['options', 'patterns']).then((items) => {
console.debug('options:', items.options)
Expand Down
1 change: 1 addition & 0 deletions src/js/pdf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as pdfjsLib from '../dist/pdfjs/pdf.min.mjs'

// noinspection JSUnresolvedReference
pdfjsLib.GlobalWorkerOptions.workerSrc = '../dist/pdfjs/pdf.worker.min.mjs'

/**
Expand Down
2 changes: 2 additions & 0 deletions src/js/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ document
*/
async function initPermissions() {
console.debug('initPermissions')
// noinspection ES6MissingAwait
updateManifest()
// noinspection ES6MissingAwait
checkPerms()
const url = new URL(window.location)
const message = url.searchParams.get('message')
Expand Down
13 changes: 8 additions & 5 deletions src/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ document.addEventListener('DOMContentLoaded', initPopup)
document.getElementById('filter-form').addEventListener('submit', filterForm)
document.getElementById('links-form').addEventListener('submit', linksForm)
document.getElementById('links-text').addEventListener('input', updateLinks)
// noinspection JSCheckFunctionSignatures
document
.querySelectorAll('.grant-permissions')
.forEach((el) => el.addEventListener('click', (e) => grantPerms(e, true)))
Expand Down Expand Up @@ -45,6 +46,7 @@ const pdfIcon = document.getElementById('pdf-icon')
async function initPopup() {
console.debug('initPopup')
filterInput.focus()
// noinspection ES6MissingAwait
updateManifest()
chrome.storage.sync.get(['options', 'patterns']).then((items) => {
console.debug('options:', items.options)
Expand Down Expand Up @@ -282,19 +284,20 @@ function updateElements(el, length) {

/**
* Extract URLs from text
* TODO: Improve Function and Simplify Regular Expression
* @function extractURLs
* @param {String} text
* @return {Array}
*/
function extractURLs(text) {
// console.debug('extractURLs:', text)
const urls = []
let urlmatcharr
const urlregex =
let urlmatch
const regex =
/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()[\]{};:'".,<>?«»“”‘’]))/gi
while ((urlmatcharr = urlregex.exec(text)) !== null) {
while ((urlmatch = regex.exec(text)) !== null) {
try {
let match = urlmatcharr[0]
let match = urlmatch[0]
match = match.includes('://') ? match : `http://${match}`
// console.debug('match:', match)
const url = new URL(match)
Expand All @@ -309,7 +312,7 @@ function extractURLs(text) {
}
urls.push(data)
} catch (e) {
console.debug('Error Processing match:', urlmatcharr)
console.debug('Error Processing match:', urlmatch)
}
}
// return [...new Set(urls)]
Expand Down
Loading

0 comments on commit bc6648b

Please sign in to comment.