Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain Ricard committed Feb 6, 2021
0 parents commit 3520ab9
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 0 deletions.
Binary file added .github/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
This quick and dirty Firefox/Chrome extension adds a "Preview" button on `signal.art`, that
allows to open a pack on `signalstickers.com` for easier preview.


![](.github/screenshot.png)



## Install of Firefox

Go to URL `about:config`, search for `xpinstall.signatures.required` and double-click on the value to set it to `false`.

Then, in `about:addons`, click on the wheel, select "Install add-on from file", and select `signal.art_preview-[version].zip`.

## Install on Chrome

Go to URL `chrome://extensions/`, enable Developper mode, then load this folder.


## Build

> A packaged version is available in the `web-ext-artifacts' directory.
Install [Firefox's tool Web-ext](https://developer.mozilla.org/fr/docs/Mozilla/Add-ons/WebExtensions/Getting_started_with_web-ext).
Then, do `web-ext build`.
22 changes: 22 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"description": "Add a 'Preview on signalstickers.com' button on signal.art page",
"manifest_version": 2,
"name": "signal.art preview",
"version": "1.1",
"content_scripts": [
{
"matches": [
"https://signal.art/addstickers/*"
],
"js": [
"signalstickerpreview.js"
]
}
],
"browser_specific_settings": {
"gecko": {
"id": "[email protected]",
"strict_min_version": "42.0"
}
}
}
31 changes: 31 additions & 0 deletions signalstickerpreview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function parseParameters(hash) {
var params = {};

hash.split("&").forEach(function (item) {
var parts = item.split("=");
if (parts.length == 2) {
params[parts[0]] = parts[1];
}
});

return params;
}


let container = document.getElementById("add-stickers-button");

let previewButton = document.createElement('button');
previewButton.className = "button button-large";
previewButton.style.margin = "0 auto 20px auto";
previewButton.style.display = "block";

let previewLink = document.createElement("a")

let params = parseParameters(window.location.hash.substr(1));
previewLink.href = `https://signalstickers.com/pack/${params.pack_id}?key=${params.pack_key}`;
previewLink.target = "_blank";
previewLink.className = "no-underline";
previewLink.innerText = "PREVIEW on signalstickers.com";

previewButton.appendChild(previewLink)
container.appendChild(previewButton);
Binary file added web-ext-artifacts/signal.art_preview-1.1.zip
Binary file not shown.

0 comments on commit 3520ab9

Please sign in to comment.