Skip to content
Draft
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
39 changes: 38 additions & 1 deletion proxy/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,40 @@ window.tlsProxy = {
}
tlsProxy.translate = translate;

function cookieBanner() {
const name='__tlsProxyCookieBannerDismissed';
if (localStorage.getItem(name)) {
return;
}
const div = document.createElement('div');
div.style.position = 'fixed';
div.style.left = '0.25rem';
div.style.bottom = '0.25rem';
div.style.width = '25vw';
div.style.padding = '1rem';
div.style.color = 'black';
div.style.backgroundColor = 'white';
div.style.border = '1px solid black';
div.style.cursor = 'pointer';
div.style.zIndex = '1';
div.style.textAlign = 'center';
div.style.boxShadow = '3px 3px 5px black';
const x = document.createElement('div');
x.style.position = 'absolute';
x.style.right = '0.25rem';
x.style.top = '0.25rem';
x.textContent = '✖';
div.appendChild(x);
const m = document.createElement('div');
m.setAttribute('tkey', 'cookie-banner');
div.appendChild(m);
div.addEventListener('click', () => {
document.body.removeChild(div);
localStorage.setItem(name, 'yes');
});
document.body.appendChild(div);
}

async function applyTranslations(lang) {
await setLanguage(lang?[lang]:navigator.languages);
let changed = false;
Expand Down Expand Up @@ -139,5 +173,8 @@ window.tlsProxy = {
});
}
}
document.addEventListener('DOMContentLoaded', () => applyTranslations());
document.addEventListener('DOMContentLoaded', () => {
cookieBanner();
applyTranslations();
});
})();
Loading