Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SWLab UI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
SWD
SWLab UI
Commits
a421d64f
Commit
a421d64f
authored
Oct 25, 2024
by
minseok.park
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test download
parent
cac1a80a
Pipeline
#21711
passed with stages
in 4 minutes and 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
27 deletions
+55
-27
07-header.js
src/js/07-header.js
+55
-27
No files found.
src/js/07-header.js
View file @
a421d64f
...
...
@@ -2,7 +2,7 @@
'use strict'
var
download
=
document
.
getElementById
(
'download'
)
const
downl
ao
dMobile
=
document
.
getElementById
(
'mobile-download'
)
const
downl
oa
dMobile
=
document
.
getElementById
(
'mobile-download'
)
document
.
addEventListener
(
'scroll'
,
function
()
{
var
navbar
=
document
.
querySelector
(
'.navbar'
)
...
...
@@ -14,37 +14,65 @@
}
})
download
.
addEventListener
(
'click'
,
function
()
{
function
downloadFile
()
{
var
pathname
=
window
.
location
.
pathname
var
path
=
pathname
.
split
(
'/'
)
var
isInternal
=
path
[
4
].
includes
(
'-s'
)
var
filename
=
path
[
3
]
?
path
[
3
]
===
'swlab-docs'
?
'docs'
:
isInternal
?
`docs-
${
path
[
3
]}
-s`
:
`docs-
${
path
[
3
]}
`
:
''
var
directory
=
path
[
3
]
&&
path
[
4
]
?
path
[
3
]
===
'swlab-docs'
?
path
[
3
]
:
path
[
4
]
:
''
var
link
=
document
.
createElement
(
'a'
)
var
isInternal
=
path
[
4
]?.
includes
(
'-s'
)
var
filename
=
path
[
3
]
?
path
[
3
]
===
'swlab-docs'
?
'docs'
:
isInternal
?
`docs-
${
path
[
3
]}
-s`
:
`docs-
${
path
[
3
]}
`
:
''
var
directory
=
path
[
3
]
&&
path
[
4
]
?
path
[
3
]
===
'swlab-docs'
?
path
[
3
]
:
path
[
4
]
:
''
link
.
href
=
`https://swlab.bwg.co.kr/web/dms/download-file?filename=
${
filename
}
.zip&directory=
${
directory
}
`
link
.
click
()
// 링크 생성 및 열기
var
link
=
`https://swlab.bwg.co.kr/web/dms/download-file?filename=
${
filename
}
.zip&directory=
${
directory
}
`
window
.
open
(
link
,
'_blank'
)
}
if
(
link
.
parentNode
)
{
document
.
body
.
removeChild
(
link
)
}
})
// PC 다운로드 버튼
download
.
addEventListener
(
'click'
,
downloadFile
)
downlaodMobile
.
addEventListener
(
'click'
,
function
()
{
var
pathname
=
window
.
location
.
pathname
var
path
=
pathname
.
split
(
'/'
)
var
isInternal
=
path
[
4
].
includes
(
'-s'
)
var
filename
=
path
[
3
]
?
path
[
3
]
===
'swlab-docs'
?
'docs'
:
isInternal
?
`docs-
${
path
[
3
]}
-s`
:
`docs-
${
path
[
3
]}
`
:
''
var
directory
=
path
[
3
]
&&
path
[
4
]
?
path
[
3
]
===
'swlab-docs'
?
path
[
3
]
:
path
[
4
]
:
''
var
link
=
document
.
createElement
(
'a'
)
// 모바일 다운로드 버튼
downloadMobile
.
addEventListener
(
'click'
,
downloadFile
)
link
.
href
=
`https://swlab.bwg.co.kr/web/dms/download-file?filename=
${
filename
}
.zip&directory=
${
directory
}
`
link
.
click
()
// download.addEventListener('click', function () {
// var pathname = window.location.pathname
// var path = pathname.split('/')
// var isInternal = path[4].includes('-s')
// var filename = path[3] ? path[3] === 'swlab-docs'
// ? 'docs' : isInternal ? `docs-${path[3]}-s` : `docs-${path[3]}` : ''
// var directory = path[3] && path[4] ? path[3] === 'swlab-docs' ? path[3] : path[4] : ''
// var link = document.createElement('a')
if
(
link
.
parentNode
)
{
document
.
body
.
removeChild
(
link
)
}
})
// link.href = `https://swlab.bwg.co.kr/web/dms/download-file?filename=${filename}.zip&directory=${directory}`
// link.click()
// if (link.parentNode) {
// document.body.removeChild(link)
// }
// })
// downlaodMobile.addEventListener('click', function () {
// var pathname = window.location.pathname
// var path = pathname.split('/')
// var isInternal = path[4].includes('-s')
// var filename = path[3] ? path[3] === 'swlab-docs'
// ? 'docs' : isInternal ? `docs-${path[3]}-s` : `docs-${path[3]}` : ''
// var directory = path[3] && path[4] ? path[3] === 'swlab-docs' ? path[3] : path[4] : ''
// var link = document.createElement('a')
// link.href = `https://swlab.bwg.co.kr/web/dms/download-file?filename=${filename}.zip&directory=${directory}`
// link.click()
// if (link.parentNode) {
// document.body.removeChild(link)
// }
// })
})()
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