Commit b6a3d216 authored by minseok.park's avatar minseok.park

update download

parent a421d64f
Pipeline #21719 passed with stages
in 3 minutes and 53 seconds
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
} }
}) })
function downloadFile () { function downloadFile (isMobile) {
var pathname = window.location.pathname var pathname = window.location.pathname
var path = pathname.split('/') var path = pathname.split('/')
var isInternal = path[4]?.includes('-s') var isInternal = path[4]?.includes('-s')
...@@ -31,48 +31,18 @@ ...@@ -31,48 +31,18 @@
: path[4] : path[4]
: '' : ''
// 링크 생성 및 열기 const downloadLink = `https://swlab.bwg.co.kr/web/dms/download-file?filename=${filename}.zip&directory=${directory}`
var link = `https://swlab.bwg.co.kr/web/dms/download-file?filename=${filename}.zip&directory=${directory}`
window.open(link, '_blank') if (isMobile) {
window.open(downloadLink, '_blank')
} else {
window.location.href = downloadLink
}
} }
// PC 다운로드 버튼 // PC 다운로드 버튼
download.addEventListener('click', downloadFile) download.addEventListener('click', () => downloadFile(false))
// 모바일 다운로드 버튼 // 모바일 다운로드 버튼
downloadMobile.addEventListener('click', downloadFile) downloadMobile.addEventListener('click', () => downloadFile(true))
// 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')
// 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)
// }
// })
})() })()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment