Skip to content

Commit

Permalink
SEO용 메타 태그 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
dalnim committed Sep 10, 2024
1 parent 958a660 commit 28e35b4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 14 deletions.
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="keywords" content="">
<link rel="shortcut icon" href="assets/images/favicon.ico" type="image/x-icon">
<title>MultiPlayer</title>

Expand Down
61 changes: 47 additions & 14 deletions language.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const jsonEnglish = {
"unavailable__desc__three": "Not Streaming Yet",
"available__title": "Important",
"available__desc": " This app only provides sample content. The video must be in the app's document folder on iPhone and in the phone storage on Android.",
"available__desc__four": "Only Pre DownloadedVideos",
"available__desc__four": "Only Pre Downloaded Videos",

"app__title": "Join community",
"app__title__desc": "Join our community on Reddit and Discord! Come hang out, share your experiences, and have fun together!",
Expand Down Expand Up @@ -131,6 +131,17 @@ const jsonKorean = {

}

const jsonEnglishMeta = {
"description": "A video player that allows infinite playback of videos simultaneously on up to 4 screens (9 screens for tablets). Enjoy features like infinite loop, auto mute & background pause, multi-screen playback, AB repeat, random play & playlist, and batch control. Ideal for focused learning, practice, or revisiting your favorite scenes.",
"keywords": "video player, infinite playback, multi-screen playback, AB repeat, auto mute, background pause, random play, playlist, batch control"
};


const jsonKoreanMeta = {
"description": "1~4개 화면에서 동시에 무제한 비디오 재생이 가능한 비디오 플레이어(태블릿의 경우 9개 화면까지 지원). 무한 반복, 자동 무음 및 백그라운드 일시 정지, 멀티 스크린 재생, AB 반복, 랜덤 재생 및 재생 목록, 배치 제어 기능 등의 다양한 기능을 제공하며, 집중 학습, 연습, 또는 좋아하는 장면을 다시 보는 데 적합합니다.",
"keywords": "비디오 플레이어, 무제한 재생, 멀티 스크린 재생, AB 반복, 자동 무음, 백그라운드 일시 정지, 랜덤 재생, 재생 목록, 배치 제어"
};

// Object to store image URLs for each language
const imageUrls = {
en: {
Expand All @@ -145,26 +156,48 @@ const imageUrls = {
}
};

// function for content update based on selected language
function updateLanguage(language) {
if (language == 'en') {
for (let key in jsonEnglish) {
document.querySelector('.' + key).textContent = jsonEnglish[key];
// Function to update text content for elements
function updateTextContent(jsonData) {
for (let key in jsonData) {
const element = document.querySelector('.' + key);
if (element) {
element.textContent = jsonData[key];
}
} else if (language == 'ko') {
for (let key in jsonKorean) {
document.querySelector('.' + key).textContent = jsonKorean[key];
}
}

// Function to update meta tags
function updateMetaTags(metaData) {
for (let key in metaData) {
const metaElement = document.querySelector(`meta[name="${key}"]`);
if (metaElement) {
metaElement.setAttribute('content', metaData[key]);
}
}
// Update multiple image sources
}

// Function to update multiple image sources and save to localStorage
function updateImageSources(language) {
for (let imageId in imageUrls[language]) {
document.querySelector('#' + imageId).src = imageUrls[language][imageId];
// Save each image URL to localStorage
localStorage.setItem(imageId + 'Src', imageUrls[language][imageId]);
const imageElement = document.querySelector('#' + imageId);
if (imageElement) {
imageElement.src = imageUrls[language][imageId];
// Save each image URL to localStorage
localStorage.setItem(imageId + 'Src', imageUrls[language][imageId]);
}
}
}

// Main function to update language
function updateLanguage(language) {
const jsonData = language === 'en' ? jsonEnglish : jsonKorean;
const metaData = language === 'en' ? jsonEnglishMeta : jsonKoreanMeta;

updateTextContent(jsonData);
updateMetaTags(metaData);
updateImageSources(language);
}

// set language on change and update the localization
document.querySelector("#language").addEventListener('change', function () {
const selectedLanguage = this.value;
Expand Down

0 comments on commit 28e35b4

Please sign in to comment.