PornMike

“;if(a=document.getElementById(“spci_”+a))a.contentDocument.write(c),a.contentDocument.close()}function checkForNetworkToggle(){if(document.getElementsByClassName(“network-list”).length){var a=document.getElementsByClassName(“network-toggle”)[0];35 ‘;
document.getElementsByTagName(“body”)[0].insertAdjacentHTML(“beforeend”,c);document.getElementsByClassName(“tb-inter-mask”)[0].addEventListener(“click”,function(){a.close()});document.getElementsByClassName(“tb-inter-btn-wrapper”)[0].addEventListener(“click”,function(){a.close()})};Inter.prototype.close=function(){var a=document.getElementsByClassName(“tb-inter”)[0];a.parentNode.removeChild(a);0diaImageSrc.indexOf(“.gif”)&&(timer=window.setTimeout(“nextDia()”,150)))});a.addEventListener(“mouseleave”,function(){hovering=!1;window.clearTimeout(timer);diaImageSrc=this.getAttribute(“src”);-1==diaImageSrc.indexOf(“data:image”)&&”src”in this.dataset&&this.setAttribute(“src”,this.dataset.src)})});a=atob(“eHk5MS5hcHA=”);window.location.hostname==a&&(a=document.getElemetsByTagName(“body”)[0].dataset.domain,
window.location.href=”https://www.”+a+window.location.pathname);a=document.querySelectorAll(“.orderbox”);Array.prototype.forEach.call(a,function(a,c){a.addEventListener(“change”,function(a){0this.status){var a=JSON.parse(this.response),b=parseInt(100*a.rating);document.getElementById(“video_rating”).textContent=b+”%”;var c=document.getElementById(“video_rating_reverse”);c&&(c.textContent=100-b+”%”);(b=document.getElementById(“rating_box”))&&b.classList.add(“rated”);if(a.message){var d=document.createElement(“div”);d.className=”rating_overlay”;d.innerHTML=a.message;c.parentNode.appendChild(d);d.style.pointerEvents=”auto”;setTimeout(function(){d.remove()},
2E3)}}};a.send();sendUAEvent(“Rating”,”click”,this.dataset.rating)})});a=document.querySelectorAll(“.cum_rate_btn”);Array.prototype.forEach.call(a,function(a,c){a.addEventListener(“click”,function(a){a.preventDefault();a=new XMLHttpRequest;var b=document.documentElement.lang;window.activity&&window.activity.cum(Number(document.getElementsByClassName(“video”)[0].dataset.id),Number(this.dataset.rating));a.open(“GET”,”/cum_rate/?video_id=”+document.getElementsByClassName(“video”)[0].dataset.id+”&rating=”+
this.dataset.rating+”&lang=”+b,!0);a.setRequestHeader(“X-Requested-With”,”XMLHttpRequest”);a.onload=function(){if(200<=this.status&&400>this.status){var a=JSON.parse(this.response),b=parseInt(100*a.rating),c=document.getElementById(“cum_rating”);c&&(c.textContent=b+”%”);if(c=document.getElementById(“cum_rating_reverse”))c.textContent=100-b+”%”;if(b=document.getElementById(“cum_rating_positives”))b.textContent=a.total_positives_formatted;if(c=document.getElementById(“cum_rating_negatives”))c.textContent=
a.total_negatives_formatted;(c=document.getElementById(“cum_rating_box”))&&c.classList.add(“rated”);if(a.message){var d=document.createElement(“div”);d.className=”rating_overlay”;d.innerHTML=a.message;b.parentNode.appendChild(d);d.style.pointerEvents=”auto”;setTimeout(function(){d.remove()},2E3)}}};a.send();sendUAEvent(“CumRating”,”click”,this.dataset.rating)})});(a=document.getElementById(“favorite_btn”))&&a.addEventListener(“click”,function(a){a.preventDefault();a=new XMLHttpRequest;a.open(“GET”,
“/user/toggleFavorite/?video_id=”+document.getElementsByClassName(“video”)[0].dataset.id,!0);a.setRequestHeader(“X-Requested-With”,”XMLHttpRequest”);a.onload=function(){200<=this.status&&400>this.status&&(JSON.parse(this.response).status?document.getElementById(“favorite_btn”).classList.add(“active”):document.getElementById(“favorite_btn”).classList.remove(“active”))};a.send();sendUAEvent(“Favorite”,”click”,this.dataset.rating)});a=document.getElementsByClassName(“network-toggle”);0window.innerWidth?”5px”:”50px”,b.onload=function(){iFrameResize({log:!1,sizeWidth:!0,
onResized:function(a){},onMessage:function(a){console.log(“MESSAGE CALLBACK: “+a.message);a.message.indexOf(“jsoncommand”)&&(a=JSON.parse(a.message),”resize”==a.action?document.getElementById(“chatina_frame”).iFrameResizer.resize():”redirect”==a.action?window.location.replace(a.url):”openwindow”==a.action&&window.open(a.url,”_blank”))},onClosed:function(a){console.log(“CLOSED CALLBACK: “+a);c.setCookie(“widget_status”,”closed”,.042);c.setCookie(“widget_status_session”,”closed”)},onInit:function(a){var b=
document.createElement(“a”);b.href=this.widgetUrl;for(var c=decodeURIComponent(document.cookie).split(“;”),d=””,g=0;g {
const root = document.documentElement;
const buttons = document.querySelectorAll(‘.themeToggle’);

// 1. Theme-Logik
// const getStoredTheme = () => localStorage.getItem(‘pm-theme’);
// const getSystemTheme = () => window.matchMedia(‘(prefers-color-scheme: dark)’).matches ? ‘dark’ : ‘light’;

const updateButtonUI = (theme) => {
buttons.forEach(btn => {
if (theme === ‘dark’) {
btn.innerHTML = ‘ Light’;
} else {
btn.innerHTML = ‘ Dark’;
}
});
};

const updateThemeElements = (theme) => {
const themeElements = document.querySelectorAll(‘[data-light]’);
themeElements.forEach(el => {
const newSrc = theme === ‘dark’ ? el.getAttribute(‘data-dark’) : el.getAttribute(‘data-light’);
if (newSrc) {
if (el.src !== newSrc) el.src = newSrc;
}
});
};

const setTheme = (t) => {
root.setAttribute(‘data-bs-theme’, t);
localStorage.setItem(‘pm-theme’, t);
updateButtonUI(t);
updateThemeElements(t);
};

// const initialTheme = getStoredTheme() || getSystemTheme();
setTheme(root.getAttribute(‘data-bs-theme’));

buttons.forEach(btn => {
// Wir nutzen onclick direkt, um andere Listener zu “überstimmen”
btn.onclick = (e) => {
e.preventDefault(); // Verhindert ungewolltes Bootstrap-Verhalten
const currentTheme = root.getAttribute(‘data-bs-theme’);
const newTheme = currentTheme === ‘light’ ? ‘dark’ : ‘light’;
setTheme(newTheme);
};
});
});

function updateURIParam(uri, key, value) {
const url = new URL(uri, window.location.origin);
const params = url.searchParams;
if (value === ”) {
params.delete(key);
} else {
params.set(key, value);
}
return url.pathname + (params.toString() ? ‘?’ + params.toString() : ”);
}

function sendgTagEvent(eventName, options = {})
{
if (typeof(gtag) != ‘undefined’)
{
gtag(‘event’, eventName, options);
}
}

function changeOrder(order, defaultSortOrder)
{
sendgTagEvent(‘order_click’, {“type”: order});
if (order == defaultSortOrder)
{
order = ”;
}
const target = updateURIParam(window.location.href, ‘o’, order);
// console.log(“[changeOrder] navigating to:”, target);
window.location.href = target;
}

function scrollContainer(container, factor) {
const amount = container.clientWidth * factor;
const hiddenLeft = container.parentElement.querySelector(‘.scrollLeft, .fade-previous’);
if (hiddenLeft)
{
hiddenLeft.classList.remove(‘d-none’);
}
container.scrollBy({
left: amount,
behavior: ‘smooth’
});

setTimeout(() => {
//console.log(‘set timeout aufrufen:’ + container.scrollLeft);
//console.log(hiddenLeft);
if (container.scrollLeft <= 0 && hiddenLeft) { //console.log('d none hinzufügen'); hiddenLeft.classList.add('d-none'); } }, 1400); } function toogleHeaderSearch() { const search = document.getElementById('header-search'); if (search.classList.contains('d-none')) { search.classList.remove('d-none'); } else { search.classList.add('d-none'); } } /* document.querySelectorAll(".toggleBtn").forEach((btn) => {
btn.addEventListener(“click”, () => {
const text = btn.previousElementSibling;
text.classList.toggle(“expanded”);
btn.textContent = text.classList.contains(“expanded”)
? “Read less”
: “Read more”;
});
});*/
/*
window.addEventListener(‘load’, () => {
function isOverflowing(el) {
return el.scrollHeight > el.clientHeight + 1; // kleine Toleranz
}

function updateBtn(btn, text) {
const expanded = text.classList.contains(‘expanded’);
const shouldBeVisible = expanded || isOverflowing(text);

requestAnimationFrame(() => {
if (shouldBeVisible) {
btn.classList.remove(‘invisible’, ‘pe-none’);
btn.removeAttribute(‘aria-hidden’);
btn.tabIndex = 0;
} else {
btn.classList.add(‘invisible’, ‘pe-none’);
btn.setAttribute(‘aria-hidden’, ‘true’);
btn.tabIndex = -1;
}
});
}

document.querySelectorAll(“.toggleBtn”).forEach((btn) => {
const text = btn.previousElementSibling;
updateBtn(btn, text);
btn.addEventListener(“click”, () => {
text.classList.toggle(“expanded”);
const expanded = text.classList.contains(“expanded”);
btn.textContent = expanded
? “Read less”
: “Read more”;
updateBtn(btn, text);
});
const ro = new ResizeObserver(() => updateBtn(btn, text));
ro.observe(text);
});

const autoDropdownInstance = new AutoComplete(‘.search-input-input’);

});

*/
window.addEventListener(‘load’, () => {
const itemsToUpdate = new Set();
let isPending = false;

/**
* Führt alle Messungen und DOM-Updates in Batches aus,
* um “Layout Thrashing” (erzwungene Umbrüche) zu verhindern.
*/
function processUpdates() {
const results = [];

// 1. PHASE: Nur LESEN (Reads)
// Wir gehen durch alle markierten Elemente und messen deren Geometrie.
itemsToUpdate.forEach(item => {
const { btn, text } = item;
const expanded = text.classList.contains(‘expanded’);

// Hier passiert der kritische Layout-Trigger (scrollHeight)
const overflowing = text.scrollHeight > text.clientHeight + 1;

results.push({
btn,
shouldBeVisible: expanded || overflowing
});
});

// 2. PHASE: Nur SCHREIBEN (Writes)
// Erst wenn alle Messungen fertig sind, ändern wir das DOM.
requestAnimationFrame(() => {
results.forEach(({ btn, shouldBeVisible }) => {
if (shouldBeVisible) {
btn.classList.remove(‘invisible’, ‘pe-none’);
btn.removeAttribute(‘aria-hidden’);
btn.tabIndex = 0;
} else {
btn.classList.add(‘invisible’, ‘pe-none’);
btn.setAttribute(‘aria-hidden’, ‘true’);
btn.tabIndex = -1;
}
});

// Set leeren und Flag zurücksetzen
itemsToUpdate.clear();
isPending = false;
});
}

/**
* Registriert ein Element für das nächste Batch-Update.
*/
function scheduleUpdate(btn, text) {
itemsToUpdate.add({ btn, text });
if (!isPending) {
isPending = true;
// Kleiner Timeout, damit der Browser Luft zum Atmen hat
setTimeout(processUpdates, 50);
}
}

// Initialisierung der Toggle-Buttons
document.querySelectorAll(“.toggleBtn”).forEach((btn) => {
const text = btn.previousElementSibling;

// Initialer Check beim Laden
scheduleUpdate(btn, text);

btn.addEventListener(“click”, () => {
text.classList.toggle(“expanded”);
const isExpanded = text.classList.contains(“expanded”);
btn.textContent = isExpanded ? “Read less” : “Read more”;
scheduleUpdate(btn, text);
});

// Observer für Größenänderungen (z.B. Window-Resize)
const ro = new ResizeObserver(() => scheduleUpdate(btn, text));
ro.observe(text);
});

// — DEIN AUTOCOMPLETE —
// Wir stellen sicher, dass es am Ende initialisiert wird
try {
const autoDropdownInstance = new AutoComplete(‘.search-input-input’);
} catch (e) {
console.error(“AutoComplete konnte nicht geladen werden:”, e);
}
});

class UserActivityStore {
constructor(o = {}) {
this.cfg = Object.assign({
prefix: “uas”,
watchedLimit: 1000,
likesLimit: 1000,
cumsLimit: 1000,
pagesLimit: 100,
version: “v1”,
autoPage: true
}, o);

const p = this.cfg.prefix + “_” + this.cfg.version;
this.k = {
w: `${p}_watched`,
l: `${p}_likes`,
c: `${p}_cums`,
p: `${p}_pages`
};

if (this.cfg.autoPage) this.page();
}

/* ——– public ——– */

// dedupe by video id
watch(id, ts = Date.now()) {
if (!this.#ok(id)) return;
return this.#upsert(this.k.w, { id: String(id), ts }, “id”, this.cfg.watchedLimit);
}

// dedupe by video id (old entry removed)
like(id, value, ts = Date.now()) {
if (!this.#ok(id) || !this.#bit(value)) return;
return this.#upsert(this.k.l, { id: String(id), ts, value }, “id”, this.cfg.likesLimit);
}

// dedupe by video id (old entry removed)
cum(id, value, ts = Date.now()) {
if (!this.#ok(id) || !this.#bit(value)) return;
return this.#upsert(this.k.c, { id: String(id), ts, value }, “id”, this.cfg.cumsLimit);
}

// dedupe by url
page(url = location.href, ts = Date.now()) {
if (!url) return;
return this.#upsert(this.k.p, { url: String(url), ts }, “url”, this.cfg.pagesLimit);
}

getWatched() { return this.#load(this.k.w); }
getLikes(value) {
return this.#filterByValue(this.k.l, value);
}

getCums(value) {
return this.#filterByValue(this.k.c, value);
}
getPages() { return this.#load(this.k.p); }

clearAll() {
Object.values(this.k).forEach(k => localStorage.removeItem(k));
}

/* ——– private ——– */

#ok(v) { return v !== undefined && v !== null && String(v).length; }

// falls value aus dataset kommt (“0″/”1”), klappt es trotzdem
#bit(v) { return v === 0 || v === 1 || v === “0” || v === “1”; }

#load(k) {
try {
const v = JSON.parse(localStorage.getItem(k));
return Array.isArray(v) ? v : [];
} catch { return []; }
}

#save(k, a) {
localStorage.setItem(k, JSON.stringify(a));
}

#filterByValue(k, value) {
const a = this.#load(k);

// kein Filter → alles zurückgeben
if (value === undefined) return a;

// nur 0 oder 1 zulassen
if (!this.#bit(value)) return [];

const v = String(value);
return a.filter(x => x && String(x.value) === v);
}

// upsert: remove existing by field, then unshift
#upsert(k, obj, field, limit) {
let a = this.#load(k);

// entfernen (auch tolerant bei String/Number)
const keyVal = obj[field];
a = a.filter(x => x && String(x[field]) !== String(keyVal));

a.unshift(obj);
if (a.length > limit) a.length = limit;
this.#save(k, a);
return a;
}
}

/* ——– example usage ——– */

window.activity = new UserActivityStore();

class AutoComplete {
constructor(selector, type = false) {
this.autoDropdown = null;
this.url = ‘/api/autocomplete/?lang=en’;
this.inputElement = document.querySelector(selector);
this.attachListeners();
this.type = type;
this.items = [];
this.currentSelectedIndex = -1;
}

renderDropdown(data, inputValue) {
this.currentSelectedIndex = -1;
let dropdownHTML = ”;
let numberOfLinks = 0;
for (let i = 0; i < data.results.length; i++) { let result = data.results[i]; if (result.links.length) { let resultCount = result['total']; if (result.links.length < result['total']) { resultCount = result.links.length + ' / ' + result['total']; } dropdownHTML += '' + result['label'] + ' (' + resultCount + ')'; result.links.forEach(item => {
/* if (this.type == ‘filter’)
{
let filterLocation = ”;
switch (result.name)
{
case ‘states’: filterLocation = ‘state_id’; break;
case ‘countries’: filterLocation = ‘country_id’; break;
case ‘cities’: filterLocation = ‘city_id’; break;
default: console.log(‘no valid filter name’);
}
let onClick = ‘addFilter(” + filterLocation + ”,’ + item.id + ‘,” + item.name + ”)’;
dropdownHTML += ” + item.html + ”;

} else*/
{
if (item.hasOwnProperty(‘click’))
{
if (item.hasOwnProperty(‘html’)) {
dropdownHTML += ” + item.html + ”;
} else {
//let highlightedText = item.label.replace(new RegExp(inputValue, ‘gi’), match => ” + match + ”);
let highlightedText = item.label
.replace(new RegExp(inputValue, ‘gi’), match => `${match}`)
.replace(/ (?=)/g, ‘ ‘)
.replace(/(?<=) /g, ‘ ‘);
dropdownHTML += ” + highlightedText + ”;
}
} else
{
/* if (item.hasOwnProperty(‘html’)) {
dropdownHTML += ” + item.html + ”;
} else {
let highlightedText = item.label.replace(new RegExp(inputValue, ‘gi’), match => ” + match + ”);
dropdownHTML += ” + highlightedText + ”;
} */

if (item.hasOwnProperty(‘html’)) {
dropdownHTML += ” + item.html + ”;
} else {
//let highlightedText = item.label.replace(new RegExp(inputValue, ‘gi’), match => ” + match + ”);

let highlightedText = item.label
.replace(new RegExp(inputValue, ‘gi’), match => `${match}`)
.replace(/ (?=)/g, ‘ ‘)
.replace(/(?<=) /g, ‘ ‘);
if (item.hasOwnProperty(‘imageUrl’))
{
dropdownHTML += ” + highlightedText + ”;
} else
{
dropdownHTML += ” + highlightedText + ”;
}
}

}
}
numberOfLinks++;
});
}
}
if (numberOfLinks === 0) {
dropdownHTML = ‘No matches found’;
}
this.autoDropdown.innerHTML = dropdownHTML;

this.items = this.autoDropdown.getElementsByClassName(‘dropdown-item’);
if (this.type == ‘locations2’ || this.type == ‘filter’)
{
this.currentSelectedIndex = 0;
this.updateSelection();
}

this.autoDropdown.classList.add(‘d-block’);
if (this.inputElement.id != ‘main_search’)
{
document.body.classList.add(‘search_overlay_active’);
}
/*
if (!isInViewport(this.inputElement))
{
if (this.inputElement.id != ‘main_search’)
{
window.scrollTo(0,0);
} else
{
this.inputElement.scrollIntoView();
}
} */
}

updateSelection() {
for (let i = 0; i < this.items.length; i++) { this.items[i].classList.remove("selected"); } if (this.currentSelectedIndex > -1) {
this.items[this.currentSelectedIndex].classList.add(“selected”);
}
}

attachListeners() {
this.inputElement.addEventListener(‘keydown’, (event) => {
if (event.key === “ArrowDown”) {
event.preventDefault();
if (this.currentSelectedIndex == -1 && this.items.length > 0)
{
this.currentSelectedIndex = 0;
this.updateSelection();
} else
{
if (this.currentSelectedIndex < this.items.length - 1) { this.currentSelectedIndex++; this.updateSelection(); } } } else if (event.key === "ArrowUp") { event.preventDefault(); if (this.currentSelectedIndex > 0) {
this.currentSelectedIndex–;
this.updateSelection();
} else
{
if (this.type == false)
{
this.currentSelectedIndex = -1;
this.updateSelection();
}
}
} else if (event.key === “Enter”) {
if (this.currentSelectedIndex > -1) {
event.preventDefault();
this.items[this.currentSelectedIndex].click();
}
}
});

this.inputElement.addEventListener(‘input’, () => {
if (!this.autoDropdown) {
this.autoDropdown = document.createElement(“ul”);
this.autoDropdown.classList.add(“dropdown-menu”);
this.autoDropdown.classList.add(“dropdown-autocomplete”);
this.inputElement.parentElement.insertBefore(this.autoDropdown, this.inputElement.parentElement.childNodes[2]);
}

let inputValue = this.inputElement.value;
if (inputValue.length > 2) {
let requestUrl = this.url + ‘&q=’ + encodeURIComponent(inputValue);
let tables = this.inputElement.dataset.tables;
if (tables) {
requestUrl += ‘&tables=’ + encodeURIComponent(tables);
}

fetch(requestUrl)
.then(response => response.json())
.then(data => {
this.renderDropdown(data, inputValue);
})
.catch(error => {
console.error(‘Error fetching autocomplete data:’, error);
});
} else {
this.autoDropdown.innerHTML = ”;
this.autoDropdown.classList.remove(‘d-block’);
document.body.classList.remove(‘search_overlay_active’);
}
});

this.inputElement.addEventListener(“focusout”, () => {
if (this.autoDropdown !== null) {
window.setTimeout(() => {
this.autoDropdown.classList.remove(‘d-block’);
document.body.classList.remove(‘search_overlay_active’);
}, 100);
}
});
}
}
/*
document.addEventListener(‘DOMContentLoaded’, () => {
const body = document.body;

window.toggleLayout = () => {
const isCurrentlySingle = body.classList.contains(‘view-single-column’);
const newState = !isCurrentlySingle;

// Toggle the class on the body
body.classList.toggle(‘view-single-column’, newState);

// Save the user preference to localStorage
localStorage.setItem(‘videoLayout’, newState ? ‘single’ : ‘double’);

console.log(`Layout switched to: ${newState ? ‘1 Column’ : ‘2 Columns’}`);
};

const savedLayout = localStorage.getItem(‘videoLayout’);
// check storage
if (savedLayout === ‘single’) {
// no blocking of browser
const isMobile = window.matchMedia(‘(max-width: 575px)’).matches;
if (isMobile) {
// put changes to next frame
requestAnimationFrame(() => {
document.body.classList.add(‘view-single-column’);
});
}
}
}); */
/*
document.addEventListener(‘DOMContentLoaded’, () => {
const body = document.body;
const layoutButtons = document.querySelectorAll(‘.btn-grid’);

const updateIcons = (isSingle) => {
layoutButtons.forEach(btn => {
const icon = btn.querySelector(‘i’);
if (icon) {
// Tausche die Klassen basierend auf dem Zustand
icon.className = isSingle
? ‘fa fa-regular fa-grid-2’
: ‘fa fa-regular fa-table-rows’;
}
});
};

window.toggleLayout = () => {
const isCurrentlySingle = body.classList.contains(‘view-single-column’);
const newState = !isCurrentlySingle;

body.classList.toggle(‘view-single-column’, newState);
localStorage.setItem(‘videoLayout’, newState ? ‘single’ : ‘double’);

updateIcons(newState);
// console.log(`Layout switched to: ${newState ? ‘1 Column’ : ‘2 Columns’}`);
};

// Event-Listener an alle Buttons binden
layoutButtons.forEach(btn => {
btn.addEventListener(‘click’, (e) => {
e.preventDefault(); // Verhindert ungewollte Sprünge/Reloads
window.toggleLayout();
});
});

// Initialer Check beim Laden der Seite
const savedLayout = localStorage.getItem(‘videoLayout’);

if (savedLayout === ‘single’) {
const isMobile = window.matchMedia(‘(max-width: 575px)’).matches;

if (isMobile) {
// requestAnimationFrame sorgt für flüssiges Rendering ohne Blocking
requestAnimationFrame(() => {
body.classList.add(‘view-single-column’);
updateIcons(true);
});
}
}
});*/
/*
document.addEventListener(‘DOMContentLoaded’, () => {
const body = document.body;

// Selektoren basierend auf deinen Klassen
const layoutBtnMobile = document.querySelector(‘.btn-grid.mobile’);
const layoutBtnDesktop = document.querySelector(‘.btn-grid.desktop’);

const updateMobileIcon = (isSingle) => {
const icon = layoutBtnMobile?.querySelector(‘i’);
if (icon) {
icon.className = isSingle ? ‘fa fa-regular fa-grid-2’ : ‘fa fa-regular fa-table-rows’;
}
};

const updateDesktopIcon = (isBig) => {
const icon = layoutBtnDesktop?.querySelector(‘i’);
if (icon) {
// Tauscht auf fa-grid-4 wenn aktiv, sonst zurück auf fa-grid-2
icon.className = isBig ? ‘fa fa-regular fa-grid-2’ : ‘fa fa-regular fa-grid-4’;
}
};

const toggleMobileLayout = () => {
const isCurrentlySingle = body.classList.contains(‘view-single-column’);
const newState = !isCurrentlySingle;

body.classList.toggle(‘view-single-column’, newState);
localStorage.setItem(‘videoLayout’, newState ? ‘single’ : ‘double’);
updateMobileIcon(newState);
};

const toggleDesktopLayout = () => {
const isCurrentlyBig = body.classList.contains(‘big-container’);
const newState = !isCurrentlyBig;

body.classList.toggle(‘big-container’, newState);
localStorage.setItem(‘containerStyle’, newState ? ‘big’ : ‘normal’);
updateDesktopIcon(newState);
};

// Event Listener binden
if (layoutBtnMobile) {
layoutBtnMobile.addEventListener(‘click’, (e) => {
e.preventDefault();
toggleMobileLayout();
});
}

if (layoutBtnDesktop) {
layoutBtnDesktop.addEventListener(‘click’, (e) => {
e.preventDefault();
toggleDesktopLayout();
});
}

// Initialer Check beim Laden der Seite
const savedLayout = localStorage.getItem(‘videoLayout’);
const savedContainer = localStorage.getItem(‘containerStyle’);

// Restore Mobile Layout Status
if (savedLayout === ‘single’) {
body.classList.add(‘view-single-column’);
updateMobileIcon(true);
}

// Restore Desktop Container Status
if (savedContainer === ‘big’) {
body.classList.add(‘big-container’);
updateDesktopIcon(true);
}
});*/

document.addEventListener(‘DOMContentLoaded’, () => {
const body = document.body;

// — LOGIK FÜR MOBILE (Spalten-Layout) —
const mobileBtns = document.querySelectorAll(‘.btn-grid.mobile’);

const setMobileLayout = (isSingle) => {
body.classList.toggle(‘view-single-column’, isSingle);
localStorage.setItem(‘videoLayout’, isSingle ? ‘single’ : ‘double’);

// Aktiven Button markieren
mobileBtns.forEach(btn => {
const active = isSingle ? btn.classList.contains(‘btn-single’) : btn.classList.contains(‘btn-double’);
btn.classList.toggle(‘easy_active’, active);
});
};

mobileBtns.forEach(btn => {
btn.addEventListener(‘click’, () => {
const targetSingle = btn.classList.contains(‘btn-single’);
setMobileLayout(targetSingle);
});
});

// — LOGIK FÜR DESKTOP (Container-Breite) —
const desktopBtns = document.querySelectorAll(‘.btn-grid.desktop’);

const setDesktopLayout = (isBig) => {
body.classList.toggle(‘big-container’, isBig);
localStorage.setItem(‘containerStyle’, isBig ? ‘big’ : ‘normal’);

// Aktiven Button markieren
desktopBtns.forEach(btn => {
const active = isBig ? btn.classList.contains(‘btn-wide’) : btn.classList.contains(‘btn-norm’);
btn.classList.toggle(‘easy_active’, active);
});
};

desktopBtns.forEach(btn => {
btn.addEventListener(‘click’, () => {
const targetBig = btn.classList.contains(‘btn-wide’);
setDesktopLayout(targetBig);
});
});

// — INITIALISIERUNG BEIM LADEN —
const savedLayout = localStorage.getItem(‘videoLayout’);
const savedContainer = localStorage.getItem(‘containerStyle’);

// Start-Zustand Mobile
setMobileLayout(savedLayout === ‘single’);

// Start-Zustand Desktop
setDesktopLayout(savedContainer === ‘big’);

// pwa installed and open event (once per session)
window.addEventListener(‘appinstalled’, function ()
{
sendgTagEvent(‘pwa_installed’, {
source: ‘browser_install_prompt’
});
});
if ((window.matchMedia(‘(display-mode: standalone)’).matches
|| window.navigator.standalone === true)
&& !sessionStorage.getItem(‘pwa_open_sent’)
) {
sendgTagEvent(‘pwa_open’, {
source: ‘standalone’,
page: window.location.pathname
});
sessionStorage.setItem(‘pwa_open_sent’, ‘1’);
}

});

PornMike
Maximize

Maximize Your Online Potential with AdultSEO Hub

Get 10X traffic for your site with professional adult SEO services from us. Technical SEO, content writing, PPC campaigns, and affiliate marketing, we offer a full-fledged, data-driven solution that promises results.

Let’s Start Today.