1
0

586 lines
24 KiB
HTML
Raw Normal View History

2025-02-26 21:09:58 +01:00
<!--DeppGPT Start-->
2025-03-01 13:59:39 +01:00
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DeppGPT</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
2025-02-26 21:09:58 +01:00
<style>
2025-03-01 13:59:39 +01:00
:root {
--primary-color: #0E766C;
--secondary-color: #264044;
--accent-color: #009688;
--text-light: #ffffff;
--background-light: #f5f5f5;
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
body {
margin: 0;
font-family: 'Segoe UI', system-ui, sans-serif;
background: var(--background-light);
min-height: 100vh;
2025-02-26 21:09:58 +01:00
display: flex;
flex-direction: column;
}
2025-03-01 13:59:39 +01:00
/* Header Styles */
.header {
background: var(--primary-color);
color: var(--text-light);
padding: 1rem;
text-align: center;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
/* Main Container */
.main-content {
flex: 1;
max-width: 800px;
margin: 20px auto;
padding: 0 20px;
width: 100%;
}
/* Chat Container */
.chat-container {
background: white;
border-radius: 15px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
height: 500px;
display: flex;
flex-direction: column;
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
.chat-messages {
flex: 1;
padding: 20px;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 15px;
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
/* Message Styles */
.message {
max-width: 75%;
padding: 12px 18px;
border-radius: 20px;
2025-02-26 21:09:58 +01:00
line-height: 1.4;
2025-03-01 13:59:39 +01:00
word-break: break-word;
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
.user-message {
2025-02-26 21:09:58 +01:00
align-self: flex-end;
2025-03-01 13:59:39 +01:00
background: var(--primary-color);
color: var(--text-light);
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
.bot-message {
2025-02-26 21:09:58 +01:00
align-self: flex-start;
2025-03-01 13:59:39 +01:00
background: var(--secondary-color);
color: var(--text-light);
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
/* Input Area */
.input-container {
display: flex;
gap: 10px;
padding: 20px;
background: white;
border-top: 1px solid #eee;
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
.input-field {
flex: 1;
padding: 12px;
border: 1px solid #ddd;
border-radius: 8px;
font-size: 16px;
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
.send-button {
background: var(--primary-color);
color: white;
padding: 12px 25px;
border: none;
border-radius: 8px;
cursor: pointer;
transition: background 0.3s ease;
}
2025-02-26 21:09:58 +01:00
2025-03-01 13:59:39 +01:00
.send-button:hover {
background: var(--accent-color);
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
/* Footer Styles */
.footer {
background: var(--primary-color);
color: var(--text-light);
text-align: center;
padding: 1rem;
margin-top: auto;
font-size: 0.9em;
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
/* Responsive Design */
@media (max-width: 768px) {
.chat-container {
height: 400px;
}
.message {
max-width: 85%;
font-size: 14px;
}
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
@media (max-width: 480px) {
.chat-container {
height: 300px;
}
.input-container {
flex-direction: column;
}
.send-button {
width: 100%;
}
}
/* Loading Animation Styles */
.send-button {
2025-02-26 21:09:58 +01:00
position: relative;
width: 80px;
}
2025-03-01 13:59:39 +01:00
2025-02-26 21:09:58 +01:00
#buttonText,
#ellipsis {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
2025-03-01 13:59:39 +01:00
2025-02-26 21:09:58 +01:00
.ellipsis div {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
background: #fff;
margin: 0 2px;
animation: ellipsis 1s infinite;
}
2025-03-01 13:59:39 +01:00
.ellipsis div:nth-child(2) { animation-delay: 0.2s; }
.ellipsis div:nth-child(3) { animation-delay: 0.4s; }
2025-02-26 21:09:58 +01:00
@keyframes ellipsis {
2025-03-01 13:59:39 +01:00
0% { transform: scale(0); }
100% { transform: scale(1); }
2025-02-26 21:09:58 +01:00
}
</style>
2025-03-01 13:59:39 +01:00
</head>
<body>
<header class="header">
<h1>DeppGPT</h1>
</header>
<main class="main-content">
<div class="chat-container">
<div class="chat-messages" id="chat-container"></div>
<div class="input-container">
<input type="text" class="input-field" id="user-input" placeholder="Schreibe eine Nachricht...">
<button class="send-button" id="send-button">
<div id="buttonText">Senden</div>
<div class="ellipsis" id="ellipsis" style="display: none;">
<div></div>
<div></div>
<div></div>
</div>
</button>
2025-02-26 21:09:58 +01:00
</div>
2025-03-01 13:59:39 +01:00
</div>
2025-02-26 21:09:58 +01:00
2025-03-01 13:59:39 +01:00
<div class="button-container">
<button class="save-button" id="save-button">Chat als Bild speichern</button>
</div>
</main>
2025-02-26 21:09:58 +01:00
2025-03-01 13:59:39 +01:00
<footer class="footer">
Geklaut von Postillon und überarbeitet von Akamaru
</footer>
2025-02-26 21:09:58 +01:00
<script>
const chatGPTContainer = document.getElementById('chat-container');
const maxMessages = getRandomInt(3, 5);
let messageCount = 0;
let serverOverloaded = false;
let sendButtonActive = true;
2025-03-01 13:59:39 +01:00
// Event-Listener für Enter-Taste
document.querySelector('.input-field').addEventListener('keypress', function (e) {
2025-02-26 21:09:58 +01:00
if (e.key === 'Enter') {
sendChatGPTMessage();
}
});
2025-03-01 13:59:39 +01:00
// Event-Listener für Send-Button
document.getElementById('send-button').addEventListener('click', sendChatGPTMessage);
2025-02-26 21:09:58 +01:00
async function sendChatGPTMessage() {
2025-03-01 13:59:39 +01:00
if (!sendButtonActive) return;
const userInput = document.querySelector('.input-field');
2025-02-26 21:09:58 +01:00
let message = userInput.value.trim();
if (message) {
userInput.value = '';
sendButtonActive = false;
toggleLoading(true);
messageCount += 1;
2025-03-01 13:59:39 +01:00
// User-Nachricht anzeigen
2025-02-26 21:09:58 +01:00
const userMessageElement = document.createElement('div');
2025-03-01 13:59:39 +01:00
userMessageElement.className = 'message user-message';
2025-02-26 21:09:58 +01:00
userMessageElement.innerText = message;
chatGPTContainer.appendChild(userMessageElement);
chatGPTContainer.scrollTop = chatGPTContainer.scrollHeight;
2025-03-01 13:59:39 +01:00
if (messageCount <= maxMessages && !serverOverloaded) {
showChatGPTLoadingAnimation();
2025-02-26 21:09:58 +01:00
2025-03-01 13:59:39 +01:00
// API-Aufruf
2025-02-26 21:09:58 +01:00
const response = await getCompletion(message);
const answer = response;
setTimeout(() => {
hideChatGPTLoadingAnimation();
const botMessageElement = document.createElement('div');
2025-03-01 13:59:39 +01:00
botMessageElement.className = 'message bot-message';
2025-02-26 21:09:58 +01:00
chatGPTContainer.appendChild(botMessageElement);
2025-03-01 13:59:39 +01:00
// Typing-Effekt
2025-02-26 21:09:58 +01:00
let index = 0;
const typingInterval = setInterval(() => {
botMessageElement.innerHTML += answer[index];
index++;
if (index === answer.length) {
clearInterval(typingInterval);
toggleLoading(false);
sendButtonActive = true;
2025-03-01 13:59:39 +01:00
if (serverOverloaded) {
showServerOverloadedMessage();
} else if (messageCount === maxMessages) {
showExitMessage();
2025-02-26 21:09:58 +01:00
}
}
chatGPTContainer.scrollTop = chatGPTContainer.scrollHeight;
}, 25);
}, 1000);
2025-03-01 13:59:39 +01:00
} else {
2025-02-26 21:09:58 +01:00
toggleLoading(false);
sendButtonActive = true;
}
}
}
let messages = [];
let serverURL = null;
function getDeepGPTVersionHost(probability) {
if (probability < 0 || probability > 1) {
throw new Error("Probability must be between 0 and 1.");
}
var randomNum = Math.random();
2025-03-01 13:59:39 +01:00
return randomNum < probability ?
"https://europe-west1-deppgpt.cloudfunctions.net/DeppGPTRelease221" :
"https://europe-west1-deppgpt.cloudfunctions.net/DeppGPTRelease20";
2025-02-26 21:09:58 +01:00
}
async function getCompletion(userMessage) {
messages.push({ role: "user", content: userMessage });
2025-03-01 13:59:39 +01:00
if (!serverURL) {
if (isGreeting(userMessage)) {
2025-02-26 21:09:58 +01:00
serverURL = getDeepGPTVersionHost(0.2);
2025-03-01 13:59:39 +01:00
} else if (isQuestion(userMessage)) {
2025-02-26 21:09:58 +01:00
serverURL = getDeepGPTVersionHost(0.8);
2025-03-01 13:59:39 +01:00
} else {
2025-02-26 21:09:58 +01:00
serverURL = getDeepGPTVersionHost(0.5);
}
}
const response = await fetch(serverURL, {
method: "POST",
2025-03-01 13:59:39 +01:00
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ messages, maxMessages }),
2025-02-26 21:09:58 +01:00
});
if (response.ok) {
const data = await response.json();
const assistantMessage = data.answer;
messages.push({ role: "assistant", content: assistantMessage });
return assistantMessage;
} else {
2025-03-01 13:59:39 +01:00
serverOverloaded = true;
2025-02-26 21:09:58 +01:00
const errorMessages = [
2025-03-01 13:59:39 +01:00
"Ich kriege gerade so viele Anfragen von so unfähigen Leuten wie dir, ich brauch grad echt mal ne Pause. Komm später wieder. Oder besser noch gar nicht!",
"Ich habe gerade genug von all den Leuten, die nicht wissen, was sie tun. Ich brauche einen Moment. Komm später zurück, wenn überhaupt!",
"Ich bin gerade von all den Anfragen von Leuten wie dir überschwemmt, die keine Ahnung haben. Ich muss durchatmen. Vielleicht kommst du später zurück, oder besser noch, gar nicht!",
"Ich bin gerade von all den Anfragen überfordert. Ich muss mich sammeln. Bitte komm später wieder, oder vielleicht sogar nie wieder!",
"Ich bin gerade mit Anfragen von Leuten überhäuft, die einfach keinen Plan haben. Ich brauche eine Pause. Versuch es später nochmal, oder besser noch, gar nicht!",
"Ich habe gerade genug von all den nutzlosen Anfragen. Ich brauche einen Moment für mich. Komm später wieder, oder vielleicht auch nicht!",
"Ich bin gerade von Menschen überwältigt, die einfach nicht wissen, was sie tun. Ich brauche eine Auszeit. Versuch es später nochmal, oder am besten gar nicht!",
"Ich bin gerade mit sinnlosen Anfragen überhäuft. Ich brauche eine Pause. Komm später wieder, oder vielleicht auch nicht!",
"Ich habe gerade genug von all den Ahnungslosen, die mich belästigen. Ich brauche eine Pause. Versuch es später nochmal, oder am besten gar nicht!",
"Ich bin gerade überfordert von all den Anfragen von Leuten, die nichts kapieren. Ich brauche eine Auszeit. Komm später wieder, oder vielleicht besser nicht!",
"Ich habe gerade genug von all den Anfragen von Leuten, die keine Ahnung haben. Ich brauche eine Pause. Versuch es später nochmal, oder besser noch, gar nicht!",
"Ich bin gerade von den Anfragen von Menschen, die nicht wissen, was sie tun, überschwemmt. Ich brauche eine Pause. Komm später wieder, oder am besten gar nicht!",
"Ich bin gerade von nutzlosen Anfragen überhäuft. Ich brauche eine Auszeit. Versuch es später nochmal, oder am besten gar nicht!",
"Ich bin gerade überfordert von all den Anfragen von Leuten, die einfach keinen Plan haben. Ich brauche eine Pause. Komm später wieder, oder vielleicht auch nicht!",
"Ich habe gerade genug von all den Leuten, die mich belästigen. Ich brauche eine Pause. Versuch es später nochmal, oder am besten gar nicht!",
"Ich bin gerade von all den Anfragen überwältigt, die ich bekomme. Ich brauche eine Auszeit. Komm später wieder, oder vielleicht auch nicht!",
"Ich bin gerade von all den Anfragen von Leuten, die nichts verstehen, überwältigt. Ich brauche eine Pause. Komm später wieder, oder vielleicht besser nicht!",
"Ich habe gerade genug von all den Anfragen von Leuten, die keinen Sinn ergeben. Ich brauche eine Auszeit. Komm später wieder, oder vielleicht auch nicht!",
"Ich bin gerade von Anfragen überhäuft, die keinen Sinn ergeben. Ich brauche eine Pause. Komm später wieder, oder vielleicht auch nicht!",
"Ich bin gerade von Leuten überwältigt, die einfach nicht wissen, was sie tun. Ich brauche eine Auszeit. Versuch es später nochmal, oder am besten gar nicht!",
"Ich bin gerade überfordert von all den Anfragen von Leuten, die einfach keinen Plan haben. Ich brauche eine Pause. Komm später wieder, oder vielleicht auch nicht!",
"Ich habe gerade genug von all den nutzlosen Anfragen. Ich brauche einen Moment für mich. Komm später wieder, oder vielleicht auch nicht!",
"Ich bin gerade von Menschen überwältigt, die einfach nicht wissen, was sie tun. Ich brauche eine Auszeit. Versuch es später nochmal, oder am besten gar nicht!",
"Ich bin gerade mit sinnlosen Anfragen überhäuft. Ich brauche eine Pause. Komm später wieder, oder vielleicht auch nicht!",
"Ich habe gerade genug von all den Ahnungslosen, die mich belästigen. Ich brauche eine Pause. Versuch es später nochmal, oder am besten gar nicht!",
"Ich bin gerade überfordert von all den Anfragen von Leuten, die nichts kapieren. Ich brauche eine Auszeit. Komm später wieder, oder vielleicht besser nicht!",
"Ich habe gerade genug von all den Anfragen von Leuten, die keine Ahnung haben. Ich brauche eine Pause. Versuch es später nochmal, oder besser noch, gar nicht!",
"Ich bin gerade von den Anfragen von Menschen, die nicht wissen, was sie tun, überschwemmt. Ich brauche eine Pause. Komm später wieder, oder am besten gar nicht!",
"Ich bin gerade von nutzlosen Anfragen überhäuft. Ich brauche eine Auszeit. Versuch es später nochmal, oder am besten gar nicht!",
"Ich bin gerade überfordert von all den Anfragen von Leuten, die einfach keinen Plan haben. Ich brauche eine Pause. Komm später wieder, oder vielleicht auch nicht!",
"Ich habe gerade genug von all den Leuten, die mich belästigen. Ich brauche eine Pause. Versuch es später nochmal, oder am besten gar nicht!",
"Ich bin gerade von all den Anfragen überwältigt, die ich bekomme. Ich brauche eine Auszeit. Komm später wieder, oder vielleicht auch nicht!",
"Ich bin gerade von all den Anfragen von Leuten, die nichts verstehen, überwältigt. Ich brauche eine Pause. Komm später wieder, oder vielleicht besser nicht!",
"Ich habe gerade genug von all den Anfragen von Leuten, die keinen Sinn ergeben. Ich brauche eine Auszeit. Komm später wieder, oder vielleicht auch nicht!",
"Ich bin gerade von Anfragen überhäuft, die keinen Sinn ergeben. Ich brauche eine Pause. Komm später wieder, oder vielleicht auch nicht!"
2025-02-26 21:09:58 +01:00
];
const randomIndex = Math.floor(Math.random() * errorMessages.length);
const errorMessage = errorMessages[randomIndex];
messages.push({ role: "assistant", content: errorMessage });
return errorMessage;
}
}
function showChatGPTLoadingAnimation() {
const loadingElement = document.createElement('div');
loadingElement.className = 'loading-animation';
chatGPTContainer.appendChild(loadingElement);
chatGPTContainer.scrollTop = chatGPTContainer.scrollHeight;
}
function hideChatGPTLoadingAnimation() {
2025-03-01 13:59:39 +01:00
const loadingElement = document.querySelector('.loading-animation');
if (loadingElement) {
loadingElement.remove();
}
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
function showServerOverloadedMessage() {
const messageDiv = document.createElement('div');
messageDiv.className = 'message bot-exit-message';
messageDiv.textContent = 'Unsere Server sind gerade überlastet, bitte versuche es später noch einmal!';
chatGPTContainer.appendChild(messageDiv);
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
function showExitMessage() {
const messageDiv = document.createElement('div');
messageDiv.className = 'message bot-exit-message';
messageDiv.textContent = 'FunGPT hat den Chat verlassen.';
chatGPTContainer.appendChild(messageDiv);
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
function toggleLoading(isLoading) {
const buttonText = document.getElementById("buttonText");
const ellipsis = document.getElementById("ellipsis");
2025-02-26 21:09:58 +01:00
2025-03-01 13:59:39 +01:00
if (isLoading) {
buttonText.style.display = 'none';
ellipsis.style.display = 'block';
} else {
buttonText.style.display = 'block';
ellipsis.style.display = 'none';
2025-02-26 21:09:58 +01:00
}
}
2025-03-01 13:59:39 +01:00
function isGreeting(sentence) {
const greetingKeywords = ['hallo', 'hi', 'guten tag', 'grüß dich', 'moin', 'servus', 'hey', 'huhu', 'grüezi', 'sers', 'salut', 'willkommen', 'tach', 'tschüss', 'ahoi', 'na', 'tagchen', 'griaß di', 'griaß enk', 'juten tach', 'hallöchen', 'hallöle', 'grüssle', 'grüß gott', 'mahoin'];
return greetingKeywords.some(word => sentence.toLowerCase().startsWith(word));
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
function isQuestion(sentence) {
sentence = sentence.trim();
if (sentence.endsWith('?')) return true;
2025-02-26 21:09:58 +01:00
2025-03-01 13:59:39 +01:00
const questionWords = ['wer', 'wen', 'wem', 'wessen', 'was', 'wann', 'wo', 'warum', 'wie'];
return questionWords.some(word => sentence.toLowerCase().startsWith(word));
2025-02-26 21:09:58 +01:00
}
function getRandomInt(min, max) {
2025-03-01 13:59:39 +01:00
return Math.floor(Math.random() * (max - min + 1)) + min;
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
// Save Button Functionality
2025-02-26 21:09:58 +01:00
document.getElementById('save-button').addEventListener('click', function () {
2025-03-01 13:59:39 +01:00
var chatWindow = document.querySelector('.chat-messages');
if (navigator.userAgent.indexOf("gonative") !== -1) {
2025-02-26 21:09:58 +01:00
let serializedChildren = serializeDivChildren(chatWindow);
let json = JSON.stringify(serializedChildren);
let encodedJson = encodeURIComponent(json);
let url = "https://postillon-test.blogspot.com/p/deppgpt-download-page.html?data=" + encodedJson;
window.location.href = url;
2025-03-01 13:59:39 +01:00
} else {
var chatWindowCopy = chatWindow.cloneNode(true);
chatWindowCopy.id = 'chat-window-copy';
var chatCopyParent = document.createElement('div');
chatCopyParent.id = 'chat-window-copy-parent';
document.body.appendChild(chatCopyParent);
var totalHeight = 0;
for (var i = 0; i < chatWindowCopy.children.length; i++) {
totalHeight += chatWindowCopy.children[i].getBoundingClientRect().height;
var style = window.getComputedStyle(chatWindowCopy.children[i]);
totalHeight += parseInt(style.marginTop) + parseInt(style.marginBottom);
totalHeight += parseInt(style.paddingTop) + parseInt(style.paddingBottom);
}
chatWindowCopy.style.height = totalHeight + 'px';
2025-02-26 21:09:58 +01:00
2025-03-01 13:59:39 +01:00
var logo = document.createElement('img');
logo.src = 'https://i.imgur.com/t7y28qo.png';
2025-02-26 21:09:58 +01:00
2025-03-01 13:59:39 +01:00
var footer = document.createElement('img');
footer.src = 'https://i.imgur.com/4IAxy4D.png';
2025-02-26 21:09:58 +01:00
2025-03-01 13:59:39 +01:00
chatCopyParent.appendChild(logo);
chatCopyParent.appendChild(chatWindowCopy);
chatCopyParent.appendChild(footer);
2025-02-26 21:09:58 +01:00
2025-03-01 13:59:39 +01:00
setTimeout(function () {
renderAndDownload(chatCopyParent);
}, 100);
}
2025-02-26 21:09:58 +01:00
});
function renderAndDownload(element) {
const popup = $('<div id="popup"></div>');
const heading = $('<h2>Chat wird gerendert</h2>');
heading.css('margin-bottom', '20px');
popup.append(heading);
const loadingAnimation = createLoadingAnimation();
loadingAnimation.css('margin', '0 auto');
popup.append(loadingAnimation);
const closeButton = $('<button id="close-button">X</button>');
closeButton.css({
'position': 'absolute',
'right': '10px',
'top': '10px',
});
closeButton.click(function () {
popup.remove();
});
popup.append(closeButton.clone(true));
popup.css({
'position': 'fixed',
'top': '50%',
'left': '50%',
'transform': 'translate(-50%, -50%)',
'z-index': '1000',
'background': '#fff',
'padding': '20px',
'border-radius': '8px',
'box-shadow': '0 0 10px rgba(0, 0, 0, 0.1)',
'text-align': 'center',
'width': '80%',
'box-sizing': 'border-box',
'max-height': '90vh',
'overflow-y': 'hidden',
});
$('body').append(popup);
html2canvas(element, { useCORS: true }).then(function (canvas) {
const imgData = canvas.toDataURL("image/png");
const img = $('<img id="captured-image" src="' + imgData + '" alt="Rendered chat">');
img.css({
'display': 'block',
'margin': '0 auto',
'border': 'none',
'max-width': '50vw',
'max-height': '70vh',
});
popup.empty();
popup.append(img);
const downloadButton = $('<button id="download-button">Download</button>');
downloadButton.css({
'display': 'block',
'margin': '20px auto',
});
downloadButton.click(async function () {
const a = document.createElement('a');
a.href = imgData;
const date = new Date();
2025-03-01 13:59:39 +01:00
const filename = `FunGPT_CHAT_${date.getFullYear()}${('0' + (date.getMonth() + 1)).slice(-2)}${('0' + date.getDate()).slice(-2)}_${('0' + date.getHours()).slice(-2)}${('0' + date.getMinutes()).slice(-2)}${('0' + date.getSeconds()).slice(-2)}.png`;
if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
a.target = '_blank';
} else {
a.download = filename;
}
2025-02-26 21:09:58 +01:00
a.click();
});
popup.append(downloadButton);
2025-03-01 13:59:39 +01:00
popup.append(closeButton.clone(true));
2025-02-26 21:09:58 +01:00
});
}
2025-03-01 13:59:39 +01:00
function serializeDivChildren(element) {
let serializedChildren = [];
for (let child of element.children) {
if (child.tagName.toLowerCase() === 'div') {
serializedChildren.push({
classes: [...child.classList],
innerText: child.innerText
});
}
2025-02-26 21:09:58 +01:00
}
2025-03-01 13:59:39 +01:00
return serializedChildren;
2025-02-26 21:09:58 +01:00
}
function createLoadingAnimation() {
const loadingAnimation = $('<div id="loading-animation"></div>');
loadingAnimation.css({
'border': '16px solid #f3f3f3',
'border-top': '16px solid #3498db',
'border-radius': '50%',
'width': '120px',
'height': '120px',
'animation': 'spin 2s linear infinite',
});
const style = $('<style>@keyframes spin {0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); }}</style>');
$('html > head').append(style);
return loadingAnimation;
}
</script>
2025-03-01 13:59:39 +01:00
</body>
</html>
2025-02-26 21:09:58 +01:00
<!--DeppGPT Ende-->