Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
gu imageworks extension
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
joetsuihk
gu imageworks extension
Commits
2a47a865
Commit
2a47a865
authored
Jan 18, 2022
by
edwin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lightbox style, prevent background js change file name when download single image on fetch js
parent
a3c5daa4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
54 deletions
+60
-54
background.js
background.js
+13
-12
lightbox.css
fetch/lightbox.css
+44
-41
lightbox.html
fetch/lightbox.html
+3
-1
No files found.
background.js
View file @
2a47a865
...
...
@@ -40,19 +40,20 @@ chrome.downloads.onDeterminingFilename.addListener(function(item, suggest) {
if
(
item
.
url
.
includes
(
"https://digitallibrary-external.fastretailing.com/api/asset"
)){
chrome
.
storage
.
local
.
get
([
'idArray'
,
'index'
],
function
(
items
)
{
let
index
=
items
.
index
;
let
idArray
=
items
.
idArray
.
split
(
','
);
let
new_filename
=
idArray
[
index
]
+
".zip"
;
suggest
({
filename
:
new_filename
});
chrome
.
storage
.
local
.
set
({
index
:
(
index
+
1
)});
index
+=
1
;
if
(
index
>=
idArray
.
length
)
{
console
.
log
(
"Last file was downloaded"
);
chrome
.
storage
.
local
.
remove
([
'idArray'
,
'index'
]);
if
(
Object
.
keys
(
items
).
length
!==
0
){
let
index
=
items
.
index
;
let
idArray
=
items
.
idArray
.
split
(
','
);
let
new_filename
=
idArray
[
index
]
+
".zip"
;
suggest
({
filename
:
new_filename
});
chrome
.
storage
.
local
.
set
({
index
:
(
index
+
1
)});
index
+=
1
;
if
(
index
>=
idArray
.
length
)
{
console
.
log
(
"Last file was downloaded"
);
chrome
.
storage
.
local
.
remove
([
'idArray'
,
'index'
]);
}
}
return
true
;
});
return
true
;
...
...
fetch/lightbox.css
View file @
2a47a865
...
...
@@ -41,6 +41,8 @@
grid-template-rows
:
1
fr
2
fr
;
}
/* general */
#fetch-lightbox
.lightbox-content
>
div
{
padding
:
15px
;
}
...
...
@@ -71,6 +73,40 @@
margin-right
:
5px
;
}
/*operation and button style*/
#fetch-lightbox
.operation-box
{
grid-column-start
:
1
;
grid-row-start
:
2
;
}
#fetch-lightbox
button
{
display
:
inline-block
;
padding
:
12px
;
margin-bottom
:
5px
;
border
:
2px
solid
transparent
;
border-radius
:
5px
;
cursor
:
pointer
;
}
#fetch-lightbox
button
:hover
{
border-color
:
black
;
}
#searchSKUs
{
background-color
:
hsl
(
40
,
75%
,
80%
);
}
#downloadSelectedSKUs
{
background-color
:
hsl
(
60
,
75%
,
80%
);
}
#downloadAllSKUs
{
background-color
:
hsl
(
80
,
75%
,
80%
);
}
/* info box and debug box*/
#fetch-lightbox
.info-box
{
grid-column-start
:
2
;
grid-row-start
:
1
;
...
...
@@ -78,14 +114,15 @@
border
:
2px
solid
#cccccc
;
border-radius
:
5px
;
overflow
:
scroll
;
overflow
-y
:
scroll
;
position
:
relative
;
}
#fetch-lightbox
.operation-box
{
grid-column-start
:
1
;
grid-row-start
:
2
;
#fetch-lightbox
.debug-box
{
width
:
100%
;
height
:
100%
;
padding-top
:
12px
;
}
#fetch-lightbox
.info-message
{
...
...
@@ -94,12 +131,11 @@
left
:
15px
;
}
#fetch-lightbox
.debug-box
{
width
:
100%
;
height
:
100%
;
padding-top
:
12px
;
#fetch-lightbox
.spacing
{
padding-top
:
50px
;
}
/* asset item*/
#fetch-lightbox
.asset-item
{
width
:
200px
;
margin
:
3px
;
...
...
@@ -132,39 +168,6 @@
}
#fetch-lightbox
button
{
display
:
inline-block
;
padding
:
12px
;
margin-bottom
:
5px
;
border
:
2px
solid
transparent
;
border-radius
:
5px
;
cursor
:
pointer
;
}
#fetch-lightbox
button
:hover
{
border-color
:
black
;
}
#searchSKUs
{
background-color
:
hsl
(
40
,
75%
,
80%
);
}
#downloadSelectedSKUs
{
background-color
:
hsl
(
60
,
75%
,
80%
);
}
#downloadAllSKUs
{
background-color
:
hsl
(
80
,
75%
,
80%
);
}
#saveSession
{
background-color
:
hsl
(
60
,
85%
,
90%
);
}
#loadSession
{
background-color
:
hsl
(
40
,
85%
,
90%
);
}
#lightbox-switch
{
position
:
fixed
;
right
:
0px
;
...
...
fetch/lightbox.html
View file @
2a47a865
...
...
@@ -21,11 +21,13 @@
<h6>
Search and Download
</h6>
<div
class=
"input-box"
>
<label>
Date:
</label>
<input
type=
"text"
id=
"filter-date"
name=
"filter-date"
value=
"
7"
>
<input
type=
"text"
id=
"filter-date"
name=
"filter-date"
value=
"
"
>
</div>
<button
id=
"searchSKUs"
>
Search
</button>
<button
id=
"downloadSelectedSKUs"
>
Download
</button>
<div
class=
"spacing"
></div>
<h6>
Download All SKUs
</h6>
<button
id=
"downloadAllSKUs"
>
Download
</button>
<a
id=
"download-trigger"
href=
"#"
download
hidden
>
Download
</a>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment