Skip to content

Commit

Permalink
Merge pull request #382 from adobe/sidekick-rc-bf6a6a5
Browse files Browse the repository at this point in the history
Sidekick Bookmarklet RC
  • Loading branch information
rofe authored Sep 28, 2023
2 parents bf6a6a5 + 1895525 commit 93f0450
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tools/sidekick/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
},
"description": "Exclude the plugin from these paths",
"examples": [
"/foo/bar",
"/foo/**"
"/foo/**",
"**/:x:**"
]
},
"id": {
Expand All @@ -44,8 +44,8 @@
},
"description": "Include the plugin on these paths (overrides excludePaths)",
"examples": [
"/foo/bar",
"/foo/bar/**"
"/foo/bar/**",
"**.docx**"
]
},
"isContainer": {
Expand Down
10 changes: 6 additions & 4 deletions tools/sidekick/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@
return true;
} else {
return [
'json',
'jpg',
'jpeg',
'png',
Expand Down Expand Up @@ -1571,7 +1572,8 @@
const isGrid = document.querySelector('div[class~="ms-TilesList"]');
return [...document.querySelectorAll('#appRoot [role="presentation"] div[aria-selected="true"]')]
.filter((row) => !row.querySelector('img')?.getAttribute('src').includes('/foldericons/')
&& !row.querySelector('img')?.getAttribute('src').endsWith('folder.svg'))
&& !row.querySelector('img')?.getAttribute('src').endsWith('folder.svg')
&& !row.querySelector('svg')?.parentElement.className.toLowerCase().includes('folder'))
.map((row) => ({
type: isGrid
? row.querySelector(':scope i[aria-label]')?.getAttribute('aria-label').trim()
Expand Down Expand Up @@ -1918,13 +1920,13 @@
} = cfg;
const condition = (s) => {
let excluded = false;
const { webPath } = s.status;
const pathSearchHash = s.location.href.replace(s.location.origin, '');
if (excludePaths && Array.isArray(excludePaths)
&& excludePaths.some((glob) => globToRegExp(glob).test(webPath))) {
&& excludePaths.some((glob) => globToRegExp(glob).test(pathSearchHash))) {
excluded = true;
}
if (includePaths && Array.isArray(includePaths)
&& includePaths.some((glob) => globToRegExp(glob).test(webPath))) {
&& includePaths.some((glob) => globToRegExp(glob).test(pathSearchHash))) {
excluded = false;
}
if (excluded) {
Expand Down

0 comments on commit 93f0450

Please sign in to comment.