Commit 059805e59607928aa6fa9ed82bdef3591660a25b
1 parent
710b8613
Suppression de la navigation JS
C'est pas sur ce genre de projet qu'on peut se permettre de perdre du temps à s'amuser à faire ce genre de trucs. Ça fonctionnerait encore, j'aurais laissé, mais là, c'était plutôt cassé de partout. Closes #5
Showing
5 changed files
with
49 additions
and
169 deletions
Show diff stats
index.php
... | ... | @@ -22,9 +22,6 @@ if (!file_exists($toLoad)) { |
22 | 22 | header('Status: 200 OK'); // FastCGI fix |
23 | 23 | } |
24 | 24 | |
25 | -if (isset($_GET['c'])) { | |
26 | - require_once("$toLoad"); | |
27 | -} else { | |
28 | 25 | ?> |
29 | 26 | <!DOCTYPE html> |
30 | 27 | <html> |
... | ... | @@ -42,8 +39,6 @@ if (isset($_GET['c'])) { |
42 | 39 | <link rel="stylesheet" href="css/crep.css"> |
43 | 40 | <script type="text/javascript" src="js/jquery.min.js"></script> |
44 | 41 | <script type="text/javascript" src="js/bootstrap.min.js"></script> |
45 | - <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script> | |
46 | - <script type="text/javascript" src="js/crep.js"></script> | |
47 | 42 | <script type="text/javascript" src="js/konami.js"></script> |
48 | 43 | </head> |
49 | 44 | |
... | ... | @@ -52,7 +47,7 @@ if (isset($_GET['c'])) { |
52 | 47 | <?php require_once("menu.php");?> |
53 | 48 | <div class="col-md-12 center-block"> |
54 | 49 | <div class="col-md-12" id="mainContainer"> |
55 | - <?php | |
50 | +<?php | |
56 | 51 | require_once("$toLoad"); |
57 | 52 | ?> |
58 | 53 | </div> |
... | ... | @@ -63,5 +58,4 @@ if (isset($_GET['c'])) { |
63 | 58 | </html> |
64 | 59 | |
65 | 60 | <?php |
66 | -} | |
67 | 61 | ?> | ... | ... |
... | ... | @@ -0,0 +1,45 @@ |
1 | +$(document).ready(function() { | |
2 | +// enhance tel-links (from http://stackoverflow.com/a/18921965/2766106) | |
3 | +$("a[href^='tel:']").each(function () { | |
4 | + var target = "call-" + this.href.replace(/[^a-z0-9]*/gi, ""); | |
5 | + var link = this; | |
6 | + | |
7 | + // load in iframe to supress potential errors when protocol is not available | |
8 | + $("body").append("<iframe name=\"" + target + "\" style=\"display: none\"></iframe>"); | |
9 | + link.target = target; | |
10 | + | |
11 | + // replace tel with callto on desktop browsers for skype fallback | |
12 | + if (!navigator.userAgent.match(/(mobile)/gi)) { | |
13 | + link.href = link.href.replace(/^tel:/, "callto:"); | |
14 | + } | |
15 | +}); | |
16 | + | |
17 | + // Carte | |
18 | + var mapCanvas = document.getElementById('map-canvas'); | |
19 | + mapCanvas.innerHTML = ''; | |
20 | + var polytechPos = new google.maps.LatLng(50.6074998, 3.1373338); | |
21 | + var mapOptions = { | |
22 | + center: polytechPos, | |
23 | + zoom: 16, | |
24 | + mapTypeId: google.maps.MapTypeId.ROADMAP | |
25 | + }; | |
26 | + var map = new google.maps.Map(mapCanvas, mapOptions); | |
27 | + var marker = new google.maps.Marker({ | |
28 | + place: { | |
29 | + location: polytechPos, | |
30 | + query: "Polytech Lille" | |
31 | + }, | |
32 | + attribution: { | |
33 | + source: "Coupe de Robotique des Écoles Primaires", | |
34 | + webUrl: window.location.host | |
35 | + }, | |
36 | + map: map, | |
37 | + title: "Polytech Lille" | |
38 | + }); | |
39 | + var infowindow = new google.maps.InfoWindow({ | |
40 | + content: "<strong>Polytech Lille</strong><br/>Lieux des évènements de la Coupe de Robotique des Écoles Primaires" | |
41 | + }); | |
42 | + marker.addListener('click', function () { | |
43 | + infowindow.open(map, this); | |
44 | + }); | |
45 | +}); | ... | ... |
js/crep.js deleted
... | ... | @@ -1,161 +0,0 @@ |
1 | -function removeAfter(string, pattern) { | |
2 | - var n = string.indexOf(pattern); | |
3 | - return string.substring(0, n != -1 ? n : string.length); | |
4 | -} | |
5 | - | |
6 | -function pageName(href) { | |
7 | - if (href.indexOf(window.location.host) >= 0) { | |
8 | - href = removeAfter(removeAfter(href, '?'), '#'); | |
9 | - hrefE = href.split('/'); | |
10 | - return hrefE[hrefE.length - 1]; | |
11 | - } | |
12 | - return false; | |
13 | -} | |
14 | - | |
15 | -function updateScrollData() { | |
16 | - history.state.scrollTop = $(document.body).scrollTop(); | |
17 | - history.replaceState(history.state); | |
18 | -} | |
19 | - | |
20 | -function pageSpecific(location) { | |
21 | - if (pageName(location) == 'contact') { | |
22 | - initializeMap(); | |
23 | - | |
24 | - // enhance tel-links (from http://stackoverflow.com/a/18921965/2766106) | |
25 | - $("a[href^='tel:']").each(function () { | |
26 | - var target = "call-" + this.href.replace(/[^a-z0-9]*/gi, ""); | |
27 | - var link = this; | |
28 | - | |
29 | - // load in iframe to supress potential errors when protocol is not available | |
30 | - $("body").append("<iframe name=\"" + target + "\" style=\"display: none\"></iframe>"); | |
31 | - link.target = target; | |
32 | - | |
33 | - // replace tel with callto on desktop browsers for skype fallback | |
34 | - if (!navigator.userAgent.match(/(mobile)/gi)) { | |
35 | - link.href = link.href.replace(/^tel:/, "callto:"); | |
36 | - } | |
37 | - }); | |
38 | - } | |
39 | - $(document).scroll(updateScrollData); | |
40 | -} | |
41 | - | |
42 | - | |
43 | - | |
44 | -function actLink(ev) { | |
45 | - var location = ev.currentTarget.href; | |
46 | - var page = pageName(location); | |
47 | - if (page && page != pageName(window.location.href)) { | |
48 | - loadDoc(location, function () { | |
49 | - history.pushState({ | |
50 | - loc: location | |
51 | - }, document.title, location); | |
52 | - }); | |
53 | - return false; | |
54 | - } | |
55 | -} | |
56 | - | |
57 | -function dynamiseLinks(el) { | |
58 | - $("a", el).click(actLink); | |
59 | -} | |
60 | - | |
61 | -function loadDoc(location, callback) { | |
62 | - if (!callback) { | |
63 | - callback = function () { | |
64 | - return undefined; | |
65 | - }; | |
66 | - } | |
67 | - var eventsLeft = 2; | |
68 | - var html = ''; | |
69 | - var mainContainer = $("#mainContainer"); | |
70 | - var oldHeight = mainContainer.height(); | |
71 | - | |
72 | - function events() { | |
73 | - eventsLeft += -1; | |
74 | - if (eventsLeft <= 0) { | |
75 | - // In | |
76 | - // Calculations | |
77 | - mainContainer.html(html); | |
78 | - mainContainer.height('auto'); | |
79 | - newHeight = mainContainer.height(); | |
80 | - mainContainer.height(oldHeight); | |
81 | - // Transition | |
82 | - mainContainer.animate({ | |
83 | - height: newHeight, | |
84 | - opacity: 1, | |
85 | - }, 'fast', function () { | |
86 | - mainContainer.height('auto'); | |
87 | - dynamiseLinks(mainContainer); | |
88 | - pageSpecific(location); | |
89 | - callback(); | |
90 | - }); | |
91 | - } | |
92 | - } | |
93 | - // Out | |
94 | - $(document).off('scroll', updateScrollData); | |
95 | - $(document.body).animate({ | |
96 | - scrollTop: $('.navbar-lower').height() | |
97 | - }, 'fast'); | |
98 | - $.get('pages/' + pageName(location) + '.php', function (data) { | |
99 | - html = data; | |
100 | - events(); | |
101 | - }); | |
102 | - mainContainer.height(oldHeight); | |
103 | - mainContainer.animate({ | |
104 | - opacity: 0 | |
105 | - }, 'fast', events); | |
106 | -} | |
107 | - | |
108 | -function historyChange(ev) { | |
109 | - loadDoc(ev.state.loc, function () { | |
110 | - if (ev.state.scrollTop > $('.navbar-lower').height()) { | |
111 | - $(document.body).animate({ | |
112 | - scrollTop: ev.state.scrollTop | |
113 | - }, 'fast'); | |
114 | - } | |
115 | - }); | |
116 | -} | |
117 | - | |
118 | -$(document).ready(function () { | |
119 | - dynamiseLinks(document.body); | |
120 | - var current = window.location.href; | |
121 | - pageSpecific(current); | |
122 | - history.replaceState({ | |
123 | - loc: current | |
124 | - }, document.title, current); | |
125 | - window.onpopstate = historyChange; | |
126 | - $('.navbar-fixed-top .navbar-toggle').click(function () { | |
127 | - $(document.body).animate({ | |
128 | - scrollTop: 0 | |
129 | - }); | |
130 | - }); | |
131 | -}); | |
132 | - | |
133 | -function initializeMap() { | |
134 | - var mapCanvas = document.getElementById('map-canvas'); | |
135 | - mapCanvas.innerHTML = ''; | |
136 | - var polytechPos = new google.maps.LatLng(50.6074998, 3.1373338); | |
137 | - var mapOptions = { | |
138 | - center: polytechPos, | |
139 | - zoom: 16, | |
140 | - mapTypeId: google.maps.MapTypeId.ROADMAP | |
141 | - }; | |
142 | - var map = new google.maps.Map(mapCanvas, mapOptions); | |
143 | - var marker = new google.maps.Marker({ | |
144 | - place: { | |
145 | - location: polytechPos, | |
146 | - query: "Polytech Lille" | |
147 | - }, | |
148 | - attribution: { | |
149 | - source: "Coupe de Robotique des Écoles Primaires", | |
150 | - webUrl: window.location.host | |
151 | - }, | |
152 | - map: map, | |
153 | - title: "Polytech Lille" | |
154 | - }); | |
155 | - var infowindow = new google.maps.InfoWindow({ | |
156 | - content: "<strong>Polytech Lille</strong><br/>Lieux des évènements de la Coupe de Robotique des Écoles Primaires" | |
157 | - }); | |
158 | - marker.addListener('click', function () { | |
159 | - infowindow.open(map, this); | |
160 | - }); | |
161 | -} |
pages/contact.php
pages/description.php