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
js/crep.js
... ... @@ -20,6 +20,21 @@ function updateScrollData() {
20 20 function pageSpecific(location) {
21 21 if (pageName(location) == 'contact') {
22 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 39 $(document).scroll(updateScrollData);
25 40 }
... ... @@ -30,7 +45,7 @@ function actLink(ev) {
30 45 var location = ev.currentTarget.href;
31 46 var page = pageName(location);
32 47 if (page && page != pageName(window.location.href)) {
33   - loadDoc(location, function() {
  48 + loadDoc(location, function () {
34 49 history.pushState({
35 50 loc: location
36 51 }, document.title, location);
... ... @@ -45,7 +60,7 @@ function dynamiseLinks(el) {
45 60  
46 61 function loadDoc(location, callback) {
47 62 if (!callback) {
48   - callback = function() {
  63 + callback = function () {
49 64 return undefined;
50 65 };
51 66 }
... ... @@ -67,7 +82,7 @@ function loadDoc(location, callback) {
67 82 mainContainer.animate({
68 83 height: newHeight,
69 84 opacity: 1,
70   - }, 'fast', function() {
  85 + }, 'fast', function () {
71 86 mainContainer.height('auto');
72 87 dynamiseLinks(mainContainer);
73 88 pageSpecific(location);
... ... @@ -80,7 +95,7 @@ function loadDoc(location, callback) {
80 95 $(document.body).animate({
81 96 scrollTop: $('.navbar-lower').height()
82 97 }, 'fast');
83   - $.get(location + '?c', function(data) {
  98 + $.get(location + '?c', function (data) {
84 99 html = data;
85 100 events();
86 101 });
... ... @@ -91,7 +106,7 @@ function loadDoc(location, callback) {
91 106 }
92 107  
93 108 function historyChange(ev) {
94   - loadDoc(ev.state.loc, function() {
  109 + loadDoc(ev.state.loc, function () {
95 110 if (ev.state.scrollTop > $('.navbar-lower').height()) {
96 111 $(document.body).animate({
97 112 scrollTop: ev.state.scrollTop
... ... @@ -100,7 +115,7 @@ function historyChange(ev) {
100 115 });
101 116 }
102 117  
103   -$(document).ready(function() {
  118 +$(document).ready(function () {
104 119 dynamiseLinks(document.body);
105 120 var current = window.location.href;
106 121 pageSpecific(current);
... ... @@ -108,7 +123,7 @@ $(document).ready(function() {
108 123 loc: current
109 124 }, document.title, current);
110 125 window.onpopstate = historyChange;
111   - $('.navbar-fixed-top .navbar-toggle').click(function() {
  126 + $('.navbar-fixed-top .navbar-toggle').click(function () {
112 127 $(document.body).animate({
113 128 scrollTop: 0
114 129 });
... ... @@ -140,7 +155,7 @@ function initializeMap() {
140 155 var infowindow = new google.maps.InfoWindow({
141 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 159 infowindow.open(map, this);
145 160 });
146 161 }
... ...
pages/contact.php
... ... @@ -3,7 +3,7 @@
3 3 <h1>Contact</h1>
4 4 <p>Pour toute information, vous pouvez contacter Mme Pichonat</p>
5 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 7 <p><span class="glyphicon glyphicon-map-marker"></span> Polytech Lille</p>
8 8 <p>2, Bd Langevin</p>
9 9 <p>59655 Villeneuve d'Ascq Cedex</p>
... ...