Skip to content

Commit

Permalink
First working version of extension
Browse files Browse the repository at this point in the history
  • Loading branch information
mathoudebine committed Aug 20, 2018
1 parent fb6fd86 commit e5315e5
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Potatoes Emojis Firefox WebExtension

**This add-on replaces latest noto-emoji from Google with old "potatoes"(or "worms" or whatever you call it...) emojis from Android 6.0.1 on the Google website Messages for web.**

## What it does

This extension just includes:

* a content script, "replace-emojis.js", that is injected into any pages under "messages.android.com" or any of its subdomains

The content script intercept HTTP requests to the CDN hosting latest Noto emojis (ssl.gstatic.com) and redirect these requests to an archived version of the noto-emoji Github repository (commit 914c9ecb9d5e6d96c972c8df577cc6a36d162ece).

1 change: 1 addition & 0 deletions icons/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The icon "sleuth-or-spy_1f575" is taken from the Google Noto Emoji project, and is used under the terms of the Apache License 2.0: https://www.apache.org/licenses/LICENSE-2.0
Binary file added icons/sleuth-or-spy_1f575_128.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 icons/sleuth-or-spy_1f575_48.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 icons/sleuth-or-spy_1f575_96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"description": "Replace latest noto-emoji from Google with old \"potatoes\"(or \"worms\" or whatever you call it...) emojis from Android 6.0.1 on the Google website Messages for web",
"manifest_version": 2,
"name": "Potatoes Emojis",
"version": "1.0",

"permissions": [
"webRequest",
"webRequestBlocking",
"*://messages.android.com/*",
"*://ssl.gstatic.com/*"
],

"background": {
"scripts": ["replace-emojis.js"]
},

"icons": {
"48": "icons/sleuth-or-spy_1f575_48.png",
"96": "icons/sleuth-or-spy_1f575_96.png",
"128": "icons/sleuth-or-spy_1f575_128.png"
}
}
14 changes: 14 additions & 0 deletions replace-emojis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var pattern = "*://ssl.gstatic.com/dynamite/emoji/*";

function redirect(requestDetails) {
// Replace origin URL with archived Google Emoji equivalent from noto-emoji repository
return {
redirectUrl: requestDetails.url.replace("ssl.gstatic.com/dynamite/emoji", "raw.githubusercontent.com/googlei18n/noto-emoji/914c9ecb9d5e6d96c972c8df577cc6a36d162ece")
};
}

browser.webRequest.onBeforeRequest.addListener(
redirect,
{urls: [pattern], types:["image"]},
["blocking"]
);

0 comments on commit e5315e5

Please sign in to comment.