// (c) 2012+ Altruja GmbH. See https://altruja.de for more information. function altruja() { } (function () { function main() { //// Globally (within the embed script) accessible variables //// Configuration - never overwrite these var default_eid = ''; var boost_eid = ''; var links = {"u4d8":"https:\/\/altruja.de\/neuer-spendenanlass-5404\/","rgig":"https:\/\/www.holocaust-denkmal-berlin.de\/?ef-page=1&neues-spendenformular-3519\/","kjuv":"https:\/\/altruja.de\/neues-spendenformular-kopie\/","l3hf":"https:\/\/altruja.de\/hand-in-hand-gegen-rassismus-fuer-menschenrechte-und-vielfalt\/","hpg9":"https:\/\/www.holocaust-denkmal-berlin.de\/index.php?id=467&unsere-prominenten-botschafter-setzen-auch-sie-ein-zeichen-gegen-rechtsradikalismus-antisemitismus-und-rassismus-kopie\/","dfzy":"https:\/\/altruja.de\/neues-kampagnentool-1157\/"}; var slugs = {"u4d8":"neuer-spendenanlass-5404","rgig":"neues-spendenformular-3519","kjuv":"neues-spendenformular-kopie","l3hf":"hand-in-hand-gegen-rassismus-fuer-menschenrechte-und-vielfalt","hpg9":"unsere-prominenten-botschafter-setzen-auch-sie-ein-zeichen-gegen-rechtsradikalismus-antisemitismus-und-rassismus-kopie","dfzy":"neues-kampagnentool-1157"}; var wideParents = []; var default_slug = slugs[default_eid]; var default_link = links[default_eid]; var placeholders = {"page":"ALTRUJA-PAGE","button":"ALTRUJA-BUTTON"}; var buttonTemplate = ''; //// Micro-Frameworks // Provide domready mini-framework, and have it call 'ready' function /*! * domready (c) Dustin Diaz 2012 - License MIT */ !function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&typeof define.amd=="object"?define(b):this[a]=b()}("domready",function(a){function m(a){l=1;while(a=b.shift())a()}var b=[],c,d=!1,e=document,f=e.documentElement,g=f.doScroll,h="DOMContentLoaded",i="addEventListener",j="onreadystatechange",k="readyState",l=/^loade|c/.test(e[k]);return e[i]&&e[i](h,c=function(){e.removeEventListener(h,c,d),m()},d),g&&e.attachEvent(j,c=function(){/^c/.test(e[k])&&(e.detachEvent(j,c),m())}),a=g?function(c){self!=top?l?c():b.push(c):function(){try{f.doScroll("left")}catch(b){return setTimeout(function(){a(c)},50)}c()}()}:function(a){l?a():b.push(a)}}); // Use fader mini-framework /*! * Fader.js 0.3.0 * * Copyright 2012, Lukas Alexandre, Tait Brown * Licensed under MIT */var Fader={supportsTransitions:function(){var e=document.body||document.documentElement;var t=e.style;var n="transition";if(typeof t[n]=="string"){return true}v=["Moz","Webkit","Khtml","O","ms"],n=n.charAt(0).toUpperCase()+n.substr(1);for(var r=0;r=n){s=2}else{s=-2}var o=t*1e3/50;var u=setInterval(function(){if(s>0&&i>=r||s<0&&i<=r){clearInterval(u)}Fader.setAlpha(e,i);i+=s},o)},setAlpha:function(e,t){e.style.filter="alpha(opacity="+t+")";e.style.opacity=t/100}};; // Use include mini-framework /* include.js 2.0 | github.com/CapMousse/include.js */ (function(j){function f(a,b){var c;for(c=0;cd.length?e[a]=g--:null===d[0][0]&&(d[0][0]=a),k())}function q(a){var b=a;if(e[b])k();else{/\.js/.test(a)||(a=a.replace(".","/"),a+=".js");var c=a;setTimeout(function(){var a,d=!1;f(document.getElementsByTagName("script"),function(a){if(a.getAttribute("data-module")&&a.getAttribute("data-module")===b)return d=a,!1});d||(g++,a=document.createElement("script"),a.async=!0,a.type="text/javascript",a.src=c,a.setAttribute("data-module", b),a.setAttribute("data-count",g),a.setAttribute("data-loaded",!1),p?p.parentNode.insertBefore(a,p):r.appendChild(a),a.attachEvent?a.attachEvent("onreadystatechange",h):a.addEventListener("load",h,!1))},0)}}var e={},d=[],g=1,p=document.getElementsByTagName("base")[0],r=document.getElementsByTagName("head")[0];j.include=j.require=j.define=function(a,b,c){"string"!==typeof a&&(c=b,b=a,a=null);"object"!==typeof b&&(c=b,b=[]);d.unshift([a,b,c]);k();b.length&&f(b,q)}})(this);; // use viper animation mini-framework // A good deal of code inspired by the awesome MooTools framework (http://mootools.net/) (function (window, undefined) { function assignEvents(array, obj) { array.push.apply(array, obj ? ({}).toString.call(obj) == '[object Array]' ? obj : [obj] : []); } function fireEvents(array, bind, obj) { for (var i = 0, l = array.length; i < l; ++i) array[i].call(bind, obj); } function Viper(options) { if (!(this instanceof Viper)) return new Viper(options); this.object = options.object; this.property = options.property; this.from = this._from = options.from || this.object[this.property]; this.to = ({}).toString.call(options.to) == '[object Array]' ? options.to : [options.to]; this.target = 0; this.parser = options.parser || (function (val) { var parsers = Viper.Parsers, parser, list = [], i, l; for (i in parsers) { if (parsers.hasOwnProperty(i)) list.push(parsers[i]); } list.sort(function (a, b) { return (b.priority || 0) - (a.priority || 0); }); for (i = 0, l = list.length; i < l; ++i) { parser = new list[i](); if (parser.parse(val) != null) return parser; } parser = new parsers.Number(); parser.parse(val); return parser; })(this.from); this.transition = options.transition || Viper.Transitions.linear; this.duration = options.duration || 500; this.fps = options.fps || 40; this.frameInterval = 1000 / this.fps; this.frames = options.frames || ~~(this.duration / this.frameInterval + 0.5); this.frame = options.frame == undefined ? -1 : 0; this.running = false; this.startHandlers = []; this.updateHandlers = []; this.finishHandlers = []; assignEvents(this.startHandlers, options.start); assignEvents(this.updateHandlers, options.update); assignEvents(this.finishHandlers, options.finish); } var VP = Viper.prototype, transition, i, old = window.Viper; VP.start = function () { if (!this.running) { this.resume(); fireEvents(this.startHandlers, this, this.object); } return this; }; VP.stop = function () { if (this.running) { this.pause(); fireEvents(this.finishHandlers, this, this.object); } return this; }; VP.pause = function (time) { if (this.running) { this.running = this.time = false; clearInterval(this.timer); var t = this; if (time != undefined) setTimeout(function () { t.resume(); }, time); } return this; }; VP.resume = function () { if (!this.running && this.frame < this.frames) { var t = this; this.timer = setInterval(function () { t.step(+new Date()); }, this.frameInterval); this.running = true; } return this; }; VP.step = function (now) { this.frame += (now - (this.time || now)) / this.frameInterval; this.time = now; this.object[this.property] = this.parser.compute(this.from, this.to[this.target], this.frame < this.frames ? this.transition(this.frame / this.frames) : 1); fireEvents(this.updateHandlers, this, this.object); if (this.frame >= this.frames) { this.frame = this.time = 0; this.parser.parse(this.from = this.to[this.target++]); if (this.to[this.target] == undefined) { this.parser.parse(this.from = this._from); this.target = 0; this.stop(); } } }; // See Robert Penner's Easing Equations (http://www.robertpenner.com/easing/), modified slightly. Viper.Transitions = { linear: function (x) { return x; }, sine: function (x) { return 1 - Math.cos(x * Math.PI / 2); }, elastic: function (x) { return Math.pow(2, 10 * --x) * Math.cos(20 * x * Math.PI / 3); }, bounce: function (x) { var a = 0, b = 1, c; while (x < (7 - 4 * a) / 11) { a += b; b /= 2; } c = (11 - 6 * a - 11 * x) / 4; return b * b - c * c; } }; for (i in Viper.Transitions) { if (Viper.Transitions.hasOwnProperty(i)) { transition = Viper.Transitions[i]; transition.out = (function (transition) { return function (x) { return 1 - transition(1 - x); }})(transition); transition.inOut = (function (transition) { return function (x) { return (x > 0.5 ? 2 - transition(2 * (1 - x)) : transition(2 * x)) / 2; }})(transition); } } function compute(from, to, delta) { return (to - from) * delta + from; } Viper.Parsers = { Number: function () { this.parse = function (x, noset) { x += ''; var match = /(\D*)(\d+)(.*)?/.exec(x) || [,,'x' - 2], value = parseFloat(match[2]); if (!noset) { this.prefix = match[1] || ''; this.suffix = match[3] || ''; this.value = value; } return isNaN(value) ? undefined : value; }; this.compute = function (from, to, delta) { return this.prefix + compute(this.value, this.parse(to, true), delta) + this.suffix; }; }, Color: function () { this.parse = function (x, noset) { var intify = parseInt, match; if (/^#[\da-f]{6}$/i.test(x)) match = [intify(x.substring(1, 3), 16), intify(x.substring(3, 5), 16), intify(x.substring(5, 7), 16)]; else if (match = /^(rgb\()?(\d+),\s*(\d+),\s*(\d+)\)?$/.exec(x)) match = [intify(match[2]), intify(match[3]), intify(match[4])]; if (!noset) this.value = match; return match; }; this.compute = function (from, to, delta) { for (var colors = [], toArray = this.parse(to, true), i = 0, l = this.value.length; i < l; ++i) colors.push(~~(compute(this.value[i], toArray[i], delta) + 0.5)); return 'rgb(' + colors + ')'; }; }, // Adapted from the MooTools Fx.Text plugin by André Fiedler (http://mootools.net/forge/p/fx_text) String: function () { this.parse = function (x) { return '' + x; }; this.compute = function (from, to, delta) { from += ''; to += ''; var l = ~~(to.length * delta + 0.5); return to.substr(0, l) + from.substr(l, from.length - l - ~~((from.length - to.length) * delta + 0.5)); }; } }; Viper.Parsers.Color.priority = 1; Viper.Parsers.String.priority = -9; Viper.noConflict = function () { window.Viper = old; return Viper; }; window.Viper = Viper; })(this); ; // use Bean event library // Hack for context var bean; function define(definition) { bean = definition(); altruja.bean = bean; // Expose for embed.js } define.amd = true; /*! * Bean - copyright (c) Jacob Thornton 2011-2012 * https://github.com/fat/bean * MIT license */ (function(a,b,c){"undefined"!=typeof module&&module.exports?module.exports=c():"function"==typeof define&&define.amd?define(c):b[a]=c()})("bean",this,function(a,b){a=a||"bean",b=b||this;var z,c=window,d=b[a],e=/[^\.]*(?=\..*)\.|.*/,f=/\..*/,g="addEventListener",h="removeEventListener",i=document||{},j=i.documentElement||{},k=j[g],l=k?g:"attachEvent",m={},n=Array.prototype.slice,o=function(a,b){return a.split(b||" ")},p=function(a){return"string"==typeof a},q=function(a){return"function"==typeof a},r="click dblclick mouseup mousedown contextmenu mousewheel mousemultiwheel DOMMouseScroll mouseover mouseout mousemove selectstart selectend keydown keypress keyup orientationchange focus blur change reset select submit load unload beforeunload resize move DOMContentLoaded readystatechange message error abort scroll ",s="show input invalid touchstart touchmove touchend touchcancel gesturestart gesturechange gestureend textinputreadystatechange pageshow pagehide popstate hashchange offline online afterprint beforeprint dragstart dragenter dragover dragleave drag drop dragend loadstart progress suspend emptied stalled loadmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate play pause ratechange volumechange cuechange checking noupdate downloading cached updateready obsolete ",t=function(a,b,c){for(c=0;b.length>c;c++)b[c]&&(a[b[c]]=1);return a}({},o(r+(k?s:""))),u=function(){var a="compareDocumentPosition"in j?function(a,b){return b.compareDocumentPosition&&16===(16&b.compareDocumentPosition(a))}:"contains"in j?function(a,b){return b=9===b.nodeType||b===window?j:b,b!==a&&b.contains(a)}:function(a,b){for(;a=a.parentNode;)if(a===b)return 1;return 0},b=function(b){var c=b.relatedTarget;return c?c!==this&&"xul"!==c.prefix&&!/document/.test(""+this)&&!a(c,this):null==c};return{mouseenter:{base:"mouseover",condition:b},mouseleave:{base:"mouseout",condition:b},mousewheel:{base:/Firefox/.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel"}}}(),v=function(){var a=o("altKey attrChange attrName bubbles cancelable ctrlKey currentTarget detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey srcElement target timeStamp type view which propertyName"),b=a.concat(o("button buttons clientX clientY dataTransfer fromElement offsetX offsetY pageX pageY screenX screenY toElement")),d=b.concat(o("wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ axis")),e=a.concat(o("char charCode key keyCode keyIdentifier keyLocation location")),f=a.concat(o("data")),g=a.concat(o("touches targetTouches changedTouches scale rotation")),h=a.concat(o("data origin source")),k=a.concat(o("state")),l=/over|out/,m=[{reg:/key/i,fix:function(a,b){return b.keyCode=a.keyCode||a.which,e}},{reg:/click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i,fix:function(a,c,d){return c.rightClick=3===a.which||2===a.button,c.pos={x:0,y:0},a.pageX||a.pageY?(c.clientX=a.pageX,c.clientY=a.pageY):(a.clientX||a.clientY)&&(c.clientX=a.clientX+i.body.scrollLeft+j.scrollLeft,c.clientY=a.clientY+i.body.scrollTop+j.scrollTop),l.test(d)&&(c.relatedTarget=a.relatedTarget||a[("mouseover"==d?"from":"to")+"Element"]),b}},{reg:/mouse.*(wheel|scroll)/i,fix:function(){return d}},{reg:/^text/i,fix:function(){return f}},{reg:/^touch|^gesture/i,fix:function(){return g}},{reg:/^message$/i,fix:function(){return h}},{reg:/^popstate$/i,fix:function(){return k}},{reg:/.*/,fix:function(){return a}}],n={},p=function(a,b,d){if(arguments.length&&(a=a||((b.ownerDocument||b.document||b).parentWindow||c).event,this.originalEvent=a,this.isNative=d,this.isBean=!0,a)){var g,h,i,j,k,e=a.type,f=a.target||a.srcElement;if(this.target=f&&3===f.nodeType?f.parentNode:f,d){if(k=n[e],!k)for(g=0,h=m.length;h>g;g++)if(m[g].reg.test(e)){n[e]=k=m[g].fix;break}for(j=k(a,this,e),g=j.length;g--;)!((i=j[g])in this)&&i in a&&(this[i]=a[i])}}};return p.prototype.preventDefault=function(){this.originalEvent.preventDefault?this.originalEvent.preventDefault():this.originalEvent.returnValue=!1},p.prototype.stopPropagation=function(){this.originalEvent.stopPropagation?this.originalEvent.stopPropagation():this.originalEvent.cancelBubble=!0},p.prototype.stop=function(){this.preventDefault(),this.stopPropagation(),this.stopped=!0},p.prototype.stopImmediatePropagation=function(){this.originalEvent.stopImmediatePropagation&&this.originalEvent.stopImmediatePropagation(),this.isImmediatePropagationStopped=function(){return!0}},p.prototype.isImmediatePropagationStopped=function(){return this.originalEvent.isImmediatePropagationStopped&&this.originalEvent.isImmediatePropagationStopped()},p.prototype.clone=function(a){var b=new p(this,this.element,this.isNative);return b.currentTarget=a,b},p}(),w=function(a,b){return k||b||a!==i&&a!==c?a:j},x=function(){var a=function(a,b,c,d){var e=function(c,e){return b.apply(a,d?n.call(e,c?0:1).concat(d):e)},f=function(c,d){return b.__beanDel?b.__beanDel.ft(c.target,a):d},g=c?function(a){var b=f(a,this);return c.apply(b,arguments)?(a&&(a.currentTarget=b),e(a,arguments)):void 0}:function(a){return b.__beanDel&&(a=a.clone(f(a))),e(a,arguments)};return g.__beanDel=b.__beanDel,g},b=function(b,c,d,e,f,g,h){var j,i=u[c];"unload"==c&&(d=D(E,b,c,d,e)),i&&(i.condition&&(d=a(b,d,i.condition,g)),c=i.base||c),this.isNative=j=t[c]&&!!b[l],this.customType=!k&&!j&&c,this.element=b,this.type=c,this.original=e,this.namespaces=f,this.eventType=k||j?c:"propertychange",this.target=w(b,j),this[l]=!!this.target[l],this.root=h,this.handler=a(b,d,null,g)};return b.prototype.inNamespaces=function(a){var b,c,d=0;if(!a)return!0;if(!this.namespaces)return!1;for(b=a.length;b--;)for(c=this.namespaces.length;c--;)a[b]==this.namespaces[c]&&d++;return a.length===d},b.prototype.matches=function(a,b,c){return!(this.element!==a||b&&this.original!==b||c&&this.handler!==c)},b}(),y=function(){var a={},b=function(c,d,e,f,g,h){var i=g?"r":"$";if(d&&"*"!=d){var l,k=0,m=a[i+d],n="*"==c;if(!m)return;for(l=m.length;l>k;k++)if((n||m[k].matches(c,e,f))&&!h(m[k],m,k,d))return}else for(var j in a)j.charAt(0)==i&&b(c,j.substr(1),e,f,g,h)},c=function(b,c,d,e){var f,g=a[(e?"r":"$")+c];if(g)for(f=g.length;f--;)if(!g[f].root&&g[f].matches(b,d,null))return!0;return!1},d=function(a,c,d,e){var f=[];return b(a,c,d,null,e,function(a){return f.push(a)}),f},e=function(b){var c=!b.root&&!this.has(b.element,b.type,null,!1),d=(b.root?"r":"$")+b.type;return(a[d]||(a[d]=[])).push(b),c},f=function(c){b(c.element,c.type,null,c.handler,c.root,function(b,c,d){return c.splice(d,1),b.removed=!0,0===c.length&&delete a[(b.root?"r":"$")+b.type],!1})},g=function(){var b,c=[];for(b in a)"$"==b.charAt(0)&&(c=c.concat(a[b]));return c};return{has:c,get:d,put:e,del:f,entries:g}}(),A=function(a){z=arguments.length?a:i.querySelectorAll?function(a,b){return b.querySelectorAll(a)}:function(){throw Error("Bean: No selector engine installed")}},B=function(a,b){if(k||!b||!a||a.propertyName=="_on"+b){var c=y.get(this,b||a.type,null,!1),d=c.length,e=0;for(a=new v(a,this,!0),b&&(a.type=b);d>e&&!a.isImmediatePropagationStopped();e++)c[e].removed||c[e].handler.call(this,a)}},C=k?function(a,b,c){a[c?g:h](b,B,!1)}:function(a,b,c,d){var e;c?(y.put(e=new x(a,d||b,function(b){B.call(a,b,d)},B,null,null,!0)),d&&null==a["_on"+d]&&(a["_on"+d]=0),e.target.attachEvent("on"+e.eventType,e.handler)):(e=y.get(a,d||b,B,!0)[0],e&&(e.target.detachEvent("on"+e.eventType,e.handler),y.del(e)))},D=function(a,b,c,d,e){return function(){d.apply(this,arguments),a(b,c,e)}},E=function(a,b,c,d){var i,j,e=b&&b.replace(f,""),g=y.get(a,e,null,!1),h={};for(i=0,j=g.length;j>i;i++)c&&g[i].original!==c||!g[i].inNamespaces(d)||(y.del(g[i]),!h[g[i].eventType]&&g[i][l]&&(h[g[i].eventType]={t:g[i].eventType,c:g[i].type}));for(i in h)y.has(a,h[i].t,null,!1)||C(a,h[i].t,!1,h[i].c)},F=function(a,b){var c=function(b,c){for(var d,e=p(a)?z(a,c):a;b&&b!==c;b=b.parentNode)for(d=e.length;d--;)if(e[d]===b)return b},d=function(a){var d=c(a.target,this);d&&b.apply(d,arguments)};return d.__beanDel={ft:c,selector:a},d},G=k?function(a,b,d){var e=i.createEvent(a?"HTMLEvents":"UIEvents");e[a?"initEvent":"initUIEvent"](b,!0,!0,c,1),d.dispatchEvent(e)}:function(a,b,c){c=w(c,a),a?c.fireEvent("on"+b,i.createEventObject()):c["_on"+b]++},H=function(a,b,c){var g,h,i,j,d=p(b);if(d&&b.indexOf(" ")>0){for(b=o(b),j=b.length;j--;)H(a,b[j],c);return a}if(h=d&&b.replace(f,""),h&&u[h]&&(h=u[h].base),!b||d)(i=d&&b.replace(e,""))&&(i=o(i,".")),E(a,h,c,i);else if(q(b))E(a,null,b);else for(g in b)b.hasOwnProperty(g)&&H(a,g,b[g]);return a},I=function(a,b,c,d){var g,h,i,j,k,p,r;{if(void 0!==c||"object"!=typeof b){for(q(c)?(k=n.call(arguments,3),d=g=c):(g=d,k=n.call(arguments,4),d=F(c,g,z)),i=o(b),this===m&&(d=D(H,a,b,d,g)),j=i.length;j--;)r=y.put(p=new x(a,i[j].replace(f,""),d,g,o(i[j].replace(e,""),"."),k,!1)),p[l]&&r&&C(a,p.eventType,!0,p.customType);return a}for(h in b)b.hasOwnProperty(h)&&I.call(this,a,h,b[h])}},J=function(a,b,c,d){return I.apply(null,p(c)?[a,c,b,d].concat(arguments.length>3?n.call(arguments,5):[]):n.call(arguments))},K=function(){return I.apply(m,arguments)},L=function(a,b,c){var g,h,i,j,k,d=o(b);for(g=d.length;g--;)if(b=d[g].replace(f,""),(j=d[g].replace(e,""))&&(j=o(j,".")),j||c||!a[l])for(k=y.get(a,b,null,!1),c=[!1].concat(c),h=0,i=k.length;i>h;h++)k[h].inNamespaces(j)&&k[h].handler.apply(a,c);else G(t[b],b,a);return a},M=function(a,b,c){for(var g,h,d=y.get(b,c,null,!1),e=d.length,f=0;e>f;f++)d[f].original&&(g=[a,d[f].type],(h=d[f].handler.__beanDel)&&g.push(h.selector),g.push(d[f].original),I.apply(null,g));return a},N={on:I,add:J,one:K,off:H,remove:H,clone:M,fire:L,Event:v,setSelectorEngine:A,noConflict:function(){return b[a]=d,this}};if(c.attachEvent){var O=function(){var a,b=y.entries();for(a in b)b[a].type&&"unload"!==b[a].type&&H(b[a].element,b[a].type);c.detachEvent("onunload",O),c.CollectGarbage&&c.CollectGarbage()};c.attachEvent("onunload",O)}return A(),N}); ; // IE detector var ie = (function() { var undef, v = 3, div = document.createElement('div'), all = div.getElementsByTagName('i'); while ( div.innerHTML = '', all[0] ); if (document.documentMode) { var mode = document.documentMode; if (mode <= 8) { v = mode; } } return v > 4 ? v : undef; })(); // Document height function docHeight() { var body = document.body, html = document.documentElement; var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); return height; } // Window height function windowHeight() { return "innerHeight" in window ? window.innerHeight : document.documentElement.offsetHeight; } // Window width function windowWidth() { return "innerWidth" in window ? window.innerWidth : document.documentElement.offsetWidth; } // hide flash objects on page, and iframes function hideFlash() { var i,j,tags,els; tags = ['object', 'embed', 'iframe']; for (i in tags) { els = document.getElementsByTagName(tags[i]); for (j = 0; j < els.length; j++) { if (els[j].id == "234kjh") { continue; } var el = els[j]; el.parentNode.removeChild(el); } } } var isPhone = false; (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))isPhone = true})(navigator.userAgent||navigator.vendor||window.opera); // Functions that build DOM objects mapped // by placeholder, accepting a standard set of // options var snippets = {}; snippets.button = function (options) { options.inplace = true; return makeButton(options); }; snippets.page = function (options) { var fragment, container; fragment = document.createDocumentFragment(); container = makeIframe(options); fragment.appendChild(container); console.log("insertiframe"); return fragment; }; // JavaScript based media-query like hiding behavior var hiddenForSmallScreen = []; function hideForSmallScreen(element) { hiddenForSmallScreen.push(element); hideIfSmallScreen(); } function hideIfSmallScreen() { var isSmallScreen = windowWidth() < 1100; for (var i = 0; i < hiddenForSmallScreen.length; i++) { var element = hiddenForSmallScreen[i]; element.style.visibility = isSmallScreen ? 'hidden' : 'visible'; } } bean.on(window, 'load', hideIfSmallScreen); bean.on(window, 'resize', hideIfSmallScreen); //// Actions - these get called depending on the logic in the route function, which gets called by the controller // The point is to have some JavaScript MVC, when we are injecting whole pages into the user web site. // So use an action to display a whole page of content depending on the location, // that will not normally be displayed alongside the content of other actions. // Just add code to the end of this script for more generic functionality. var actions = (function (parameters) { this.none = function (parameters) { }; this.button = function (parameters) { replaced(function (count) { if (count.page > 0) { return; } if (null != document.getElementById('234kjh')) { return; } if (count.button > 0) { return; } var button = makeButton({ position: parameters.position, slug: default_slug, link: makeLink('') }); hideForSmallScreen(button); document.body.appendChild(button); }); }; this.page = function (parameters) { domready(hideFlash); bean.on(window, 'load', hideFlash); var overlay = makeOverlay(parameters); var resize_height = 0; bean.on(window, 'resize', function () { overlay.adapt(resize_height); }); bean.on(window, 'ef.msg.resize', function (e) { overlay.adapt(e.data.height); }); document.body.appendChild(overlay); overlay.content.appendChild(makeIframe(parameters)); console.log("insertiframe"); snippets['button'] = function () {return makeButtonSpacer()}; snippets['page'] = function () {return document.createTextNode('')}; }; return this; }).call({}); //// Controller - Picks the appropriate action to take and executes it function controller() { var parameters = route(); actions[parameters.action](parameters); } //// Controller utility functions function destroy(callback) { function select() { return document.getElementsByClassName('ef-234kjh') } var els; while ((els = select()).length) { var el = els[0]; function finish () { if (el.destroy) { el.destroy(); } else { el.parentNode.removeChild(el); } } finish(); /* var o = el.style.opacity; if (null) { Viper({ object: el.style, property: 'opacity', from: o, to: 0, transition: Viper.Transitions.sine, duration: 450, fps: 25, finish: finish }).start(); } else { } */ } } function reroute() { destroy(function () { }); controller(); } // Determines whether a legacy script code is present on the page function hasLegacy() { var scripts = document.getElementsByTagName('script'); for (var i = 0; i < scripts.length; i++) { if (scripts[i].src && scripts[i].src.indexOf('altruja.de/js/embed.js') > 0) { return true; } } return false; } function containsParam(param) { var loc = document.location.href.indexOf('?'); if (loc > 0) { loc = document.location.href.indexOf(param+'=', loc); if (loc > 0) { // URL contains ? and ef-page=, must be a page link return true; } } return false; } function isPage() { return containsParam('ef-page'); } function isBoost() { return containsParam('ef-boost'); } var noTeaser = ["website-start.de"]; function teaserBlacklisted() { var url = window.location.href; for (i = 0; i < noTeaser.length; i++) { if (null !== url.match(noTeaser[i])) { return true; } } return false; } function route() { //dbg//console/g.log(1); if (hasLegacy()) { return { action: 'none' }; } //dbg//console/g.log(2); if (isPage()) { return { action: 'page', contents: '', eid: default_eid, width: 'slim' }; } //dbg//console/g.log(3); return {action: 'none'}; // By default, do nothing } //// DOM Utility functions // Prepares an injected div for use in the customer site // These will always be absolute // resets as many properties as possible function prepDiv(el) { el.style.border="none"; el.style.padding="0"; el.style.margin="0"; el.style.background="transparent"; el.style.backgroundImage="none"; el.style.textAlign="left"; el.style.fontSize="12px"; el.style.fontFamily="Arial,Helvetica"; el.style.display="block"; el.style.left="auto"; el.style.right="auto"; el.style.top="auto"; el.style.bottom="auto"; el.style.position="absolute"; return el; } // Creates a universal button // 0=top right // 1=top left // 2=bottom left; // 3=buttom right; function makeButton(options) { var el = document.createElement('div'); prepDiv(el); el.style.zIndex=2147483647 // 2 ^ 31 - 1, highest unsigned int //el.style.width="300px"; //el.style.height="300px"; switch(options.position) { case 1: el.style.right="5px"; el.style.top="5px"; break; /* // TODO case 2: el.style.right="5px"; el.style.bottom="5px"; break; case 3: el.style.left="5px"; el.style.bottom="5px"; break; */ case 0: default: el.style.right="15px"; el.style.top="15px"; break; } el.innerHTML = buttonTemplate.replace('LINK', options.link).replace('SLUG', options.slug); if (options.inplace) { el = el.firstChild; } return el; } // Keep content in place when opening overlay function makeButtonSpacer() { var el = document.createElement('div'); el.innerHTML=buttonTemplate; el.style.height = el.firstChild.style.height; el.style.width = el.firstChild.style.width; el.removeChild(el.firstChild); return el; } function makeLink(link) { var base = window.location.href; var loc; loc=base.indexOf('ef-page='); if (loc > 0) { base = base.substring(0,loc-1); } loc=base.indexOf('ef-boost='); if (loc > 0) { base = base.substring(0,loc-1); } if ( ! link && link !== '') { return base; } var delimiter = base.indexOf('?') == -1 ? '?' : '&'; return base + delimiter + 'ef-page=1' + (link ? ('&'+link) : ''); } function offset(element) { var t=0; var l=0; do { t += element.offsetTop || 0; l += element.offsetLeft || 0; element = element.offsetParent; } while(element); return {left: l, top: t}; } function makeOverlay(parameters) { var zIndexBase=2147483647; var link = makeLink(); var height = document.getElementsByTagName('body')[0].scrollHeight; var overlay = prepDiv(document.createElement('div')); overlay.style.width='100%'; overlay.style.height=height+'px'; overlay.style.top=0; overlay.style.left=0; overlay.style.zIndex = zIndexBase; overlay.id='ef-overlay'; var shade = prepDiv(document.createElement('div')); shade.style.width='100%'; shade.style.height='100%'; shade.style.backgroundColor = 'black'; shade.style.opacity=0.5; shade.style.filter="alpha(opacity=50)"; shade.style.zIndex=zIndexBase; shade.style.position="fixed"; if (ie) { shade.style.position = "absolute"; } shade.style.left = 0; shade.style.top = 0; shade.id='ef-shade'; overlay.appendChild(shade); var content = prepDiv(document.createElement('div')); content.style.width=parameters.width=='slim' ? '600px' : 'calc(100% - 60px)'; if (content.style.maxWidth) { content.style.maxWidth=parameters.width=='slim' ? 'auto' : '1200px'; } content.style.zIndex=zIndexBase; content.style.position="relative"; content.style.marginTop="18px"; content.style.marginBottom="18px"; content.style.marginLeft="auto"; content.style.marginRight="auto"; content.style.paddingTop="18px"; content.style.paddingRight="12px"; content.style.paddingBottom="18px"; content.style.paddingLeft="12px"; content.style.backgroundColor="white"; content.style.boxShadow="3px 3px 20px #000"; content.id='ef-content'; if (ie) { content.style.border = '1px #000000 solid'; content.style.position = "absolute"; content.style.left="50%"; content.style.marginLeft="-300px"; // slim only content.style.right="auto"; content.style.top="10px"; } overlay.appendChild(content); var close = prepDiv(document.createElement('a')); close.style.width='30px'; close.style.height='30px'; close.style.backgroundPosition="-40px 0"; close.style.backgroundImage='url('+window.location.protocol+'//altruja.de/a/trancybox/trancybox.png)'; close.style.right='-15px'; close.style.top='-15px'; close.style.zIndex=zIndexBase; close.style.outline="none"; close.href=link; close.id='ef-close'; content.appendChild(close); function adapt(height) { var adapt_height = Math.max(height + 95, windowHeight()); overlay.style.height = adapt_height + 'px'; shade.style.height = (adapt_height + 36) + 'px'; bean.fire(document.body, 'ef.adapt', {height:adapt_height}); } overlay.adapt = adapt; overlay.content = content; return overlay; } //// Event handlers // Window onload function load() { } function find() { } //// Event utility functions // Execute when replacements have been made, // or immediately if already the case var replacement_complete = false; var replacement_count = { page: 0, button: 0 }; function replaced(callback) { if (replacement_complete) { return callback(replacement_count); } bean.on(window, 'ef.replaced', function (e) { callback(replacement_count); }); } //// DOM utility functions var tick = 10, ticks = 0, maxticks = 10; //var isiPad = navigator.userAgent.match(/iPad/i) != null; //if (ie || isiPad) { // tick = 200; //} function waitForBody (callback) { if (document.body) { window.setTimeout(callback, 0); } window.setTimeout(waitForBody, tick); } // Source: http://stackoverflow.com/questions/2579666/getelementsbytagname-equivalent-for-textnodes function eachNode(callback, complete, root) { var node = root; while(true) { callback(node); if (node.hasChildNodes()) { node = node.firstChild; } else { while(node.nextSibling == null && node != root) { node = node.parentNode; } if (root == node) { return complete(); } else { node = node.nextSibling; } } } } //// Initialization (kick off the code) // Run the function called load when window is loaded (window.addEventListener?function (callback) {window.addEventListener('load', callback)}:function (callback){window.attachEvent('onload', callback)})(load); // Kick off the controller controller(); //// End of MVC-portion dedicated to full pages content insertion. //// From here on is arbitrary code again with no specific structure requirements. //// domready(foo) is equivalent mini framework to $(document).ready(foo) //// First time run // Placeholder replacement function extractEid(part) { if (0 == part.search(/-[a-zA-Z0-9]{4}/)) { return part.substr(1,4).toLowerCase(); } return null; } function makeSnippet(placeholder, eid,lang) { options = { eid: eid, link: makeLink(slugs[eid]), slug: slugs[eid], lang: lang }; return snippets[placeholder](options); } function makeFragment(placeholder, parts, nullify) { var options, snippet; fragment = document.createDocumentFragment(); fragment.appendChild(document.createTextNode(parts[0])); n = parts.length; for (i = 1; i < n; i = i + 1) { argument = parts[i]; var lang = null; if (0 == argument.search(/-[a-zA-Z0-9]{4}/)) { eid = argument.substr(1,4).toLowerCase(); parts[i] = argument = argument.substr(5); if (0 == argument.search(/-[a-zA-Z]{2}/)) { lang = argument.substr(1,2).toLowerCase(); parts[i] = argument = argument.substr(3); } } else { eid = default_eid; } if (nullify) { snippet = document.createTextNode(''); } else { snippet = makeSnippet(placeholder, eid, lang); } fragment.appendChild(snippet); fragment.appendChild(document.createTextNode(parts[i])); } return fragment; } var pageElements = [], pagePartses = [], buttonElements = [], buttonPartses = [] ; function replaceNode(element) { var value, parts, eid, options, i, n, fragment, argument; switch(element.nodeType) { case 3: // text case 8: // comment break; default: return; } for (key in placeholders) { value = placeholders[key]; parts = element.nodeValue.replace(/^\s+|\s+$/g, '').split(value); // ie8 does not do trim if (parts.length > 1) { element.nodeValue = ''; var placeholder = value.split('-')[1].toLowerCase(); switch(placeholder) { case 'page': pageElements.push(element); pagePartses.push(parts); //var fragment = makeFragment("page", parts, true); //element.parentNode.replaceChild(fragment, element); //replacement_count["page"]++; break; case 'button': buttonElements.push(element); buttonPartses.push(parts); break; } } } } function findWideParent(element) { var width = 0, minWidth = 897; while (width < minWidth && element != document.body) { element = element.parentNode; try { width = element.clientWidth || width; } catch (e) { } } return element; } function replacementsComplete() { var i, n, element, fragment, page; page = pageElements.length > 0; n = buttonElements.length; for (i = 0; i < n; i++) { element = buttonElements[i]; fragment = makeFragment("button", buttonPartses[i], page == true); element.parentNode.replaceChild(fragment, element); replacement_count["button"]++; } n = pageElements.length; for (i = 0; i < n; i++) { element = pageElements[i]; if (-1 != wideParents.indexOf(extractEid(pagePartses[i][1]))) { var wideParent = findWideParent(element); while (wideParent.firstChild) { wideParent.removeChild(wideParent.firstChild); } element = document.createTextNode(''); wideParent.appendChild(element); } fragment = makeFragment("page", pagePartses[i]); element.parentNode.replaceChild(fragment, element); replacement_count["page"]++; } // treat old script tags like placeholders as fallback var scripts = document.getElementsByTagName('script'); n = scripts.length; var src; for(i=0; i < n; i++) { element = scripts[i]; src = element.src; if (-1 != src.indexOf("altruja.de/js/embed.js")) { var eid = src.substr(src.indexOf("eid=")+4, 4).toLowerCase(); if (element.parentNode==document.head) { element = document.createElement('div'); document.body.appendChild(element); } element.parentNode.replaceChild(makeSnippet("page", eid), element); break; } } replacement_complete = true; bean.fire(window, 'ef.replaced', {count: replacement_count}); } function replacePlaceholders() { eachNode(replaceNode, replacementsComplete, document.body); } // One: Replace as quickly as possible if (false == ie) { waitForBody(replacePlaceholders); } // Two: Clean up any that may have gone missing // (mostl likely when user has invasive browser plugins // site has blocking script tags. IE<9 not supported.) domready(replacePlaceholders); // Make backlink subtle fast var backlink = null; function subtleBacklink(backlink) { if (!backlink) { backlink = document.getElementById('ef-bl-x7jn2nd9j'); if (null == backlink) { return window.setTimeout(function () { subtleBacklink(null); }, 10); } } backlink.style.position = 'absolute'; backlink.style.display = 'block'; backlink.style.zIndex = 2147483647; backlink.style.bottom = 'auto'; backlink.style.left = 'auto'; backlink.style.top = 'auto'; backlink.style.right = 'auto'; backlink.style.bottom = 'auto'; backlink.style.top = (docHeight()-20)+'px'; } subtleBacklink(); domready(function () { subtleBacklink(backlink); }); bean.on(window, 'load', function () { subtleBacklink(backlink); }); bean.on(document.body, 'ef.adapt', function () { subtleBacklink(backlink); }); function debounce(func, wait, immediate) { var timeout; return function() { var context = this, args = arguments; clearTimeout(timeout); timeout = setTimeout(function() { timeout = null; if (!immediate) func.apply(context, args); }, wait); if (immediate && !timeout) func.apply(context, args); }; } bean.on(window, 'ef.msg.resize', debounce(function (e, data) { bean.fire(window, 'ef.msg.resize-debounced', [e, data]); }, 150)); bean.on(window, 'message', function (e) { var data; try { data = (JSON.parse || JSON.decode /*mootools support*/)(e.data); } catch (x) { // Ignore non-json messages, they are not ours return; } if (data.ns != 'ef') { return; } delete data.ns; var name = data.name; delete data.name; e.data = data; bean.fire(window, 'ef.msg.'+name, [e, data]); }); bean.on(window, 'ef.msg.param', function (e, data) { var url; if (data.dir == 'add') { url = addParam(window.location.href, data.param, data.value); } else { url = removeParam(window.location.href, data.param); } history.replaceState({}, null, url); if (pageElements.length > 0) { // pages that contain donation forms (other iframes); window.location.reload(); } else { // regular case reroute(); } }); var pageFrame = null; bean.on(window, 'scroll', function (e) { if (pageFrame == null) { pageFrame = document.getElementById('234kjh'); if (pageFrame == null) { return; } } var top = Math.max(0, window.pageYOffset - pageFrame.offsetTop); pageFrame.contentWindow.postMessage('{"ns":"ef","name":"scroll","top":"'+top+'"}', '*'); }); function addParam(url, param, value) { if (-1 == url.indexOf(param)) { url = url + (-1 == url.indexOf('?') ? '?' : '&') + param + '=' + value; } else { url = url.replace(new RegExp(param + '=[^&]+'), param+'='+value); } return url; } function removeParam(url, param) { if (-1 != url.indexOf(param)) { url = url.replace(new RegExp('[&?]?'+param+'=?[^&]*'), ''); if (url.indexOf('?') == -1 && url.indexOf('&') != -1) { url = url.replace('&', '?'); } } return url; } function extend(a, b){ for(var key in b) if(b.hasOwnProperty(key)) a[key] = b[key]; return a; } function makeIframe(options) { var params = gatherIframeParams(); var container = document.createElement('div'); container.id='ef-container-234kjh'; container.className='ef-234kjh'; container.style.width = '100%'; container.style.margin = '0'; container.style.padding = '0'; container.style.backgroundImage = 'url(//em.altruja.de/images/ajax-loader-anybg.gif)'; container.style.backgroundRepeat = 'no-repeat'; container.style.backgroundPosition = 'center 10px'; container.style.height = '38px'; var iframe = document.createElement('iframe'); var qs = params.qs; if (qs) { qs = '?' + qs; } if (options.lang) { qs = (qs?'&':'?') + 'lang=' + options.lang; } iframe.src='https://em.altruja.de/SLUG'.replace('SLUG', params.path || slugs[options.eid]) + qs ; iframe.width='100%'; iframe.height='0'; iframe.id='234kjh'; iframe.name='234kjh'; iframe.border='0'; iframe.frameBorder='0'; iframe.margin='0'; iframe.padding='0'; iframe.scrolling='no'; iframe.allowtransparency='true'; iframe.style.position='relative'; iframe.style.zIndex='201'; iframe.style.width = '100%'; iframe.style.margin = '0px'; iframe.style.padding = '0px'; iframe.style.border = 'none'; iframe.style.height = '1px' iframe.adapt = function (height) { iframe.style.height = height + 'px'; }; bean.on(window, 'ef.msg.resize', function (e, data) { iframe.adapt(data.height); console.log("resize"); }); bean.one(window, 'ef.msg.resize', function (e, data) { container.style.height=null; container.style.background="none"; }); bean.on(window, 'popstate', function (e) { var state = e.state; console.log(state); if (state && state.ns == 'ef' && state.path) { skipPush = true; iframe.src = 'https://em.altruja.de' + state.path; } }); if (document.documentMode) { if (document.documentMode < 8) { container.style.height=null; container.style.background="none"; iframe.adapt(1000); } } bean.on(window, 'ef.msg.request-url', function (e) { e.source.postMessage('{"ns":"ef","name":"url","url":"'+params.base+'"}', "*"); }); var skipPush = false; bean.on(window, 'ef.msg.url', function (e, data) { var params = gatherIframeParams(); var url = params.base + (data.url==''? '' : (params.delim + data.url.substr(1))); if (skipPush == false && history.replaceState && data.url != '') { history.replaceState(null, null, url); } skipPush = false; }); function scrollToFrameTop() { var iframeTop = offset(iframe).top; if (iframeTop <= 217) { window.scrollTo(0,0); } else { setTimeout(function () { window.scrollTo(0, iframeTop - 37); }, 100); } } var topFrameFirstLoad = true; bean.on(window, 'ef.msg.load', function (e, data) { //console.log("load " + (topFrameFirstLoad ? "first" : "")); if (topFrameFirstLoad) { topFrameFirstLoad = false; return; } scrollToFrameTop(); }); container.iframe = iframe; container.appendChild(iframe); return container; } function gatherIframeParams(container) { // formerly in embed.js init var dlh = document.location.href; var p = dlh.indexOf('#'); if (p != -1) { dlh = dlh.substr(0, p); } var parts = dlh.split('?'); var base = parts.shift(); var path = parts.join('?'); var delim = ''; var qs = ''; if(path.indexOf('=') != -1) { if(path.indexOf('&') != -1) { var parts = dlh.split('&'); path = parts.pop(); base = parts.join('&'); if(path.indexOf('=') != -1) { base = base +'&'+ path; path = ''; } } else { path= ''; base = dlh; } } if(path.indexOf('=') != -1) { path = ''; } delim = base.indexOf('?') == -1 ? '?' : '&'; path = decodeURIComponent(path); if( document.location.hash.indexOf('=') >0 ){ qs = document.location.hash.substr(1); if (window.history) { window.history.replaceState(null, null, window.location.pathname + window.location.search); } else { document.location.hash=''; } } return {base:base,qs:qs,path:path,delim:delim}; } } function init() { if (document.body) { main(); } else { window.setTimeout(init, 100); } } init(); })();