-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·259 lines (208 loc) · 9.11 KB
/
index.html
File metadata and controls
executable file
·259 lines (208 loc) · 9.11 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!DOCTYPE html>
<html lang="en">
<!-- This is a demonstration of HTML5 goodness with healthy does of CSS3 mixed in -->
<head>
<title>API Cupid</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
<script src="lib/modernizr-2.0.6.js" type="text/javascript"></script>
<script src="lib/jqote2.js" type="text/javascript"></script>
<script src="lib/jquery.anchor.js" type="text/javascript"></script>
<script src="lib/jquery.fancybox-1.2.6.pack.js" type="text/javascript"></script>
<script type="text/x-jqote-template" id="question">
<![CDATA[
<div id="question_<%=this.key%>" class="questiondiv">
<p><%=this.text%></p>
<a class="answer" id="<%=this.key%>_1" href="#yes">Yes</a>
<a class="answer" id="<%=this.key%>_0" href="#no">No</a>
</div>
]]>
</script>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" href="styles/ie7.css" type="text/css" media="screen" />
<![endif]-->
<link rel="stylesheet" href="styles/style.css" type="text/css" media="screen" />
</head>
<body>
<header> <!-- HTML5 header tag -->
<div id="headercontainer">
<h1><img src="images/logo.png" width="40%" /></h1>
<div>
<br /><br /><br />
<input type="text" name="keyword" value="" placeholder="Keyword Search" />
<br /><br />
<div id="questions"></div>
</div>
</div>
</header>
<section id="contentcontainer"> <!-- HTML5 section tag for the content 'section' -->
<section id="portfolio"> <!-- HTML5 section tag for the portfolio 'section' -->
<h2 class="work">Your API Suggestions</h2>
<div id="apis">
<ul class="work">
<li>
<a href="http://inspectelement.com"><img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /></a>
</li>
<li>
<a href="http://inspectelement.com"><img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /></a>
</li>
<li>
<a href="http://inspectelement.com"><img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /></a>
</li>
<li>
<a href="http://inspectelement.com"><img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /></a>
</li>
<li>
<a href="http://inspectelement.com"><img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /></a>
</li>
<li>
<a href="http://inspectelement.com"><img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /></a>
</li>
<li>
<a href="http://inspectelement.com"><img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /></a>
</li>
<li>
<a href="http://inspectelement.com"><img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /></a>
</li>
<li>
<a href="http://inspectelement.com"><img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /></a>
</li>
</ul>
</div>
</section>
<section id="about"> <!-- HTML5 section tag for the about 'section' -->
<h2 class="about">About Me</h2>
<p>Now this is a story all about how my life got twisted upside down and I'd like to take a minute just sit right there I'll tell you how I became the prince of a town called Bel-Air. In West Philadelphia born and raised on the playground my momma said most of my days chilling out, maxing and relaxing all cool and all shooting some b-ball outside of school when a couple of guys they were up to no good started making trouble in our neighbourhood I got in one little fight and my mom got scared, she said your moving in with your auntie and uncle in Bel-Air</p>
</section>
<section id="contact"> <!-- HTML5 section tag for the contact 'section' -->
<h2 class="contact">Contact Me</h2>
<p>I whistled for a cab and when it came near the license plate said fresh and had dice in the mirror, if anything I could say that this cab was rare but I thought nah, <a href="">forget it</a>, yo home to Bel-Air! I pulled up to the house about seven or eight I yelled to the cabbie yo home, smell you later, looked at my kingdom I was finally there to sit on my throne as the prince of Bel-Air</p>
<form id="contactform">
<p><label for="name">Name</label></p>
<input type="text" id=name name=name placeholder="First and last name" required tabindex="1" />
<p><label for="email">Email</label></p>
<input type="text" id=email name=email placeholder="example@domain.com" required tabindex="2" />
<p><label for="comment">Your Message</label></p>
<textarea name="comment" id="comment" tabindex="4"></textarea>
<input name="submit" type="submit" id="submit" tabindex="5" value="Send Message" />
</form>
</section>
<footer> <!-- HTML5 footer tag -->
<ul>
<li><img src="images/twitter.png" alt="" /><a href="http://twitter.com/tkenny">Follow me on Twitter</a></li>
<li><a href="http://inspectelement.com/articles/code-a-backwards-compatible-one-page-portfolio-with-html5-and-css3">Back to the Tutorial on Inspect Element</a></li>
</ul>
</footer>
</section>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-9207090-1");
pageTracker._trackPageview();
} catch(err) {}
</script>
<script>
function showQuestion(field) {
$(field).fadeIn("slow");
}
function hideQuestions() {
$('.questiondiv').hide();
}
</script>
<script>
$(document).ready(function() {
var apilist;
var questions;
jQuery.getJSON('data/apilist.json', function(data){
apilist = data;
renderApis(apilist);
});
jQuery.getJSON('data/questions.json', function(data){
questions = data;
renderQuestions(questions);
// hideQuestions();
// showQuestion('#question_Maps');
});
$('.question').each(function() {
$(this).val( localStorage['apiDateUser.' + $(this).attr('id')]);
});
$('.answer').live('click', function() {
var answer = $(this).attr('id').split('_');
$('#question_' + answer[0]).hide();
var attribute = answer[0].replace('-', ' ')
localStorage['apiDateUser.' + attribute] = answer[1];
renderApis(apilist);
});
});
function renderQuestions(questionList) {
$.each(questionList, function(key, text) {
key = key.replace(' ', '-');
$('#questions').append($('#question').jqote({key: key, text: text}));
});
}
function renderApis(apilist) {
var attributelist = new Object;
var apirating = new Object;
var retvals = new Object;
// determine the global sutability rating for each api
$.each(apilist, function(key, val) {
var rating = checkData(key, val, attributelist);
apirating[key] = rating;
});
$.each(attributelist, function(attribute, apis) {
// for each attribute, sort the api list by their global suitability
apis = apis.sort(function(a,b) {
return apirating[b] - apirating[a];
});
// filter down to only the top-ranked apis for each attribute
// and de-duplicate
var maxval = -1;
$.each(apis, function(index, api) {
if(-1 == maxval) {
maxval = apirating[api];
}
if(maxval == apirating[api]) {
retvals[api] = apirating[api];
}
});
});
$('#apis').html('');
$('#apis').append('<ul class="work" id="api_ul">');
$.each(retvals, function(api, rating) {
$('#api_ul').append('<li><div><img src="icons/' + api + '.png" alt="' + api + '" /></a><br>' + api + ' - ' + rating + '</div></li>');
});
$('#apis').append('</ul>');
}
// sloppily rates the different api matchups by category
function checkData(apiname, api, attributelist) {
var rating = 0;
$.each(api, function(attribute, val) {
// retrieve the user's response to this question
var userAttribute = (localStorage['apiDateUser.' + attribute])
if(userAttribute && (userAttribute == val)) {
rating += 1;
// append to list of apis for this attribute
if(!attributelist[attribute]) {
attributelist[attribute] = new Array();
}
attributelist[attribute].push(apiname);
}
});
return rating;
}
if (Modernizr.localstorage) {
// window.localStorage is available!
} else {
console.log("window.localStorage isn't available!")
// no native support for HTML5 storage :(
// maybe try dojox.storage or a third-party solution
}
</script>
</body>
</html>