Files
XiangYue/js/mapping-mode-2.js
风之暇想 bcc6329cee v1.1
2025-07-16 19:10:25 +08:00

1 line
6.2 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const CharSets2={"A": ["♾️","☯️","⏲️","🐄","🛕","♐️","🚗","😄","🍎","😈"],"B": ["❗","😙","☮️","😿","📿","🪑","🫔","🥖","🚭","🛷"],"C": ["🍈","😘","🐃","🎧","🚊","🏩","🐔","🍿","⏯️","🔽"],"D": ["🦚","🚬","🌭","🎥","🧪","🍊","😸","🗽","⏬","🏊"],"E": ["🏨","🍋","⏪","🏺","💓","💳","🤔","🦃","🧕","🚒"],"F": ["🦮","🦪","🏤","💷","💶","🚔","🎆","🛸","😊","🕌"],"G": ["🛀","🏭","🥯","🐹","📟","💙","🤣","😅","🦁","🤾"],"H": ["👦","🎭","🥨","⛹️","🧯","🐦","♍️","🥷","📻","🔯"],"I": ["🚣","🪁","🉑","🥕","🌄","🚇","🛴","💴","🍰","🐷"],"J": ["🚖","🪃","🦘","🐕","👾","⛪️","💊","🐽","💈","🐟"],"K": ["💂","🪔","🪜","🧰","⏫","🤽","🪣","🧙","🏂","🚎"],"L": ["🦹","🍔","🪒","⚛️","🌮","🕎","🐠","🥘","🌉","🥪"],"M": ["🌆","🛻","🚂","👨","🥟","🦀","🍥","🧷","🎪","🚷"],"N": ["🪘","🙂","🚡","🧴","🦈","🐖","🐭","⏱️","🪳","🌽"],"O": ["🪂","🐆","🐪","💇","😍","🐮","🚧","🥚","💽","🍡"],"P": ["⛺️","🚐","🎡","🍗","♊️","🚅","📡","🤗","🐊","😠"],"Q": ["🐬","💯","🐱","👴","🔅","🏦","📲","♨️","🫕","🐳"],"R": ["🚋","📷","🔂","🐫","🏬","🙃","⚕️","❤️","😽","🐐"],"S": ["◀️","🚛","🏃","🐌","⌚️","👵","🍒","🧇","🌠","😔"],"T": ["🦐","🚩","✈️","🚨","🛒","🍬","🥦","🤿","🥫","🚪"],"U": ["😛","🐛","🥩","🚈","🚄","👧","🦓","⛲️","🧓","🫐"],"V": ["🦒","🚠","🦋","🎇","🚟","🧍","🥅","🍛","🙊","🍣"],"W": ["🚦","🍨","🙈","🔡","🔁","😆","♉️","🥐","🔀","🪲"],"X": ["💗","📹","⚠️","🔣","🦗","🔰","🔋","🦞","🍟","🦢"],"Y": ["🚳","🐋","♓️","💞","☦️","🧎","🥴","🪗","🕋","⏰"],"Z": ["📀","💉","😝","☠️","⛔","🌅","🏫","🦖","🚃","🧀"],"a": ["🐎","🚴","🏑","🧻","🔤","😪","🎦","","🐞","👿"],"b": ["🏴","📺","🥞","🪀","🗼","🤧","🦌","🌁","🎯","🤼"],"c": ["⛴️","🥔","🚘","😳","💾","🐈","🦉","⚾️","😚","🏁"],"d": ["🍦","🍤","👸","💟","🥑","🎼","⏭️","🥱","💀","🦜"],"e": ["⏮️","😏","🪝","⛷️","🧖","🎤","⛎","😒","🦽","🛗"],"f": ["💺","🦯","🥎","🦧","🔮","🍞","🚯","⛰️","🎿","🤖"],"g": ["🚀","😷","♋️","🚝","🕍","🦅","♻️","🎲","⛽️","🏓"],"h": ["🎑","💎","🙀","🔠","☪️","🐏","🎳","🌌","⚜️","📞"],"i": ["🚓","😴","🐵","🤬","🙉","🎨","😌","🥗","🚵","🌯"],"j": ["🏡","🍍","⛩️","⏩","😹","👩","🧟","🥰","🤫","👯"],"k": ["🥬","🦇","🤡","♈️","👷","😁","🧂","🥥","🎺","😑"],"l": ["🤮","💔","🥓","🎾","🛺","🎹","😡","🫓","💿","💘"],"m": ["🐧","🦕","🦸","🧝","🎂","🗿","🧒","🐍","🚢","☸️"],"n": ["🏏","📼","🍘","🧛","💝","🥁","♎️","🐴","🛶","🎣"],"o": ["🥒","⏹️","🧗","🤐","🤎","😼","🍚","🦼","💡","🗻"],"p": ["🧄","🚥","🛌","🫒","🎰","🧅","🍉","🛬","🐗","❣️"],"q": ["🐯","👺","🌃","🍖","😻","🍮","🍠","🚱","📛","💆"],"r": ["🛝","🪦","⛱️","🔭","🐜","👳","🚿","🔢","🛵","📶"],"s": ["🐑","🏥","🍱","🍐","🚕","🥠","🎽","🏐","🦛","🛫"],"t": ["🚞","💕","🔦","📠","😇","🐙","🤴","🧺","▶️","☎️"],"u": ["🦎","🎢","🏀","🤢","🏸","✡️","👶","🤵","⚽️","🗾"],"v": ["⚖️","🚑","🤍","🥶","📸","✝️","😾","🍢","😂","🩺"],"w": ["👲","🐅","👻","⏺️","♒️","💸","💲","😜","💖","♌️"],"x": ["🐺","🐸","🍲","🐼","🏣","🦑","🧲","🧆","🧘","🚲"],"y": ["💱","🚙","🦂","🤭","🐢","😐","🫑","🎱","🏒","😗"],"z": ["💒","🥊","💵","🛖","🏈","🚏","🌇","🥋","🏄","🦟"],"0": ["😃","🍕","🍅","🍌","🪱","👰","🐓","🚤","🤒","🧜"],"1": ["♏️","🐝","🌋","🍳","🤑","🛁","🚌","🤪","🧑","💚"],"2": ["🚶","📵","🎷","⚱️","🍫","🚚","🐩","🏉","🎻","🪰"],"3": ["🐶","🔌","⚓️","🥧","🥭","🦊","⌨️","🐂","💩","🦏"],"4": ["🧽","🦴","♑️","🧩","🏢","🚉","🙄","👽","🪕","🥝"],"5": ["🧡","🧁","🧬","🦄","🏪","🍇","🐨","🩸","⏳","🛐"],"6": ["🍙","⏸️","⛵️","🐰","🏇","📱","🤸","🤺","🥵","🎸"],"7": ["🥍","🩹","🍜","🚍","🧚","🥌","🎠","⛸️","😉","😺"],"8": ["🤥","🚽","🍏","🚁","💻","🦆","🐡","👹","🚜","🚸"],"9": ["🎬","🔬","🧞","🥏","♟️","💛","🍓","🤕","⌛️","🥮"],"+": ["🚆","⚰️","🤯","💜","🎮","🧹","🔆","🧼","🐻","🦍"],"/": ["🧫","🍝","🆘","🔼","🚫","❓","💰","🧭","😵","🍭"],"=": ["👮","😀","🍑","🔱","😬","🐘","🥙","😋","😶","🍧"]};const emojiSet=new Set();const combinedCharMap2={};const allEmojis=[];let hasDuplicate=false;for(const [base64Char,emojiChars] of Object.entries(CharSets2)){for(const emoji of emojiChars){if(emojiSet.has(emoji)){console.warn(`重复的emoji: ${emoji}已存在于字符集`);hasDuplicate=true;}else{emojiSet.add(emoji);combinedCharMap2[emoji]=base64Char;allEmojis.push(emoji);}}}allEmojis.sort((a,b)=> [...b].length-[...a].length);const mappingMode2={base64ToEmoji:(base64)=>{return [...base64].reduce((emojiStr,char)=>{const charSet=CharSets2[char];return charSet ? emojiStr+charSet[Math.floor(Math.random()*charSet.length)] : emojiStr;},'');},emojiToBase64:(emoji)=>{const emojiArray=[...emoji];let base64='';let i=0;while(i < emojiArray.length){let matched=false;const maxCheckLength=Math.min(5,emojiArray.length-i);for(let len=maxCheckLength;len >=1;len--){const candidate=emojiArray.slice(i,i+len).join('');if(combinedCharMap2.hasOwnProperty(candidate)){base64+=combinedCharMap2[candidate];i+=len;matched=true;break;}}if(!matched){console.warn(`未找到匹配的emoji: ${emojiArray[i]}`);i++;}}return base64;},getEmojiLength:(emoji)=> [...emoji].length};