(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_334333 = document.getElementById('melde_334333'); var meldeInst = new melde(meldeEl_334333, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp334333 = new getXMLObject(); function ajaxNewspost_334333() { if(xmlhttp334333) { var melde_message = document.getElementById("melde_message_334333").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_334333").value); xmlhttp334333.open("POST","../meldung_send.php",true); xmlhttp334333.onreadystatechange = handleServerResponse334333; xmlhttp334333.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp334333.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse334333() { if (xmlhttp334333.readyState == 4) { if(xmlhttp334333.status == 200) { document.getElementById("melde_message_334333").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_334334 = document.getElementById('melde_334334'); var meldeInst = new melde(meldeEl_334334, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp334334 = new getXMLObject(); function ajaxNewspost_334334() { if(xmlhttp334334) { var melde_message = document.getElementById("melde_message_334334").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_334334").value); xmlhttp334334.open("POST","../meldung_send.php",true); xmlhttp334334.onreadystatechange = handleServerResponse334334; xmlhttp334334.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp334334.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse334334() { if (xmlhttp334334.readyState == 4) { if(xmlhttp334334.status == 200) { document.getElementById("melde_message_334334").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_335630 = document.getElementById('melde_335630'); var meldeInst = new melde(meldeEl_335630, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp335630 = new getXMLObject(); function ajaxNewspost_335630() { if(xmlhttp335630) { var melde_message = document.getElementById("melde_message_335630").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_335630").value); xmlhttp335630.open("POST","../meldung_send.php",true); xmlhttp335630.onreadystatechange = handleServerResponse335630; xmlhttp335630.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp335630.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse335630() { if (xmlhttp335630.readyState == 4) { if(xmlhttp335630.status == 200) { document.getElementById("melde_message_335630").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_336306 = document.getElementById('melde_336306'); var meldeInst = new melde(meldeEl_336306, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp336306 = new getXMLObject(); function ajaxNewspost_336306() { if(xmlhttp336306) { var melde_message = document.getElementById("melde_message_336306").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_336306").value); xmlhttp336306.open("POST","../meldung_send.php",true); xmlhttp336306.onreadystatechange = handleServerResponse336306; xmlhttp336306.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp336306.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse336306() { if (xmlhttp336306.readyState == 4) { if(xmlhttp336306.status == 200) { document.getElementById("melde_message_336306").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_336307 = document.getElementById('melde_336307'); var meldeInst = new melde(meldeEl_336307, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp336307 = new getXMLObject(); function ajaxNewspost_336307() { if(xmlhttp336307) { var melde_message = document.getElementById("melde_message_336307").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_336307").value); xmlhttp336307.open("POST","../meldung_send.php",true); xmlhttp336307.onreadystatechange = handleServerResponse336307; xmlhttp336307.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp336307.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse336307() { if (xmlhttp336307.readyState == 4) { if(xmlhttp336307.status == 200) { document.getElementById("melde_message_336307").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } }