-
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.
- Loading branch information
1 parent
28a70f3
commit ece6d82
Showing
13 changed files
with
106 additions
and
103 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 |
---|---|---|
@@ -1,38 +1,38 @@ | ||
import { delay } from "../Utils/delay.js" | ||
import { delay } from "../utils/delay.js"; | ||
|
||
export default function DescriptionOnOff({ $parent }) { | ||
const $descriptionOnOff = document.createElement('div') | ||
$descriptionOnOff.id = "descriptionOnOff" | ||
$descriptionOnOff.innerHTML = `visible check` | ||
const $descriptionOnOff = document.createElement("div"); | ||
$descriptionOnOff.id = "descriptionOnOff"; | ||
$descriptionOnOff.innerHTML = `visible check`; | ||
|
||
var visible = true | ||
var visible = true; | ||
|
||
$descriptionOnOff.addEventListener('click', () => { | ||
const $mainLogo = document.querySelector('#mainLogo') | ||
const $detailDescriptionContainer = document.querySelector('#detailDescriptionContainer') | ||
const $sublogo = document.querySelector('#subLogo') | ||
|
||
|
||
if (visible) { | ||
$mainLogo.classList.remove('show') | ||
$detailDescriptionContainer.classList.remove('show') | ||
$sublogo.classList.remove('show') | ||
$descriptionOnOff.classList.remove('show') | ||
visible = false | ||
} else if (!visible) { | ||
$mainLogo.classList.add('show') | ||
$detailDescriptionContainer.classList.add('show') | ||
$sublogo.classList.add('show') | ||
$descriptionOnOff.classList.add('show') | ||
visible = true | ||
} | ||
}) | ||
|
||
this.render = async () => { | ||
$parent.appendChild($descriptionOnOff) | ||
$descriptionOnOff.classList.remove("show") | ||
await delay(500); | ||
$descriptionOnOff.classList.add("show") | ||
$descriptionOnOff.addEventListener("click", () => { | ||
const $mainLogo = document.querySelector("#mainLogo"); | ||
const $detailDescriptionContainer = document.querySelector( | ||
"#detailDescriptionContainer" | ||
); | ||
const $sublogo = document.querySelector("#subLogo"); | ||
|
||
if (visible) { | ||
$mainLogo.classList.remove("show"); | ||
$detailDescriptionContainer.classList.remove("show"); | ||
$sublogo.classList.remove("show"); | ||
$descriptionOnOff.classList.remove("show"); | ||
visible = false; | ||
} else if (!visible) { | ||
$mainLogo.classList.add("show"); | ||
$detailDescriptionContainer.classList.add("show"); | ||
$sublogo.classList.add("show"); | ||
$descriptionOnOff.classList.add("show"); | ||
visible = true; | ||
} | ||
} | ||
}); | ||
|
||
this.render = async () => { | ||
$parent.appendChild($descriptionOnOff); | ||
$descriptionOnOff.classList.remove("show"); | ||
await delay(500); | ||
$descriptionOnOff.classList.add("show"); | ||
}; | ||
} |
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
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 |
---|---|---|
@@ -1,32 +1,35 @@ | ||
import { delay } from "../Utils/delay.js"; | ||
import { delay } from "../utils/delay.js"; | ||
|
||
export default async function ImageController(element, imgs, page) { | ||
var current_src = page.style.backgroundImage; | ||
console.log(current_src); | ||
var current_src = page.style.backgroundImage; | ||
console.log(current_src); | ||
|
||
const regex = /url\(".*\/([^\/]+)(\d+)\.jpg"\)/; | ||
var imageName = ""; | ||
var numberBeforeJpg = 0; | ||
var newNumber = 0; | ||
const regex = /url\(".*\/([^\/]+)(\d+)\.jpg"\)/; | ||
var imageName = ""; | ||
var numberBeforeJpg = 0; | ||
var newNumber = 0; | ||
|
||
const match = current_src.match(regex); | ||
const match = current_src.match(regex); | ||
|
||
if (match) { | ||
imageName = match[1]; | ||
numberBeforeJpg = match[2]; | ||
console.log(imageName, numberBeforeJpg); | ||
} else { | ||
console.log("매칭되는 문자열이 없습니다."); | ||
} | ||
if (match) { | ||
imageName = match[1]; | ||
numberBeforeJpg = match[2]; | ||
console.log(imageName, numberBeforeJpg); | ||
} else { | ||
console.log("매칭되는 문자열이 없습니다."); | ||
} | ||
|
||
if (element === "next") { | ||
newNumber = Number(numberBeforeJpg) + 1; | ||
if (newNumber > (imgs.length - 1)) newNumber = 0; | ||
} else if (element === "prev") { | ||
newNumber = Number(numberBeforeJpg) - 1; | ||
if (newNumber < 0) newNumber = imgs.length - 1; | ||
} | ||
current_src = current_src.replace(new RegExp(`${imageName}\\d+\\.jpg`), `${imageName}${newNumber}.jpg`); | ||
await delay(500) | ||
page.style.backgroundImage = current_src | ||
if (element === "next") { | ||
newNumber = Number(numberBeforeJpg) + 1; | ||
if (newNumber > imgs.length - 1) newNumber = 0; | ||
} else if (element === "prev") { | ||
newNumber = Number(numberBeforeJpg) - 1; | ||
if (newNumber < 0) newNumber = imgs.length - 1; | ||
} | ||
current_src = current_src.replace( | ||
new RegExp(`${imageName}\\d+\\.jpg`), | ||
`${imageName}${newNumber}.jpg` | ||
); | ||
await delay(500); | ||
page.style.backgroundImage = current_src; | ||
} |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { delay } from "../Utils/delay.js" | ||
import { delay } from "../utils/delay.js"; | ||
|
||
export default async function setDetailPage ({imgs, $parent}) { | ||
$parent.style.backgroundImage = `url(${imgs[0]})` | ||
await delay(300) | ||
} | ||
export default async function setDetailPage({ imgs, $parent }) { | ||
$parent.style.backgroundImage = `url(${imgs[0]})`; | ||
await delay(300); | ||
} |
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
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
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
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