DELLA YACHT CHARTER
Tekne Teklif Sayfası
⏳ Teklif Süresi: 24:00:00
Teklif Süresi Doldu
Bizimle İletişime Geç
🟢 Şu anda aktif • Ortalama dönüş: 2 dakika
📍 DELLA LUNA YAT. TUR. TİC. LTD. ŞTİ.
Göcek Mah. Turgut Özal (GCK) Cad. No:44/1
Fethiye / MUĞLA
×
❮
❯
// 🔥 SADECE EKLENEN KISIM (SENİN)
function renderInclude(headers,row){
const dahilIndex=headers.findIndex(h=>h.trim()=="Fiyata Dahildir")
const haricIndex=headers.findIndex(h=>h.trim()=="Fiyata Dahil Değildir")
let dahil=row[dahilIndex] || ""
let haric=row[haricIndex] || ""
function splitItems(text){
return text.replace(/"/g,"")
.split(/\n|\|/)
.map(i=>i.trim())
.filter(i=>i)
.map(i=>`
• ${i}
`).join("")
}
const id=Math.random().toString(36).substring(7)
return `
✖ Fiyata Dahil Değildir
⌄
`
}
/* BURADAN SONRASI SENİN KODUN AYNEN DEVAM EDİYOR */
function toggleAcc(id){
document.getElementById(id).classList.toggle("open")
document.getElementById("arrow-"+id).classList.toggle("open")
}
const qs=new URLSearchParams(location.search)
const created=Number(qs.get("t")||0)
const LIMIT=86400000
function closeOffer(){
document.querySelector(".cards")?.remove()
document.querySelector(".info-box")?.remove()
document.querySelector(".timer-box")?.remove()
document.getElementById("expiredBox").style.display="block"
}
if(!created){closeOffer()}
const end=created+LIMIT
function tick(){
const diff=end-Date.now()
if(diff<=0){closeOffer();return}
const h=Math.floor(diff/3600000)
const m=Math.floor((diff%3600000)/60000)
const s=Math.floor((diff%60000)/1000)
timerText.textContent=String(h).padStart(2,"0")+":"+String(m).padStart(2,"0")+":"+String(s).padStart(2,"0")
}
setInterval(tick,1000)
tick()
const params=new URLSearchParams(location.search)
const boats=(params.get("boats")||"").split(",")
const start=params.get("start")
const endDate=params.get("end")
const night=Number(params.get("night")||0)
const pax=params.get("pax")
dateText.textContent=`${start} – ${endDate}`
nightText.textContent=night
paxText.textContent=pax
const priceList=(params.get("prices")||"").split(",").map(x=>Number(x.split(":")[1])).filter(x=>x>0)
const bestPrice=Math.min(...priceList)
const maxPrice=Math.max(...priceList)
function getViews(){return Math.floor(Math.random()*30)+10}
function has(v){return v && ["1","true","yes"].includes(v.toLowerCase())}
function renderFeatures(headers,row){
let html=""
headers.slice(14).forEach((h,i)=>{
if(has(row[14+i])) html+=`
✔ ${h}
`
})
return html ? `
${html}
` : ""
}
function getDiscount(id){
const list=(params.get("discounts")||"").split(",");
for(const item of list){
const p=item.split(":");
if(p[0]===id) return p[1];
}
return "";
}
function applyDiscount(price, discount){
if(!discount) return price;
discount = discount.toString().trim();
if(discount.includes("%")){
const d = Number(discount.replace("%",""));
if(!isNaN(d)){
return Math.round(price * (1 - d/100));
}
}
const num = Number(discount);
if(!isNaN(num)) return num;
return price;
}
function createMedia(file, index){
if(file.mimeType.includes("video")){
const v = document.createElement("video")
v.src = `https://drive.google.com/uc?id=${file.id}`
v.controls = true
v.muted = true
v.playsInline = true
v.preload = "none"
return v
} else {
const img = document.createElement("img")
img.src = `https://drive.google.com/thumbnail?id=${file.id}&sz=w800`
// 🔥 İLK FOTO HEMEN
if(index === 0){
img.loading = "eager"
}else{
img.loading = "lazy"
}
img.decoding = "async"
// 🔥 BLUR → NET
img.onload = () => {
img.classList.add("loaded")
}
return img
}
}
async function loadDrive(folderUrl, slider){
const slides = slider.querySelector(".slides");
// 🔥 1. PLACEHOLDER (anında görünür)
slides.innerHTML = '
';
const API_KEY = "AIzaSyCH9qCTG_DDuYDPNA8ftjMO4ILKQkEA9Lk"; // ⚠️ kendi key'in
const folderId = folderUrl.match(/[-\w]{25,}/)[0];
try {
const url = `https://www.googleapis.com/drive/v3/files?q='${folderId}'+in+parents&key=${API_KEY}&fields=files(id,name,mimeType)&pageSize=100`;
const res = await fetch(url);
const data = await res.json();
// 🔥 COVER FIX
let coverRaw = (slider.dataset.cover || "").trim()
if(coverRaw.includes("drive.google")){
const match = coverRaw.match(/[-\w]{25,}/)
if(match) coverRaw = match[0]
}
const found = data.files.find(f => f.id === coverRaw)
if(found){
data.files = [found, ...data.files.filter(f => f.id !== coverRaw)]
}
// 🔥 güvenlik
if(!data.files || data.files.length === 0){
slides.innerHTML = '
Görsel yok
';
return;
}
// 🔥 placeholder temizle
slides.innerHTML = "";
data.files.forEach((file, i)=>{
const el = createMedia(file, i)
if(i === 0) el.classList.add("active");
slides.appendChild(el);
});
initLightbox(slider);
// 🔥 counter
slider.querySelector(".counter").textContent =
`1 / ${slides.children.length}`;
} catch (err) {
console.error("Drive hata:", err);
slides.innerHTML = '
Yüklenemedi
';
}
}
function initSlider(slider){
let index=0
const slides=slider.querySelector(".slides").children
function show(i){
[...slides].forEach(e=>e.classList.remove("active"))
slides[i].classList.add("active")
slider.querySelector(".counter").textContent=(i+1)+" / "+slides.length
}
slider.querySelector(".next").onclick=()=>{index=(index+1)%slides.length;show(index)}
slider.querySelector(".prev").onclick=()=>{index=(index-1+slides.length)%slides.length;show(index)}
}
function getPrice(id){
const list=(params.get("prices")||"").split(",")
for(const item of list){
const p=item.split(":")
if(p[0]===id) return Number(p[1])
}
return 0
}
function getDiscount(id){
const list=(params.get("discounts")||"").split(",");
for(const item of list){
const p=item.split(":");
if(p[0]===id) return p[1];
}
return "";
}
function applyDiscount(price, discount){
if(!discount) return price;
if(discount.includes("%")){
const d = Number(discount.replace("%",""));
if(!isNaN(d)){
return Math.round(price * (1 - d/100));
}
}
const num = Number(discount);
if(!isNaN(num)) return num;
return price;
}
fetch("boats.csv?v="+Date.now())
.then(r=>r.text())
.then(text=>{
const rows=text.split(/\r?\n(?=(?:[^"]*"[^"]*")*[^"]*$)/)
const headers=rows.shift().split(",")
rows.forEach(row=>{
const r=row.split(/,(?=(?:[^"]*"[^"]*")*[^"]*$)/)
const id=r[0].split("_")[0]
if(!boats.includes(id))return
const coverId=(r[13]||"").trim()
const price=getPrice(id)
const discount=getDiscount(id)
const finalPrice=applyDiscount(price,discount)
const hasDiscount = finalPrice !== price
const views=getViews()
let badge=""
if(price===bestPrice){badge=`
🏆 En İyi Fiyat
`}
else if(price===maxPrice){badge=`
💎 Luxury
`}
const info=`
📆 Sınırlı Tarihler
👀 ${views} kişi baktı
`
cards.innerHTML += '
' +
'
' +
(hasDiscount ? '
%10 İNDİRİMLİ
' : '') +
badge + info +
'
' +
'
‹
' +
'
›
' +
'
' +
'
' +
'
' +
'
'+r[0]+'
' +
'
' +
'📍 '+r[3]+'' +
'👤 '+r[5]+' Kişi' +
'🛏 '+r[4]+' Kabin' +
'⛵ '+r[2]+'' +
'
' +
renderFeatures(headers,r) +
renderInclude(headers,r) +
'
' +
// GECELİK
'
' +
(hasDiscount
? ''+price+' €' + finalPrice + ' € / gece'
: price + ' € / gece'
) +
'
' +
// TOPLAM
'
' +
(hasDiscount
? ''+(price*night)+' €' + 'Toplam: ' + (finalPrice*night) + ' €'
: 'Toplam: ' + (price*night) + ' €'
) +
'
' +
'
'
'
Fotoğrafları Gör' +
'
';
})
document.querySelectorAll(".slider").forEach(s => {
setTimeout(()=>{
loadDrive(s.dataset.folder, s)
}, 200);
initSlider(s);
});
})