-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 33a2109
Showing
7 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Celeridade | ||
|
||
Acesse PageSpeed, BuiltWith e Cloudinary Web Speed Test através do menu de contexto em navegadores baseados em Chromium. | ||
|
||
## Instalação | ||
|
||
- Faça o download do arquivo `celeridade-v0.1.zip`. | ||
- 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. | ||
|
||
## Notas | ||
|
||
- O uso de VPNs não é permitido pela ferramenta **BuiltWith**. | ||
- A análise feita pela ferramenta **Cloudinary Web Speed Test** leva alguns milésimos para iniciar; após selecioná-la no menu, aguarde. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
chrome.runtime.onInstalled.addListener(() => { | ||
const sites = [ | ||
{ id: "PageSpeed", title: "PageSpeed" }, | ||
{ id: "BuiltWith", title: "BuiltWith" }, | ||
{ id: "Cloudinary", title: "Cloudinary Web Speed Test" }, | ||
]; | ||
|
||
for (const site of sites) { | ||
chrome.contextMenus.create({ | ||
id: site.id, | ||
title: site.title, | ||
contexts: ["all"], | ||
}); | ||
} | ||
}); | ||
|
||
chrome.contextMenus.onClicked.addListener((info, tab) => { | ||
const siteUrls = { | ||
PageSpeed: `https://pagespeed.web.dev/analysis?url=${encodeURIComponent( | ||
tab.url | ||
)}`, | ||
BuiltWith: `https://builtwith.com/?${encodeURIComponent(tab.url)}`, | ||
Cloudinary: `https://webspeedtest-api.cloudinary.com/test/run`, | ||
}; | ||
|
||
if (info.menuItemId === "Cloudinary") { | ||
async function sendPostRequest(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}`; | ||
|
||
chrome.tabs.create({ url: analysisUrl }); | ||
} catch (error) { | ||
console.error( | ||
"Erro ao enviar URL para Cloudinary Web Speed Test:", | ||
error | ||
); | ||
} | ||
} | ||
|
||
sendPostRequest(tab.url); | ||
} else if (siteUrls[info.menuItemId]) { | ||
chrome.tabs.create({ url: siteUrls[info.menuItemId] }); | ||
} | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"manifest_version": 3, | ||
"name": "Celeridade", | ||
"version": "0.1", | ||
"description": "Acesse ferramentas de análise de performance de sites através do menu de contexto.", | ||
"homepage_url": "https://github.com/Celere-WP/celeridade", | ||
"author": "Célere", | ||
"permissions": [ | ||
"contextMenus", | ||
"tabs" | ||
], | ||
"background": { | ||
"service_worker": "background.js" | ||
}, | ||
"icons": { | ||
"16": "icons/icon16.png", | ||
"48": "icons/icon48.png", | ||
"128": "icons/icon128.png" | ||
} | ||
} |