mirror of
https://github.com/serega404/SfeduHelper.git
synced 2025-04-21 12:40:45 +03:00
Залил код
This commit is contained in:
parent
644ce1b49d
commit
b72cf26429
18
SfeduHelper/grade.js
Normal file
18
SfeduHelper/grade.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
if (document.getElementById('signoauthin_b')) {
|
||||||
|
document.getElementById('signoauthin_b').addEventListener('click', function () {
|
||||||
|
if (document.getElementById("loginoauth").value.toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||||
|
)) {
|
||||||
|
chrome.storage.local.set({ "email": document.getElementById("loginoauth").value }, function () {
|
||||||
|
console.log('Email сохранен');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log("Не удалось сохранить email");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
chrome.storage.local.get(["email"], function (items) {
|
||||||
|
if (items["email"] != undefined && document.getElementById("loginoauth").value == "") {
|
||||||
|
document.getElementById("loginoauth").value = items["email"];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
BIN
SfeduHelper/icons/iconDis128.png
Normal file
BIN
SfeduHelper/icons/iconDis128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
SfeduHelper/icons/iconDis64.png
Normal file
BIN
SfeduHelper/icons/iconDis64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
SfeduHelper/icons/iconEn128.png
Normal file
BIN
SfeduHelper/icons/iconEn128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
SfeduHelper/icons/iconEn64.png
Normal file
BIN
SfeduHelper/icons/iconEn64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
7
SfeduHelper/icons/trash.svg
Normal file
7
SfeduHelper/icons/trash.svg
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Transformed by: SVG Repo Mixer Tools -->
|
||||||
|
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g id="SVGRepo_bgCarrier" stroke-width="0"/>
|
||||||
|
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<g id="SVGRepo_iconCarrier"> <path d="M20.5001 6H3.5" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round"/> <path d="M18.8332 8.5L18.3732 15.3991C18.1962 18.054 18.1077 19.3815 17.2427 20.1907C16.3777 21 15.0473 21 12.3865 21H11.6132C8.95235 21 7.62195 21 6.75694 20.1907C5.89194 19.3815 5.80344 18.054 5.62644 15.3991L5.1665 8.5" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round"/> <path d="M9.5 11L10 16" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round"/> <path d="M14.5 11L14 16" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round"/> <path d="M6.5 6C6.55588 6 6.58382 6 6.60915 5.99936C7.43259 5.97849 8.15902 5.45491 8.43922 4.68032C8.44784 4.65649 8.45667 4.62999 8.47434 4.57697L8.57143 4.28571C8.65431 4.03708 8.69575 3.91276 8.75071 3.8072C8.97001 3.38607 9.37574 3.09364 9.84461 3.01877C9.96213 3 10.0932 3 10.3553 3H13.6447C13.9068 3 14.0379 3 14.1554 3.01877C14.6243 3.09364 15.03 3.38607 15.2493 3.8072C15.3043 3.91276 15.3457 4.03708 15.4286 4.28571L15.5257 4.57697C15.5433 4.62992 15.5522 4.65651 15.5608 4.68032C15.841 5.45491 16.5674 5.97849 17.3909 5.99936C17.4162 6 17.4441 6 17.5 6" stroke="#ffffff" stroke-width="1.5"/> </g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
32
SfeduHelper/manifest.json
Normal file
32
SfeduHelper/manifest.json
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"name": "Sfedu Helper",
|
||||||
|
"description": "Расширение для упрощения работы с сайтами Sfedu",
|
||||||
|
"version": "1.0",
|
||||||
|
"manifest_version": 3,
|
||||||
|
"icons": {
|
||||||
|
"64": "icons/iconEn64.png",
|
||||||
|
"128": "icons/iconEn128.png"
|
||||||
|
},
|
||||||
|
"action": {
|
||||||
|
"default_popup": "popup.html"
|
||||||
|
},
|
||||||
|
"permissions": [
|
||||||
|
"storage",
|
||||||
|
"activeTab",
|
||||||
|
"tabs"
|
||||||
|
],
|
||||||
|
"content_scripts": [
|
||||||
|
{
|
||||||
|
"matches": [
|
||||||
|
"https://grade.sfedu.ru/", "https://grade.sfedu.ru/sign"
|
||||||
|
],
|
||||||
|
"js": [
|
||||||
|
"grade.js"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"background": {
|
||||||
|
"service_worker": "service_worker.js",
|
||||||
|
"type": "module"
|
||||||
|
}
|
||||||
|
}
|
99
SfeduHelper/popup.css
Normal file
99
SfeduHelper/popup.css
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
body {
|
||||||
|
width: 200px;
|
||||||
|
height: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#clearBtn {
|
||||||
|
color: white;
|
||||||
|
background-color: #4272e1;
|
||||||
|
width: 80%;
|
||||||
|
height: 35px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border-radius: 20px;
|
||||||
|
border: none;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#clearBtn:hover {
|
||||||
|
background-color: #003ece;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#version {
|
||||||
|
color: gray;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notif {
|
||||||
|
position: fixed;
|
||||||
|
left: 15px;
|
||||||
|
bottom: -50px;
|
||||||
|
padding: 8px 15px 8px 15px;
|
||||||
|
vertical-align: middle;
|
||||||
|
color: #fff;
|
||||||
|
background-color: #38bc73;
|
||||||
|
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
|
||||||
|
border-radius: 20px;
|
||||||
|
font-family: "Trebuchet MS", Helvetica, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.peek {
|
||||||
|
-webkit-animation: peek 2.5s forwards;
|
||||||
|
animation: peek 2.5s forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes peek {
|
||||||
|
0% {
|
||||||
|
bottom: -50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
20% {
|
||||||
|
bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
90% {
|
||||||
|
bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
bottom: -50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes peek {
|
||||||
|
0% {
|
||||||
|
bottom: -90px;
|
||||||
|
}
|
||||||
|
|
||||||
|
20% {
|
||||||
|
bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
90% {
|
||||||
|
bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
bottom: -50px;
|
||||||
|
}
|
||||||
|
}
|
20
SfeduHelper/popup.html
Normal file
20
SfeduHelper/popup.html
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Sfedu Helper</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="popup.css" />
|
||||||
|
<script src="popup.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="main">
|
||||||
|
<h1><b style="color: #FF4534;">Sfedu</b> <b style="color: #0033AB;">Helper</b></h1>
|
||||||
|
<button id="clearBtn"><img src="icons/trash.svg" />Очистить данные</button>
|
||||||
|
<p id="version">V 1.0.0</p>
|
||||||
|
</div>
|
||||||
|
<div id="popup"></div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
10
SfeduHelper/popup.js
Normal file
10
SfeduHelper/popup.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
var checkButton = document.getElementById('clearBtn');
|
||||||
|
checkButton.addEventListener('click', function() {
|
||||||
|
chrome.storage.local.clear(function () {
|
||||||
|
var popup = document.getElementById("popup");
|
||||||
|
popup.innerHTML = "<div class=\"notif peek\">OK</div>";
|
||||||
|
});
|
||||||
|
|
||||||
|
}, false);
|
||||||
|
}, false);
|
30
SfeduHelper/service_worker.js
Normal file
30
SfeduHelper/service_worker.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
|
||||||
|
// Получить URL текущей вкладки
|
||||||
|
var url = tab.url;
|
||||||
|
var manifestData = chrome.runtime.getManifest();
|
||||||
|
var enabled = false;
|
||||||
|
manifestData.content_scripts[0].matches.forEach((element) => {
|
||||||
|
console.log(element + " " + url.includes(element));
|
||||||
|
enabled = url.includes(element)
|
||||||
|
});
|
||||||
|
if (enabled) {
|
||||||
|
chrome.action.setIcon({ path: {
|
||||||
|
"64" : "icons/iconEn64.png",
|
||||||
|
"128" : "icons/iconEn128.png"
|
||||||
|
}, tabId: tabId });
|
||||||
|
// Установить обработчик клика по иконке
|
||||||
|
chrome.action.onClicked.addListener(function (tab) {
|
||||||
|
// Выполнить какое-то действие при клике
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
chrome.action.setIcon({ path: {
|
||||||
|
"64" : "icons/iconDis64.png",
|
||||||
|
"128" : "icons/iconDis128.png"
|
||||||
|
}, tabId: tabId });
|
||||||
|
// Установить обработчик клика по иконке
|
||||||
|
chrome.action.onClicked.addListener(function (tab) {
|
||||||
|
// Показать alert при клике
|
||||||
|
alert("This extension is not available for this page");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user