63251bca90c873f94545d605d4f9260be58abb2f
Bernd Wurst E-Mail-Modul auf JQuery umg...

Bernd Wurst authored 10 years ago

1) 
2)   function moreForward(e)
3)   {
4)     e.preventDefault();
5)     last = $('div.vmail-forward:last');
6)     last_id = parseInt(last.attr('id').match(/\d+/g));
7)     new_id = ++last_id;
8)  
9)     if (new_id > 50) {
10)       alert("Jetzt wird's merkwürdig. Bitte nutzen Sie eine Mailingliste wenn Sie so viele Empfänger brauchen!");
11)       return;
12)     }
13) 
14) 
15)     var $clone = last.clone();
16)     $clone.attr('id',$clone.attr('id').replace(/\d+$/, function(str) { return parseInt(str) + 1; }) ); 
17) 
18)     // Find all elements in $clone that have an ID, and iterate using each()
19)     $clone.find('[id]').each(function() { 
20)       //Perform the same replace as above
21)       var $th = $(this);
22)       var newID = $th.attr('id').replace(/\d+$/, function(str) { return parseInt(str) + 1; });
23)       $th.attr('id', newID);
24)     });
25)     // Find all elements in $clone that have a name, and iterate using each()
26)     $clone.find('[name]').each(function() { 
27)       //Perform the same replace as above
28)       var $th = $(this);
29)       var newName = $th.attr('name').replace(/\d+$/, function(str) { return parseInt(str) + 1; });
30)       $th.attr('name', newName);
31)     });
32) 
33)     $clone.find('input:first-of-type').val('');
34)     $clone.find('select:first-of-type')
Bernd Wurst attr() zu prop() geändert

Bernd Wurst authored 10 years ago

35)           .find('option:first-of-type').prop('selected', true);
Bernd Wurst E-Mail-Modul auf JQuery umg...

Bernd Wurst authored 10 years ago

36)     $clone.find('.warning').text('');
37)     $clone.find('.warning').hide();
38)     
39)     $clone.find('div.delete_forward').click(removeForward);
40)     $clone.find('input').on("change keyup paste", checkForward);
41)     
42)     last.after($clone);
43)   }
44) 
45)   function removeForward() 
46)   {
47)     div = $(this).closest('div.vmail-forward');
48)     input = div.find('input:first');
49)     input.val('');
50)     select = div.find('select:first');
Bernd Wurst attr() zu prop() geändert

Bernd Wurst authored 10 years ago

51)     select.find('option:first').prop('selected', true);
Bernd Wurst E-Mail-Modul auf JQuery umg...

Bernd Wurst authored 10 years ago

52)     if ($('div.vmail-forward').length > 1) {
53)       div.remove();
54)     }
55)   }
56) 
57) 
58)   function removeUnneededForwards() {
59)     // Alle <div> nach dem Element mit der ID vmail_forward_1...
60)     $('div#vmail_forward_1 ~ div').each( function (el) {
61)       // ... die leere Eingabefelder haben ...
62)       if ($(this).find('input:first').val() == '') {
63)         // ... werden gelöscht
64)         $(this).remove();
65)       }
66)       });
67)   }
68) 
69)   function clearPassword() {
70)     var input = document.getElementById('password');
71)     if (input.value == '**********') {
72)       input.value = '';
73)     }
74)     input.style.color = '#000';
75)     /* FIXME: Keine Ahnung, warum das notwendig ist. Mit dem tut es was es soll.  */
76)     input.focus();
77)   }
78) 
79)   function refillPassword() {
80)     var input = document.getElementById('password');
81)     if (input.value == '') {
82)       input.value = input.defaultValue;
83)     }
84)     if (input.value == '**********') {
85)       input.style.color = '#aaa';
86)     }
87)   }
88) 
89) 
90) function hideOrShowGroup( ev ) {
91)   checkbox = ev.target;
92)   the_id = checkbox.id;
93)   checkbox = $('#'+the_id)
94)   div = $('#'+the_id+'_config')
95)   if (checkbox.is(':checked')) {
96)     div.show(100);
97)   } else {
98)     div.hide(100);
99)   }
100) 
101) }
102) 
103) 
104) function hideUnchecked() {
105)   $('div.option_group').each( function(index) {
106)     the_id = this.id.replace('_config', '');
107)     checkbox = $('#'+the_id)
108)     div = $('#'+the_id+'_config')
109)     if (checkbox.is(':checked')) {
110)       div.show();
111)     } else {
112)       div.hide();
113)     }
114)   });
115) }
116) 
117) 
118) function checkForward( ) {
119)   input = $(this);
120)   val = input.val();
121)   atpos = val.indexOf('@');
122)   dot = val.lastIndexOf('.');
123)   if (atpos < 0 || val.length < atpos + 3 || dot < atpos || dot > val.length - 2) {
124)     return;
125)   }
126)   div = input.closest('div.vmail-forward');
127) }
128) 
129) 
130) 
131) $(document).ready(function(){
132)   // Automatisch Sternchen im Passwortfeld eintragen und entfernen
133)   $('#password').on('blur', refillPassword);
134)   $('#password').on('focus',clearPassword);    
135) 
136)   hideUnchecked();
137)   $('input.option_group').change(hideOrShowGroup);
138) 
139)   removeUnneededForwards();
140)   $('div.delete_forward').click(removeForward);
141)   $('#more_forwards').click(moreForward);
142) 
143)   $('div.vmail-forward input').on("change keyup paste", checkForward);
Bernd Wurst Ändere nicht die eingestell...

