-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpangramtester.html
120 lines (98 loc) · 2.94 KB
/
pangramtester.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!DOCTYPE html>
<html>
<head>
<style>
@import url(http://fonts.googleapis.com/css?family=Bitter|Lobster);
body{
font-family: Bitter, serif;
font-size: 11pt;
color: #777;
background: #eee;
text-align: center;
}
.content, .footer{
width: 500px;
margin: 0 auto;
}
h1{
font-family: Lobster, serif;
font-size: 5em;
/*text-shadow: 0px 0px 5px #444;*/
color: #222;
}
textarea{
box-sizing: border-box;
width: 100%;
border: 0px;
/*border-bottom: 2px #444 solid;*/
padding: 20px;
font-size: 2em;
font-family: Bitter;
text-align: center;
box-shadow: 0px 0px 10px #888;
}
.footer{
font-size: 0.8em;
color: #999;
margin-top: 50px;
}
a, a:visited{
color: #777;
}
.error, .success{
background: #222;
color: #F05;
padding: 20px;
box-sizing: border-box;
margin-bottom: 15px;
}
.error span{
color: #fff;
font-size: 2em;
}
.success{
background: #0598ff;
color: #fff;
}
</style>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(document).ready(function(){
checkPangram();
$('#text').on('keyup', function(){
checkPangram();
});
function checkPangram(){
var str = 'abcdefghijklmnopqrstuvwxyz';
var all = str.split("");
var not_exists = [];
$.each(all, function(index,val){
//compare to text
var pos = $('#text').val().toLowerCase().indexOf(val);
if(pos == -1){
not_exists.push(val);
}
});
if(not_exists.length == 0){
var response = '<div class="success">Your pangram is complete!</div>';
}else{
var response = '<div class="error">The following character was not found in the text <br/> <span>'+not_exists.join('</span>, <span>')+'</span></div>';
}
$('#response').html(response);
}
});
</script>
</head>
<body>
<a href="https://robotys.github.io/pangramtester"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
<div class="content">
<h1>Pangram Tester</h1>
<div id="response"></div>
<textarea id="text">Quick fox jumps over the lazy dog</textarea>
<p>A pangram or holoalphabetic sentence for a given alphabet is a sentence using every letter of the alphabet at least once. Pangrams have been used to display typefaces, test equipment, and develop skills in handwriting, calligraphy, and keyboarding. <a href="http://en.wikipedia.org/wiki/Pangram">more (wikipedia)</a></p>
</div>
<div class="footer">
made by <a href="http:/github.com/robotys">Robotys</a> for <a href="https://www.facebook.com/groups/jomweb/636277229777283/">Jomweb</a> and for fun!
</div>
</body>
</html>