mirror of
https://github.com/Ry3yr/Fake-Social-MediaWriter.git
synced 2026-08-19 17:20:03 -04:00
142 lines
6.6 KiB
Plaintext
142 lines
6.6 KiB
Plaintext
<meta charset="UTF-8">
|
|
<style>
|
|
body {
|
|
body{font-family:Arial,sans-serif;margin:0;padding:0}.container{max-width:800px;margin:0 auto;padding:20px}.post{background-color:#fff;border-radius:5px;box-shadow:0 2px 4px rgba(0,0,0,.1);padding:20px;margin-bottom:20px}.content,.date{margin-bottom:10px}.date{color:#888;font-size:14px}.content{font-size:16px}.hashtags{font-size:14px;color:#555}.tag{margin-right:5px}a{color:pink;text-decoration:none}a:hover{text-decoration:underline}img{max-width:100%;height:auto}iframe{width:100%;height:315px;margin-top:10px;border:none}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div id="results"></div>
|
|
</div>
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
fetch('/other/extra/scripts/fakesocialmedia/data_alcea.json?v=' + Date.now())
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
const urlParams2 = new URLSearchParams(window.location.search);
|
|
const queryText = urlParams2.get('text');
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const number = urlParams.get('number') || 40;
|
|
|
|
|
|
const matches = data.slice(0, number).filter(entry => {
|
|
const date = Object.keys(entry)[0];
|
|
//return entry[date].value.includes(queryText);
|
|
return entry[date].value.toLowerCase().includes(queryText.toLowerCase());
|
|
});
|
|
const resultsContainer = document.getElementById('results');
|
|
if (resultsContainer) {
|
|
matches.forEach(match => {
|
|
const date = Object.keys(match)[0];
|
|
//const user = match[date].user;
|
|
const user = "alcea";
|
|
const value = match[date].value;
|
|
const hashtags = match[date].hashtags.split(', ');
|
|
const postElement = document.createElement('div');
|
|
postElement.classList.add('post');
|
|
const dateElement = document.createElement('p');
|
|
dateElement.classList.add('date');
|
|
dateElement.textContent = date;
|
|
postElement.appendChild(dateElement);
|
|
const valueElement = document.createElement('p');
|
|
valueElement.innerHTML = `<img src="https://alcea-wisteria.de/z_files/emoji/alcea.png" width="100px"><br>
|
|
@<a target="_blank" href="/fakesocialrender_limited.html?user=${user}" style="color:pink">${user}</a>:
|
|
${replaceEmojis(value).replace(/(https?:\/\/[^\s]+)/g, (match) => {
|
|
if (match.includes('youtube.com') || match.includes('youtu.be')) {
|
|
const videoId = getYouTubeVideoId(match);
|
|
if (videoId) {
|
|
return `<iframe src="https://www.youtube.com/embed/${videoId}" allowfullscreen></iframe>`;
|
|
}
|
|
}
|
|
if (match.includes('pixiv.net')) {
|
|
const pixivRegex = /https?:\/\/(?:www\.)?pixiv\.net\/(?:en\/)?artworks\/(\d+)/;
|
|
const pixivMatch = match.match(pixivRegex);
|
|
if (pixivMatch) {
|
|
const artworkId = pixivMatch[1];
|
|
return `<div><img src="https://embed.pixiv.net/decorate.php?illust_id=${artworkId}&mode=sns-automator" width="50%"></div><br><a href="${match}" target="_blank">${match}</a>`;
|
|
}
|
|
}
|
|
if (match.endsWith('.gif') || match.endsWith('.png') || match.endsWith('.webp') || match.endsWith('.jpg') || match.endsWith('.jpeg')) {
|
|
let imageWidth = "50%";
|
|
let imageElement = `<img src="${match}" width="${imageWidth}" alt="${match}">`;
|
|
|
|
// Check if the match is an emoji (this can be identified by a keyword in the URL, like "emoji")
|
|
if (match.includes("emoji")) {
|
|
imageWidth = "45px"; // Adjust width for emoji
|
|
imageElement = `<img src="${match}" width="${imageWidth}" alt="${match}">`;
|
|
return imageElement; // Only return the image element for emojis, without the link
|
|
}
|
|
|
|
// For non-emoji images, return the image and the link
|
|
return `${imageElement}<br><a href="${match}" target="_blank">${match}</a>`;
|
|
}
|
|
return `<a href="${match}" target="_blank">${match}</a>`;
|
|
}).replace(/\n/g, '<br>')}`;
|
|
postElement.appendChild(valueElement);
|
|
const hashtagsElement = document.createElement('div');
|
|
hashtagsElement.classList.add('hashtags');
|
|
hashtags.forEach(tag => {
|
|
const tagElement = document.createElement('span');
|
|
tagElement.classList.add('tag');
|
|
tagElement.textContent = `#${tag}`;
|
|
hashtagsElement.appendChild(tagElement);
|
|
});
|
|
postElement.appendChild(hashtagsElement);
|
|
resultsContainer.appendChild(postElement);
|
|
});
|
|
} else {
|
|
console.error('Error: Results container not found.');
|
|
}
|
|
})
|
|
.catch(error => {
|
|
console.error('Error fetching data:', error);
|
|
});
|
|
});
|
|
function replaceEmojis(text) {
|
|
return text.replace(/:(\w+):/g, (match, emoji) => {
|
|
return `https://alcea-wisteria.de/z_files/emoji/${emoji}.gif`;
|
|
});
|
|
}
|
|
function getYouTubeVideoId(url) {
|
|
const videoIdMatch = url.match(/(?:v=|\/(?:embed|v|shorts)\/|youtu\.be\/|vi\/)([a-zA-Z0-9_-]{11})/);
|
|
return videoIdMatch ? videoIdMatch[1] : null;
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
|
|
|
|
<h2>Comments</h2>
|
|
<div id="comments"></div>
|
|
<script>
|
|
function fetchAndDisplayComments() {
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const text = (urlParams.get('text') || '').toString().toLowerCase().normalize();
|
|
|
|
const jsonUrl = '/other/extra/scripts/fakesocialmedia/comments.json?v=' + Date.now();
|
|
|
|
fetch(jsonUrl)
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
const matchingComments = data.filter(comment => {
|
|
const commentText = (comment.text || '').toString().toLowerCase().normalize();
|
|
return commentText.includes(text);
|
|
});
|
|
|
|
const commentsDiv = document.getElementById('comments');
|
|
matchingComments.forEach(comment => {
|
|
const commentElement = document.createElement('div');
|
|
commentElement.textContent = comment.value;
|
|
commentsDiv.appendChild(commentElement);
|
|
});
|
|
})
|
|
.catch(error => {
|
|
console.error('Error fetching comments:', error);
|
|
});
|
|
}
|
|
|
|
window.onload = fetchAndDisplayComments;
|
|
</script>
|
|
</body>
|
|
</html>
|