Dateien nach "main" hochladen

This commit is contained in:
hanad 2025-09-25 14:08:06 +02:00
parent e79518025c
commit ad17d9fc68
5 changed files with 257 additions and 0 deletions

BIN
main/background.html Normal file

Binary file not shown.

77
main/popup.css Normal file
View File

@ -0,0 +1,77 @@
body{
width: 300px;
background-color: rgb(255, 221, 221);
font-size: 17px;
font-style: inherit;
}
h1{
text-align: center;
}
.text{
width: 100%;
color: rgb(0,0,0);
border-top-width: 10px;
border-top-style: solid;
border-top-color: rgb(255, 168, 168);
}
.counter{
width: 100%;
color: rgb(0,0,0);
border-top-width: 10px;
border-top-style: solid;
border-top-color: rgb(255, 168, 168);
font-size: 80%;
margin-bottom: 10px;
}
.counter p{
margin-bottom: 5px;
text-align: center;
}
#getDetectedWords{
font-size: 110%;
font-weight:bold;
background-color: rgb(255, 168, 168);
min-width: 20px;
width: auto;
height: 20px;
display: inline-block;
border-color: rgb(255, 168, 168);
border-radius: 20px;
border-style: solid;
border-width: 10px;
margin-left: 40%;
margin-top: 0px;
text-align: center;
}
.knöpfe{
background-color: rgb(255, 168, 168);
border-color: rgb(255, 168, 168);
border-radius: 5px;
border-style: solid;
border-width: 5px;
padding-bottom: 20px;
padding-top: 20px;
}
.knopf{
background-color: white;
color: red;
width: 70%;
height: 50px;
text-align: center;
margin-left: 5%;
margin-top: 10px;
}
.switch{
width: 20px;
}

93
main/popup.html Normal file
View File

@ -0,0 +1,93 @@
<html lang="de">
<head>
<meta charset="utf-8">
<title>Antihate</title>
<meta name="author" content="Hanad.H.">
<meta name="date" content="2025-07-03">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="main.css" rel="stylesheet" type="text/css">
<link href="popup.css" rel="stylesheet" type="text/css">
</head>
<html>
<body>
<h1>anti<b>Hate</b></h1>
<div class="text">
<p>
Mit dieser Browsererweiterung können Sie sich vor Hassrede oder anstößigen
Inhalten auf sämtlichen Webseiten schützen. Entscheiden Sie selbst, ob
solche Inhalte markiert, entfernt, ersetzt oder reflekitiert erläutert
werden sollen. Sie können die Seite auch bei Google melden.
</p>
</div>
<script src="popup.js">
</script>
<div class ="counter" id="how_many_words">
<p>Auf dieser Seite gefundene Inhalte: </p><p id="getDetectedWords"></p>
</div>
<div class="knöpfe">
<button id="clickMe1" class="knopf" title="Mit dieser Einstellung werden alle anstößigen, sowie volksverhetzenden oder hasserfüllten Inhalte auf der Webseite markiert.">
Inhalte markieren
</button>
<label>
<input type="checkbox" class="switch" id="toggleSwitch1">
</label>
<button id="clickMe2" onclick="border(this)" class="knopf" title="Diese Einstellung löscht Einträge mit hasserfülltem oder anstäßigem Inhalt. Warnung: Texte könnten so unvollständig und unlogisch angezeigt werden.">
Erläuterungen aktivieren
</button>
<label>
<input type="checkbox" class="switch" id="toggleSwitch2">
</label>
<button id="clickMe3" onclick="highlight(this)" class="knopf" title="Bei dieser Einstellung bleiben alle Inhalte unverändert auf der Webseie vorhanden. Allerdings erscheinen bei gewaltvollem oder anstößigem Inhalt reflektierte Erläuterungen zu dem Thema.">
Inhalte ersetzen
</button>
<label>
<input type="checkbox" class="switch" id="toggleSwitch3">
</label>
<button id="clickMe4" onclick="highlight(this)" class="knopf" title="Bei dieser Einstellung bleiben alle Inhalte unverändert auf der Webseie vorhanden. Allerdings erscheinen bei gewaltvollem oder anstößigem Inhalt reflektierte Erläuterungen zu dem Thema.">
Inhalte enfernen
</button>
<label>
<input type="checkbox" class="switch" id="toggleSwitch4">
</label>
<button id="clickMe4" class="knopf" title="Bei dieser Einstellung bleiben alle Inhalte unverändert auf der Webseie vorhanden. Allerdings erscheinen bei gewaltvollem oder anstößigem Inhalt reflektierte Erläuterungen zu dem Thema.">
Seite melden
</button>
</div>
<div class="footer">
<p>
Beachten Sie unsere
<a href="warnings.html">
Warnhinweise
</a>. Seien Sie stets sorgsam mit dieser Erweiterung.
Da sie KI verwendet, sollte man ersetzte Inhalte nur mit Voricht verwenden.
</p>
</div>
</body>
</html>

86
main/popup.js Normal file
View File

@ -0,0 +1,86 @@
function mark(){
browser.tabs.executeScript({ file: "content_script.js" });
}
console.log("popup.jscipt");
document.addEventListener('DOMContentLoaded', function(){
console.log("nochmal");
const checkbox1 = document.getElementById('toggleSwitch1');
console.log(checkbox1);
chrome.storage.sync.get(['checkboxState1'], function(result){
if(result.checkboxState1 !== undefined){
checkbox1.checked = result.checkboxState1;
console.log(checkbox1.checked);
}
});
checkbox1.addEventListener('change', function(){
chrome.storage.sync.set({ 'checkboxState1': checkbox1.checked}, function() {
console.log('Checkbox-Zustand gespeichert');
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, { action: "checkboxStatusChanged", isChecked: checkbox1.checked });
});
});
});
console.log("Hallo!")
chrome.storage.local.get(['detectedWords'], function(result){
if(result.detectedWords) {
console.log("Wörter in storage: ", result.detectedWords);
document.getElementById("getDetectedWords").textContent = result.detectedWords;
}
else{
console.log("noch keine Wortanzahl vorhanden");
}
});
// Anzahl der unterstrichenen Wörter angeben:
/*
document.addEventListener('DOMContentLoaded', () => {
const detectedWords = 'detectedWords';
chrome.storage.local.get(['detectedWords'], (result) => {
if (result[detectedWords] !== undefined) {
console.log("Wert schon da", result[detectedWords]);
}
else{
console.log("Wert noch nicht da");
}
});
chrome.storage.onChanged.addListener((changes, namespace) => {
if (namespace === 'local' && changes[detectedWords]) {
const newValue = changes[detectedWords].newValue;
const oldValue = changes[detectedWords].oldValue;
if (newValue !== undefined) {
console.log("Wert wurde geändert!");
executeFunctionWithStorageValue(newValue);
}
}
});
function executeFunctionWithStorageValue(data) {
const displayDiv = document.getElementById('getDetectedWords');
if (displayDiv) {
einfügen = chrome.storage.local.get(['detectedWords'])
displayDiv.textContent = einfügen;
}
} */
});

1
main/warnings.html Normal file
View File

@ -0,0 +1 @@
Obacht!