$(document).ready(function() {
var current_path = window.location.pathname;
console.log(current_path);
$('.sub_menu_tab ul li a').removeClass('active');
if (
current_path.indexOf('/sub5/menu4.php') !== -1 ||
current_path.indexOf('/sub5/menu5.php') !== -1 ||
current_path.indexOf('/sub5/menu6.php') !== -1
) {
$('.sub_menu_tab ul li a[href*="menu4.php"]').addClass('active');
} else {
$('.sub_menu_tab ul li a[href="' + current_path + '"]').addClass('active');
}
});
jQuery(document).ready(function($){
$('#sectionSlide').carousel({
interval: 3000,
ride: 'carousel'
});
});
document.addEventListener("DOMContentLoaded", function () {
function insertWalkingTitle(tableSelector, targetText) {
const rows = document.querySelectorAll(tableSelector + " tr");
rows.forEach(function(row) {
const titleCell = row.querySelector(".board_bgcolor span, .board_bgcolor font, .board_bgcolor");
if (titleCell && titleCell.textContent.trim() === targetText) {
// Áߺ¹ »ðÀÔ ¹æÁö
if (row.previousElementSibling && row.previousElementSibling.classList.contains("walking-title-row")) {
return;
}
const newRow = document.createElement("tr");
newRow.className = "walking-title-row";
newRow.innerHTML = '
¡°ãÌ¿Í »êÃ¥¡± Âü¿©ÀϽà | ';
row.parentNode.insertBefore(newRow, row);
}
});
}
// ÀÛ¼ºÆû
insertWalkingTitle(".board_table", "5¿ù 15ÀÏ (±Ý)");
// º¸±âÆäÀÌÁö
insertWalkingTitle(".board-view-table2", "5¿ù 15ÀÏ (±Ý)");
});
document.addEventListener("DOMContentLoaded", function () {
// ÀÌ °Ô½ÃÆÇ(write Æû)¸¸ Àû¿ë
const targetBoard = document.querySelector(".board_table.add-item");
if (!targetBoard) return;
const textarea = document.getElementById("descriptionView_TEXTAREA");
const iframe = document.getElementById("descriptionView_IFRAME");
if (!textarea || !iframe) return;
const defaultText = `¼ø¹ø, ¼º¸í, ÀüȹøÈ£¸¦ ÀÛ¼ºÇØÁÖ¼¼¿ä.
¿¹)
1. È«±æµ¿ / 010-1234-5678
2. ±èö¼ö / 010-9876-5432
3. ÀÌ¿µÈñ / 010-1111-2222`;
let isPlaceholderActive = false;
// textarea ±âº»°ª
if (textarea.value.trim() === "") {
textarea.value = defaultText;
isPlaceholderActive = true;
}
function applyPlaceholderToIframe() {
try {
const doc = iframe.contentDocument || iframe.contentWindow.document;
if (!doc || !doc.body) return;
const currentText = doc.body.innerText.trim();
if (currentText === "") {
doc.body.innerHTML = '' + defaultText.replace(/\n/g, "
") + '
';
const placeholderEl = doc.querySelector(".desc-placeholder");
if (placeholderEl) {
placeholderEl.style.color = "#666";
placeholderEl.style.fontSize = "13px";
placeholderEl.style.fontWeight = "500";
}
isPlaceholderActive = true;
}
// Ŭ¸¯/Æ÷Ä¿½º/ÀÔ·Â ½Ã ¾È³»¹® Á¦°Å
doc.body.addEventListener("focus", clearPlaceholder, true);
doc.body.addEventListener("click", clearPlaceholder, true);
doc.body.addEventListener("keydown", clearPlaceholder, true);
} catch (e) {}
}
function clearPlaceholder() {
try {
const doc = iframe.contentDocument || iframe.contentWindow.document;
if (!doc || !doc.body) return;
const bodyText = doc.body.innerText.trim();
if (isPlaceholderActive || bodyText === defaultText.trim()) {
doc.body.innerHTML = "";
doc.body.style.color = "#000";
textarea.value = "";
isPlaceholderActive = false;
}
} catch (e) {}
}
function syncIframeToTextarea() {
try {
const doc = iframe.contentDocument || iframe.contentWindow.document;
if (!doc || !doc.body) return;
const bodyText = doc.body.innerText.trim();
if (bodyText === defaultText.trim()) {
textarea.value = "";
} else {
textarea.value = doc.body.innerHTML;
}
} catch (e) {}
}
function preventPlaceholderSubmit() {
try {
const doc = iframe.contentDocument || iframe.contentWindow.document;
if (!doc || !doc.body) return;
const bodyText = doc.body.innerText.trim();
if (bodyText === defaultText.trim()) {
doc.body.innerHTML = "";
textarea.value = "";
} else {
textarea.value = doc.body.innerHTML;
}
} catch (e) {}
}
// iframe ·Îµå ÈÄ placeholder Àû¿ë
iframe.addEventListener("load", function () {
setTimeout(applyPlaceholderToIframe, 300);
});
// ÀÌ¹Ì ·ÎµåµÈ °æ¿ì ´ëºñ
setTimeout(applyPlaceholderToIframe, 800);
// textarea Æ÷Ä¿½º ½Ã Á¦°Å
textarea.addEventListener("focus", function () {
if (textarea.value.trim() === defaultText.trim()) {
textarea.value = "";
isPlaceholderActive = false;
}
});
// Æû Á¦Ãâ Àü placeholder Á¦°Å
const form = textarea.closest("form");
if (form) {
form.addEventListener("submit", function () {
preventPlaceholderSubmit();
});
}
// ¿¡µðÅÍ ³»¿ë µ¿±âÈ
setInterval(syncIframeToTextarea, 1000);
});