Spaces:
Sleeping
Sleeping
add support for Copy&Paste results
Browse files- app/static/index.html +19 -25
- app/static/script.js +12 -1
- app/static/style.css +20 -0
app/static/index.html
CHANGED
@@ -5,32 +5,26 @@
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6 |
<title>Fast API 🤗 Space served with Uvicorn</title>
|
7 |
<link rel="stylesheet" href="style.css" />
|
|
|
8 |
<script type="module" src="script.js"></script>
|
9 |
</head>
|
10 |
<body>
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
</textarea>
|
30 |
-
<button id="text-gen-submit">Submit</button>
|
31 |
-
<p class="text-gen-output"></p>
|
32 |
-
</form>
|
33 |
-
</section>
|
34 |
-
</main>
|
35 |
-
</body>
|
36 |
</html>
|
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6 |
<title>Fast API 🤗 Space served with Uvicorn</title>
|
7 |
<link rel="stylesheet" href="style.css" />
|
8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
|
9 |
<script type="module" src="script.js"></script>
|
10 |
</head>
|
11 |
<body>
|
12 |
+
<main>
|
13 |
+
<section id="text-gen">
|
14 |
+
<h1 class="title">Simple DGA detector using 1DCNN</h1>
|
15 |
+
<p class="model">
|
16 |
+
Model:
|
17 |
+
<a href="https://huggingface.co/harpomaxx/dga-detector" rel="noreferrer" target="_blank">harpomaxx/dga-detector</a>
|
18 |
+
</p>
|
19 |
+
<form class="text-gen-form">
|
20 |
+
<label for="text-gen-input">Check for domains (one per line)</label>
|
21 |
+
<textarea id="text-gen-input" rows="10"></textarea>
|
22 |
+
<button id="text-gen-submit">Submit</button>
|
23 |
+
<p class="text-gen-output"></p>
|
24 |
+
<i class="fas fa-copy copy-icon"></i>
|
25 |
+
</form>
|
26 |
+
</section>
|
27 |
+
</main>
|
28 |
+
|
29 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
</html>
|
app/static/script.js
CHANGED
@@ -14,7 +14,8 @@ textGenForm.addEventListener("submit", async (event) => {
|
|
14 |
event.preventDefault();
|
15 |
|
16 |
const textGenInput = document.getElementById("text-gen-input");
|
17 |
-
const textGenParagraph = document.querySelector(".text-gen-output");
|
|
|
18 |
|
19 |
// Split the inputted text into separate domains
|
20 |
const domains = textGenInput.value.trim().split('\n');
|
@@ -27,5 +28,15 @@ textGenForm.addEventListener("submit", async (event) => {
|
|
27 |
}
|
28 |
|
29 |
textGenParagraph.textContent = output;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
});
|
31 |
|
|
|
14 |
event.preventDefault();
|
15 |
|
16 |
const textGenInput = document.getElementById("text-gen-input");
|
17 |
+
const textGenParagraph = document.querySelector(".text-gen-output");
|
18 |
+
const copyButton = document.querySelector('.copy-icon');
|
19 |
|
20 |
// Split the inputted text into separate domains
|
21 |
const domains = textGenInput.value.trim().split('\n');
|
|
|
28 |
}
|
29 |
|
30 |
textGenParagraph.textContent = output;
|
31 |
+
copyButton.addEventListener('click', () => {
|
32 |
+
const textarea = document.createElement('textarea');
|
33 |
+
textarea.value = output;
|
34 |
+
document.body.appendChild(textarea);
|
35 |
+
textarea.select();
|
36 |
+
document.execCommand('copy');
|
37 |
+
textarea.remove();
|
38 |
+
});
|
39 |
+
|
40 |
+
|
41 |
});
|
42 |
|
app/static/style.css
CHANGED
@@ -59,3 +59,23 @@ h1 {
|
|
59 |
border-radius: 5px;
|
60 |
}
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
border-radius: 5px;
|
60 |
}
|
61 |
|
62 |
+
/* Add styling for the "Copy to Clipboard" button */
|
63 |
+
#copy-to-clipboard {
|
64 |
+
margin-top: 1rem;
|
65 |
+
padding: 0.5rem 1rem;
|
66 |
+
background-color: var(--primary-color);
|
67 |
+
color: white;
|
68 |
+
border: none;
|
69 |
+
border-radius: 0.25rem;
|
70 |
+
cursor: pointer;
|
71 |
+
}
|
72 |
+
.copy-icon {
|
73 |
+
margin-left: 0.5rem;
|
74 |
+
color: gray;
|
75 |
+
cursor: pointer;
|
76 |
+
}
|
77 |
+
|
78 |
+
.copy-icon:hover {
|
79 |
+
color: black;
|
80 |
+
}
|
81 |
+
|