Spaces:
Runtime error
Runtime error
neon_arch
commited on
Commit
•
ea32052
1
Parent(s):
b35cb86
✨ feat: provide code to handle the change of selected value in the safe search menu (#210)
Browse files
public/static/search_area_options.js
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
document.addEventListener(
|
2 |
+
'DOMContentLoaded',
|
3 |
+
() => {
|
4 |
+
let url = new URL(window.location)
|
5 |
+
let searchParams = url.searchParams
|
6 |
+
|
7 |
+
let safeSearchLevel = searchParams.get('safesearch')
|
8 |
+
|
9 |
+
if (
|
10 |
+
safeSearchLevel >= 0 &&
|
11 |
+
safeSearchLevel <= 2 &&
|
12 |
+
safeSearchLevel !== null
|
13 |
+
) {
|
14 |
+
document.querySelector('.search_options select').value = safeSearchLevel
|
15 |
+
}
|
16 |
+
},
|
17 |
+
false,
|
18 |
+
)
|