Skip to content

Commit

Permalink
Merge pull request #93 from Sav22999/beta
Browse files Browse the repository at this point in the history
3.17
  • Loading branch information
Sav22999 authored Mar 24, 2023
2 parents aacc9da + bd92e97 commit 5cb1104
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 23 deletions.
Binary file modified .DS_Store
Binary file not shown.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Official repo of https://addons.mozilla.org/firefox/addon/emoji-sav/.

[<img src="img/firefoxAddons.png" height="50px">](https://addons.mozilla.org/firefox/addon/emoji-sav/) [<img src="img/chromeAddons.png" height="50px">](https://chrome.google.com/webstore/detail/emoji/kjepehkgbooeigeflhiogplnckadlife) [<img src="img/microsoftAddons.png" height="50px">](https://microsoftedge.microsoft.com/addons/detail/emoji/ejcgfbaipbelddlbokgcfajefbnnagfm)

To support me, you can do a donation :smile: with **PayPal**, **LiberaPay** or **Ko-Fi**:
To support me, you can do a donation :smile: with **PayPal** or **LiberaPay**:

<a href="https://liberapay.com/Sav22999/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a> [<img src="img/paypal.svg" width="160px"></img>](https://paypal.me/saveriomorelli) [<img src="https://cdn.ko-fi.com/cdn/kofi1.png?v=2" width="120px"></img>](https://ko-fi.com/R5R31UQ8G)
<a href="https://liberapay.com/Sav22999/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a> [<img src="img/paypal.svg" width="160px"></img>](https://paypal.me/saveriomorelli)

## Description

Expand All @@ -41,7 +41,7 @@ Emojis are divided in some sections, to help you to find the correct emoji quick
- Most used emojis: in the first tab you can find the emoji you use more
- Clear, modern and customisable UI
- Simplicity: with a single click you can copy an emoji
- Short-cut: open the add-on with `Ctrl`/`Cmd`+`Alt`+`A`
- Shortcut: open the add-on with `Ctrl`/`Cmd`+`Alt`+`A` (you can customise this)
- Tooltip: every emoji has the tooltip, so you can learn what's the name of an emoji

## How to contribute
Expand All @@ -54,7 +54,7 @@ Also, you can translate the extension (and the emojis description as well) on [C

See folder <code>screenshots</code> to see screenshots also of the older versions.

<img src="screenshots/3.16.1/1.png" width="400px"></img> <img src="screenshots/3.16.1/2.png" width="400px"></img> <img src="screenshots/3.16.1/3.png" width="400px"></img> <img src="screenshots/3.16.1/4.png" width="400px"></img>
<img src="screenshots/3.17/1.png" width="400px"></img> <img src="screenshots/3.17/2.png" width="400px"></img> <img src="screenshots/3.17/3.png" width="400px"></img> <img src="screenshots/3.17/4.png" width="400px"></img>

## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FSav22999%2Femoji.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FSav22999%2Femoji?ref=badge_large)
23 changes: 22 additions & 1 deletion js/emoji-insert-directly.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,33 @@ if (browserOrChromeIndex === 0) {
}
var lastRequestNumber = -1;
browserAgentSettings.runtime.onMessage.addListener(function (request, sender, sendResponse) {
if (request.requestNumber !== lastRequestNumber) {
if (request.type === "insert-emoji-by-injection" && request.requestNumber !== lastRequestNumber) {
let active = document.activeElement;
if (["input", "textarea"].includes(active.tagName.toLowerCase())) {
let pre = (active.value).substring(0, active.selectionStart);
let post = (active.value).substring(active.selectionEnd, active.value.length);
active.value = pre + request.emoji + post;
} else if (["p", "div", "span"].includes(active.tagName.toLowerCase()) && active.contentEditable) {
try {
let position = {start: 0, end: 0};
let selection = document.getSelection();
let range = selection.getRangeAt(0);
let range2 = range.cloneRange();
range2.selectNodeContents(active);
position.start = range.startOffset;
position.end = range.endOffset;
let pre = (active.textContent).substring(0, position.start);
let post = (active.textContent).substring(position.end, active.textContent.length);
active.textContent = pre + request.emoji + post;

let range3 = document.createRange();
range3.setStart(active.childNodes[0], position.start + (request.emoji.length));
range3.setEnd(active.childNodes[0], position.start + (request.emoji.length));
selection.removeAllRanges();
selection.addRange(range3);
} catch (e) {
console.error("Exception: " + e);
}
}
lastRequestNumber = request.requestNumber; //update the request number used to avoid to show more emoji (because of more injection scripts)
}
Expand Down
2 changes: 1 addition & 1 deletion js/emojis.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ emojis_language[lang] = [];
emojis_language[lang][0] = {};
/*smileys*/
emojis_language[lang][2] = {
"😀": ["Grinning Face", ":)", "Happy Face", "Smiley Face"],
"😀": ["Grinning Face", ":grinning:", ":grinning_face:", ":)", "Happy Face", "Smiley Face"],
"😃": ["Grinning Face with Big Eyes", ":D", "Happy Face", "Smiley Face", "Smiling Face with Open Mouth"],
"😄": ["Grinning Face with Smiling Eyes", "Happy Face", "Smiley Face", "Grinning Face With Squinting Eyes", "Smiling Face with Open Mouth and Smiling Eyes"],
"😁": ["Beaming Face with Smiling Eyes", "Grinning Face with Smiling Eyes"],
Expand Down
9 changes: 9 additions & 0 deletions js/release_notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ function releaseNotes(release) {
release_notes_text += "<li>Updated languages</li>";
release_notes_text += "</ul>";
break;

case "3.17":
release_notes_text = "<ul>";
release_notes_text += "<li>Improved the feature 'Insert directly the emoji' (now support also many other elements)</li>";
release_notes_text += "<li>Updated languages</li>";
release_notes_text += "</ul>";
release_notes_text += "<br>Remember to buy me a coffee if you like the add-on and you want to support me<br><br><div class='text-center'><a href='https://paypal.me/saveriomorelli' class='button-release'>PayPay</a> <a href='https://liberapay.com/Sav22999/donate' class='button-release'>LiberaPay</a></div>";
break;
//release_notes_text += "<li>Added shortcodes to find emojis, for example <small><span class='background-lightblue'>:grinning:</span></small></li>";
}
return release_notes_text;
}
18 changes: 5 additions & 13 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function loaded() {
checkOpenedAddon();
showNewsInRelease(false);

let shortcuts = browser.commands.getAll();
let shortcuts = browserAgentSettings.commands.getAll();
shortcuts.then(getCurrentShortcuts);
}

Expand All @@ -131,7 +131,7 @@ function getCurrentShortcuts(commands) {

function updateShortcut() {
const commandName = '_execute_browser_action';
browser.commands.update({
browserAgentSettings.commands.update({
name: commandName, shortcut: currentShortcut
});
}
Expand Down Expand Up @@ -179,7 +179,7 @@ function copyEmoji(text, tooltip) {
type: "requestNumber"
}).then((response) => {
browserAgentSettings.tabs.sendMessage(tabs[0].id, {
emoji: text, requestNumber: response.requestNumber
type: "insert-emoji-by-injection", emoji: text, requestNumber: response.requestNumber
}).catch(onError);
addToMostUsedCopyEmoji(nameOfSetting, text, tooltip);
}).catch(onError);
Expand Down Expand Up @@ -642,11 +642,6 @@ function setPopUpUI() {
browserAgentSettings.tabs.create({url: url_to_use});
window.close();
};
document.getElementById("donate-kofi-settings").onclick = function () {
let url_to_use = linkDonate[1];
browserAgentSettings.tabs.create({url: url_to_use});
window.close();
};
document.getElementById("donate-liberapay-settings").onclick = function () {
let url_to_use = linkDonate[2];
browserAgentSettings.tabs.create({url: url_to_use});
Expand Down Expand Up @@ -684,7 +679,7 @@ function setPopUpUI() {
let ctrl_alt_shift = document.getElementById("key-shortcut-ctrl-alt-shift-selected").value;
let letter_number = document.getElementById("key-shortcut-selected").value;
currentShortcut = ctrl_alt_shift + "+" + letter_number;
updateShortcut()
updateShortcut();

saveSettings();
}
Expand All @@ -693,7 +688,7 @@ function setPopUpUI() {
let ctrl_alt_shift = document.getElementById("key-shortcut-ctrl-alt-shift-selected").value;
let letter_number = document.getElementById("key-shortcut-selected").value;
currentShortcut = ctrl_alt_shift + "+" + letter_number;
updateShortcut()
updateShortcut();

saveSettings();
}
Expand Down Expand Up @@ -1408,7 +1403,6 @@ function setTheme() {
removeThemeClassId("font-family-selected", "-select");
removeThemeClassId("extension-icon-selected", "-select");
removeThemeClassId("donate-paypal-settings", "-btn-settings-button");
removeThemeClassId("donate-kofi-settings", "-btn-settings-button");
removeThemeClassId("donate-liberapay-settings", "-btn-settings-button");
removeThemeClassId("translate-settings", "-btn-settings-button");
removeThemeClassId("language-selected", "-select");
Expand Down Expand Up @@ -1441,7 +1435,6 @@ function setTheme() {
document.getElementById("save-data-settings").classList.add(theme + "-btn-settings-button");
document.getElementById("reset-data-settings").classList.add(theme + "-btn-settings-button");
document.getElementById("donate-paypal-settings").classList.add(theme + "-btn-settings-button");
document.getElementById("donate-kofi-settings").classList.add(theme + "-btn-settings-button");
document.getElementById("donate-liberapay-settings").classList.add(theme + "-btn-settings-button");
document.getElementById("translate-settings").classList.add(theme + "-btn-settings-button");
document.getElementById("language-selected").classList.add(theme + "-select");
Expand Down Expand Up @@ -1734,7 +1727,6 @@ function setLanguageUI() {
document.getElementById("need-help-settings").value = strings["settings"]["button-need-help"];
document.getElementById("donate-paypal-settings").value = strings["settings"]["button-paypal"];
document.getElementById("donate-liberapay-settings").value = strings["settings"]["button-liberapay"];
document.getElementById("donate-kofi-settings").value = strings["settings"]["button-ko-fi"];
document.getElementById("translate-settings").value = strings["settings"]["button-translate"];
document.getElementById("made-in-basilicata-settings").innerHTML = strings["settings"]["label-made-with-heart-basilicata"].replaceAll("{{properties}}", "class='font-" + font_family + " font-size-16'");
document.getElementById("select-ctrl-shortcut").textContent = strings["settings"]["label-ctrl-" + currentOS];
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"manifest_version": 2,
"name": "Emoji",
"version": "3.16.1",
"description": "It permits just with a single click to copy and insert an emoji. You can also customise the add-on.",
"version": "3.17",
"description": "Insert emojis using a web browser, and customise the experience and the add-on in Settings.",
"icons": {
"16": "./img/icon-dark-16.png",
"24": "./img/icon-dark-24.png",
Expand Down
2 changes: 0 additions & 2 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,6 @@ <h1 id="settings-title">Settings</h1>
id="donate-paypal-settings">
<input type="button" value="☕ LiberaPay" class="button button-settings"
id="donate-liberapay-settings">
<input type="button" value="☕ Ko-fi" class="button button-settings"
id="donate-kofi-settings">
<input type="button" value="🌐 Translate" class="button button-settings"
id="translate-settings">
</div>
Expand Down
Binary file modified screenshots/.DS_Store
Binary file not shown.
Binary file added screenshots/3.17/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/3.17/1.xcf
Binary file not shown.
Binary file added screenshots/3.17/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/3.17/2.xcf
Binary file not shown.
Binary file added screenshots/3.17/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/3.17/3.xcf
Binary file not shown.
Binary file added screenshots/3.17/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/3.17/4.xcf
Binary file not shown.

0 comments on commit 5cb1104

Please sign in to comment.