blob: ecf39b2f77ad3ccafd9d7aab33a82f750f520711 [file] [log] [blame]
Nils Diewald4e9fbcb2014-07-15 11:45:09 +00001function setTutorialPage(obj) {
2 var page = obj;
3 if (typeof page != 'string') {
4 page = window.location.pathname + window.location.search;
5 for (i = 1; i < 5; i++) {
6 if (obj.nodeName === 'SECTION') {
7 if (obj.hasAttribute('id'))
8 page += '#' + obj.getAttribute('id');
9 break;
10 }
11 else if (obj.nodeName === 'PRE' && obj.hasAttribute('id')) {
12 page += '#' + obj.getAttribute('id');
13 break;
14 }
15 else {
16 obj = obj.parentNode;
17 };
18 };
19 };
20 document.cookie = 'tutorial_page=' + page + '; path=/';
21};
22
23function getTutorialPage() {
24 var pc = 'tutorial_page';
25 var c_value = document.cookie;
Nils Diewald4e9fbcb2014-07-15 11:45:09 +000026 var c_start = c_value.indexOf(" " + pc + "=");
27 if (c_start == -1)
28 c_start = c_value.indexOf(pc + "=");
29
30 if (c_start == -1) {
Nils Diewald3d871842015-03-10 23:14:34 +000031 if (document.location.pathname.indexOf('kalamar') >= 0) {
32 c_value = '/kalamar/tutorial?embedded=1';
33 }
34 else {
35 c_value = '/tutorial?embedded=1';
36 };
Nils Diewald4e9fbcb2014-07-15 11:45:09 +000037 }
38 else {
39 c_start = c_value.indexOf("=", c_start) + 1;
40 var c_end = c_value.indexOf(";", c_start);
41
42 if (c_end == -1)
43 c_end = c_value.length;
44
45 c_value = unescape(c_value.substring(c_start,c_end));
46 };
Nils Diewald4e9fbcb2014-07-15 11:45:09 +000047 return c_value;
48};