Skip to content

Commit 569b40c

Browse files
committed
disabling copy actions and code inspection shortcuts
1 parent 931aef8 commit 569b40c

File tree

3 files changed

+38
-15
lines changed

3 files changed

+38
-15
lines changed

app/pods/components/problem-explanation/component.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
11
import Component from '@ember/component';
22
import { inject as service } from '@ember/service';
3-
import {jsonToTable} from '../../../util/json-to-table'
3+
import { jsonToTable } from '../../../util/json-to-table';
44

55
export default Component.extend({
66
languageSelection: service('language-selection'),
77

88
init() {
99
this._super(...arguments);
1010
let contest = this.get('contest');
11+
12+
13+
document.addEventListener('contextmenu', function (event) {
14+
event.preventDefault();
15+
});
16+
17+
18+
document.addEventListener('keydown', function (event) {
19+
if (
20+
event.key === 'F12' ||
21+
(event.ctrlKey && event.shiftKey && event.key === 'I') ||
22+
(event.ctrlKey && event.shiftKey && event.key === 'C') ||
23+
(event.ctrlKey && event.shiftKey && event.key === 'J') ||
24+
(event.ctrlKey && event.key === 'U')
25+
) {
26+
event.preventDefault();
27+
}
28+
});
1129
},
30+
1231
jsonToTable(data) {
1332
const table = jsonToTable(data);
1433
return table;

app/pods/components/problem-explanation/template.hbs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
1-
2-
3-
<div class="py-4">
1+
<div class="py-4 no-select">
42
<p>{{markdown-to-html problem.details.description}}</p>
53

64
<div class="extra-bold">Input Format</div>
7-
8-
<pre>{{problem.details.input_format}}</pre>
9-
5+
<pre>{{problem.details.input_format}}</pre>
106

117
<div class="extra-bold">Constraints</div>
128
<div class="bg-grey br-5 w-60 px-4 py-2 my-2">
139
<p>{{markdown-to-html problem.details.constraints}}</p>
1410
</div>
1511

1612
<div class="extra-bold">Output Format</div>
17-
<pre>{{problem.details.output_format}}</pre>
13+
<pre>{{problem.details.output_format}}</pre>
14+
1815
<div class="extra-bold">Sample Input</div>
1916
<div class="bg-grey br-5 w-60 px-4 py-2 my-2">
20-
<pre>{{ problem.details.sample_input}}</pre>
17+
<pre>{{problem.details.sample_input}}</pre>
2118
</div>
2219

2320
<div class="extra-bold">Sample Output</div>
2421
<div class="bg-grey br-5 w-60 px-4 py-2 my-2">
25-
{{#if (includes contest.allowedLanguages "mysql")}}
26-
<pre>{{json-to-table problem.details.sample_output}}</pre>
27-
{{else}}
28-
<pre>{{problem.details.sample_output}}</pre>
29-
{{/if}}
30-
22+
{{#if (includes contest.allowedLanguages "mysql")}}
23+
<pre>{{json-to-table problem.details.sample_output}}</pre>
24+
{{else}}
25+
<pre>{{problem.details.sample_output}}</pre>
26+
{{/if}}
3127
</div>
3228

3329
{{#if problem.details.explanation}}

app/styles/app.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,4 +292,12 @@ body{
292292
100% {
293293
box-shadow: 0 0 0 6px rgba(167, 89, 47, 0.032);
294294
}
295+
}
296+
297+
.no-select {
298+
user-select: none;
299+
-webkit-user-select: none; /* Safari */
300+
-moz-user-select: none; /* Firefox */
301+
-ms-user-select: none; /* Internet Explorer/Edge */
302+
pointer-events: none;
295303
}

0 commit comments

Comments
 (0)