Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emoji guessing extension #1295

Merged
merged 1 commit into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Emoji Guessing Extension/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"manifest_version": 3,
"name": "✨ Emoji Lookup",
"version": "1.2",
"description": "Quickly find emoji meanings with a click!",
"permissions": ["activeTab", "storage"]
}

21 changes: 21 additions & 0 deletions Emoji Guessing Extension/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>✨ Emoji Lookup</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1 class="title">✨ Emoji Lookup</h1>
<div class="emoji-container">
<p id="emoji-text"></p>
</div>
<p id="emoji-meaning"></p>
<button id="copy-button">Copy Meaning</button>
</div>

<script src="script.js"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions Emoji Guessing Extension/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const emojiTextElement = document.getElementById('emoji-text');
const emojiMeaningElement = document.getElementById('emoji-meaning');
const copyButton = document.getElementById('copy-button');

let emojis = localStorage.getItem('emojis') ? JSON.parse(localStorage.getItem('emojis')) : {};

chrome.runtime.onMessage.addListener((message) => {
if (message.emoji) {
emojiTextElement.textContent = message.emoji;
if (emojis[message.emoji]) {
emojiMeaningElement.textContent = emojis[message.emoji];
} else {
fetch(`https://api.emojidex.com/v2/emojis/${message.emoji}`) // Replace with your API
.then(response => response.json())
.then(data => {
emojis[message.emoji] = data.meanings[0];
localStorage.setItem('emojis', JSON.stringify(emojis));
emojiMeaningElement.textContent = data.meanings[0];
})
.catch(error => emojiMeaningElement.textContent = 'Oops! Could not find meaning.');
69 changes: 69 additions & 0 deletions Emoji Guessing Extension/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
body {
font-family: sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #f5f5f5;
}

.container {
background-color: #fff;
padding: 20px;
border-radius: 5px;
text-align: center;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
max-width: 400px;
}

.title {
font-size: 24px;
margin-bottom: 10px;
color: #333;
}

.emoji-container {
display: flex;
justify-content: center;
margin-bottom: 15px;
}

#emoji-text {
font-size: 48px;
}

#emoji-meaning {
font-size: 16px;
margin-bottom: 10px;
color: #666;
}

#copy-button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 3px;
cursor: pointer;
font-size: 16px;
}

#copy-button:hover {
background-color: #3e8e41;
}

@media only screen and (max-width: 600px) {
.container {
max-width: 350px;
}

.title {
font-size: 22px;
}

#emoji-text {
font-size: 44px;
}
}
Loading