Skip to content

Commit 8884fed

Browse files
committed
Add fail and done sounds for manual lookups
1 parent bfcb76f commit 8884fed

File tree

6 files changed

+47
-15
lines changed

6 files changed

+47
-15
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ Look at a domain and check for DNSSEC records. Name and shame included!
1313

1414

1515

16+
## Thanks
17+
18+
- [buzzer2.wav](https://www.freesound.org/people/hypocore/sounds/164089/) by [hypocore](https://www.freesound.org/people/hypocore/), licensed under [CC0 1.0](http://creativecommons.org/publicdomain/zero/1.0/).
19+
- [success.wav](https://www.freesound.org/people/grunz/sounds/109662/) by [grunz](https://www.freesound.org/people/grunz/), licensed under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0/).
20+
21+
22+
1623
## License
1724

1825
Copyright (c) 2014, [Joel Purra](http://joelpurra.com/) and Tom Cuddy. All rights reserved.

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"private": true,
44
"version": "0.0.0",
55
"dependencies": {
6-
"jquery": "^2.1.0"
6+
"jquery": "^2.1.0",
7+
"SoundJS": "*"
78
}
89
}

public/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ <h3>
124124
</footer>
125125

126126
<script src="bower_components/jquery/dist/jquery.min.js"></script>
127+
<script src="bower_components/SoundJS/lib/soundjs-NEXT.combined.js"></script>
127128
<script src="resources/javascript/main.js"></script>
128129

129130
<!-- DO NOT COPY THIS SCRIPT TAG -->
11.5 KB
Binary file not shown.
13.5 KB
Binary file not shown.

public/resources/javascript/main.js

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,44 @@
1-
var nameShameForm = $("#name-shame-form");
1+
$(function() {
2+
var playSound = function(name) {
3+
var instance = createjs.Sound.play("fail");
4+
},
25

3-
function onSubmit(evt) {
4-
var domainname = $("[name=domainname]", this).val();
5-
6-
$.getJSON("/name-shame/", {
7-
domainname: domainname
8-
})
9-
.fail(function(jqXHR, textStatus, errorThrown) {
6+
domainLookupFail = function(jqXHR, textStatus, errorThrown) {
107
// TODO: show error to the user
118
console.error(jqXHR, textStatus, errorThrown);
12-
})
13-
.done(function(data, textStatus, jqXHR) {
9+
10+
playSound("fail");
11+
},
12+
13+
domainLookupDone = function(data, textStatus, jqXHR) {
1414
// TODO: use data
1515
console.log(data, textStatus, jqXHR);
16-
});
1716

18-
return false;
19-
}
17+
if (data.isSecure) {
18+
playSound("done");
19+
} else {
20+
playSound("fail");
21+
}
22+
};
23+
24+
(function() {
25+
createjs.Sound.registerSound("resources/audio/164089_2975503-lq.mp3", "fail");
26+
createjs.Sound.registerSound("resources/audio/109662_945474-lq.mp3", "done");
27+
}());
28+
29+
(function() {
30+
var nameShameForm = $("#name-shame-form"),
31+
onSubmit = function(evt) {
32+
var domainname = $("[name=domainname]", this).val(),
33+
onSubmitPromise = $.getJSON("/name-shame/", {
34+
domainname: domainname
35+
})
36+
.fail(domainLookupFail)
37+
.done(domainLookupDone);
38+
39+
return false;
40+
};
2041

21-
nameShameForm.on("submit", onSubmit);
42+
nameShameForm.on("submit", onSubmit);
43+
}());
44+
});

0 commit comments

Comments
 (0)