Commit dcc55beacf403c4259c88e2955b9817197332aed

Authored by Geoffrey PREUD'HOMME
1 parent b8d34eaa

Minor cleanup navigation

Showing 1 changed file with 19 additions and 13 deletions   Show diff stats
js/crep.js
1   -function loadDoc(ev) {
  1 +function pageSpecific(location) {
  2 + if (location.indexOf('contact') >= 0) {
  3 + initializeMap()
  4 + }
  5 +}
  6 +
  7 +function actLink(ev) {
2 8 var location = ev.currentTarget.href
3 9 if (location.indexOf(window.location.host) >= 0) {
4   - $.get(location + '?c', function (data) {
5   - mainContainer = $("#mainContainer")
6   - mainContainer.html(data)
7   - // POST
8   - dynamiseLinks(mainContainer)
9   - pageSpecific(location)
10   - })
  10 + loadDoc(location)
11 11 return false
12 12 }
13 13 }
14 14  
15 15 function dynamiseLinks(el) {
16   - $("a", el).click(loadDoc)
  16 + $("a", el).click(actLink)
17 17 }
18 18  
19   -function pageSpecific(location) {
20   - if (location.indexOf('contact') >= 0) {
21   - initializeMap()
22   - }
  19 +function loadDoc(location) {
  20 + $.get(location + '?c', function (data) {
  21 + mainContainer = $("#mainContainer")
  22 + mainContainer.html(data)
  23 + history.pushState({}, document.title, location)
  24 + // POST
  25 + dynamiseLinks(mainContainer)
  26 + pageSpecific(location)
  27 + })
  28 +
23 29 }
24 30  
25 31 $(document).ready(function () {
... ...