(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_65695 = document.getElementById('melde_65695'); var meldeInst = new melde(meldeEl_65695, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp65695 = new getXMLObject(); function ajaxNewspost_65695() { if(xmlhttp65695) { var melde_message = document.getElementById("melde_message_65695").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_65695").value); xmlhttp65695.open("POST","../meldung_send.php",true); xmlhttp65695.onreadystatechange = handleServerResponse65695; xmlhttp65695.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp65695.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse65695() { if (xmlhttp65695.readyState == 4) { if(xmlhttp65695.status == 200) { document.getElementById("melde_message_65695").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_65720 = document.getElementById('melde_65720'); var meldeInst = new melde(meldeEl_65720, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp65720 = new getXMLObject(); function ajaxNewspost_65720() { if(xmlhttp65720) { var melde_message = document.getElementById("melde_message_65720").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_65720").value); xmlhttp65720.open("POST","../meldung_send.php",true); xmlhttp65720.onreadystatechange = handleServerResponse65720; xmlhttp65720.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp65720.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse65720() { if (xmlhttp65720.readyState == 4) { if(xmlhttp65720.status == 200) { document.getElementById("melde_message_65720").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_65721 = document.getElementById('melde_65721'); var meldeInst = new melde(meldeEl_65721, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp65721 = new getXMLObject(); function ajaxNewspost_65721() { if(xmlhttp65721) { var melde_message = document.getElementById("melde_message_65721").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_65721").value); xmlhttp65721.open("POST","../meldung_send.php",true); xmlhttp65721.onreadystatechange = handleServerResponse65721; xmlhttp65721.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp65721.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse65721() { if (xmlhttp65721.readyState == 4) { if(xmlhttp65721.status == 200) { document.getElementById("melde_message_65721").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_65722 = document.getElementById('melde_65722'); var meldeInst = new melde(meldeEl_65722, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp65722 = new getXMLObject(); function ajaxNewspost_65722() { if(xmlhttp65722) { var melde_message = document.getElementById("melde_message_65722").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_65722").value); xmlhttp65722.open("POST","../meldung_send.php",true); xmlhttp65722.onreadystatechange = handleServerResponse65722; xmlhttp65722.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp65722.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse65722() { if (xmlhttp65722.readyState == 4) { if(xmlhttp65722.status == 200) { document.getElementById("melde_message_65722").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_65744 = document.getElementById('melde_65744'); var meldeInst = new melde(meldeEl_65744, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp65744 = new getXMLObject(); function ajaxNewspost_65744() { if(xmlhttp65744) { var melde_message = document.getElementById("melde_message_65744").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_65744").value); xmlhttp65744.open("POST","../meldung_send.php",true); xmlhttp65744.onreadystatechange = handleServerResponse65744; xmlhttp65744.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp65744.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse65744() { if (xmlhttp65744.readyState == 4) { if(xmlhttp65744.status == 200) { document.getElementById("melde_message_65744").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_65799 = document.getElementById('melde_65799'); var meldeInst = new melde(meldeEl_65799, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp65799 = new getXMLObject(); function ajaxNewspost_65799() { if(xmlhttp65799) { var melde_message = document.getElementById("melde_message_65799").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_65799").value); xmlhttp65799.open("POST","../meldung_send.php",true); xmlhttp65799.onreadystatechange = handleServerResponse65799; xmlhttp65799.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp65799.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse65799() { if (xmlhttp65799.readyState == 4) { if(xmlhttp65799.status == 200) { document.getElementById("melde_message_65799").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } }