forked from Ray-D-Song/web-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Ray-D-Song#53 from Ray-D-Song/firefox
support firefox
- Loading branch information
Showing
9 changed files
with
428 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
{ | ||
"name": "web-archive", | ||
"author": "Ray-D-Song", | ||
"icons": { | ||
"16": "assets/icon.png", | ||
"48": "assets/icon.png", | ||
"64": "assets/icon.png", | ||
"128": "assets/icon.png" | ||
}, | ||
"description": "SingleFile with categories and exhibition pages", | ||
"version": "0.1.1", | ||
"manifest_version": 3, | ||
"action": { | ||
"default_icon": "assets/icon.png", | ||
"default_popup": "popup/index.html" | ||
}, | ||
"host_permissions": [ | ||
"<all_urls>" | ||
], | ||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"<all_urls>" | ||
], | ||
"run_at": "document_start", | ||
"js": [ | ||
"lib/browser-polyfill.min.js", | ||
"lib/single-file-frames.js", | ||
"lib/single-file-extension-frames.js" | ||
], | ||
"all_frames": true, | ||
"match_about_blank": true, | ||
"match_origin_as_fallback": true | ||
}, | ||
{ | ||
"matches": [ | ||
"<all_urls>" | ||
], | ||
"run_at": "document_start", | ||
"js": [ | ||
"lib/single-file-hooks-frames.js" | ||
], | ||
"all_frames": true, | ||
"match_about_blank": true, | ||
"match_origin_as_fallback": true, | ||
"world": "MAIN" | ||
}, | ||
{ | ||
"matches": [ | ||
"<all_urls>" | ||
], | ||
"run_at": "document_start", | ||
"js": [ | ||
"lib/browser-polyfill.min.js", | ||
"lib/single-file-bootstrap.js" | ||
], | ||
"all_frames": false | ||
}, | ||
{ | ||
"matches": [ | ||
"<all_urls>" | ||
], | ||
"js": [ | ||
"lib/browser-polyfill.min.js", | ||
"contentScripts/main.js" | ||
] | ||
} | ||
], | ||
"background": { | ||
"scripts": ["background/background.js"], | ||
"type": "module" | ||
}, | ||
"permissions": [ | ||
"activeTab", | ||
"storage", | ||
"tabs", | ||
"scripting" | ||
], | ||
"web_accessible_resources": [ | ||
{ | ||
"matches": [ | ||
"<all_urls>" | ||
], | ||
"resources": [ | ||
"lib/single-file-hooks-frames.js", | ||
"lib/browser-polyfill.min.js", | ||
"contentScripts/content.js", | ||
"chunks/*" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import * as React from 'react' | ||
import { Check, ChevronDown } from 'lucide-react' | ||
|
||
import { cn } from '@web-archive/shared/utils' | ||
import { Button } from '@web-archive/shared/components/button' | ||
import { | ||
Command, | ||
CommandEmpty, | ||
CommandGroup, | ||
CommandItem, | ||
CommandList, | ||
} from '@web-archive/shared/components/command' | ||
import { | ||
Popover, | ||
PopoverContent, | ||
PopoverTrigger, | ||
} from '@web-archive/shared/components/popover' | ||
|
||
interface ComboboxProps { | ||
value?: string | ||
onValueChange?: (value: string) => void | ||
options: { value: string, label: string }[] | ||
} | ||
|
||
function FolderCombobox({ value, onValueChange, options }: ComboboxProps) { | ||
const [open, setOpen] = React.useState(false) | ||
|
||
return ( | ||
<Popover open={open} onOpenChange={setOpen}> | ||
<PopoverTrigger asChild> | ||
<Button | ||
variant="outline" | ||
role="combobox" | ||
aria-expanded={open} | ||
className="justify-between w-full" | ||
> | ||
{value | ||
? options.find(option => option.value === value)?.label | ||
: 'Select a folder'} | ||
{open ? <ChevronDown size={16} className="transform rotate-180 opacity-50" /> : <ChevronDown size={16} className="opacity-50" />} | ||
</Button> | ||
</PopoverTrigger> | ||
<PopoverContent className="p-0 w-[14.5rem]"> | ||
<Command> | ||
<CommandList className="h-48 scrollbar-hide"> | ||
<CommandEmpty>No Folder Found.</CommandEmpty> | ||
<CommandGroup> | ||
{options.map(option => ( | ||
<CommandItem | ||
key={option.value} | ||
value={option.value} | ||
onSelect={(currentValue) => { | ||
onValueChange?.(currentValue === value ? '' : currentValue) | ||
setOpen(false) | ||
}} | ||
> | ||
{option.label} | ||
<Check | ||
className={cn( | ||
'ml-auto', | ||
value === option.value ? 'opacity-100' : 'opacity-0', | ||
)} | ||
/> | ||
</CommandItem> | ||
))} | ||
</CommandGroup> | ||
</CommandList> | ||
</Command> | ||
</PopoverContent> | ||
</Popover> | ||
) | ||
} | ||
|
||
export default FolderCombobox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.