(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_9374 = document.getElementById('melde_9374'); var meldeInst = new melde(meldeEl_9374, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp9374 = new getXMLObject(); function ajaxNewspost_9374() { if(xmlhttp9374) { var melde_message = document.getElementById("melde_message_9374").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_9374").value); xmlhttp9374.open("POST","../meldung_send.php",true); xmlhttp9374.onreadystatechange = handleServerResponse9374; xmlhttp9374.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp9374.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse9374() { if (xmlhttp9374.readyState == 4) { if(xmlhttp9374.status == 200) { document.getElementById("melde_message_9374").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_9375 = document.getElementById('melde_9375'); var meldeInst = new melde(meldeEl_9375, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp9375 = new getXMLObject(); function ajaxNewspost_9375() { if(xmlhttp9375) { var melde_message = document.getElementById("melde_message_9375").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_9375").value); xmlhttp9375.open("POST","../meldung_send.php",true); xmlhttp9375.onreadystatechange = handleServerResponse9375; xmlhttp9375.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp9375.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse9375() { if (xmlhttp9375.readyState == 4) { if(xmlhttp9375.status == 200) { document.getElementById("melde_message_9375").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_9409 = document.getElementById('melde_9409'); var meldeInst = new melde(meldeEl_9409, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp9409 = new getXMLObject(); function ajaxNewspost_9409() { if(xmlhttp9409) { var melde_message = document.getElementById("melde_message_9409").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_9409").value); xmlhttp9409.open("POST","../meldung_send.php",true); xmlhttp9409.onreadystatechange = handleServerResponse9409; xmlhttp9409.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp9409.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse9409() { if (xmlhttp9409.readyState == 4) { if(xmlhttp9409.status == 200) { document.getElementById("melde_message_9409").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_9418 = document.getElementById('melde_9418'); var meldeInst = new melde(meldeEl_9418, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp9418 = new getXMLObject(); function ajaxNewspost_9418() { if(xmlhttp9418) { var melde_message = document.getElementById("melde_message_9418").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_9418").value); xmlhttp9418.open("POST","../meldung_send.php",true); xmlhttp9418.onreadystatechange = handleServerResponse9418; xmlhttp9418.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp9418.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse9418() { if (xmlhttp9418.readyState == 4) { if(xmlhttp9418.status == 200) { document.getElementById("melde_message_9418").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_11436 = document.getElementById('melde_11436'); var meldeInst = new melde(meldeEl_11436, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp11436 = new getXMLObject(); function ajaxNewspost_11436() { if(xmlhttp11436) { var melde_message = document.getElementById("melde_message_11436").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_11436").value); xmlhttp11436.open("POST","../meldung_send.php",true); xmlhttp11436.onreadystatechange = handleServerResponse11436; xmlhttp11436.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp11436.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse11436() { if (xmlhttp11436.readyState == 4) { if(xmlhttp11436.status == 200) { document.getElementById("melde_message_11436").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } }