mirror of
https://github.com/Ry3yr/Fake-Social-MediaWriter.git
synced 2026-08-19 17:20:03 -04:00
377 lines
11 KiB
HTML
377 lines
11 KiB
HTML
[<a target="_blank" href="https://alceawis.de/other/extra/scripts/fakesocialmedia/lastshorthands.html#https://codepen.io/ryedai1/pen/EaYQmqz" style=color:blue>s</a>]
|
|
<a href="?emojiinstancefilter=https://alceawis.de/other/extra/fetchdata/2024-03-07-FediTools/2025-08-17-EmojiDownloader/mas.to.txt" style=color:blue>mas.to</a>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Emoji Viewer with Instance Filtering</title>
|
|
<style>
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
max-width: 1900px; /* Increased to accommodate more emojis per row */
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
background-color: #f5f7fa;
|
|
color: #333;
|
|
}
|
|
|
|
h1 {
|
|
text-align: center;
|
|
color: #2c3e50;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
h2 {
|
|
color: #3498db;
|
|
border-bottom: 2px solid #eaeaea;
|
|
padding-bottom: 10px;
|
|
margin-top: 30px;
|
|
}
|
|
|
|
h3 {
|
|
color: #e74c3c;
|
|
}
|
|
|
|
.emoji-container {
|
|
background: white;
|
|
border-radius: 10px;
|
|
padding: 20px;
|
|
margin-bottom: 20px;
|
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.emoji-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); /* Reduced from 60px to 40px */
|
|
gap: 8px; /* Reduced from 15px to 8px */
|
|
margin: 20px 0;
|
|
}
|
|
|
|
img.emoji {
|
|
width: 30px; /* Reduced from 40px */
|
|
height: 30px; /* Reduced from 40px */
|
|
object-fit: contain;
|
|
cursor: pointer;
|
|
transition: transform 0.2s;
|
|
}
|
|
|
|
img.emoji:hover {
|
|
transform: scale(1.2);
|
|
}
|
|
|
|
.emoji-wrapper {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
text-align: center;
|
|
}
|
|
|
|
.emoji-name {
|
|
font-size: 10px; /* Reduced from 12px */
|
|
margin-top: 3px; /* Reduced from 5px */
|
|
word-break: break-all;
|
|
max-width: 60px;
|
|
line-height: 1.2;
|
|
}
|
|
|
|
.button-container {
|
|
display: flex;
|
|
justify-content: center;
|
|
gap: 15px;
|
|
margin: 20px 0;
|
|
}
|
|
|
|
button {
|
|
background-color: #3498db;
|
|
color: white;
|
|
border: none;
|
|
padding: 12px 20px;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
font-weight: bold;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
button:hover {
|
|
background-color: #2980b9;
|
|
}
|
|
|
|
#download-btn {
|
|
background-color: #27ae60;
|
|
}
|
|
|
|
#download-btn:hover {
|
|
background-color: #219653;
|
|
}
|
|
|
|
.filter-info {
|
|
background-color: #eaf7ff;
|
|
border-left: 4px solid #3498db;
|
|
padding: 15px;
|
|
margin: 20px 0;
|
|
border-radius: 0 5px 5px 0;
|
|
}
|
|
|
|
.hidden {
|
|
display: none;
|
|
}
|
|
|
|
.status {
|
|
text-align: center;
|
|
padding: 20px;
|
|
font-style: italic;
|
|
color: #7f8c8d;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<p></p>
|
|
</div>
|
|
|
|
<div class="emoji-container">
|
|
<div id="shorthand-images" class="emoji-grid"></div>
|
|
<div class="status" id="supported-status">Loading supported emojis...</div>
|
|
</div>
|
|
|
|
<div class="emoji-container">
|
|
<div id="unsupported-images" class="emoji-grid"></div>
|
|
<div class="status" id="unsupported-status">Loading unsupported emojis...</div>
|
|
</div>
|
|
<div class="filter-info" id="filter-info">
|
|
<button id="download-btn">Download All Emojis</button>
|
|
|
|
<!-- JSZip & FileSaver -->
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script>
|
|
|
|
<script>
|
|
// Global variables
|
|
let allShorthands = [];
|
|
let allUnsupported = [];
|
|
let instanceFilter = null;
|
|
let instanceEmojis = new Set();
|
|
|
|
// Main initialization
|
|
document.addEventListener("DOMContentLoaded", async () => {
|
|
// Check for instance filter in URL
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const filterParam = urlParams.get('emojiinstancefilter');
|
|
|
|
if (filterParam) {
|
|
try {
|
|
await loadInstanceFilter(filterParam);
|
|
} catch (error) {
|
|
console.error('Error loading instance filter:', error);
|
|
document.getElementById('filter-info').innerHTML =
|
|
`<p>Error loading filter: ${error.message}. Showing all emojis.</p>`;
|
|
}
|
|
}
|
|
|
|
// Fetch and process JSON data
|
|
await fetchAndProcessJSON();
|
|
|
|
// Set up event listeners
|
|
document.getElementById('download-btn').addEventListener('click', downloadAllEmojis);
|
|
});
|
|
|
|
// Function to load instance filter
|
|
async function loadInstanceFilter(filterUrl) {
|
|
try {
|
|
const response = await fetch(filterUrl);
|
|
if (!response.ok) {
|
|
throw new Error(`Failed to fetch filter: ${response.status}`);
|
|
}
|
|
|
|
const text = await response.text();
|
|
const lines = text.split('\n');
|
|
|
|
// Parse each line to extract emoji names
|
|
lines.forEach(line => {
|
|
if (line.trim()) {
|
|
const parts = line.split(' ');
|
|
if (parts.length > 0) {
|
|
const emojiName = parts[0].trim();
|
|
if (emojiName) {
|
|
instanceEmojis.add(`:${emojiName}:`);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
instanceFilter = true;
|
|
document.getElementById('filter-info').innerHTML =
|
|
`<p>Instance filter applied. Showing ${instanceEmojis.size} emojis from the instance.</p>`;
|
|
} catch (error) {
|
|
console.error('Error loading instance filter:', error);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
// Function to fetch and process JSON
|
|
async function fetchAndProcessJSON() {
|
|
try {
|
|
const response = await fetch('https://alceawis.de/other/extra/scripts/fakesocialmedia/data_alcea.json');
|
|
const data = await response.json();
|
|
const { shorthands, unsupported } = extractShorthands(data);
|
|
|
|
// Store all shorthands and unsupported
|
|
allShorthands = shorthands.filter(shorthand => !unsupported.includes(shorthand));
|
|
allUnsupported = unsupported;
|
|
|
|
// Apply instance filter if set
|
|
let filteredShorthands = allShorthands;
|
|
if (instanceFilter) {
|
|
filteredShorthands = allShorthands.filter(shorthand => instanceEmojis.has(shorthand));
|
|
}
|
|
|
|
displayShorthandImages(filteredShorthands);
|
|
displayUnsupportedShorthands(allUnsupported);
|
|
} catch (error) {
|
|
console.error('Error fetching or processing JSON:', error);
|
|
document.getElementById('supported-status').textContent = 'Error loading emojis';
|
|
document.getElementById('unsupported-status').textContent = 'Error loading emojis';
|
|
}
|
|
}
|
|
|
|
// Function to extract shorthands from data
|
|
function extractShorthands(data) {
|
|
const shorthandPattern = /:\w+:/g;
|
|
let shorthands = new Set();
|
|
let unsupported = new Set([
|
|
':confused_dog:', ':RJ_RedJohn_TheMentalist:', ':rofl:', ':plc:', ':34:',
|
|
':40:', ':02:', ':27:', ':33:', ':20:', ':18:', ':awesome:', ':sweat:',
|
|
':00:', ':08:', ':i:', ':35:', ':baa:', 'Alcea_LolFace:', ':54:', ':immeasurable_sadness:'
|
|
]);
|
|
|
|
function searchInObject(obj) {
|
|
for (let key in obj) {
|
|
if (typeof obj[key] === 'string') {
|
|
const matches = obj[key].match(shorthandPattern);
|
|
if (matches) {
|
|
matches.forEach(match => shorthands.add(match));
|
|
}
|
|
} else if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
searchInObject(obj[key]);
|
|
}
|
|
}
|
|
}
|
|
|
|
searchInObject(data);
|
|
|
|
return {
|
|
shorthands: Array.from(shorthands),
|
|
unsupported: Array.from(unsupported)
|
|
};
|
|
}
|
|
|
|
// Function to create emoji image element
|
|
function createEmojiImage(shorthand, containerId) {
|
|
const shorthandKey = shorthand.replace(/:/g, '');
|
|
const imgUrl = `https://alcea-wisteria.de/z_files/emoji/${shorthandKey}.gif`;
|
|
|
|
const wrapper = document.createElement('div');
|
|
wrapper.className = 'emoji-wrapper';
|
|
|
|
const imgElement = document.createElement('img');
|
|
imgElement.src = imgUrl;
|
|
imgElement.alt = shorthandKey;
|
|
imgElement.title = shorthand;
|
|
imgElement.classList.add('emoji');
|
|
|
|
imgElement.onerror = () => {
|
|
wrapper.classList.add('hidden');
|
|
};
|
|
|
|
imgElement.onclick = () => {
|
|
parent.postMessage({ type: 'shorthandSelected', shorthand: shorthand }, '*');
|
|
};
|
|
|
|
const nameElement = document.createElement('div');
|
|
nameElement.className = 'emoji-name';
|
|
nameElement.textContent = shorthand;
|
|
|
|
wrapper.appendChild(imgElement);
|
|
wrapper.appendChild(nameElement);
|
|
document.getElementById(containerId).appendChild(wrapper);
|
|
|
|
return imgElement;
|
|
}
|
|
|
|
// Function to display shorthand images
|
|
function displayShorthandImages(shorthands) {
|
|
const container = document.getElementById('shorthand-images');
|
|
const status = document.getElementById('supported-status');
|
|
|
|
container.innerHTML = '';
|
|
|
|
if (shorthands.length === 0) {
|
|
status.textContent = instanceFilter ?
|
|
'No emojis match the instance filter' : 'No supported emojis found';
|
|
status.classList.remove('hidden');
|
|
} else {
|
|
status.classList.add('hidden');
|
|
shorthands.forEach(shorthand => createEmojiImage(shorthand, 'shorthand-images'));
|
|
}
|
|
}
|
|
|
|
// Function to display unsupported shorthands
|
|
function displayUnsupportedShorthands(unsupported) {
|
|
const container = document.getElementById('unsupported-images');
|
|
const status = document.getElementById('unsupported-status');
|
|
|
|
container.innerHTML = '';
|
|
|
|
if (unsupported.length === 0) {
|
|
status.textContent = 'No unsupported emojis';
|
|
status.classList.remove('hidden');
|
|
} else {
|
|
status.classList.add('hidden');
|
|
unsupported.forEach(shorthand => createEmojiImage(shorthand, 'unsupported-images'));
|
|
}
|
|
}
|
|
|
|
// Function to download all emojis
|
|
async function downloadAllEmojis() {
|
|
const images = document.querySelectorAll('#shorthand-images img.emoji');
|
|
if (!images.length) {
|
|
alert("No images to download.");
|
|
return;
|
|
}
|
|
|
|
const zip = new JSZip();
|
|
const folder = zip.folder("emojis");
|
|
|
|
for (const img of images) {
|
|
const url = img.src;
|
|
let filename = img.alt;
|
|
if (!filename) filename = 'emoji';
|
|
if (!filename.endsWith('.gif')) filename += '.gif';
|
|
|
|
try {
|
|
const response = await fetch(url);
|
|
if (!response.ok) {
|
|
console.warn(`Failed to fetch ${filename}`);
|
|
continue;
|
|
}
|
|
const blob = await response.blob();
|
|
folder.file(filename, blob);
|
|
} catch (e) {
|
|
console.warn(`Error fetching ${filename}:`, e);
|
|
}
|
|
}
|
|
|
|
zip.generateAsync({ type: "blob" }).then(content => {
|
|
saveAs(content, "emoji_images.zip");
|
|
});
|
|
}
|
|
|
|
// Handle postMessage from parent
|
|
window.addEventListener('message', (event) => {
|
|
if (event.origin !== window.location.origin) return;
|
|
if (event.data.type === 'changeBackgroundColor') {
|
|
document.body.style.backgroundColor = event.data.color;
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |