forked from next-door-nate/Lunch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
112 lines (85 loc) · 4.21 KB
/
index.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Lunch - It's what goes down the gullet.</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="It's what goes down the gullet... soon to be a SaaS for lunch menus... hang tight... or loose... You do you.">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600">
<link href="style.css" rel="stylesheet">
<link rel="icon" href="favicon.png">
</head>
<body>
<div class="featured-area">
<div class="wrapper lunch">
<h1>Lunch</h1>
<section></section>
<!-- <p><span class="veggie"><img src="img/veggie.svg" width="12" height="12" alt="Veggie Icon" /></span>Vegetarian: Spaghetti with veggie bolognaise</p> -->
<p class="heart"><3</p>
</div>
</div>
<footer class="site-footer">
<p class="copyright">© <span class="year"></span> Whipped up by <a href="https://hugemuffs.com">Nate Vandervis</a> with contributions from <a href="https://twitter.com/jvforest">Joel Forest</a> | Hosted sparingly on <a href="https://pages.github.com">Github Pages</a> | Cached gracefully by <a href="https://www.cloudflare.com">Cloudflare</a>.</p>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="particleGround.min.js"></script>
<script src="scripts.js"></script>
<script>
!function(l,u,n,c,h){l.GoogleAnalyticsObject=n;l[n]||(l[n]=function(){
(l[n].q=l[n].q||[]).push(arguments)});l[n].l=+new Date;c=u.createElement('script');
h=u.scripts[0];c.src='//www.google-analytics.com/analytics.js';
h.parentNode.insertBefore(c,h)}(window,document,'ga');
ga('create', 'UA-29923838-4', 'auto');
ga('send', 'pageview');
</script>
<script type="text/javascript">
$(window).load(function() {
$('.heart').natorize({
'enterOn' : 'click',
'delayTime' : 1000,
});
});
</script>
<script>
$(document).ready(function(){
$.getJSON("https://cdn.contentful.com/spaces/6qqte9wlq16o/entries?access_token=bab0ec81f61331d6e29f5c0e3164d8d506c5ae6957088607c0125a71124177c7", function(data) {
var menu = [];
$.each(data.items[0].fields, function(key, val) {
if (key == "weekStart" || key == "weekEnd" || key == "weekTitle") {
} else {
if (key == "caterer") {
if (val == "All Seasons") {
menu.push("<p class='caterer'>Catered by: <a href='http://allseasonscatering.ca/' target='_blank' rel='noopener noreferrer'>" + val + "</a></p>");
} else {
menu.push("<p class='caterer'>Catered by: <a href='http://www.urbanprairiecuisine.com/' target='_blank' rel='noopener noreferrer'>" + val + "</a></p>");
}
} else {
if ( key.indexOf('Veg') != -1 ){
menu.push("<p><span class='veggie'><img src='img/veggie.svg' width='12' height='12' alt='Veggie Icon' /></span><a class='google-search' href='http://www.google.com/search?q=" + encodeSearchQuery(val) + "' target='_blank' rel='noopener noreferrer'>" + val + "</a></p>");
} else {
var formattedVal = googler(val);
menu.push("<div class='"+ key +"'><h2>" + key + "</h2><p> " + formattedVal + "</p></div>");
}
}
}
});
$("<div/>", {
"class": "menu",
html: menu.join("").replace(/([,])/g, "<br />")
}).appendTo("section");
});
});
function googler(val){
var items = val.splice('<br>');
items.forEach(function(item , index){
items[index] = "<a class='google-search' href='http://www.google.com/search?q=" + encodeSearchQuery(item) + "' target='_blank' rel='noopener noreferrer'>" +item+"</a>";
});
return items.join('<br>');
}
function encodeSearchQuery(val) {
return encodeURIComponent(val).replace("'", "%27");
}
</script>
</body>
</html>