Commit 84032f20ba0f229a37c60a18d3251a03dbbd0039

Authored by Geoffrey PREUD'HOMME
1 parent 08dfd8ee

tel: → callto: on PC

Showing 2 changed files with 24 additions and 9 deletions   Show diff stats
@@ -20,6 +20,21 @@ function updateScrollData() { @@ -20,6 +20,21 @@ function updateScrollData() {
20 function pageSpecific(location) { 20 function pageSpecific(location) {
21 if (pageName(location) == 'contact') { 21 if (pageName(location) == 'contact') {
22 initializeMap(); 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 + });
23 } 38 }
24 $(document).scroll(updateScrollData); 39 $(document).scroll(updateScrollData);
25 } 40 }
@@ -30,7 +45,7 @@ function actLink(ev) { @@ -30,7 +45,7 @@ function actLink(ev) {
30 var location = ev.currentTarget.href; 45 var location = ev.currentTarget.href;
31 var page = pageName(location); 46 var page = pageName(location);
32 if (page && page != pageName(window.location.href)) { 47 if (page && page != pageName(window.location.href)) {
33 - loadDoc(location, function() { 48 + loadDoc(location, function () {
34 history.pushState({ 49 history.pushState({
35 loc: location 50 loc: location
36 }, document.title, location); 51 }, document.title, location);
@@ -45,7 +60,7 @@ function dynamiseLinks(el) { @@ -45,7 +60,7 @@ function dynamiseLinks(el) {
45 60
46 function loadDoc(location, callback) { 61 function loadDoc(location, callback) {
47 if (!callback) { 62 if (!callback) {
48 - callback = function() { 63 + callback = function () {
49 return undefined; 64 return undefined;
50 }; 65 };
51 } 66 }
@@ -67,7 +82,7 @@ function loadDoc(location, callback) { @@ -67,7 +82,7 @@ function loadDoc(location, callback) {
67 mainContainer.animate({ 82 mainContainer.animate({
68 height: newHeight, 83 height: newHeight,
69 opacity: 1, 84 opacity: 1,
70 - }, 'fast', function() { 85 + }, 'fast', function () {
71 mainContainer.height('auto'); 86 mainContainer.height('auto');
72 dynamiseLinks(mainContainer); 87 dynamiseLinks(mainContainer);
73 pageSpecific(location); 88 pageSpecific(location);
@@ -80,7 +95,7 @@ function loadDoc(location, callback) { @@ -80,7 +95,7 @@ function loadDoc(location, callback) {
80 $(document.body).animate({ 95 $(document.body).animate({
81 scrollTop: $('.navbar-lower').height() 96 scrollTop: $('.navbar-lower').height()
82 }, 'fast'); 97 }, 'fast');
83 - $.get(location + '?c', function(data) { 98 + $.get(location + '?c', function (data) {
84 html = data; 99 html = data;
85 events(); 100 events();
86 }); 101 });
@@ -91,7 +106,7 @@ function loadDoc(location, callback) { @@ -91,7 +106,7 @@ function loadDoc(location, callback) {
91 } 106 }
92 107
93 function historyChange(ev) { 108 function historyChange(ev) {
94 - loadDoc(ev.state.loc, function() { 109 + loadDoc(ev.state.loc, function () {
95 if (ev.state.scrollTop > $('.navbar-lower').height()) { 110 if (ev.state.scrollTop > $('.navbar-lower').height()) {
96 $(document.body).animate({ 111 $(document.body).animate({
97 scrollTop: ev.state.scrollTop 112 scrollTop: ev.state.scrollTop
@@ -100,7 +115,7 @@ function historyChange(ev) { @@ -100,7 +115,7 @@ function historyChange(ev) {
100 }); 115 });
101 } 116 }
102 117
103 -$(document).ready(function() { 118 +$(document).ready(function () {
104 dynamiseLinks(document.body); 119 dynamiseLinks(document.body);
105 var current = window.location.href; 120 var current = window.location.href;
106 pageSpecific(current); 121 pageSpecific(current);
@@ -108,7 +123,7 @@ $(document).ready(function() { @@ -108,7 +123,7 @@ $(document).ready(function() {
108 loc: current 123 loc: current
109 }, document.title, current); 124 }, document.title, current);
110 window.onpopstate = historyChange; 125 window.onpopstate = historyChange;
111 - $('.navbar-fixed-top .navbar-toggle').click(function() { 126 + $('.navbar-fixed-top .navbar-toggle').click(function () {
112 $(document.body).animate({ 127 $(document.body).animate({
113 scrollTop: 0 128 scrollTop: 0
114 }); 129 });
@@ -140,7 +155,7 @@ function initializeMap() { @@ -140,7 +155,7 @@ function initializeMap() {
140 var infowindow = new google.maps.InfoWindow({ 155 var infowindow = new google.maps.InfoWindow({
141 content: "<strong>Polytech Lille</strong><br/>Lieux des évènements de la Coupe de Robotique des Écoles Primaires" 156 content: "<strong>Polytech Lille</strong><br/>Lieux des évènements de la Coupe de Robotique des Écoles Primaires"
142 }); 157 });
143 - marker.addListener('click', function() { 158 + marker.addListener('click', function () {
144 infowindow.open(map, this); 159 infowindow.open(map, this);
145 }); 160 });
146 } 161 }
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <h1>Contact</h1> 3 <h1>Contact</h1>
4 <p>Pour toute information, vous pouvez contacter Mme Pichonat</p> 4 <p>Pour toute information, vous pouvez contacter Mme Pichonat</p>
5 <p><span class="glyphicon glyphicon-envelope"></span> <a href="mailto:emmanuelle.pichonat@polytech-lille.fr">emmanuelle.pichonat@polytech-lille.fr</a></p> 5 <p><span class="glyphicon glyphicon-envelope"></span> <a href="mailto:emmanuelle.pichonat@polytech-lille.fr">emmanuelle.pichonat@polytech-lille.fr</a></p>
6 - <p><span class="glyphicon glyphicon-phone-alt"></span> <a href="tel:+33328767447">03 28 76 74 47</a></p> 6 + <p><span class="glyphicon glyphicon-phone-alt"></span> <a href="tel:0033328767447">03 28 76 74 47</a></p>
7 <p><span class="glyphicon glyphicon-map-marker"></span> Polytech Lille</p> 7 <p><span class="glyphicon glyphicon-map-marker"></span> Polytech Lille</p>
8 <p>2, Bd Langevin</p> 8 <p>2, Bd Langevin</p>
9 <p>59655 Villeneuve d'Ascq Cedex</p> 9 <p>59655 Villeneuve d'Ascq Cedex</p>