(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_645104 = document.getElementById('melde_645104');
var meldeInst = new melde(meldeEl_645104, {
openCallback: function() {
console.log('Callback for when melde is open.');
},
closeCallback: function() {
console.log('Callback for when melde is closed.');
}
});
meldeInst.init();
var xmlhttp645104 = new getXMLObject();
function ajaxNewspost_645104() {
if(xmlhttp645104) {
var melde_message = document.getElementById("melde_message_645104").value;
var melde_id = encodeURIComponent(document.getElementById("melde_id_645104").value);
xmlhttp645104.open("POST","../meldung_send.php",true);
xmlhttp645104.onreadystatechange = handleServerResponse645104;
xmlhttp645104.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp645104.send("message=" + melde_message + "&melde_id=" + melde_id);
}
}
function handleServerResponse645104() {
if (xmlhttp645104.readyState == 4) {
if(xmlhttp645104.status == 200) {
document.getElementById("melde_message_645104").value='';
}
else {
alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!");
}
}
}
var meldeEl_343916 = document.getElementById('melde_343916');
var meldeInst = new melde(meldeEl_343916, {
openCallback: function() {
console.log('Callback for when melde is open.');
},
closeCallback: function() {
console.log('Callback for when melde is closed.');
}
});
meldeInst.init();
var xmlhttp343916 = new getXMLObject();
function ajaxNewspost_343916() {
if(xmlhttp343916) {
var melde_message = document.getElementById("melde_message_343916").value;
var melde_id = encodeURIComponent(document.getElementById("melde_id_343916").value);
xmlhttp343916.open("POST","../meldung_send.php",true);
xmlhttp343916.onreadystatechange = handleServerResponse343916;
xmlhttp343916.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp343916.send("message=" + melde_message + "&melde_id=" + melde_id);
}
}
function handleServerResponse343916() {
if (xmlhttp343916.readyState == 4) {
if(xmlhttp343916.status == 200) {
document.getElementById("melde_message_343916").value='';
}
else {
alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!");
}
}
}
var meldeEl_343915 = document.getElementById('melde_343915');
var meldeInst = new melde(meldeEl_343915, {
openCallback: function() {
console.log('Callback for when melde is open.');
},
closeCallback: function() {
console.log('Callback for when melde is closed.');
}
});
meldeInst.init();
var xmlhttp343915 = new getXMLObject();
function ajaxNewspost_343915() {
if(xmlhttp343915) {
var melde_message = document.getElementById("melde_message_343915").value;
var melde_id = encodeURIComponent(document.getElementById("melde_id_343915").value);
xmlhttp343915.open("POST","../meldung_send.php",true);
xmlhttp343915.onreadystatechange = handleServerResponse343915;
xmlhttp343915.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp343915.send("message=" + melde_message + "&melde_id=" + melde_id);
}
}
function handleServerResponse343915() {
if (xmlhttp343915.readyState == 4) {
if(xmlhttp343915.status == 200) {
document.getElementById("melde_message_343915").value='';
}
else {
alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!");
}
}
}
var meldeEl_343914 = document.getElementById('melde_343914');
var meldeInst = new melde(meldeEl_343914, {
openCallback: function() {
console.log('Callback for when melde is open.');
},
closeCallback: function() {
console.log('Callback for when melde is closed.');
}
});
meldeInst.init();
var xmlhttp343914 = new getXMLObject();
function ajaxNewspost_343914() {
if(xmlhttp343914) {
var melde_message = document.getElementById("melde_message_343914").value;
var melde_id = encodeURIComponent(document.getElementById("melde_id_343914").value);
xmlhttp343914.open("POST","../meldung_send.php",true);
xmlhttp343914.onreadystatechange = handleServerResponse343914;
xmlhttp343914.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp343914.send("message=" + melde_message + "&melde_id=" + melde_id);
}
}
function handleServerResponse343914() {
if (xmlhttp343914.readyState == 4) {
if(xmlhttp343914.status == 200) {
document.getElementById("melde_message_343914").value='';
}
else {
alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!");
}
}
}
var meldeEl_343913 = document.getElementById('melde_343913');
var meldeInst = new melde(meldeEl_343913, {
openCallback: function() {
console.log('Callback for when melde is open.');
},
closeCallback: function() {
console.log('Callback for when melde is closed.');
}
});
meldeInst.init();
var xmlhttp343913 = new getXMLObject();
function ajaxNewspost_343913() {
if(xmlhttp343913) {
var melde_message = document.getElementById("melde_message_343913").value;
var melde_id = encodeURIComponent(document.getElementById("melde_id_343913").value);
xmlhttp343913.open("POST","../meldung_send.php",true);
xmlhttp343913.onreadystatechange = handleServerResponse343913;
xmlhttp343913.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp343913.send("message=" + melde_message + "&melde_id=" + melde_id);
}
}
function handleServerResponse343913() {
if (xmlhttp343913.readyState == 4) {
if(xmlhttp343913.status == 200) {
document.getElementById("melde_message_343913").value='';
}
else {
alert("Upsal! Da hat es jetzt irgendwo ein Problem geben! Probier es einfach nochmal!");
}
}
}