initial commit
commit
a203d98726
|
@ -0,0 +1,50 @@
|
|||
document.addEventListener( "keydown", (event) => {
|
||||
const key = event.key;
|
||||
const code = event.code;
|
||||
|
||||
if (key.match(/^\p{Number}$/u)) {
|
||||
console.log(`Клавиша: number`);
|
||||
}
|
||||
else if (key.match(/^\p{Letter}$/u)) {
|
||||
console.log(`Клавиша: letter`);
|
||||
}
|
||||
else if (key.match(/^\p{Punctuation}$|^\p{Symbol}$/u)) {
|
||||
console.log(`Клавиша: symbol`);
|
||||
}
|
||||
else {
|
||||
console.log(`Клавиша: ${key} Код: ${code}`);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
document.addEventListener( "mousedown", (event) => {
|
||||
console.log(`Клик мышью: ${event.button}`)
|
||||
})
|
||||
|
||||
|
||||
document.addEventListener( "click", (event) => {
|
||||
const clickedElement = event.target;
|
||||
if (clickedElement.tagName === 'A') {
|
||||
const href = clickedElement.href;
|
||||
console.log(`Переход по ссылке: ${href}`)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
document.addEventListener( "copy", (event) => {
|
||||
const pageUrl = window.location.href;
|
||||
|
||||
const selectedText = window.getSelection().toString();
|
||||
|
||||
if (selectedText.length > 0) {
|
||||
let outputText;
|
||||
|
||||
if (selectedText.length > 50) {
|
||||
outputText = selectedText.substring(0, 49) + '…';
|
||||
} else {
|
||||
outputText = selectedText;
|
||||
}
|
||||
|
||||
console.log(`Скопирован текст: ${outputText}, Скопировано из: ${pageUrl}`)
|
||||
}
|
||||
})
|
Binary file not shown.
After Width: | Height: | Size: 225 B |
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
|
||||
"description": "Adds a solid red border to all webpages matching mozilla.org. See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Examples#borderify",
|
||||
"manifest_version": 2,
|
||||
"name": "Borderify",
|
||||
"version": "1.0",
|
||||
"homepage_url": "https://github.com/mdn/webextensions-examples/tree/master/borderify",
|
||||
"icons": {
|
||||
"48": "icons/border-48.png"
|
||||
},
|
||||
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["*://*/*"],
|
||||
"js": ["borderify.js"]
|
||||
}
|
||||
]
|
||||
|
||||
}
|
Loading…
Reference in New Issue