SF/FF Filter: Ersetze Alerts durch Modals // Blende "noobyfication" aus
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Serienfans/Filmfans Releasegruppen Filter
|
// @name Serienfans/Filmfans Releasegruppen Filter
|
||||||
// @namespace https://git.ponywave.de/Akamaru/Userscripts
|
// @namespace https://git.ponywave.de/Akamaru/Userscripts
|
||||||
// @version 1.3
|
// @version 1.4
|
||||||
// @description Blende Uploads bestimmter Releasegruppen aus
|
// @description Blende Uploads bestimmter Releasegruppen aus
|
||||||
// @author Akamaru
|
// @author Akamaru
|
||||||
// @match https://serienfans.org/*
|
// @match https://serienfans.org/*
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
#blacklist-modal {
|
#blacklist-modal, #confirm-modal, #alert-modal {
|
||||||
display: none;
|
display: none;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 10000;
|
z-index: 10000;
|
||||||
@@ -182,6 +182,61 @@
|
|||||||
#blacklist-menu-btn:hover {
|
#blacklist-menu-btn:hover {
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Confirm/Alert Modal Styles */
|
||||||
|
#confirm-modal-content, #alert-modal-content {
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
margin: 15% auto;
|
||||||
|
padding: 30px;
|
||||||
|
border: 1px solid #333;
|
||||||
|
border-radius: 8px;
|
||||||
|
width: 90%;
|
||||||
|
max-width: 450px;
|
||||||
|
box-shadow: 0 4px 20px rgba(0,0,0,0.5);
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#confirm-modal-message, #alert-modal-message {
|
||||||
|
margin: 20px 0 30px;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
#confirm-modal-buttons, #alert-modal-buttons {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-btn {
|
||||||
|
padding: 10px 25px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
transition: background 0.2s;
|
||||||
|
min-width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-btn-confirm {
|
||||||
|
background: #4caf50;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-btn-confirm:hover {
|
||||||
|
background: #45a049;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-btn-cancel, .modal-btn-ok {
|
||||||
|
background: #666;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-btn-cancel:hover, .modal-btn-ok:hover {
|
||||||
|
background: #777;
|
||||||
|
}
|
||||||
`);
|
`);
|
||||||
|
|
||||||
// Standard-Blacklist (kann über das Menü bearbeitet werden)
|
// Standard-Blacklist (kann über das Menü bearbeitet werden)
|
||||||
@@ -261,10 +316,11 @@
|
|||||||
blockBtn.textContent = '🚫';
|
blockBtn.textContent = '🚫';
|
||||||
blockBtn.className = 'block-group-btn';
|
blockBtn.className = 'block-group-btn';
|
||||||
blockBtn.title = `Releasegruppe "${releasegroup}" blocken`;
|
blockBtn.title = `Releasegruppe "${releasegroup}" blocken`;
|
||||||
blockBtn.onclick = (e) => {
|
blockBtn.onclick = async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (confirm(`Releasegruppe "${releasegroup}" zur Blacklist hinzufügen?`)) {
|
const confirmed = await showConfirmModal(`Releasegruppe "${releasegroup}" zur Blacklist hinzufügen?`);
|
||||||
|
if (confirmed) {
|
||||||
blockReleasegroup(releasegroup);
|
blockReleasegroup(releasegroup);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -336,14 +392,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Funktion zum Hinzufügen einer Releasegruppe
|
// Funktion zum Hinzufügen einer Releasegruppe
|
||||||
function addToBlacklist() {
|
async function addToBlacklist() {
|
||||||
const input = document.getElementById('blacklist-add-input');
|
const input = document.getElementById('blacklist-add-input');
|
||||||
const group = input.value.trim();
|
const group = input.value.trim();
|
||||||
|
|
||||||
if (group === '') return;
|
if (group === '') return;
|
||||||
|
|
||||||
if (blacklist.some(blocked => blocked.toLowerCase() === group.toLowerCase())) {
|
if (blacklist.some(blocked => blocked.toLowerCase() === group.toLowerCase())) {
|
||||||
alert(`"${group}" ist bereits in der Blacklist!`);
|
await showAlertModal(`"${group}" ist bereits in der Blacklist!`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,6 +436,95 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Custom Confirm Modal
|
||||||
|
function showConfirmModal(message) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
// Erstelle Modal falls nicht vorhanden
|
||||||
|
let modal = document.getElementById('confirm-modal');
|
||||||
|
if (!modal) {
|
||||||
|
modal = document.createElement('div');
|
||||||
|
modal.id = 'confirm-modal';
|
||||||
|
modal.innerHTML = `
|
||||||
|
<div id="confirm-modal-content">
|
||||||
|
<div id="confirm-modal-message"></div>
|
||||||
|
<div id="confirm-modal-buttons">
|
||||||
|
<button class="modal-btn modal-btn-confirm" id="confirm-yes">Ja</button>
|
||||||
|
<button class="modal-btn modal-btn-cancel" id="confirm-no">Abbrechen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
document.body.appendChild(modal);
|
||||||
|
|
||||||
|
// Event Listeners
|
||||||
|
modal.addEventListener('click', (e) => {
|
||||||
|
if (e.target === modal) {
|
||||||
|
modal.style.display = 'none';
|
||||||
|
resolve(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setze Nachricht und zeige Modal
|
||||||
|
document.getElementById('confirm-modal-message').textContent = message;
|
||||||
|
modal.style.display = 'block';
|
||||||
|
|
||||||
|
// Button Event Listeners
|
||||||
|
const yesBtn = document.getElementById('confirm-yes');
|
||||||
|
const noBtn = document.getElementById('confirm-no');
|
||||||
|
|
||||||
|
const cleanup = (result) => {
|
||||||
|
modal.style.display = 'none';
|
||||||
|
yesBtn.onclick = null;
|
||||||
|
noBtn.onclick = null;
|
||||||
|
resolve(result);
|
||||||
|
};
|
||||||
|
|
||||||
|
yesBtn.onclick = () => cleanup(true);
|
||||||
|
noBtn.onclick = () => cleanup(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom Alert Modal
|
||||||
|
function showAlertModal(message) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
// Erstelle Modal falls nicht vorhanden
|
||||||
|
let modal = document.getElementById('alert-modal');
|
||||||
|
if (!modal) {
|
||||||
|
modal = document.createElement('div');
|
||||||
|
modal.id = 'alert-modal';
|
||||||
|
modal.innerHTML = `
|
||||||
|
<div id="alert-modal-content">
|
||||||
|
<div id="alert-modal-message"></div>
|
||||||
|
<div id="alert-modal-buttons">
|
||||||
|
<button class="modal-btn modal-btn-ok" id="alert-ok">OK</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
document.body.appendChild(modal);
|
||||||
|
|
||||||
|
// Event Listeners
|
||||||
|
modal.addEventListener('click', (e) => {
|
||||||
|
if (e.target === modal) {
|
||||||
|
modal.style.display = 'none';
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setze Nachricht und zeige Modal
|
||||||
|
document.getElementById('alert-modal-message').textContent = message;
|
||||||
|
modal.style.display = 'block';
|
||||||
|
|
||||||
|
// Button Event Listener
|
||||||
|
const okBtn = document.getElementById('alert-ok');
|
||||||
|
okBtn.onclick = () => {
|
||||||
|
modal.style.display = 'none';
|
||||||
|
okBtn.onclick = null;
|
||||||
|
resolve();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Funktion zum Hinzufügen des Buttons im Header
|
// Funktion zum Hinzufügen des Buttons im Header
|
||||||
function addHeaderButton() {
|
function addHeaderButton() {
|
||||||
const menu = document.getElementById('menu');
|
const menu = document.getElementById('menu');
|
||||||
@@ -405,14 +550,22 @@
|
|||||||
// Registriere Menübefehl (als Fallback)
|
// Registriere Menübefehl (als Fallback)
|
||||||
GM_registerMenuCommand('Releasegruppen-Filter bearbeiten', openModal);
|
GM_registerMenuCommand('Releasegruppen-Filter bearbeiten', openModal);
|
||||||
|
|
||||||
|
// Funktion zum Entfernen des roten Hinweises
|
||||||
|
function removeNoobyfication() {
|
||||||
|
const noobElements = document.querySelectorAll('.noobyfication');
|
||||||
|
noobElements.forEach(element => element.remove());
|
||||||
|
}
|
||||||
|
|
||||||
// Initialisierung
|
// Initialisierung
|
||||||
addHeaderButton();
|
addHeaderButton();
|
||||||
createBlacklistModal();
|
createBlacklistModal();
|
||||||
filterReleasesAlternative();
|
filterReleasesAlternative();
|
||||||
|
removeNoobyfication();
|
||||||
|
|
||||||
// Beobachte Änderungen (falls Inhalte dynamisch nachgeladen werden)
|
// Beobachte Änderungen (falls Inhalte dynamisch nachgeladen werden)
|
||||||
const observer = new MutationObserver(() => {
|
const observer = new MutationObserver(() => {
|
||||||
filterReleasesAlternative();
|
filterReleasesAlternative();
|
||||||
|
removeNoobyfication();
|
||||||
});
|
});
|
||||||
|
|
||||||
const listContainer = document.getElementById('list');
|
const listContainer = document.getElementById('list');
|
||||||
|
|||||||
Reference in New Issue
Block a user