Skip to content

Commit

Permalink
Merge pull request #3 from celere-dev/v0.3
Browse files Browse the repository at this point in the history
v0.3
  • Loading branch information
claromes authored Nov 19, 2024
2 parents 2059e2d + 7abca3f commit cbb8092
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 72 deletions.
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

Access website performance analysis tools via context menu.
Copyright (C) 2024 Célere
Easily access web performance analysis tools through the context menu.
Copyright (C) 2024 Célere/Clarissa Mendes

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

Celeridade: Browser Extension Copyright (C) 2024 Célere
Célere Toolkit Copyright (C) 2024 Célere/Clarissa Mendes
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
English (US) | [Português (BR)](./README.pt-BR.md)

# Célere Toolkit

Acesse facilmente ferramentas de análise de web performance através do menu de contexto em navegadores baseados em Chromium.
Easily access web performance analysis tools through the context menu in Chromium-based browsers.

## Ferramentas
## Tools

- [PageSpeed](https://pagespeed.web.dev/)
- [BuiltWith](https://builtwith.com/)
Expand All @@ -12,21 +14,27 @@ Acesse facilmente ferramentas de análise de web performance através do menu de
- [Image Analysis Tool by Cloudinary](https://webspeedtest.cloudinary.com/)
- [W3C Markup Validation Service](https://validator.w3.org/)

## Instalação
## Installation

- [Faça o download do arquivo](https://github.com/Celere-WP/celeridade/releases).
- Extraia o arquivo ZIP.
- Abra o navegador baseado em Chromium e vá para `chrome://extensions`.
- Ative o "Modo Desenvolvedor" (localizado no canto superior direito).
- Clique no botão "Carregar sem compactação" (localizado no canto superior esquerdo).
- Navegue até o diretório onde você extraiu o arquivo ZIP contendo a extensão.
- Selecione a pasta da extensão.
- [Download the file](https://github.com/Celere-WP/celeridade/releases).
- Extract the ZIP file.
- Open the Chromium-based browser and go to `chrome://extensions`.
- Enable "Developer Mode" (located in the upper right corner).
- Click the "Load unpacked" button (located in the upper left corner).
- Navigate to the directory where you extracted the ZIP file containing the extension.
- Select the extension folder.

## Uso
## Usage

![Printscreen](assets/context-menu.png)
![Screenshot](assets/context-menu.png)

No site que deseja analisar, clique com o botão direito em qualquer área da página para acessar o menu; uma nova aba será aberta na ferramenta selecionada e a análise começará automaticamente.
On the site you want to analyze, right-click anywhere on the page to access the menu; a new tab will open in the selected tool and the analysis will start automatically.

> [!NOTE]
> A análise feita pela ferramenta **Image Analysis Tool by Cloudinary** leva alguns segundos para iniciar; após selecioná-la no menu, aguarde.
> The analysis performed by the **Image Analysis Tool by Cloudinary** takes a few seconds to start; after selecting it from the menu, please wait.
>
> Each tool has its own access policies: request limits, IP or VPN blocking, and login requirements for some features. To avoid access issues, use the tools moderately and refer to the policies directly on the sites when necessary.
## Contributing

Feel free to submit issues or pull requests for any bug fixes or new features. They can be opened in English or Portuguese.
40 changes: 40 additions & 0 deletions README.pt-BR.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[English (US)](./README.md) | Português (BR)

# Célere Toolkit

Acesse facilmente ferramentas de análise de web performance através do menu de contexto em navegadores baseados em Chromium.

## Ferramentas

- [PageSpeed](https://pagespeed.web.dev/)
- [BuiltWith](https://builtwith.com/)
- [Yellow Lab Tools](https://yellowlab.tools/)
- [InspectWP](https://inspectwp.com/en)
- [Siteliner](https://www.siteliner.com/)
- [Image Analysis Tool by Cloudinary](https://webspeedtest.cloudinary.com/)
- [W3C Markup Validation Service](https://validator.w3.org/)

## Instalação

- [Faça o download do arquivo](https://github.com/Celere-WP/celeridade/releases).
- Extraia o arquivo ZIP.
- Abra o navegador baseado em Chromium e vá para `chrome://extensions`.
- Ative o "Modo Desenvolvedor" (localizado no canto superior direito).
- Clique no botão "Carregar sem compactação" (localizado no canto superior esquerdo).
- Navegue até o diretório onde você extraiu o arquivo ZIP contendo a extensão.
- Selecione a pasta da extensão.

## Uso

![Printscreen](assets/context-menu.png)

No site que deseja analisar, clique com o botão direito em qualquer área da página para acessar o menu; uma nova aba será aberta na ferramenta selecionada e a análise começará automaticamente.

> [!NOTE]
> A análise feita pela ferramenta **Image Analysis Tool by Cloudinary** leva alguns segundos para iniciar; após selecioná-la no menu, aguarde.
>
> Cada ferramenta possui suas próprias políticas de acesso: limite de requisições, bloqueio de IPs ou VPNs, e requisitos de login em algumas funcionalidades. Para evitar problemas de acesso, utilize as ferramentas de forma moderada e consulte as políticas diretamente nos sites quando necessário.
## Contribuições

Sinta-se à vontade para enviar issues ou pull requests para qualquer correção de bugs ou novas funcionalidades. Eles podem ser abertos em inglês ou em português.
Binary file modified assets/context-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
147 changes: 96 additions & 51 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@ chrome.runtime.onInstalled.addListener(() => {
{ id: "Siteliner", title: "Siteliner" },
{ id: "Cloudinary", title: "Image Analysis Tool by Cloudinary" },
{ id: "W3C", title: "W3C Markup Validation Service" },
{ id: "All", title: "Open all tools" },
];

for (const site of sites) {
if (site.id === "All") {
chrome.contextMenus.create({
id: "separator-before-all",
type: "separator",
contexts: ["all"],
});
}

chrome.contextMenus.create({
id: site.id,
title: site.title,
Expand All @@ -31,61 +40,84 @@ chrome.contextMenus.onClicked.addListener((info, tab) => {
W3C: `https://validator.w3.org/nu/?doc=${encodeURIComponent(tab.url)}`,
};

if (info.menuItemId === "Cloudinary") {
async function sendPostRequestCloudinary(url) {
try {
const response = await fetch(siteUrls.Cloudinary, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ url }),
});

const data = await response.json();
const analysisId = data.data.testId;
const analysisUrl = `https://webspeedtest.cloudinary.com/results/${analysisId}`;
if (info.menuItemId === "All") {
sendPostRequestCloudinary(tab.url);
sendPostRequestYellow(tab.url);
openInspectWP();
openSiteliner();

chrome.tabs.create({ url: analysisUrl });
} catch (error) {
console.error(
"Erro ao enviar URL para Image Analysis Tool by Cloudinary:",
error
);
{
for (const [id, url] of Object.entries(siteUrls)) {
if (
id !== "Cloudinary" &&
id !== "Yellow" &&
id !== "InspectWP" &&
id !== "Siteliner"
) {
chrome.tabs.create({ url });
}
}
}

} else if (info.menuItemId === "Cloudinary") {
sendPostRequestCloudinary(tab.url);
} else if (info.menuItemId === "Yellow") {
async function sendPostRequestYellow(url) {
try {
const request = {
url: url,
waitForResponse: false,
screenshot: true,
device: "phone",
};

const response = await fetch(siteUrls.Yellow, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(request),
});
sendPostRequestYellow(tab.url);
} else if (info.menuItemId === "InspectWP") {
openInspectWP();
} else if (info.menuItemId === "Siteliner") {
openSiteliner();
} else if (siteUrls[info.menuItemId]) {
chrome.tabs.create({ url: siteUrls[info.menuItemId] });
}

async function sendPostRequestCloudinary(url) {
try {
const response = await fetch(siteUrls.Cloudinary, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ url }),
});

const data = await response.json();
const runId = data.runId;
const runUrl = `https://yellowlab.tools/queue/${runId}`;
const data = await response.json();
const analysisId = data.data.testId;
const analysisUrl = `https://webspeedtest.cloudinary.com/results/${analysisId}`;

chrome.tabs.create({ url: runUrl });
} catch (error) {
console.error("Erro ao enviar URL para Yellow Lab Tools:", error);
}
chrome.tabs.create({ url: analysisUrl });
} catch (error) {
logging("Image Analysis Tool by Cloudinary", error);
}
}

sendPostRequestYellow(tab.url);
} else if (info.menuItemId === "InspectWP") {
async function sendPostRequestYellow(url) {
try {
const request = {
url: url,
waitForResponse: false,
screenshot: true,
device: "phone",
};

const response = await fetch(siteUrls.Yellow, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(request),
});

const data = await response.json();
const runId = data.runId;
const runUrl = `https://yellowlab.tools/queue/${runId}`;

chrome.tabs.create({ url: runUrl });
} catch (error) {
logging("Yellow Lab Tools", error);
}
}

function openInspectWP() {
try {
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
const activeTab = tabs[0];
Expand Down Expand Up @@ -113,9 +145,11 @@ chrome.contextMenus.onClicked.addListener((info, tab) => {
});
});
} catch (error) {
console.error("Erro ao enviar URL para InspectWP:", error);
logging("InspectWP", error);
}
} else if (info.menuItemId === "Siteliner") {
}

function openSiteliner() {
try {
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
const activeTab = tabs[0];
Expand All @@ -141,9 +175,20 @@ chrome.contextMenus.onClicked.addListener((info, tab) => {
});
});
} catch (error) {
console.error("Erro ao enviar URL para Siteliner:", error);
logging("Siteliner", error);
}
} else if (siteUrls[info.menuItemId]) {
chrome.tabs.create({ url: siteUrls[info.menuItemId] });
}

function logging(toolName, error) {
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
const activeTab = tabs[0];
chrome.scripting.executeScript({
target: { tabId: activeTab.id },
func: (errorMessage) => {
alert(errorMessage);
},
args: [`Error sending URL to ${toolName}: ` + error],
});
});
}
});
Binary file modified icons/icon128.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 modified icons/icon16.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 modified icons/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"manifest_version": 3,
"name": "Célere Toolkit",
"version": "0.2",
"description": "Acesse facilmente ferramentas de análise de web performance através do menu de contexto.",
"homepage_url": "https://github.com/Celere-WP/celere-toolkit",
"author": "Célere",
"version": "0.3",
"description": "Easily access web performance analysis tools through the context menu.",
"homepage_url": "https://github.com/celere-dev/celere-toolkit",
"author": "Célere/Claromes",
"permissions": [
"contextMenus",
"tabs",
Expand Down

0 comments on commit cbb8092

Please sign in to comment.