// JavaScript Document
// Prototype.js 共存前提:$ は使用しない
// ================================
// 多棟物件(既存処理・安全書き換え)
// ================================
jQuery(function () {
if (jQuery("div#tatou_child").length) {
jQuery("div#tatou_child").each(function () {
jQuery(this)
.children(".secInfoBox")
.wrapAll('
');
jQuery(this).find(".secInfoBox").wrapAll('- ');
jQuery(this)
.find(".accordion")
.prepend('
');
});
}
jQuery("#tatou_child .accordion_title").on("click", function () {
jQuery(this).next().slideToggle();
jQuery(this).toggleClass("open");
});
});
// ================================
// 多棟物件スライダー(既存処理・安全)
// ================================
jQuery(function () {
jQuery(".secInfoBox .sliderInfo").each(function () {
if (jQuery(this).children("p").length) {
jQuery(this).bxSlider({
mode: "fade",
auto: false,
});
}
});
});
// ================================
// 物件詳細:写真ギャラリー(本体)
// ================================
jQuery(function () {
var slideWidthSize = window.matchMedia("(max-width: 750px)").matches
? 50
: 180;
jQuery("div.photo_gallery").each(function () {
var $gallery = jQuery(this);
var $main = $gallery.find(".bxslider");
var $thumb = $gallery.find(".slider_tm");
// 念のため存在チェック
if (!$main.length || !$thumb.length) {
return;
}
// data-slide-index を付与
$thumb.find("li").each(function (i) {
jQuery(this).find("a").attr("data-slide-index", i);
});
// メインスライダー
var mainSlider = $main.bxSlider({
pagerCustom: $thumb,
controls: true,
onSlideBefore: function ($slideElement, oldIndex, newIndex) {
setActive(newIndex);
},
});
// サムネスライダー
var thumbSlider = $thumb.bxSlider({
pager: false,
controls: true,
minSlides: 5,
maxSlides: 5,
moveSlides: 1,
slideWidth: slideWidthSize,
slideMargin: 5,
onSlideBefore: function ($slideElement, oldIndex, newIndex) {
mainSlider.goToSlide(newIndex);
setActive(newIndex);
},
});
// active 制御(HTML に合わせて is-active)
function setActive(index) {
$thumb.find("a").removeClass("is-active");
$thumb.find("li").eq(index).find("a").addClass("is-active");
}
// 初期状態
setActive(0);
});
});
// 2026/06/01 追記
// 現地販売
document.addEventListener("DOMContentLoaded", function () {
document
.querySelectorAll(".template_detail_header .open_house")
.forEach(function (openHouse) {
const text = openHouse.textContent
.replace(/\s+/g, "")
.replace("###openhouse###", "");
if (text) {
const title = openHouse.querySelector(".r_open_title_detail");
if (title) {
title.textContent = title.textContent.replace(/^■/, "");
}
openHouse.classList.add("is-show");
}
});
});
// 2026/07/10 追記
// 建築確認番号の表示制御
document.addEventListener("DOMContentLoaded", function () {
const status = document.querySelector(".js-property-status");
const confirmationRow = document.querySelector(".js-building-confirmation");
if (!status || !confirmationRow) return;
const statusText = status.textContent.trim();
if (
statusText.includes("建築中")
// || statusText === '空'
) {
confirmationRow.style.display = "table-row";
}
});