Skip to content

Commit 7a9ba44

Browse files
authored
Add files via upload
0 parents  commit 7a9ba44

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

getparams.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/node
2+
// Get ?x=y \ &x=y * arguments
3+
const params = new Proxy(new URLSearchParams(window.location.search), {
4+
get: (searchParams, prop) => searchParams.get(prop),
5+
});
6+
const isparamnull = function(param){
7+
if (param == null || param == 'null'){
8+
return true
9+
} else{
10+
return false
11+
}
12+
}

levels/1.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Boogle Search - Online</title>
5+
<script type="text/javascript" src="../pass.js"></script>
6+
<script type="text/javascript" src="../getparams.js"></script>
7+
<script type="text/javascript">
8+
// Main page script
9+
window.onload = function(){
10+
console.log('DOM structure loaded')
11+
var searchQuery = params.q;
12+
var searchQuery = decodeURIComponent(searchQuery)
13+
if (isparamnull(searchQuery)){
14+
console.warn('Argument not given')
15+
} else {
16+
console.warn('Overwriting content with scripts is not recommended')
17+
document.write('<!DOCTYPE html>\n<title>Boogle</title>\n<h1>Boogle Search: <xmp>' + searchQuery + '</xmp></h1>\n<div id="results_paragraph">No results found for ' + searchQuery + ', sorry.</div>')
18+
/*
19+
br = document.createElement('br')
20+
document.body.appendChild(br)
21+
finalElement = document.createElement('div')
22+
finalElement.setAttribute('id', 'results_paragraph')
23+
finalElement.innerHTML = 'No results found for ' + searchQuery + ', sorry.'
24+
document.body.appendChild(finalElement)
25+
*/
26+
}
27+
}
28+
/*
29+
Hint:
30+
<script>window.alert(1)
31+
*/
32+
</script>
33+
</head>
34+
<body>
35+
<h1>Welcome to Boogle, your best searcher-friend!</h1>
36+
<form>
37+
<input name="q" id="query" type="field" placeholder="Enter your query here"></input>
38+
&nbsp;
39+
<!-- &nbsp; is used to make
40+
the button not being near the
41+
search field. -->
42+
<input type="submit" value="Search">
43+
</form>
44+
</body>
45+
</html>

pass.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/node
2+
oldalert = alert
3+
window.safeXMP = function(e){
4+
e.innerHTML.replace(/&lt;(?=\/xmp[> \n\r\t\f\/])/gi, '<');
5+
return e
6+
}
7+
window.alert = function(text){
8+
oldalert('Congratulations, you passed this level!\n\nAlerted text: ' + String(text) + '\n\nYaay!')
9+
document.location.href = document.location.h;
10+
}

0 commit comments

Comments
 (0)