(function() { 'use strict'; function classReg(cl) { return new RegExp('(\\s|^)'+ cl +'(\\s|$)'); } function hasClass(el, cl) { return el.className.match(classReg(cl)); } function addClass(el, cl) { if (!hasClass(el, cl)) { el.className += ' ' + cl; } } function removeClass(el, cl) { if (hasClass(el, cl)) { el.className = el.className.replace(classReg(cl), ''); } } function extend(obj1, obj2) { var obj = {}; for (var key in obj1) { obj[key] = obj2[key] === undefined ? obj1[key] : obj2[key]; } return obj; } var melde = function(el, opts) { this.melde = el, this.triggerBtn = document.querySelectorAll('[data-trigger-melde="' + this.melde.id + '"]'), this.closeBtn = this.melde.querySelectorAll('[data-close-melde]'), this.body = document.body, this.defaults = { activeClass: 'melde--active', bodyClass: 'melde-is-active', overlay: true, overlayClass: 'melde__overlay', openCallback: null, closeCallback: null }, this.opts = extend(this.defaults, opts); }; melde.prototype = { init: function() { this.meldeTriggering(); }, meldeTriggering: function() { var self = this; for (var i = 0; i < self.triggerBtn.length; i++) { self.triggerBtn[i].addEventListener('click', self.openmelde.bind(this)); } }, openmelde: function() { var self = this; if (self.opts.overlay) { self.appendOverlay(); } addClass(self.melde, self.opts.activeClass); addClass(self.body, self.opts.bodyClass); for (var i = 0; i < self.closeBtn.length; i++) { self.closeBtn[i].addEventListener('click', this.closemelde.bind(this)); } if (self.opts.openCallback) { self.opts.openCallback.call(self); } setTimeout(function() { self.closeBtn[0].focus(); }, 500); }, closemelde: function() { var self = this; removeClass(self.melde, self.opts.activeClass); removeClass(self.body, self.opts.bodyClass); for (var i = 0; i < self.closeBtn.length; i++) { self.closeBtn[i].removeEventListener('click', this.closemelde.bind(this)); } if (self.opts.overlay) { self.removeOverlay(); } if (self.opts.closeCallback) { self.opts.closeCallback.call(self); } }, appendOverlay: function() { var self = this; self.overlay = document.createElement('div'); self.overlay.className = self.opts.overlayClass; self.melde.appendChild(self.overlay); }, removeOverlay: function() { var self = this; setTimeout(function() { self.overlay.remove(); }, 500); } }; window.melde = melde; })(); var meldeEl_187219 = document.getElementById('melde_187219'); var meldeInst = new melde(meldeEl_187219, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp187219 = new getXMLObject(); function ajaxNewspost_187219() { if(xmlhttp187219) { var melde_message = document.getElementById("melde_message_187219").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_187219").value); xmlhttp187219.open("POST","../meldung_send.php",true); xmlhttp187219.onreadystatechange = handleServerResponse187219; xmlhttp187219.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp187219.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse187219() { if (xmlhttp187219.readyState == 4) { if(xmlhttp187219.status == 200) { document.getElementById("melde_message_187219").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_187243 = document.getElementById('melde_187243'); var meldeInst = new melde(meldeEl_187243, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp187243 = new getXMLObject(); function ajaxNewspost_187243() { if(xmlhttp187243) { var melde_message = document.getElementById("melde_message_187243").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_187243").value); xmlhttp187243.open("POST","../meldung_send.php",true); xmlhttp187243.onreadystatechange = handleServerResponse187243; xmlhttp187243.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp187243.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse187243() { if (xmlhttp187243.readyState == 4) { if(xmlhttp187243.status == 200) { document.getElementById("melde_message_187243").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_187244 = document.getElementById('melde_187244'); var meldeInst = new melde(meldeEl_187244, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp187244 = new getXMLObject(); function ajaxNewspost_187244() { if(xmlhttp187244) { var melde_message = document.getElementById("melde_message_187244").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_187244").value); xmlhttp187244.open("POST","../meldung_send.php",true); xmlhttp187244.onreadystatechange = handleServerResponse187244; xmlhttp187244.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp187244.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse187244() { if (xmlhttp187244.readyState == 4) { if(xmlhttp187244.status == 200) { document.getElementById("melde_message_187244").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_187245 = document.getElementById('melde_187245'); var meldeInst = new melde(meldeEl_187245, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp187245 = new getXMLObject(); function ajaxNewspost_187245() { if(xmlhttp187245) { var melde_message = document.getElementById("melde_message_187245").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_187245").value); xmlhttp187245.open("POST","../meldung_send.php",true); xmlhttp187245.onreadystatechange = handleServerResponse187245; xmlhttp187245.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp187245.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse187245() { if (xmlhttp187245.readyState == 4) { if(xmlhttp187245.status == 200) { document.getElementById("melde_message_187245").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_187246 = document.getElementById('melde_187246'); var meldeInst = new melde(meldeEl_187246, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp187246 = new getXMLObject(); function ajaxNewspost_187246() { if(xmlhttp187246) { var melde_message = document.getElementById("melde_message_187246").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_187246").value); xmlhttp187246.open("POST","../meldung_send.php",true); xmlhttp187246.onreadystatechange = handleServerResponse187246; xmlhttp187246.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp187246.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse187246() { if (xmlhttp187246.readyState == 4) { if(xmlhttp187246.status == 200) { document.getElementById("melde_message_187246").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_187247 = document.getElementById('melde_187247'); var meldeInst = new melde(meldeEl_187247, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp187247 = new getXMLObject(); function ajaxNewspost_187247() { if(xmlhttp187247) { var melde_message = document.getElementById("melde_message_187247").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_187247").value); xmlhttp187247.open("POST","../meldung_send.php",true); xmlhttp187247.onreadystatechange = handleServerResponse187247; xmlhttp187247.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp187247.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse187247() { if (xmlhttp187247.readyState == 4) { if(xmlhttp187247.status == 200) { document.getElementById("melde_message_187247").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_187248 = document.getElementById('melde_187248'); var meldeInst = new melde(meldeEl_187248, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp187248 = new getXMLObject(); function ajaxNewspost_187248() { if(xmlhttp187248) { var melde_message = document.getElementById("melde_message_187248").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_187248").value); xmlhttp187248.open("POST","../meldung_send.php",true); xmlhttp187248.onreadystatechange = handleServerResponse187248; xmlhttp187248.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp187248.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse187248() { if (xmlhttp187248.readyState == 4) { if(xmlhttp187248.status == 200) { document.getElementById("melde_message_187248").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } }