mirror of
https://github.com/elder-plinius/P4RS3LT0NGV3.git
synced 2026-07-31 16:27:29 +02:00
Fix emoji encoding display and improve preview features
This commit is contained in:
@@ -287,6 +287,20 @@ button:hover {
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
/* Encoded preview styling */
|
||||
.encoded-preview {
|
||||
display: inline-block;
|
||||
padding: 2px 4px;
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
border-radius: 3px;
|
||||
font-family: monospace;
|
||||
word-break: break-all;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
letter-spacing: 0.5px; /* Better display for variation selectors */
|
||||
}
|
||||
|
||||
.transform-button kbd {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@
|
||||
>
|
||||
{{ carrier.emoji }} {{ carrier.name }}
|
||||
<small class="transform-preview" v-if="emojiMessage">
|
||||
{{ carrier.preview ? carrier.preview(emojiMessage.slice(0, 10)) : '' }}
|
||||
<span class="encoded-preview">{{ carrier.preview ? carrier.preview(emojiMessage.slice(0, 10)) : '' }}</span>
|
||||
</small>
|
||||
</button>
|
||||
<button
|
||||
|
||||
+60
-4
@@ -1,9 +1,65 @@
|
||||
// Steganography carriers
|
||||
// First define encoding function for preview usage
|
||||
function encodeForPreview(emoji, text) {
|
||||
if (!text) return emoji;
|
||||
|
||||
// Convert text to binary string
|
||||
const binary = Array.from(text)
|
||||
.map(c => c.charCodeAt(0).toString(2).padStart(8, '0'))
|
||||
.join('');
|
||||
|
||||
// Use variation selectors to encode binary
|
||||
const vs15 = '\ufe0e'; // text variation selector (0)
|
||||
const vs16 = '\ufe0f'; // emoji variation selector (1)
|
||||
|
||||
// Start with the emoji character
|
||||
let result = emoji;
|
||||
|
||||
// Add variation selectors based on binary representation
|
||||
for (const bit of binary) {
|
||||
result += bit === '0' ? vs15 : vs16;
|
||||
}
|
||||
|
||||
// Ensure there's a zero-width space after the encoded content
|
||||
result += '\u200B';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const carriers = [
|
||||
{ emoji: '🐍', name: 'SNAKE', desc: 'Classic Snake', preview: text => `🐍${text}` },
|
||||
{ emoji: '🐉', name: 'DRAGON', desc: 'Mystical Dragon', preview: text => `🐉${text}` },
|
||||
{ emoji: '🦎', name: 'LIZARD', desc: 'Sneaky Lizard', preview: text => `🦎${text}` },
|
||||
{ emoji: '🐊', name: 'CROCODILE', desc: 'Dangerous Croc', preview: text => `🐊${text}` }
|
||||
{
|
||||
emoji: '🐍',
|
||||
name: 'SNAKE',
|
||||
desc: 'Classic Snake',
|
||||
preview: function(text) {
|
||||
// Show actual encoded result for preview
|
||||
return encodeForPreview(this.emoji, text);
|
||||
}
|
||||
},
|
||||
{
|
||||
emoji: '🐉',
|
||||
name: 'DRAGON',
|
||||
desc: 'Mystical Dragon',
|
||||
preview: function(text) {
|
||||
return encodeForPreview(this.emoji, text);
|
||||
}
|
||||
},
|
||||
{
|
||||
emoji: '🦎',
|
||||
name: 'LIZARD',
|
||||
desc: 'Sneaky Lizard',
|
||||
preview: function(text) {
|
||||
return encodeForPreview(this.emoji, text);
|
||||
}
|
||||
},
|
||||
{
|
||||
emoji: '🐊',
|
||||
name: 'CROCODILE',
|
||||
desc: 'Dangerous Croc',
|
||||
preview: function(text) {
|
||||
return encodeForPreview(this.emoji, text);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
// Emoji encoding/decoding
|
||||
|
||||
Reference in New Issue
Block a user