history.js 2.21 KB
Newer Older
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
function activateStoryFrame(pageN) {
  if (pageN == "1") {
    // window.location.reload();

    stopStory();

    $("#story-frame").removeClass("tour-inactive");
    $("#story-frame").removeClass("tour");
    $("#story-frame").addClass("startscreen");
    $("#balloon-startscreen").attr("style", "display:'block'!important");
  } else if (pageN == "2") {
    startStory();
    Introshow();
    setpositionVAR(false);
    zoomtop("IntroProj");
  } else if (pageN == "3") {
    zoomtop("ProjektePage");
    Projektshow();
  } else if (pageN == "4") {
    removebuildings();
    addcont("main_bock");
    addcont("main_heatdem");
    addcont("main_nordbstuff");
    Expert();
    setpositionVAR(false);
    zoomtop("Expertenmodus");
  } else if (pageN == "5") {
    removebuildings();
    addcont("main_nordbstuff2");
    NordbahnhofText();
    setpositionVAR(false);
    zoomtop("NordbahnhofInfo");
  } else if (pageN == "6") {
    addcont("main_bock2");
    showtourSpecific("main");
    setpositionVAR(false);
    zoomtop("projektOne");
Cholgrrr's avatar
Cholgrrr committed
38
39
40
41
42
43
  } else if (pageN == "7"){
    removebuildings();
    addcont("main_nordbstuff3");
    RosensteinText();
    setpositionVAR(false);
    zoomtop("RosensteinPage");
44
45
  }
}
patri's avatar
patri committed
46
47
48
49

//-------------------------------------
// TEST 02

50
function historyInfo() {
51
  history.pushState({ id: 2 }, "Info page", "./");
patri's avatar
patri committed
52
53
}

54
function historyProjekt() {
55
  history.pushState({ id: 3 }, "Project page", "./");
patri's avatar
patri committed
56
57
}

58
function historyToolbox() {
59
  history.pushState({ id: 4 }, "Info page", "./");
patri's avatar
patri committed
60
61
}

62
function historyNordb() {
63
  history.pushState({ id: 5 }, "Info page", "./");
patri's avatar
patri committed
64
65
}

Cholgrrr's avatar
Cholgrrr committed
66
function historyRosen() {
67
  history.pushState({ id: 7 }, "Info page", "./");
Cholgrrr's avatar
Cholgrrr committed
68
69
}

70
function historyBock() {
71
  history.pushState({ id: 6 }, "Info page", "./");
patri's avatar
patri committed
72
73
}

74
history.replaceState({ id: 1 }, "Default page", "./");
75
76
77
78
79
80
81
82
83
84
85

window.addEventListener("popstate", (e) => {
  if (e.state != null && e.state !== undefined) {
    if (typeof e.state.id !== "undefined") {
      console.log(e.state.id);
      activateStoryFrame(e.state.id);
    } else if (typeof e.state.key !== "undefined") {
      console.log(e.state.key);
      activateStoryFrame(1);
    } else {
      console.log(e.state);
patri's avatar
patri committed
86
    }
87
88
  }
});