Skip to content

Commit c3412fe

Browse files
committed
1.0
1 parent 41ad65e commit c3412fe

File tree

13 files changed

+443
-204
lines changed

13 files changed

+443
-204
lines changed

_locales/en/messages.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,23 @@
145145
},
146146
"empty": {
147147
"message": "Empty"
148+
},
149+
"cut": {
150+
"message": "Cut"
151+
},
152+
"copy": {
153+
"message": "Copy"
154+
},
155+
"paste": {
156+
"message": "Paste"
157+
},
158+
"clipboard": {
159+
"message": "Clipboard"
160+
},
161+
"select": {
162+
"message": "Select"
163+
},
164+
"dragAndDrop": {
165+
"message": "Drag & Drop"
148166
}
149167
}

assets/icons/128.png

8.58 KB
Loading

assets/icons/128.png~

12 KB
Binary file not shown.

assets/icons/16.png

658 Bytes
Loading

assets/icons/16.png~

8.58 KB
Binary file not shown.

assets/icons/32.png

1.3 KB
Loading

assets/icons/32.png~

12 KB
Binary file not shown.

assets/icons/48.png

2.23 KB
Loading

assets/icons/48.png~

12 KB
Binary file not shown.

content-scripts.js

Lines changed: 72 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ function prevent(event) {
3838
var data = JSON.parse(SETTINGS.data[key]);
3939

4040
if (
41-
data.key === HID.key &&
42-
data.shiftKey === HID.shiftKey &&
43-
data.ctrlKey === HID.ctrlKey &&
44-
data.altKey === HID.altKey &&
41+
(data.key === HID.key || isset(data.key) === false) &&
42+
(data.shiftKey === HID.shiftKey || isset(data.shiftKey) === false) &&
43+
(data.ctrlKey === HID.ctrlKey || isset(data.ctrlKey) === false) &&
44+
(data.altKey === HID.altKey || isset(data.altKey) === false) &&
4545
data.click === HID.click &&
4646
data.context === HID.context &&
4747
data.wheel === HID.wheel
@@ -202,9 +202,75 @@ window.addEventListener('mouseup', function(event) {
202202
}
203203
}, true);
204204

205+
window.addEventListener('cut', function(event) {
206+
if (SETTINGS.data.cut !== false) {
207+
event.stopPropagation();
208+
}
209+
}, true);
210+
211+
window.addEventListener('copy', function(event) {
212+
if (SETTINGS.data.copy !== false) {
213+
console.log('COPY', event);
214+
event.stopPropagation();
215+
}
216+
}, true);
217+
218+
window.addEventListener('paste', function(event) {
219+
if (SETTINGS.data.paste !== false) {
220+
event.stopPropagation();
221+
}
222+
}, true);
223+
224+
window.addEventListener('select', function(event) {
225+
if (SETTINGS.data.select !== false) {
226+
event.stopPropagation();
227+
}
228+
}, true);
229+
230+
window.addEventListener('drag', function(event) {
231+
if (SETTINGS.data.drag_and_drop !== false) {
232+
event.stopPropagation();
233+
}
234+
}, true);
235+
236+
window.addEventListener('dragend', function(event) {
237+
if (SETTINGS.data.drag_and_drop !== false) {
238+
event.stopPropagation();
239+
}
240+
}, true);
241+
242+
window.addEventListener('dragenter', function(event) {
243+
if (SETTINGS.data.drag_and_drop !== false) {
244+
event.stopPropagation();
245+
}
246+
}, true);
247+
248+
window.addEventListener('dragstart', function(event) {
249+
if (SETTINGS.data.drag_and_drop !== false) {
250+
event.stopPropagation();
251+
}
252+
}, true);
253+
254+
window.addEventListener('dragleave', function(event) {
255+
if (SETTINGS.data.drag_and_drop !== false) {
256+
event.stopPropagation();
257+
}
258+
}, true);
259+
260+
window.addEventListener('dragover', function(event) {
261+
if (SETTINGS.data.drag_and_drop !== false) {
262+
event.stopPropagation();
263+
}
264+
}, true);
265+
266+
window.addEventListener('drop', function(event) {
267+
if (SETTINGS.data.drag_and_drop !== false) {
268+
event.stopPropagation();
269+
}
270+
}, true);
271+
205272
/*window.addEventListener('dbclick', prevent, true);
206-
window.addEventListener('mousemove', prevent, true);
207-
window.addEventListener('select', prevent, true);*/
273+
window.addEventListener('mousemove', prevent, true);*/
208274

209275

210276
/*---------------------------------------------------------------

manifest.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{
22
"manifest_version": 2,
33
"name": "HID control prevention",
4-
"version": "0.61",
4+
"version": "1.0",
5+
"icons": {
6+
"16": "assets/icons/16.png",
7+
"32": "assets/icons/32.png",
8+
"48": "assets/icons/48.png",
9+
"128": "assets/icons/128.png"
10+
},
511

612
"default_locale": "en",
713

0 commit comments

Comments
 (0)