Bernd Wurst authored 10 years ago

144)   
145)   // trigger setup of warnings
146)   $('div.vmail-forward input').change();
Bernd Wurst Umgestellt auf JQueryUI-Dat...

Bernd Wurst authored 10 years ago

147) 
148) 
149)   $.datepicker.regional['de'] = {clearText: 'löschen', clearStatus: 'aktuelles Datum löschen',
150)                 closeText: 'schließen', closeStatus: 'ohne Änderungen schließen',
151)                 prevText: '< zurück', prevStatus: 'letzten Monat zeigen',
152)                 nextText: 'vor >', nextStatus: 'nächsten Monat zeigen',
153)                 currentText: 'heute', currentStatus: '',
154)                 monthNames: ['Januar','Februar','März','April','Mai','Juni',
155)                 'Juli','August','September','Oktober','November','Dezember'],
156)                 monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
157)                 'Jul','Aug','Sep','Okt','Nov','Dez'],
158)                 monthStatus: 'anderen Monat anzeigen', yearStatus: 'anderes Jahr anzeigen',
159)                 weekHeader: 'Wo', weekStatus: 'Woche des Monats',
160)                 dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
161)                 dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
162)                 dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
163)                 dayStatus: 'Setze DD als ersten Wochentag', dateStatus: 'Wähle D, M d',
164)                 dateFormat: 'dd.mm.yy', firstDay: 1, 
165)                 initStatus: 'Wähle ein Datum', isRTL: false};
166)   $.datepicker.setDefaults( $.datepicker.regional[ "de" ] );
167)   $.datepicker.setDefaults({
168)     dateFormat: 'yy-mm-dd',
169)     minDate: 1,
Bernd Wurst Autoresponder nur noch befr...

Bernd Wurst authored 9 years ago

170)     maxDate: "+2m"
Bernd Wurst Umgestellt auf JQueryUI-Dat...

Bernd Wurst authored 10 years ago

171) 
172)     });
173) 
174)   $('#ar_startdate').datepicker();
175)   $('#ar_startdate').change(function () {
Bernd Wurst attr() zu prop() geändert

Bernd Wurst authored 10 years ago

176)     $('#ar_valid_from_date').prop('checked', true)
Bernd Wurst Autoresponder nur noch befr...

Bernd Wurst authored 9 years ago

177)     mindate = $('#ar_startdate').datepicker("getDate");
178)     mindate.setDate(mindate.getDate()+1);
179)     $('#ar_enddate').datepicker("option", "minDate", mindate);
180)     maxdate = $('#ar_startdate').datepicker("getDate");
181)     maxdate.setDate(maxdate.getDate()+60);
182)     $('#ar_enddate').datepicker("option", "maxDate", maxdate);
Bernd Wurst Umgestellt auf JQueryUI-Dat...

Bernd Wurst authored 10 years ago

183)     });
184) 
185)   $('#ar_enddate').datepicker();
186)   $('#ar_enddate').datepicker("option", "minDate", $('#ar_startdate').val());
187)   $('#ar_enddate').change(function () {
Bernd Wurst attr() zu prop() geändert

Bernd Wurst authored 10 years ago

188)     $('#ar_valid_until_date').prop('checked', true)
Bernd Wurst Umgestellt auf JQueryUI-Dat...

Bernd Wurst authored 10 years ago

189)     });
Bernd Wurst E-Mail-Modul auf JQuery umg...

Bernd Wurst authored 10 years ago

190) });
191)