diff options
Diffstat (limited to 'js/abmahn.js')
-rw-r--r-- | js/abmahn.js | 82 |
1 files changed, 70 insertions, 12 deletions
diff --git a/js/abmahn.js b/js/abmahn.js index 6b6e39c..46f18e6 100644 --- a/js/abmahn.js +++ b/js/abmahn.js | |||
@@ -15,6 +15,21 @@ function setClass(id, classes) { | |||
15 | document.getElementById(id).className = classes; | 15 | document.getElementById(id).className = classes; |
16 | } | 16 | } |
17 | 17 | ||
18 | function hasClass(id, classes) { | ||
19 | return (" " + document.getElementById(id).className + " ").replace(/[\n\t]/g, " ").indexOf(" " + classes + " ") > -1; | ||
20 | } | ||
21 | |||
22 | function addClass(id, classes) { | ||
23 | if (hasClass(id, classes)) { return; } | ||
24 | document.getElementById(id).className += ' ' + classes; | ||
25 | } | ||
26 | |||
27 | function setExclusiveClass(id,value,clearpattern) { | ||
28 | var reg = new RegExp('(\\s|^)' + clearpattern + '-[^\\s]+(\\s|$)'); | ||
29 | var elem = document.getElementById(id); | ||
30 | elem.className = elem.className.replace(reg, ' ') + ' ' + clearpattern + '-' + value; | ||
31 | } | ||
32 | |||
18 | function setSelection(id, selection) { | 33 | function setSelection(id, selection) { |
19 | document.getElementById(id).value = selection; | 34 | document.getElementById(id).value = selection; |
20 | } | 35 | } |
@@ -56,21 +71,64 @@ function scrollTo(end) { | |||
56 | step(); | 71 | step(); |
57 | } | 72 | } |
58 | 73 | ||
59 | function step0_cancel() { scrollTo(0); setClass('wrapper', 'not-confirmed stepcancel'); } | 74 | /* Handle all visual transitions first */ |
60 | function step0_done() { scrollTo(0); setClass('wrapper', 'step1'); } | 75 | function hide_impressum() { setExclusiveClass('footer', 'hidden', 'impressum'); } |
61 | function step1_done() { scrollTo(0); setClass('wrapper', 'step2'); } | 76 | function show_impressum() { setExclusiveClass('footer', 'shown', 'impressum'); } |
62 | function step2_done() { scrollTo(103); setClass('wrapper', 'step3'); } | 77 | |
63 | function step3_done() { scrollTo(196); setClass('wrapper', 'step4'); } | 78 | function show_moreinfo() { setExclusiveClass('wrapper', 'shown', 'moreinfo'); } |
64 | function step4_done() { scrollTo(289); setClass('wrapper', 'step5'); } | 79 | function hide_moreinfo() { scrollTo(0); setExclusiveClass('wrapper', 'hidden', 'moreinfo'); } |
65 | function step5_done() { scrollTo(382); setClass('wrapper', 'step6'); } | 80 | |
66 | function step6_done() { scrollTo(475); setClass('wrapper', 'step7'); } | 81 | function head_n_click(step, scroll_val) { |
82 | if(!hasClass('wrapper', 'stepdone-' + (step - 1).toString() )) { return; } | ||
83 | scrollTo(scroll_val); | ||
84 | setExclusiveClass('wrapper', step.toString(), 'step'); | ||
85 | setExclusiveClass('wrapper', 'hidden', 'moreinfo'); | ||
86 | } | ||
87 | |||
88 | function head_1_click() { head_n_click(1, 0); } | ||
89 | function head_2_click() { head_n_click(2, 0); } | ||
90 | function head_3_click() { head_n_click(3, 103); } | ||
91 | function head_4_click() { head_n_click(4, 196); } | ||
92 | function head_5_click() { head_n_click(5, 289); } | ||
93 | function head_6_click() { head_n_click(6, 382); } | ||
94 | function head_7_click() { head_n_click(7, 475); } | ||
95 | |||
96 | /* Handle functional step transitions now */ | ||
97 | function step_0_cancel() { scrollTo(0); setClass('wrapper', 'not-confirmed step-0'); } | ||
98 | |||
99 | function step_1_done() { | ||
100 | addClass('wrapper', 'stepdone-1'); | ||
101 | head_2_click(); | ||
102 | } | ||
103 | |||
104 | function step_2_done() { | ||
105 | addClass('wrapper', 'stepdone-2'); | ||
106 | head_3_click(); | ||
107 | } | ||
108 | |||
109 | function step_3_done() { | ||
110 | addClass('wrapper', 'stepdone-3'); | ||
111 | head_4_click(); | ||
112 | } | ||
113 | |||
114 | function step_4_done() { | ||
115 | addClass('wrapper', 'stepdone-4'); | ||
116 | head_5_click(); | ||
117 | } | ||
118 | |||
119 | function step_5_done() { | ||
120 | addClass('wrapper', 'stepdone-5'); | ||
121 | head_6_click(); | ||
122 | } | ||
123 | |||
124 | function step_6_done() { | ||
125 | addClass('wrapper', 'stepdone-6'); | ||
126 | head_7_click(); | ||
127 | } | ||
67 | 128 | ||
68 | function hide_impressum() { setClass('footer', 'footer'); } | ||
69 | function show_impressum() { setClass('footer', 'footer show-imprint'); } | ||
70 | 129 | ||
71 | function show_moreinfo() { setClass('step1hook', 'juice moreinfoshown'); } | ||
72 | function show_lessinfo() { scrollTo(0); setClass('step1hook', 'juice'); } | ||
73 | 130 | ||
131 | /* Handle presets for known kanzleien */ | ||
74 | function waldorf() { | 132 | function waldorf() { |
75 | setText('abmahnender_kanzlei', 'Waldorf & Frommer RAe'); | 133 | setText('abmahnender_kanzlei', 'Waldorf & Frommer RAe'); |
76 | setText('abmahnender_bearbeiter', ''); | 134 | setText('abmahnender_bearbeiter', ''); |