Added a baisc chrome extention
This commit is contained in:
parent
c554a337b6
commit
84c3e1a9cc
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"0 debug pnpm:scope": {
|
|
||||||
"selected": 1
|
|
||||||
},
|
|
||||||
"1 error pnpm": {
|
|
||||||
"code": "ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND",
|
|
||||||
"err": {
|
|
||||||
"name": "pnpm",
|
|
||||||
"message": "No package.json (or package.yaml, or package.json5) was found in \"D:\\url-minify\".",
|
|
||||||
"code": "ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND",
|
|
||||||
"stack": "pnpm: No package.json (or package.yaml, or package.json5) was found in \"D:\\url-minify\".\n at readProjectManifest (C:\\Users\\chira\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:19805:13)\n at async Object.readProjectManifestOnly (C:\\Users\\chira\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:19809:28)\n at async readProjectManifestOnly (C:\\Users\\chira\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:43712:24)\n at async Object.handler (C:\\Users\\chira\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:177753:24)\n at async C:\\Users\\chira\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:182016:21\n at async run (C:\\Users\\chira\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:181990:34)\n at async runPnpm (C:\\Users\\chira\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:182209:5)\n at async C:\\Users\\chira\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:182201:7"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"name": "URL Minify Extension",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "URL Minify Extension for Chrome",
|
||||||
|
"icons": {
|
||||||
|
"128": "logo.png"
|
||||||
|
},
|
||||||
|
"browser_action": {
|
||||||
|
"default_popup": "popup.html"
|
||||||
|
},
|
||||||
|
"options_ui": {
|
||||||
|
"page": "options.html",
|
||||||
|
"open_in_tab": false
|
||||||
|
},
|
||||||
|
"manifest_version": 2,
|
||||||
|
"permissions": [
|
||||||
|
"storage",
|
||||||
|
"tabs",
|
||||||
|
"activeTab",
|
||||||
|
"http://*/*",
|
||||||
|
"https://*/*",
|
||||||
|
"*://*/*"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
let saveBtn = document.querySelector("#save");
|
||||||
|
let api = document.querySelector("#apikey");
|
||||||
|
let toastError = document.querySelector(".toast-error");
|
||||||
|
let toastSuccess = document.querySelector(".toast-success");
|
||||||
|
|
||||||
|
saveBtn.addEventListener("click", () => {
|
||||||
|
if (api.value) {
|
||||||
|
toastSuccess.classList.remove("d-hide");
|
||||||
|
chrome.storage.local.set({ urlMinifyAPIKey: api.value }, function () {
|
||||||
|
console.log("Value is set to " + api.value);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toastError.classList.remove("d-hide");
|
||||||
|
setTimeout(() => {
|
||||||
|
toastError.classList.add("d-hide");
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,29 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<link rel="stylesheet" href="spectre.min.css" />
|
||||||
|
<script defer src="option.js"></script>
|
||||||
|
<link href="style.css" rel="stylesheet" />
|
||||||
|
<title>Url Minify</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="toast toast-error d-hide">Please enter valid API</div>
|
||||||
|
<div class="card-subtitle text-gray">Enter API key</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="form-group">
|
||||||
|
<input class="form-input" type="password" id="apikey" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<button class="btn btn-primary" id="save">Save</button>
|
||||||
|
<div class="toast toast-success d-hide">Saved!</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<script defer src="popup.js"></script>
|
||||||
|
<link rel="stylesheet" href="spectre.min.css">
|
||||||
|
<link href="style.css" rel="stylesheet">
|
||||||
|
<title>Url Shortener</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="card bg-dark">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title h1 text-bold">URL Minify</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<div class="loading d-hide"></div>
|
||||||
|
<button class="btn btn-primary" id="shortURL">Minify it!!</button>
|
||||||
|
<input type="text" class="form-input d-hide" id="myInput">
|
||||||
|
<button class="btn btn-success d-hide" id="copybutton">Copy It</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -0,0 +1,14 @@
|
||||||
|
let generateBtn = document.querySelector("#shortURL");
|
||||||
|
|
||||||
|
const url = new URL("https://api.minfy.xyz/minify/api/addCustom"); //api url endpoint
|
||||||
|
let headers = {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
|
};
|
||||||
|
|
||||||
|
generateBtn.addEventListener("click", () => {
|
||||||
|
chrome.tabs.query({ currentWindow: true, active: true }, function (tabs) {
|
||||||
|
var currentTabUrl = tabs[0].url;
|
||||||
|
console.log(currentTabUrl);
|
||||||
|
});
|
||||||
|
});
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,25 @@
|
||||||
|
body {
|
||||||
|
width: 500px;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.toast-success {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
.btn-success {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
.form-input {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
.card-footer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"lockfileVersion": 1
|
|
||||||
}
|
|
Loading…
Reference in New Issue