From 392324b0d4229acee14b080b479b0065117ac062 Mon Sep 17 00:00:00 2001 From: SmAsHeD <6071159+smashedr@users.noreply.github.com> Date: Sat, 26 Oct 2024 22:19:10 -0700 Subject: [PATCH] Add Lazy Load Options (#107) --- README.md | 1 + assets/lazy-icon.png | Bin 0 -> 12290 bytes src/css/main.css | 24 ++++- src/css/permissions.css | 5 + src/html/lazy.html | 1 + src/html/links.html | 16 +-- src/html/options.html | 178 +++++++++++++++++++++++--------- src/html/permissions.html | 15 +-- src/html/popup.html | 43 ++++---- src/images/lazy/icon-black.png | Bin 0 -> 679 bytes src/images/lazy/icon-red.png | Bin 0 -> 771 bytes src/images/lazy/icon-white.png | Bin 0 -> 855 bytes src/images/lazy/icon-yellow.png | Bin 0 -> 805 bytes src/js/exports.js | 103 ++++++++++++++---- src/js/lazy.js | 35 ++++++- src/js/links.js | 2 +- src/js/main.js | 4 +- src/js/options.js | 93 +++++++++++------ src/js/popup.js | 6 +- src/js/service-worker.js | 24 +++-- 20 files changed, 391 insertions(+), 159 deletions(-) create mode 100644 assets/lazy-icon.png create mode 100644 src/css/permissions.css create mode 100644 src/images/lazy/icon-black.png create mode 100644 src/images/lazy/icon-red.png create mode 100644 src/images/lazy/icon-white.png create mode 100644 src/images/lazy/icon-yellow.png diff --git a/README.md b/README.md index d61306f..889152e 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=cssnr_link-extractor&metric=alert_status&label=quality)](https://sonarcloud.io/summary/overall?id=cssnr_link-extractor) [![GitHub Last Commit](https://img.shields.io/github/last-commit/cssnr/link-extractor?logo=github&logoColor=white&label=updated)](https://github.com/cssnr/link-extractor/graphs/commit-activity) [![GitHub Top Language](https://img.shields.io/github/languages/top/cssnr/link-extractor?logo=htmx&logoColor=white)](https://github.com/cssnr/link-extractor) +[![GitHub Org Stars](https://img.shields.io/github/stars/cssnr?style=flat&logo=github&logoColor=white&label=org%20stars)](https://cssnr.github.io/) [![Discord](https://img.shields.io/discord/899171661457293343?logo=discord&logoColor=white&label=discord&color=7289da)](https://discord.gg/wXy6m2X8wY) # Link Extractor diff --git a/assets/lazy-icon.png b/assets/lazy-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..7d71841d871c02f9fe2cd1a50022262ffbebc6cf GIT binary patch literal 12290 zcmd^li93|t8}KtTmLw!0#=eXwTVvlV%M7Nh71<*DnysM0_7 z29b3lF$tr{Wc?oR`}_Wg@A|H5=9*{Dxu5&o+d1dn5-l#6a2ysq3;+NJ7Gr1y0C4CL z4jf{Ee%A5BThI?%5XLS9065zYzOc@~^6Su`K&a7`Q0qXC(3{tS-GQ4oZz^~P_=dP$ z3vyQo4ED@l(GdgyF#v0L)&^g&Jax0l-8N=_ZS!~;_$i8~LK2s!nu0g-GaTMIj`K^j z#2(Rib4|%J)aB>lNkLhbN(dr-QoLN-j~R)TxIR9K%XlQ)%Ate?*LQ0B!xY+7$g;t^m##(=i3MRRtdGL}oQHHf7DQ~6U#8H@;z&;|bc>Lq_BBO{)APlfrS0VF9dbfjayP! zN_!)V!lP-f{lSPRw4xbFD%DejE}XYb7wys(#QQ^7g!avUi|$F%ROwp~IO@&=Msutu zTnbw?GI9@Cfb$~~jQP*yvEe;Kx#gzMQFc$~Ba#Vy#=CJ>VIju5zZ!(*KFJ}!ft zdMqdGkIXV3En&x{kvVO}v%Z1+P+f6(;S6wFaDkDGUs=S-q`Jl7< zr_P@u!NaOx8h1n8EU|aif(`C9!V3+yYV=$7!_ImcCA~;fF$;pxW2h5k6G7>QPnPY~ zI}1s~zN>%^0unX{hDR~Q? zn4jjk5g96{=zJ7KF2{W3d-m>%vokgn$>TFWp2u5sHdMD8p$QJVnnxQ zI(`45o;#dvxwa`L<-T;j{jHr%rqc)_tD<%7{7m*eUu;h4eQFHC>QbTE4${!pd&wMJ zA)AOQ%EYFm3P_E@;}XyaD?T+zd6wh59Tv9ZV@#)|recJ38#`=rGkch}#oS#kgu-B- zvsS1vrlI1z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5= zxSy%%bd3}iA?FYEN-0&|&&-gja5MFR2R!pW0?|*lQeZ7`90fk!CP-Bzo7$aTytN4N z=umC;ZnbtO5BupW%vr-|k^aWHw=w7V+naT>F<* z*YhBW9T#GoG>;M8>me?v{_%kZvX_~nQ-A31C^B(+(Zet#vH+etNIpJ}J_9Q_((BzA z4JpMsgqQ=&z&*-Wk>;Lzf%(E-^5wm%P8ohTHRiXZU0Bdx?u= + diff --git a/src/html/links.html b/src/html/links.html index c65cffb..041cc4d 100644 --- a/src/html/links.html +++ b/src/html/links.html @@ -188,19 +188,19 @@ More Info - +
- - - + +
+ +
- - Remove Duplicate Links +
- - Use Default Link Filtering +
- - Save Links Page Options +
- - Truncate Long Links +
- - Don't Wrap Long Links +
-
- - Enable Right Click Menu +
- - Show Update Release Notes +
- +

More about Options @@ -154,7 +232,7 @@

Link Extractor

@@ -181,7 +259,7 @@

Link Extractor

- +

Copy Support Information for issue reporting. @@ -196,32 +274,30 @@

Link Extractor

FAQ - Report Issue - - + - + +
-
+ -
+
+ +
- - - +
diff --git a/src/html/permissions.html b/src/html/permissions.html index 14d3da5..86f2882 100644 --- a/src/html/permissions.html +++ b/src/html/permissions.html @@ -8,14 +8,15 @@ + -
+
-
-
+
+
Auto Auth @@ -53,7 +54,7 @@

Link Extractor

FAQ - Get Support
@@ -69,11 +70,11 @@

Link Extractor

-
- diff --git a/src/html/popup.html b/src/html/popup.html index 5a22e7e..3722bee 100644 --- a/src/html/popup.html +++ b/src/html/popup.html @@ -60,22 +60,28 @@
+
+ + +
Browser does not allow access to files.
+
PDF files require file access.
+
PDF extraction needs host permissions.
@@ -97,38 +103,38 @@
- - Lazy Load Opened Tabs +
- - Remove Duplicate Links +
- - Use Default Link Filtering +
- - Save Links Page Options +
- - Truncate Long Links +
- - Don't Wrap Long Links +
@@ -143,23 +149,18 @@ More Options - - - - -
-
+
-
- diff --git a/src/images/lazy/icon-black.png b/src/images/lazy/icon-black.png new file mode 100644 index 0000000000000000000000000000000000000000..2a55a272661f4a43e6e88fab1ea4341a17e97bd4 GIT binary patch literal 679 zcmV;Y0$BZtP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!Ts>4;qhnMk7HKA`*#;LMXhhf=aZPC{$DuJwJd-6#M{DC}`+B3S6)F3liMoHeQWa zu-4r3-R#+S&zU)so1vJMteiRf>^=KC`+WORjT!T=SyEqv#dra?;~NV`%^v(yd(nb~ z^>`9*;8T2$U+^n_z-Q<)>sWUvmg7q-1+g1HVmxc|C*H+_*qXJt5J7|waVHkZb3lIJ zR@~dUtE&C=^)XK41Kfny@G9QK*SHk7V2)*HW`9;s(4cy<67OOD7MkZoi39i!OYQYO zuEHYg@D-LChItT&@HlSh+|A$mrHbJczDVv%L0E1OfjJZPOWLP>SLf=2CePy<>=%S15ud|0>3@{8?`kF~=;bk# z6PT8lf-ooKD5iBw&baip;dgxvE@1>=0#D%Q&Rq)z{RHChI?Va=bR>d-KfxeLXhH>- zu~a7y!Z}~67tST2I3>~qE9smUrh?^=rU&FDMc!e6)#^XE1`g$CiS>6>iB!?*)C zqPT(ieIH?LU~lm(e#3!q3$MwYWO-cp~=?nk> N002ovPDHLkV1f^xGHU<; literal 0 HcmV?d00001 diff --git a/src/images/lazy/icon-red.png b/src/images/lazy/icon-red.png new file mode 100644 index 0000000000000000000000000000000000000000..3b450f7a9bfe5ba758a8de0d68820c0f667ea5a6 GIT binary patch literal 771 zcmV+e1N{7nP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!TleK~z{r?Up}J z6j2n#F9@X)i5A+JU~8+5F|n|5r4T!$#l%>fsD-gH!4F`t<~vwu111)T2_k$7%o1Zn z!6n zn+tp~JB6^>me~Sag>~3)ZozkOftXug%}#sT{_xA}C`HzDBJf>;+rih3)M&w%t=_V#BL~N*+ zhnK)`49ELiLdsYKdBvW9+H}wG7bE7nmgdD&FZC>nU>L^mJPnG8e=Qc66X9|5ZZ_5{ zAwEa-d_-?!gm-fRF}2A)m#3qv2-t$f<4{gqBS-a?(oZ>OOqxx3(V4`)O9U~~y4LB4 zV{=sRVPY#^6a)s);}1s6?gbGPdd-iX{kE=qhQ^R8OQ~@xR^x@O)E`eGKsjk#O7$)_ zAw{b;;fmMQH0ECUpr=Eb>N3$^!x*kIkt|^xFs6V|( zdJ%2p5=8u)-^|W>c=0&2;o!|!e3c0GP%jVZ1dee6mg0n%_&(5J(!<+Gk0|S`2<(gM z;jTOg)QIN@Y=(j<@xRq3=lGWWN-|Tm@bF8y_qHjnyCcPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!T8%84=#7^x#ynqpL6frBr##ae?_TO%Jh1@*WGUSg_
2UcAAGOqvhk=? zDrY2+YVe5QP4l#tPDO&BNt|s2Eiz1Lh|wsQ%NHU<%#SL7=# z!Q4*0UO%VqUK)+YMR)0g@Qc7-D)5BFSJjlLR;$-Ybf`;)V9kN#Qg<6lbe4%d^@+r{ z9eI)+(M;M$#xr84+zaX+h~$!-RuIN%3|sb8Fa(#+?pUB(1j+6ZtSNR8q2>h7p=UzS zoaqDyXw^1_BZrK=J0Bt9E(xtlINKp>)HM|1t%}kk9f!hce=I>sx}qiv-*!BZSOi^` zv8++IP{e<{OM*PwTVyhsXO4(eDz!zxdB!zsa#W-YDkv06ye7Ujf=B8*Lq#^?DuG|=41B0{!# zi=jg|3UMNm+Q%Y)v(o8wp2yo>Bnf>T`wt$Aw9knClFep6;D1BbvPJJ0 zKbPk}3Ps71a7u?B{0Eb-CQ!h*SFr~w(c$g;I`ojs<;qlTj>EaHrc>JgU3mG^Y{~sX hp%7T93ICWx;up5Kd(qPi00000002ovPDHLkV1m(HjBWq` literal 0 HcmV?d00001 diff --git a/src/images/lazy/icon-yellow.png b/src/images/lazy/icon-yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..2496a82c7ff032b21d504cf9d275ae6cc74fc401 GIT binary patch literal 805 zcmV+=1KRwFP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!T~tE2^QLb2?byx2>t{c z%o1Yw2piZBpSe4SoIM=&E-D*~o#f3ucjld$_s%`%?n=*k_Fq|}A^B=mUV^9Q>aHCg z${j>B6s%vHJGI?i8A8~jT1{rbS5O8O!zNe(vv3~o?a3ueJDt_*(od1KmXJz6B;XK4SKiR<-agxC)k-rhkSEz8r3>v-F2wa44H2N4q5!{dR^b_P> zF&9L+njvCcdl|iHIEnfZVcKxft&fEfat7l*VGCHdG16ci7ar@cfX_e9h;6JR2D+Vsazee zjya6`lW?XvAuojXW+e$lvo_(f)zxXt#5kb{c%NfD2kWVCKxAu621sao3`rPKF6%xO zku?e8Cw{iI7qR9sbcRDeMC-8x1@VpjeYs}z^mXWl0}p)hSt7KD_A*MV5g3Fp?m z_LByqMnAIfh_a4~z(1!wEEG40I^t=FRaY#kY2G1(_iEYxDn55XB&u_&ATIlar%ubFGWuHChAS^D`; jc$+Dl*~9kiFHGb&BoMfk>F-fZ00000NkvXXu0mjf4Z>x~ literal 0 HcmV?d00001 diff --git a/src/js/exports.js b/src/js/exports.js index e3d740e..24cb594 100644 --- a/src/js/exports.js +++ b/src/js/exports.js @@ -91,32 +91,74 @@ export async function injectTab({ * @param {Object} options */ export function updateOptions(options) { - for (const [key, value] of Object.entries(options)) { - // console.debug(`${key}: ${value}`) + console.debug('updateOptions:', options) + for (let [key, value] of Object.entries(options)) { + // console.debug(`%c${key}: %c${value}`) + if (typeof value === 'undefined') { + console.warn('Value undefined for key:', key) + continue + } + // Option Key should be `radioXXX` and values should be the option IDs + if (key.startsWith('radio')) { + key = value //NOSONAR + value = true //NOSONAR + } const el = document.getElementById(key) - if (el) { - if (typeof value === 'boolean') { - el.checked = value - } else { - el.value = value - } - el.classList.remove('is-invalid') + if (!el) { + continue + } + if (el.tagName !== 'INPUT') { + el.textContent = value.toString() + } else if (typeof value === 'boolean') { + el.checked = value + } else { + el.value = value + } + if (el.dataset.related) { + hideShowElement(`#${el.dataset.related}`, value) } } } +/** + * Hide or Show Element with JQuery + * @function hideShowElement + * @param {String} selector + * @param {Boolean} [show] + * @param {String} [speed] + */ +function hideShowElement(selector, show, speed = 'fast') { + const element = $(`${selector}`) + // console.debug('hideShowElement:', show, element) + if (show) { + element.show(speed) + } else { + element.hide(speed) + } +} + /** * Save Options Callback + * NOTE: Look into simplifying this function * @function saveOptions * @param {InputEvent} event */ -export async function saveOptions(event) { +export async function saveOptions(event) /* NOSONAR */ { console.debug('saveOptions:', event) - const { options } = await chrome.storage.sync.get(['options']) - let key = event.target?.id + // console.debug('%c ----- targets -----', 'color: Yellow') + // console.debug('event.currentTarget:', event.currentTarget) + // // console.debug('target:', target) + // console.debug('event.target:', event.target) + // console.debug('%c ----- targets -----', 'color: Yellow') + // target = event.currentTarget || target || event.target + const target = event.currentTarget || event.target + console.debug('target:', target) + let key = target.id + // console.debug('key:', key) let value - if (['flags', 'reset-default'].includes(event.target.id)) { - key = 'flags' + const { options } = await chrome.storage.sync.get(['options']) + if (key === 'flags') { + // key = 'flags' /** @type {HTMLInputElement} */ const element = document.getElementById(key) let flags = element.value.toLowerCase().replace(/\s+/gm, '').split('') @@ -132,17 +174,40 @@ export async function saveOptions(event) { } element.value = flags value = flags - } else if (event.target.id === 'linksDisplay') { - value = parseInt(event.target.value) - } else if (event.target.type === 'checkbox') { - value = event.target.checked + // } else if (key.startsWith('reset-')) { + // key = target.dataset.target + // console.debug('key reset-:', key) + // /** @type {HTMLInputElement} */ + // const element = document.getElementById(key) + // console.debug('element:', element) + // element.value = target.dataset.value + // value = target.dataset.value + } else if (target.dataset.target) { + key = target.dataset.target + console.debug('key dataset.target:', key) + const element = document.getElementById(key) + value = element.value + } else if (target.type === 'radio') { + key = target.name + console.debug('key radio:', key) + const radios = document.getElementsByName(key) + for (const input of radios) { + if (input.checked) { + value = input.id + break + } + } + } else if (target.type === 'checkbox') { + value = target.checked } else { - value = event.target.value + value = target.value } if (value !== undefined) { options[key] = value console.log(`Set %c${key}:`, 'color: Khaki', value) await chrome.storage.sync.set({ options }) + } else { + console.warn(`No Value for key: ${key}`) } } diff --git a/src/js/lazy.js b/src/js/lazy.js index 50bc9a7..99bc5e9 100644 --- a/src/js/lazy.js +++ b/src/js/lazy.js @@ -3,12 +3,37 @@ const searchParams = new URLSearchParams(window.location.search) const url = new URL(searchParams.get('url')) -document.title = `${url.host}${url.pathname}` +// document.title = `${url.host}${url.pathname}` +// const link = document.createElement('link') +// link.rel = 'icon' +// link.href = `${url.origin}/favicon.ico` +// document.head.appendChild(link) -const link = document.createElement('link') -link.rel = 'icon' -link.href = `${url.origin}/favicon.ico` -document.head.appendChild(link) +chrome.storage.sync.get(['options']).then((items) => { + console.debug('options:', items.options) + // if (items.options.lazyFavicon) { + // const urlPath = `${url.host}${url.pathname}` + let title = items.options.lazyTitle + title = title.replaceAll('{host}', url.host) + title = title.replaceAll('{pathname}', url.pathname) + console.debug('title:', title) + document.title = title + // } + if (items.options.lazyFavicon) { + // const link = document.createElement('link') + const link = document.querySelector('link[rel="icon"]') + console.debug('link:', link) + // link.rel = 'icon' + if (items.options.radioFavicon === 'default') { + link.href = `${url.origin}/favicon.ico` + } else { + const path = `/images/lazy/${items.options.radioFavicon}.png` + link.href = chrome.runtime.getURL(path) + } + console.debug('link.href:', link.href) + // document.head.appendChild(link) + } +}) let theme = localStorage.getItem('theme') if (!theme || theme === 'auto') { diff --git a/src/js/links.js b/src/js/links.js index d4ee926..2e64a17 100644 --- a/src/js/links.js +++ b/src/js/links.js @@ -210,7 +210,7 @@ async function initLinks() { /** * Process Links - * TODO: Cleanup this function + * NOTE: Look into simplifying this function * @function processLinks * @param {Array} links */ diff --git a/src/js/main.js b/src/js/main.js index 1b9b5ff..ec73aef 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -36,7 +36,7 @@ if (typeof ClipboardJS !== 'undefined') { }) } -$('.form-control').on('focus change input', function () { +$('.form-control').on('change input', function () { $(this).removeClass('is-invalid') }) @@ -63,7 +63,7 @@ function onScroll() { */ function showToast(message, type = 'primary') { console.debug(`showToast: ${type}: ${message}`) - const clone = document.querySelector('.d-none .toast') + const clone = document.querySelector('#clones .toast') const container = document.getElementById('toast-container') if (!clone || !container) { return console.warn('Missing clone or container:', clone, container) diff --git a/src/js/options.js b/src/js/options.js index 9342815..afada34 100644 --- a/src/js/options.js +++ b/src/js/options.js @@ -26,7 +26,6 @@ document.addEventListener('blur', filterClick) document.addEventListener('click', filterClick) document.getElementById('update-filter').addEventListener('submit', filterClick) document.getElementById('filters-form').addEventListener('submit', addFilter) -document.getElementById('reset-default').addEventListener('click', resetForm) document.getElementById('copy-support').addEventListener('click', copySupport) document .querySelectorAll('.revoke-permissions') @@ -34,6 +33,12 @@ document document .querySelectorAll('.grant-permissions') .forEach((el) => el.addEventListener('click', grantPerms)) +document + .querySelectorAll('[data-reset-input]') + .forEach((el) => el.addEventListener('click', resetInput)) +document + .querySelectorAll('[data-insert-input]') + .forEach((el) => el.addEventListener('click', insertInput)) document .querySelectorAll('#options-form input, select') .forEach((el) => el.addEventListener('change', saveOptions)) @@ -54,8 +59,6 @@ document.getElementById('import-data').addEventListener('click', importClick) document.getElementById('import-input').addEventListener('change', importChange) const filtersTbody = document.querySelector('#filters-table tbody') -const faTrash = document.querySelector('.d-none .fa-trash-can') -const faGrip = document.querySelector('.d-none .fa-grip') /** * DOMContentLoaded - Initialize Options @@ -78,7 +81,7 @@ async function initOptions() { // noinspection ES6MissingAwait checkPerms() chrome.storage.sync.get(['options', 'patterns']).then((items) => { - console.debug('options:', items.options) + // console.debug('options:', items.options) updateOptions(items.options) updateTable(items.patterns) }) @@ -90,6 +93,8 @@ async function initOptions() { * @param {Object} data */ function updateTable(data) { + const faTrash = document.querySelector('#clones > .fa-trash-can') + const faGrip = document.querySelector('#clones > .fa-grip') filtersTbody.innerHTML = '' data.forEach((value, i) => { const row = filtersTbody.insertRow() @@ -128,7 +133,6 @@ function updateTable(data) { grip.title = 'Drag' cell3.appendChild(grip) cell3.setAttribute('draggable', 'true') - cell3.addEventListener('dragstart', dragStart) }) filtersTbody.addEventListener('dragover', dragOver) @@ -148,7 +152,7 @@ async function addFilter(event) { const input = event.target.elements['add-filter'] const filter = input.value if (filter) { - console.log(`filter: ${filter}`) + console.debug('%cfilter:', 'color: Lime', filter) const { patterns } = await chrome.storage.sync.get(['patterns']) if (!patterns.includes(filter)) { patterns.push(filter) @@ -174,7 +178,7 @@ async function deleteFilter(event, index = undefined) { console.debug('deleteFilter:', index, event) event.preventDefault() const filter = event.currentTarget?.dataset?.value - console.debug('filter:', filter) + console.debug('%cfilter:', 'color: Yellow', filter) const { patterns } = await chrome.storage.sync.get(['patterns']) // console.debug('patterns:', patterns) if (!index) { @@ -196,17 +200,48 @@ async function deleteFilter(event, index = undefined) { } /** - * Reset Options Form Click Callback - * @function resetForm + * Reset Title Input Callback + * @function resetInput * @param {InputEvent} event */ -async function resetForm(event) { - console.debug('resetForm:', event) +async function resetInput(event) { + console.debug('resetInput:', event) + const target = event.currentTarget + console.debug('target:', target) event.preventDefault() - const input = document.getElementById('flags') - input.value = 'ig' + const input = document.getElementById(target.dataset.resetInput) + console.debug('input:', input) + input.value = target.dataset.value input.classList.remove('is-invalid') input.focus() + const changeEvent = new Event('change') + input.dispatchEvent(changeEvent) +} + +/** + * Insert Value into Input Callback + * @function insertInput + * @param {InputEvent} event + */ +async function insertInput(event) { + console.debug('insertInput:', event) + const target = event.currentTarget + event.preventDefault() + console.debug('target:', target) + const id = target.dataset.target + console.debug('id:', id) + const value = target.dataset.value + console.debug('value:', value) + const input = document.getElementById(id) + console.debug('input:', input) + const pos = input.selectionStart + console.debug('pos:', pos) + const cur = input.value + console.debug('cur:', cur) + input.value = [cur.slice(0, pos), value, cur.slice(pos)].join('') + const newPos = pos + value.length + input.focus() + input.setSelectionRange(newPos, newPos) await saveOptions(event) } @@ -220,7 +255,7 @@ let last = -1 * @param {MouseEvent} event */ async function dragStart(event) { - console.debug('dragStart:', event) + console.debug('%cdragStart:', 'color: Aqua', event) // editing = false await filterClick(event) row = event.target.closest('tr') @@ -258,7 +293,7 @@ function dragEnd() { } async function drop(event) { - console.debug('drop:', event) + console.debug('%cdrop:', 'color: Lime', event) // if (event.target.tagName === 'INPUT') { // return // } @@ -266,14 +301,14 @@ async function drop(event) { const tr = event.target.closest('tr') if (!row || !tr) { row = null - return console.debug('row or tr undefined') + return console.debug('%crow or tr undefined', 'color: Yellow') } tr.classList?.remove('table-group-divider') last = -1 // console.debug(`row.id: ${row.id} - tr.id: ${tr.id}`) if (row.id === tr.id) { row = null - return console.debug('return on same row drop') + return console.debug('%creturn on same row drop', 'color: Yellow') } filtersTbody.removeChild(row) filtersTbody.insertBefore(row, tr) @@ -331,7 +366,7 @@ let editing = false async function filterClick(event) { // console.debug('filterClick:', event) if (event.type === 'submit') { - // TODO: The submit event is also triggering a click event + // NOTE: The submit event is also triggering a click event return event.preventDefault() } if (event.target?.classList?.contains('filter-edit')) { @@ -340,7 +375,7 @@ async function filterClick(event) { let deleted let previous = editing if (editing !== false) { - console.info(`-- saving: ${editing}`) + console.log(`%c-- saving: ${editing}`, 'color: DeepPink') deleted = await saveEditing(event, editing) editing = false } @@ -351,7 +386,7 @@ async function filterClick(event) { if (deleted && parseInt(td.dataset.idx) > parseInt(previous)) { idx -= 1 } - console.info(`-- editing: ${idx}`) + console.log(`%c-- editing: ${idx}`, 'color: DeepPink') editing = idx beginEditing(event, editing) } @@ -367,9 +402,9 @@ async function filterClick(event) { async function saveEditing(event, idx) { event.preventDefault() // block dragStart if editing const td = document.getElementById(`td-filter-${idx}`) - console.debug(`saveEditInput: ${idx}`, event, td) + console.debug(`%csaveEditInput: ${idx}`, 'color: SpringGreen', event, td) if (!td) { - console.info(`TD Not Found: #td-filter-${idx}`) + console.log(`%cTD Not Found: #td-filter-${idx}`, 'color: OrangeRed') return false } @@ -384,13 +419,13 @@ async function saveEditing(event, idx) { const { patterns } = await chrome.storage.sync.get(['patterns']) // console.debug('patterns:', patterns) if (value === patterns[idx]) { - console.info(`-- unchanged: ${idx}`) + console.log(`%c-- unchanged: ${idx}`, 'color: DeepPink') } else if (patterns.includes(value)) { showToast('Filter Already Exists!', 'warning') console.debug('Value Already Exists!') value = patterns[idx] } else { - console.info( + console.log( `Updated idx "${idx}" from "${patterns[idx]}" to "${value}"` ) patterns[idx] = value @@ -412,14 +447,14 @@ function beginEditing(event, idx) { const td = document.getElementById(`td-filter-${idx}`) console.debug(`addEditInput: ${idx}`, event, td) if (!td) { - return console.info(`TD Not Found: #td-filter-${idx}`) + return console.log(`%cNot Found: #td-filter-${idx}`, 'color: Yellow') } const link = td.querySelector('a') const value = link.textContent console.log('value:', value) - const input = document.querySelector('.d-none input').cloneNode() + const input = document.querySelector('#clones > input').cloneNode() input.value = value input.dataset.idx = idx @@ -446,17 +481,15 @@ async function setShortcuts(names, selector = '#keyboard-shortcuts') { const table = parent.querySelector('table') console.log('table:', table) const tbody = table.querySelector('tbody') - const source = table.querySelector('tfoot > tr').cloneNode(true) - // console.log('source:', source) const commands = await chrome.commands.getAll() // console.log('commands:', commands) for (const name of names) { const command = commands.find((x) => x.name === name) - console.debug('command:', command) + // console.debug('command:', command) if (!command) { console.warn('Command Not Found:', command) } - const row = source.cloneNode(true) + const row = table.querySelector('tfoot > tr').cloneNode(true) let description = command.description // Note: Chrome does not parse the description for _execute_action in manifest.json if (!description && command.name === '_execute_action') { diff --git a/src/js/popup.js b/src/js/popup.js index 8168aaa..3f09ff5 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -145,14 +145,14 @@ async function extractPDF(event) { function createFilterLink(number, value = '') { const ul = document.getElementById('filters-ul') const li = document.createElement('li') - ul.appendChild(li) const a = document.createElement('a') a.textContent = value a.dataset.pattern = value - a.classList.add('dropdown-item', 'small', 'text-break') + a.classList.add('dropdown-item', 'small', 'text-ellipsis') a.setAttribute('role', 'button') a.addEventListener('click', filterForm) li.appendChild(a) + ul.appendChild(li) } /** @@ -294,7 +294,7 @@ function extractURLs(text) { const urls = [] 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 + /\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 // NOSONAR while ((urlmatch = regex.exec(text)) !== null) { try { let match = urlmatch[0] diff --git a/src/js/service-worker.js b/src/js/service-worker.js index 9278fc4..f1d47ef 100644 --- a/src/js/service-worker.js +++ b/src/js/service-worker.js @@ -24,6 +24,9 @@ async function onInstalled(details) { linksDisplay: -1, flags: 'ig', lazyLoad: true, + lazyFavicon: true, + lazyTitle: '[{host}{pathname}]', + radioFavicon: 'default', removeDuplicates: true, defaultFilter: true, saveState: true, @@ -51,7 +54,7 @@ async function onInstalled(details) { } } checkPerms().then((hasPerms) => { - if (hasPerms) { + if (hasPerms /* NOSONAR */) { onAdded() } else { onRemoved() @@ -153,7 +156,7 @@ async function onCommand(command, tab) { // await injectCopyLinks(tab) await injectTab({ open: false }) const { options } = await chrome.storage.sync.get(['options']) - await injectFunction(copyLinks, [options.removeDuplicates, true]) + await injectFunction(copyLinks, [options.removeDuplicates]) } else if (command === 'copySelection') { console.debug('copySelection') // await injectCopyLinks(tab, true) @@ -172,26 +175,29 @@ async function onCommand(command, tab) { * @param {Object} changes * @param {String} namespace */ -async function onChanged(changes, namespace) { +async function onChanged(changes, namespace) /* NOSONAR */ { // console.debug('onChanged:', changes, namespace) for (const [key, { oldValue, newValue }] of Object.entries(changes)) { if (namespace === 'sync' && key === 'options') { if (oldValue?.contextMenu !== newValue?.contextMenu) { if (newValue?.contextMenu) { - console.log('Enabled contextMenu...') + console.log('contextMenu: %cEnabling.', 'color: Lime') + // chrome.storage.sync + // .get(['patterns']) + // .then((items) => createContextMenus(items.patterns)) const { patterns } = await chrome.storage.sync.get([ 'patterns', ]) createContextMenus(patterns) } else { - console.log('Disabled contextMenu...') + console.log('contextMenu: %cDisabling.', 'color: OrangeRed') chrome.contextMenus.removeAll() } } } else if (namespace === 'sync' && key === 'patterns') { const { options } = await chrome.storage.sync.get(['options']) if (options?.contextMenu) { - console.log('Updating Context Menu Patterns...') + console.log('contextMenu: %cUpdating Patterns.', 'color: Aqua') createContextMenus(newValue) } } @@ -347,7 +353,7 @@ function copyActiveElementText(ctx) { // noinspection JSIgnoredPromiseFromCall navigator.clipboard.writeText(text) } else { - console.log('No Text to Copy.', 'color: Yellow') + console.log('%cNo Text to Copy.', 'color: Yellow') } } @@ -380,7 +386,7 @@ function copyLinks(removeDuplicates, selection = false) { // noinspection JSIgnoredPromiseFromCall navigator.clipboard.writeText(text) } else { - console.info('No Links to Copy.') + console.log('%cNo Links to Copy.', 'color: Yellow') } } @@ -428,7 +434,7 @@ async function setDefaultOptions(defaultOptions) { // patterns if (!patterns) { - console.info('Set patterns to empty array.') + console.log('Init patterns to empty array.') patterns = [] await chrome.storage.sync.set({ patterns }) }