Merge remote-tracking branch 'origin/main'

This commit is contained in:
IM23a-spirgif
2024-09-17 14:25:42 +02:00
4 changed files with 188 additions and 28 deletions
+87
View File
@@ -229,3 +229,90 @@ nav {
.button1 { .button1 {
background-color: black; background-color: black;
} }
/* Suggestion Form Enhancements */
main h1 {
font-size: 2.5em;
color: black;
text-align: center;
margin-bottom: 20px;
}
.suggestion-title {
font-size: 1.5em;
color: black;
text-align: center;
margin-bottom: 30px;
}
article label {
font-weight: bold;
font-size: 1.1em;
color: #333;
margin-bottom: 10px;
display: block;
}
input[type="text"], input[type="number"], textarea {
width: 95%;
padding: 12px;
font-size: 1em;
border: 1px solid #ccc;
border-radius: 8px;
margin-bottom: 20px;
background-color: #f9f9f9;
transition: border-color 0.3s, box-shadow 0.3s;
}
/* Focus effect to highlight the active input field */
input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
border-color: black;
box-shadow: 0 0 5px darkred;
background-color: #fff;
outline: none;
}
textarea {
resize: none;
height: 150px;
}
/* Submit button improvements */
.button1 {
background-color: darkred;
color: white;
font-size: 1.2em;
padding: 12px 24px;
border: none;
border-radius: 8px;
cursor: pointer;
display: block;
margin: 0 auto;
transition: background-color 0.3s ease, transform 0.3s ease;
}
/* Button hover effect */
.button1:hover {
background-color: #45a049;
transform: scale(1.05);
}
/* Success message styling */
#successMessage {
font-size: 1.1em;
color: green;
text-align: center;
margin-top: 20px;
}
/* Adjustments for mobile responsiveness */
@media screen and (max-width: 600px) {
input[type="text"], input[type="number"], textarea {
width: 80%;
font-size: 0.95em;
}
.suggestion-title {
font-size: 1.2em;
}
}
+96
View File
@@ -0,0 +1,96 @@
const cooldownDuration = 10 * 360000;
const prohibitedWords = ['fuck', 'shit', 'asshole', 'bitch', 'bastard', 'damn', 'crap', 'dick', 'piss', 'cunt', 'motherfucker', 'douche',
'prick', 'whore', 'slut', 'fag', 'nigger', 'spic', 'retard', 'twat', 'bollocks', 'wanker', 'bugger', 'arse',
'shithead', 'dumbass', 'jackass', 'dipshit', 'dildo', 'knobhead', 'ballsack', 'buttfucker', 'cum', 'jizz',
'cocksucker', 'fucker', 'skank', 'pussy', 'tits', 'clit', 'schlong', 'dickhead', 'goddamn', 'hell', 'bitchass',
'fuckface', 'shitfaced', 'asshat', 'bint', 'chink', 'gook', 'jap', 'negro', 'dyke', 'queer', 'tranny', 'tosser',
'spaz', 'mong', 'coon', 'beaner', 'cracker', 'wetback', 'homo', 'fudgepacker', 'tard', 'cocks', 'bollocks',
'numbnuts', 'knob', 'muppet', 'git', 'shag', 'minge', 'git', 'bugger', 'tosser', 'nonce', 'plonker', 'pillock']
; // Example word filtering
// Function to get the last submission time from localStorage
function getLastSubmissionTime() {
const storedTime = localStorage.getItem('lastSubmissionTime');
return storedTime ? parseInt(storedTime, 10) : 0;
}
// Function to save the last submission time to localStorage
function setLastSubmissionTime(time) {
localStorage.setItem('lastSubmissionTime', time.toString());
}
function sendMessage() {
// Get the current time
const currentTime = Date.now();
// Retrieve the last submission time from localStorage
const lastSubmissionTime = getLastSubmissionTime();
// Cooldown logic to prevent spamming
if (currentTime - lastSubmissionTime < cooldownDuration) {
alert(`Please wait for ${cooldownDuration / 1000} seconds between submissions.`);
return;
}
// Get the values from the input fields
const pseudoname = document.getElementById("name").value || "Anonymous";
const rating = parseInt(document.getElementById("rate").value, 10);
const comment = document.getElementById("text").value.trim();
// Validation: Rating should be between 1 and 10
if (isNaN(rating) || rating < 1 || rating > 10) {
alert("Rating must be a number between 1 and 10.");
return;
}
// Validation: Comment length (min 5, max 500) and simple prohibited word check
if (comment.length < 5 || comment.length > 500) {
alert("Comment must be between 5 and 500 characters.");
return;
}
// Check for prohibited words (basic check)
for (const word of prohibitedWords) {
if (comment.toLowerCase().includes(word)) {
alert("Your comment contains inappropriate content.");
return;
}
}
// If all checks pass, send the message to the Discord webhook
const request = new XMLHttpRequest();
request.open("POST", "https://discord.com/api/webhooks/1284936894890901649/Zi-2ZV12L1v1OSBoM-DluE1V1LECXilrNNRZYJcxelnwO7rGgXNH47dxvfFEOK7Fe9_J");
request.setRequestHeader('Content-type', 'application/json');
// Create the content to send to the Discord webhook
const content = `**Rating:** ${rating}\n**Comment:**\n${comment}`;
// Debugging information
console.log('Sending message with content:', content);
// Send the message payload to the Discord webhook
const params = {
username: pseudoname, // Pseudoname will appear as the username
content: content // The combined content (pseudoname, rating, and comment)
};
request.send(JSON.stringify(params));
// Update the last submission time to the current time
setLastSubmissionTime(currentTime);
// Optionally, you can reset the form after sending
document.getElementById("name").value = "";
document.getElementById("rate").value = "";
document.getElementById("text").value = "";
// Display the success message
const successMessage = document.getElementById("successMessage");
successMessage.textContent = "Successfully sent the message!";
successMessage.style.display = "block"; // Ensure the message is visible
// Optionally hide the message after a few seconds
setTimeout(() => {
successMessage.style.display = "none"; // Hide message after 3 seconds
}, 3000);
}
+1 -1
View File
@@ -57,7 +57,7 @@
TRL Community with an easy go-to way to calculate DPS and DPM values to help players make informed decisions TRL Community with an easy go-to way to calculate DPS and DPM values to help players make informed decisions
about their gameplay. Whether you're fine-tuning your new Deathwish Strategy or simply curious about firearm about their gameplay. Whether you're fine-tuning your new Deathwish Strategy or simply curious about firearm
performance, we’ve got you covered. If you have suggestions, feedback, or want to contribute new stats or performance, we’ve got you covered. If you have suggestions, feedback, or want to contribute new stats or
features, we’d love to hear from you, just contact us on Discord! features, we’d love to hear from you, just contact us on Discord or on the <a href="{{ url_for('suggestion') }}">Suggestion Page!</a>
</p> </p>
<h2>Our Story</h2> <h2>Our Story</h2>
<p class="about_us_text"> <p class="about_us_text">
+4 -27
View File
@@ -63,34 +63,11 @@
<textarea id="text" name="text" rows="4" cols="50" placeholder="Enter your comments here..." minlength="5" maxlength="500" required></textarea><br><br> <textarea id="text" name="text" rows="4" cols="50" placeholder="Enter your comments here..." minlength="5" maxlength="500" required></textarea><br><br>
</article> </article>
<button class="button1" type="button" onclick="sendMessage()">Send</button> <button class="button1" type="button" onclick="sendMessage()">Send</button>
<!-- Success message (initially hidden) -->
<p id="successMessage" style="display: none; color: green;"></p>
</main> </main>
<script> <script src="{{ url_for('static', filename='suggestion.js') }}"></script>
function sendMessage() {
const request = new XMLHttpRequest();
request.open("POST", "https://discord.com/api/webhooks/1284936894890901649/Zi-2ZV12L1v1OSBoM-DluE1V1LECXilrNNRZYJcxelnwO7rGgXNH47dxvfFEOK7Fe9_J");
request.setRequestHeader('Content-type', 'application/json');
// Get the values from the input fields
const pseudoname = document.getElementById("name").value || "Anonymous";
const rating = document.getElementById("rate").value;
const comment = document.getElementById("text").value;
// Create the content to send to the Discord webhook
const content = `**Pseudoname:** ${pseudoname}\n**Rating:** ${rating}\n**Comment:**\n${comment}`;
// Debugging information
console.log('Sending message with content:', content);
// Send the message payload to the Discord webhook
const params = {
username: pseudoname, // Pseudoname will appear as the username
content: content // The combined content (pseudoname, rating, and comment)
};
request.send(JSON.stringify(params));
}
</script>
</body> </body>
</html> </html>