summaryrefslogtreecommitdiff
path: root/js/abmahn.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/abmahn.js')
-rw-r--r--js/abmahn.js82
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
18function hasClass(id, classes) {
19 return (" " + document.getElementById(id).className + " ").replace(/[\n\t]/g, " ").indexOf(" " + classes + " ") > -1;
20}
21
22function addClass(id, classes) {
23 if (hasClass(id, classes)) { return; }
24 document.getElementById(id).className += ' ' + classes;
25}
26
27function 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
18function setSelection(id, selection) { 33function 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
59function step0_cancel() { scrollTo(0); setClass('wrapper', 'not-confirmed stepcancel'); } 74/* Handle all visual transitions first */
60function step0_done() { scrollTo(0); setClass('wrapper', 'step1'); } 75function hide_impressum() { setExclusiveClass('footer', 'hidden', 'impressum'); }
61function step1_done() { scrollTo(0); setClass('wrapper', 'step2'); } 76function show_impressum() { setExclusiveClass('footer', 'shown', 'impressum'); }
62function step2_done() { scrollTo(103); setClass('wrapper', 'step3'); } 77
63function step3_done() { scrollTo(196); setClass('wrapper', 'step4'); } 78function show_moreinfo() { setExclusiveClass('wrapper', 'shown', 'moreinfo'); }
64function step4_done() { scrollTo(289); setClass('wrapper', 'step5'); } 79function hide_moreinfo() { scrollTo(0); setExclusiveClass('wrapper', 'hidden', 'moreinfo'); }
65function step5_done() { scrollTo(382); setClass('wrapper', 'step6'); } 80
66function step6_done() { scrollTo(475); setClass('wrapper', 'step7'); } 81function 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
88function head_1_click() { head_n_click(1, 0); }
89function head_2_click() { head_n_click(2, 0); }
90function head_3_click() { head_n_click(3, 103); }
91function head_4_click() { head_n_click(4, 196); }
92function head_5_click() { head_n_click(5, 289); }
93function head_6_click() { head_n_click(6, 382); }
94function head_7_click() { head_n_click(7, 475); }
95
96/* Handle functional step transitions now */
97function step_0_cancel() { scrollTo(0); setClass('wrapper', 'not-confirmed step-0'); }
98
99function step_1_done() {
100 addClass('wrapper', 'stepdone-1');
101 head_2_click();
102}
103
104function step_2_done() {
105 addClass('wrapper', 'stepdone-2');
106 head_3_click();
107}
108
109function step_3_done() {
110 addClass('wrapper', 'stepdone-3');
111 head_4_click();
112}
113
114function step_4_done() {
115 addClass('wrapper', 'stepdone-4');
116 head_5_click();
117}
118
119function step_5_done() {
120 addClass('wrapper', 'stepdone-5');
121 head_6_click();
122}
123
124function step_6_done() {
125 addClass('wrapper', 'stepdone-6');
126 head_7_click();
127}
67 128
68function hide_impressum() { setClass('footer', 'footer'); }
69function show_impressum() { setClass('footer', 'footer show-imprint'); }
70 129
71function show_moreinfo() { setClass('step1hook', 'juice moreinfoshown'); }
72function show_lessinfo() { scrollTo(0); setClass('step1hook', 'juice'); }
73 130
131/* Handle presets for known kanzleien */
74function waldorf() { 132function waldorf() {
75 setText('abmahnender_kanzlei', 'Waldorf & Frommer RAe'); 133 setText('abmahnender_kanzlei', 'Waldorf & Frommer RAe');
76 setText('abmahnender_bearbeiter', ''); 134 setText('abmahnender_bearbeiter', '');