Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions src/components/CookieSeal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { useEffect } from "react";

export function CookieSeal() {
useEffect(() => {
// Load CookieSeal styles
const style = document.createElement("link");
style.rel = "stylesheet";
style.href = "https://assets.cookieseal.com/cookie-seal.css";
style.type = "text/css";

// Load CookieSeal script
const script = document.createElement("script");
script.src = "https://assets.cookieseal.com/cookie-seal.js";
script.async = true;

document.head.appendChild(style);

script.onload = () => {
const interval = setInterval(() => {
const banner = document.getElementById("cookieseal-banner");

if (banner) {
clearInterval(interval);

// 1. Customize Settings butonunu kaldır
const customizeBtn = document.getElementById("cookieseal-banner-reject");
if (customizeBtn?.parentElement) {
customizeBtn.parentElement.removeChild(customizeBtn);
}

// 2. Butonlara border-radius ver
const buttons = document.querySelectorAll<HTMLButtonElement>(
".cookieseal-banner-button"
);
buttons.forEach((btn) => {
btn.style.borderRadius = "0.375rem";
});

// 3. Yazıdaki “Cookie Settings” ifadesini değiştir
const bannerText = document.getElementById("cookieseal-banner-text");
if (bannerText) {
bannerText.innerHTML = bannerText.innerHTML
.replace(/Cookie Settings/gi, "Customize Settings")
.replace(
/and analyze our traffic./gi,
'and analyze our traffic as specified in our<a href="/cookie-policy" target="_blank" rel="noopener noreferrer" style="text-decoration: underline; color: inherit;">Cookie Policy.</a>'
)
.replace(/ You can/gi, "You can")
.replace(/orYou can/gi, "or you can");
}
}
}, 100);
};

document.head.appendChild(script);

return () => {
document.head.removeChild(style);
document.head.removeChild(script);
};
}, []);

return null;
}
12 changes: 12 additions & 0 deletions src/theme/Layout/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import Layout from '@theme-original/Layout';
import { CookieSeal } from '../../components/CookieSeal';

export default function CustomLayout(props) {
return (
<>
<Layout {...props} />
<CookieSeal />
</>
);
}