Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Options/Options.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ const Options = () => {
>
<span>Show file renaming textbox</span>
<//>

<br />
<${Checkbox}
id="make_uri_folder_checkbox"
title="Make folders by download URI"
checked="${options.make_uri_folder === 'true'}"
onChange=${setCheckboxOption('make_uri_folder')}
>
<span>Make folders by download URI</span>
<//>
</fieldset>

<fieldset>
Expand Down
4 changes: 4 additions & 0 deletions src/background/downloadImages.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ function suggestNewFilename(item, suggest) {
if (task.options.folder_name) {
newFilename += `${task.options.folder_name}/`;
}
if (task.options.make_uri_folder) {
const url = new URL(item.url);
newFilename += `${url.host}/${url.pathname.slice(0, -(item.filename.length))}/`;
}
if (task.options.new_file_name) {
const regex = /(?:\.([^.]+))?$/;
const extension = regex.exec(item.filename)[1];
Expand Down
1 change: 1 addition & 0 deletions src/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const defaults = {
// Filters
folder_name: '',
new_file_name: '',
make_uri_folder: false,
filter_url: '',
filter_url_mode: 'normal',
filter_min_width: 0,
Expand Down