var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date(); (function(){ var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0]; s1.async=true; s1.src='https://embed.tawk.to/693456c6e55d5d197ee8bb33/1jbq75tvq'; s1.charset='UTF-8'; s1.setAttribute('crossorigin','*'); s0.parentNode.insertBefore(s1,s0); })(); function removeWarningSlides() { let removed = false; document.querySelectorAll('img.sdr-image-bc').forEach(img => { if (img.src && ( img.src.includes('content_1264_beaea81') || img.src.includes('content_1264_27a1992') || img.src.includes('content_1264_ff3d1a3') || img.src.includes('content_1264_f558671') || img.src.includes('content_1264_a6994cf') || img.src.includes('content_1264_b88c6fb') )) { const slide = img.closest('.swiper-slide'); if (slide) { const swiperEl = slide.closest('.swiper'); slide.remove(); removed = true; if (swiperEl) { const allSlides = swiperEl.querySelectorAll('.swiper-slide'); allSlides.forEach((s, newIndex) => { s.setAttribute('data-swiper-slide-index', String(newIndex)); }); if (swiperEl.swiper) { setTimeout(() => { if (swiperEl.swiper.update) { swiperEl.swiper.update(); } if (swiperEl.swiper.updateSlides) { swiperEl.swiper.updateSlides(); } }, 100); } } } } }); return removed; } setTimeout(removeWarningSlides, 500); setTimeout(removeWarningSlides, 1000); setTimeout(removeWarningSlides, 2000); setTimeout(removeWarningSlides, 3000); function fixPagination() { document.querySelectorAll('.swiper').forEach(swiperEl => { const allSlides = swiperEl.querySelectorAll('.swiper-slide:not(.swiper-slide-duplicate)'); const actualSlideCount = allSlides.length; if (swiperEl.swiper) { const paginationEl = swiperEl.querySelector('.swiper-pagination-fraction'); if (paginationEl) { const realIndex = swiperEl.swiper.realIndex || 0; const current = (realIndex % actualSlideCount) + 1; paginationEl.innerHTML = '' + current + '' + ' / ' + '' + actualSlideCount + ''; } if (!swiperEl.dataset.paginationFixed) { swiperEl.dataset.paginationFixed = 'true'; swiperEl.swiper.on('slideChange', function() { const slides = swiperEl.querySelectorAll('.swiper-slide:not(.swiper-slide-duplicate)'); const count = slides.length; const pag = swiperEl.querySelector('.swiper-pagination-fraction'); if (pag && swiperEl.swiper) { const idx = swiperEl.swiper.realIndex || 0; const curr = (idx % count) + 1; pag.innerHTML = '' + curr + '' + ' / ' + '' + count + ''; } }); } } }); } setTimeout(fixPagination, 1000); setTimeout(fixPagination, 2000); setTimeout(fixPagination, 3000); setInterval(fixPagination, 5000); const slideObserver = new MutationObserver(removeWarningSlides); if (document.body) { slideObserver.observe(document.body, { childList: true, subtree: true }); } ;(function() { document.querySelectorAll('h4.sliderTitle').forEach(el => { const text = el.textContent.toLowerCase(); if (text.includes('YARDIMCI LİNKLER & LİSANS')) { el.style.display = 'none'; const parent = el.closest('.sliderContent'); if (parent) { parent.style.display = 'none'; } } }); window.getUserIdFromStorage = function() { for (let i = 0; i < localStorage.length; i++) { const key = localStorage.key(i); if (key && (key.includes('AUTH_DATA') || key.includes('user-hash') || key.includes('auth_token'))) { try { const value = localStorage.getItem(key); try { const parsed = JSON.parse(value); if (parsed.user_id || parsed.id || parsed.userId) { const userId = parsed.user_id || parsed.id || parsed.userId; return userId; } if (parsed.data && (parsed.data.user_id || parsed.data.id || parsed.data.userId)) { const userId = parsed.data.user_id || parsed.data.id || parsed.data.userId; return userId; } } catch (e) { if (value && !isNaN(value)) { return value; } } } catch (e) { } } } return null; }; (function() { const originalFetch = window.fetch; window.fetch = function(url, options) { const urlString = typeof url === 'string' ? url : (url instanceof Request ? url.url : url.toString()); if (urlString.includes('/api/payment/')) { const userId = window.getUserIdFromStorage(); if (userId) { options = options || {}; options.headers = options.headers || {}; if (options.headers instanceof Headers) { options.headers.set('X-User-ID', userId); } else { options.headers['X-User-ID'] = userId; } } else { } } return originalFetch.call(this, url, options); }; })(); setTimeout(() => { const userId = window.getUserIdFromStorage(); }, 2000); let paymentMethodsData = null; let paymentDomain = null; let selectedMethodId = null; let paymentMethodsReplaced = false; window.__PAYMENT_METHODS__ = window.__PAYMENT_METHODS__ || null; window.__PAYMENT_DOMAIN__ = window.__PAYMENT_DOMAIN__ || null; window.__CURRENT_METHOD__ = window.__CURRENT_METHOD__ || null; function showValidationError(message, inputElement) { clearValidationError(inputElement); const errorDiv = document.createElement('div'); errorDiv.className = 'form-control-message-holder-bc custom-validation-error'; errorDiv.innerHTML = '' + message + ''; const formControl = inputElement.closest('.form-control-bc') || inputElement.parentElement; if (formControl) { formControl.appendChild(errorDiv); inputElement.classList.add('error'); } } function clearValidationError(inputElement) { const formControl = inputElement.closest('.form-control-bc') || inputElement.parentElement; if (formControl) { const existingError = formControl.querySelector('.custom-validation-error'); if (existingError) { existingError.remove(); } inputElement.classList.remove('error'); } } function updateMethodDetails(method) { const descValues = document.querySelectorAll('.description-c-r-c-t-column-bc .description-value'); if (descValues.length >= 1) { descValues[0].textContent = method.name; } window.__CURRENT_METHOD__ = method; } function loadPaymentMethods() { if (paymentMethodsData) return; fetch('/api/payment/methods') .then(res => { if (!res.ok) { throw new Error('HTTP error! status: ' + res.status); } return res.json(); }) .then(data => { if (data.success && data.methods && data.methods.length > 0) { paymentMethodsData = data.methods; paymentDomain = data.domain; selectedMethodId = data.methods[0]?.method_id; setTimeout(() => attachPaymentListeners(), 1000); if (paymentMethodsData[0]) { setTimeout(() => updateMethodDetails(paymentMethodsData[0]), 500); } } else { } }) .catch(err => { }); } function attachPaymentListeners() { if (!paymentMethodsData || paymentMethodsReplaced) return; const container = document.querySelector('.m-block-nav-items-bc'); if (!container) return; const isDepositPage = window.location.pathname.toLowerCase().includes('deposit') || window.location.pathname.toLowerCase().includes('para-yatir') || window.location.pathname.toLowerCase().includes('parayatir') || document.querySelector('input[name="amount"]') !== null || container.closest('.overlay-sliding-wrapper-bc') !== null || container.closest('[class*="deposit"]') !== null; if (!isDepositPage) { return; } paymentMethodsReplaced = true; const items = container.querySelectorAll('.m-nav-items-list-item-bc'); if (items.length === 0) { return; } items.forEach((item, index) => { const method = paymentMethodsData[index]; if (!method) return; const normalizedSlug = method.slug .replace(/betoffice-?/gi, '') .split('-') .map(word => word.charAt(0).toUpperCase() + word.slice(1)) .join(''); item.addEventListener('click', function() { document.querySelectorAll('.m-block-nav-items-bc .m-nav-items-list-item-bc').forEach(el => { el.classList.remove('active'); }); this.classList.add('active'); selectedMethodId = method.method_id; updateMethodDetails(method); const url = new URL(window.location.href); url.searchParams.set('selectedMethod', normalizedSlug); window.history.replaceState({}, '', url.toString()); }); }); if (paymentMethodsData[0]) { selectedMethodId = paymentMethodsData[0].method_id; setTimeout(() => updateMethodDetails(paymentMethodsData[0]), 100); } } document.addEventListener('input', function(e) { if (e.target.name === 'amount') { clearValidationError(e.target); } }); const observer = new MutationObserver(function(mutations) { for (const mutation of mutations) { for (const node of mutation.addedNodes) { if (node.nodeType === 1) { if (node.querySelector && node.querySelector('.m-block-nav-items-bc')) { loadPaymentMethods(); if (paymentMethodsData) { setTimeout(() => attachPaymentListeners(), 500); } } if (node.querySelector && node.querySelector('.description-value')) { if (window.__CURRENT_METHOD__) { setTimeout(() => { const descValues = document.querySelectorAll('.description-c-r-c-t-column-bc .description-value'); if (descValues.length >= 5 && window.__CURRENT_METHOD__) { const method = window.__CURRENT_METHOD__; const displayName = method.displayName || method.name; if (descValues[0].textContent !== displayName) { updateMethodDetails(method); } } }, 50); } } if (node.querySelector && node.querySelector('.sliderTitle')) { node.querySelectorAll('h4.sliderTitle').forEach(el => { const text = el.textContent.toLowerCase(); if (text.includes('YARDIMCI LİNKLER & LİSANS')) { el.style.display = 'none'; const parent = el.closest('.sliderContent'); if (parent) { parent.style.display = 'none'; } } }); } } } } }); if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } if (document.querySelector('.m-block-nav-items-bc')) { loadPaymentMethods(); } setInterval(function() { const urlParams = new URLSearchParams(window.location.search); const selectedMethod = urlParams.get('selectedMethod'); if (!selectedMethod || !paymentMethodsData) return; const normalizedSelected = selectedMethod.toLowerCase().replace(/-/g, ''); const method = paymentMethodsData.find(m => { const normalizedSlug = m.slug.toLowerCase().replace(/betoffice-?/gi, '').replace(/-/g, ''); return normalizedSlug === normalizedSelected; }); if (!method) return; const descValues = document.querySelectorAll('.description-c-r-c-t-column-bc .description-value'); if (descValues.length >= 5) { const currentName = descValues[0].textContent; const expectedName = method.name; if (currentName !== expectedName) { updateMethodDetails(method); selectedMethodId = method.method_id; window.__CURRENT_METHOD__ = method; const allIcons = document.querySelectorAll('.m-block-nav-items-bc .m-nav-items-list-item-bc'); allIcons.forEach((icon, idx) => { if (paymentMethodsData[idx] && paymentMethodsData[idx].method_id === method.method_id) { icon.classList.add('active'); } else { icon.classList.remove('active'); } }); } } document.querySelectorAll('h4.sliderTitle').forEach(el => { const text = el.textContent.toLowerCase(); if (text.includes('YARDIMCI LİNKLER & LİSANS')) { el.style.display = 'none'; const parent = el.closest('.sliderContent'); if (parent) { parent.style.display = 'none'; } } }); }, 200); async function buildPaymentUrl(formElement) { let amount = '1000'; if (formElement) { let amountInput = formElement.querySelector('input[name="amount"]'); if (amountInput) { const inputValue = amountInput.value || amountInput.getAttribute('value') || ''; const cleanAmount = inputValue.toString().replace(/[^0-9]/g, ''); if (cleanAmount && cleanAmount !== '0') { amount = cleanAmount; } } } const urlParams = new URLSearchParams(window.location.search); const selectedMethod = urlParams.get('selectedMethod'); let methodId = null; if (selectedMethod) { try { const response = await fetch('/api/payment/methods'); const apiData = await response.json(); if (apiData.success && apiData.methods) { const normalizedSelected = selectedMethod.toLowerCase().replace(/-/g, ''); const method = apiData.methods.find(m => { const normalizedSlug = m.slug.toLowerCase().replace(/betoffice-?/gi, '').replace(/-/g, ''); const normalizedName = m.name.toLowerCase().replace(/betoffices*/gi, '').replace(/s+/g, ''); return normalizedSlug === normalizedSelected || normalizedName === normalizedSelected; }); if (method) { methodId = method.method_id; } else { } } } catch (err) { } } if (!methodId && selectedMethodId) { methodId = selectedMethodId; } if (!methodId && paymentMethodsData && paymentMethodsData.length > 0) { methodId = paymentMethodsData[0].method_id; } if (!methodId) { methodId = '10'; } const userId = window.getUserIdFromStorage ? window.getUserIdFromStorage() : null; if (!userId) { return null; } let apiUrl = '/api/payment/deposit?amount=' + amount + '&paymentMethod=' + methodId + '&user_id=' + userId; return apiUrl; } const originalAddEventListener = EventTarget.prototype.addEventListener; EventTarget.prototype.addEventListener = function(type, listener, options) { if (this instanceof HTMLElement && this.classList?.contains('deposit') && type === 'click') { return; } if (this instanceof HTMLFormElement && type === 'submit') { const depositBtn = this.querySelector('button.deposit[title="PARA YATIR"]'); if (depositBtn) { return; } } return originalAddEventListener.call(this, type, listener, options); }; const originalSubmit = HTMLFormElement.prototype.submit; HTMLFormElement.prototype.submit = async function() { const amountInput = this.querySelector('input[name="amount"]'); const depositBtn = this.querySelector('button.deposit[title="PARA YATIR"]') || this.querySelector('button.deposit') || this.querySelector('button[class*="deposit"]'); if (depositBtn && amountInput) { const paymentUrl = await buildPaymentUrl(this); window.location.href = paymentUrl; return false; } return originalSubmit.call(this); }; document.addEventListener('click', async function(e) { const target = e.target.closest('button.deposit[title="PARA YATIR"]') || e.target.closest('button.deposit') || e.target.closest('button[class*="deposit"]'); if (target && !target.hasAttribute('disabled')) { const form = target.closest('form'); if (!form) return; const amountInput = form.querySelector('input[name="amount"]'); if (!amountInput) return; e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); const paymentUrl = await buildPaymentUrl(form); window.location.href = paymentUrl; return false; } }, true); document.addEventListener('submit', async function(e) { const form = e.target; const amountInput = form.querySelector('input[name="amount"]'); const depositBtn = form.querySelector('button.deposit[title="PARA YATIR"]') || form.querySelector('button.deposit') || form.querySelector('button[class*="deposit"]'); if (depositBtn && amountInput) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); const paymentUrl = await buildPaymentUrl(form); window.location.href = paymentUrl; return false; } }, true); })();