(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_1163042 = document.getElementById('melde_1163042'); var meldeInst = new melde(meldeEl_1163042, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp1163042 = new getXMLObject(); function ajaxNewspost_1163042() { if(xmlhttp1163042) { var melde_message = document.getElementById("melde_message_1163042").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_1163042").value); xmlhttp1163042.open("POST","../meldung_send.php",true); xmlhttp1163042.onreadystatechange = handleServerResponse1163042; xmlhttp1163042.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp1163042.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse1163042() { if (xmlhttp1163042.readyState == 4) { if(xmlhttp1163042.status == 200) { document.getElementById("melde_message_1163042").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_1163044 = document.getElementById('melde_1163044'); var meldeInst = new melde(meldeEl_1163044, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp1163044 = new getXMLObject(); function ajaxNewspost_1163044() { if(xmlhttp1163044) { var melde_message = document.getElementById("melde_message_1163044").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_1163044").value); xmlhttp1163044.open("POST","../meldung_send.php",true); xmlhttp1163044.onreadystatechange = handleServerResponse1163044; xmlhttp1163044.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp1163044.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse1163044() { if (xmlhttp1163044.readyState == 4) { if(xmlhttp1163044.status == 200) { document.getElementById("melde_message_1163044").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_1163046 = document.getElementById('melde_1163046'); var meldeInst = new melde(meldeEl_1163046, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp1163046 = new getXMLObject(); function ajaxNewspost_1163046() { if(xmlhttp1163046) { var melde_message = document.getElementById("melde_message_1163046").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_1163046").value); xmlhttp1163046.open("POST","../meldung_send.php",true); xmlhttp1163046.onreadystatechange = handleServerResponse1163046; xmlhttp1163046.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp1163046.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse1163046() { if (xmlhttp1163046.readyState == 4) { if(xmlhttp1163046.status == 200) { document.getElementById("melde_message_1163046").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } } var meldeEl_1163053 = document.getElementById('melde_1163053'); var meldeInst = new melde(meldeEl_1163053, { openCallback: function() { console.log('Callback for when melde is open.'); }, closeCallback: function() { console.log('Callback for when melde is closed.'); } }); meldeInst.init(); var xmlhttp1163053 = new getXMLObject(); function ajaxNewspost_1163053() { if(xmlhttp1163053) { var melde_message = document.getElementById("melde_message_1163053").value; var melde_id = encodeURIComponent(document.getElementById("melde_id_1163053").value); xmlhttp1163053.open("POST","../meldung_send.php",true); xmlhttp1163053.onreadystatechange = handleServerResponse1163053; xmlhttp1163053.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp1163053.send("message=" + melde_message + "&melde_id=" + melde_id); } } function handleServerResponse1163053() { if (xmlhttp1163053.readyState == 4) { if(xmlhttp1163053.status == 200) { document.getElementById("melde_message_1163053").value=''; } else { alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!"); } } }