Commit 6797ae34 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

minify javascript

parent 37ff6ea7
Loading
Loading
Loading
Loading
+3 −0

File added.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
$(document).ready(function(){var e=function(){$("div.candidatestatus").remove()},t=function(e,t,n){var r=$(document.createElement("div"));r.attr("class","error"),r.text(t);var o=$(document.createElement("strong"));if(o.text(e),r.prepend(o),n){var a=$(document.createElement("div"));a.attr("class","errcode"),a.text(n),r.append(a)}$("div.candidatelist").append(r)},n=function(n){e(),n.error?t("Backend-Fehler:",n.error,null):0==n.candidates.length?t("Keine Bahnhöfe in 70km Umkreis gefunden","",null):$.each(n.candidates,function(e,t){var n=t.ds100,r=t.name,o=t.distance;o=o.toFixed(1);var a=$(document.createElement("a"));a.attr("href",n),a.text(r);var i=$(document.createElement("div"));i.attr("class","distance"),i.text(o),a.append(i),$("div.candidatelist").append(a)})},r=function(e){$.post("/_geolocation",{lon:e.coords.longitude,lat:e.coords.latitude},n),$("div.candidatestatus").text("Suche Bahnhöfe…")},o=function(n){e(),n.code==n.PERMISSION_DENIED?t("Standortanfrage nicht möglich.","Vermutlich fehlen die Rechte im Browser oder der Android Location Service ist deaktiviert.","geolocation.error.PERMISSION_DENIED"):n.code==n.POSITION_UNAVAILABLE?t("Standort konnte nicht ermittelt werden","(Service nicht verfügbar)","geolocation.error.POSITION_UNAVAILABLE"):n.code==n.TIMEOUT?t("Standort konnte nicht ermittelt werden","(Timeout)","geolocation.error.TIMEOUT"):t("Standort konnte nicht ermittelt werden","(unbekannter Fehler)","unknown geolocation.error code")};navigator.geolocation?(navigator.geolocation.getCurrentPosition(r,o),$("div.candidatestatus").text("Position wird bestimmt…")):(e(),t("Standortanfragen werden von diesem Browser nicht unterstützt","",null))});
+1 −0
Original line number Diff line number Diff line
!function(t){t.fn.marquee=function(i){function a(t,i,a){var e=a.behavior,r=a.width,s=a.dir;return"alternate"==e?1==t?i[a.widthAxis]-2*r:r:"slide"==e?-1==t?-1==s?i[a.widthAxis]:r:-1==s?i[a.widthAxis]-2*r:0:-1==t?i[a.widthAxis]:0}function e(){for(var i=r.length,s=null,d=null,l={},o=[],n=!1;i--;)s=r[i],d=t(s),l=d.data("marqueeState"),!0!==d.data("paused")?(s[l.axis]+=l.scrollamount*l.dir,n=-1==l.dir?s[l.axis]<=a(-1*l.dir,s,l):s[l.axis]>=a(-1*l.dir,s,l),"scroll"==l.behavior&&l.last==s[l.axis]||"alternate"==l.behavior&&n&&-1!=l.last||"slide"==l.behavior&&n&&-1!=l.last?("alternate"==l.behavior&&(l.dir*=-1),l.last=-1,d.trigger("stop"),l.loops--,0===l.loops?("slide"!=l.behavior?s[l.axis]=a(l.dir,s,l):s[l.axis]=a(-1*l.dir,s,l),d.trigger("end")):(o.push(s),d.trigger("start"),s[l.axis]=a(l.dir,s,l))):o.push(s),l.last=s[l.axis],d.data("marqueeState",l)):o.push(s);r=o,r.length&&setTimeout(e,25)}var r=[],s=this.length;return this.each(function(d){var l=t(this),o=l.attr("width")||l.width(),n=l.attr("height")||l.height(),h=l.after("<div "+(i?'class="'+i+'" ':"")+'style="display: block-inline; width: '+o+"px; height: "+n+'px; overflow: hidden;"><div style="float: left; white-space: nowrap;">'+l.html()+"</div></div>").next(),u=h.get(0),p=(l.attr("direction")||"left").toLowerCase(),c={dir:/down|right/.test(p)?-1:1,axis:/left|right/.test(p)?"scrollLeft":"scrollTop",widthAxis:/left|right/.test(p)?"scrollWidth":"scrollHeight",last:-1,loops:l.attr("loop")||-1,scrollamount:l.attr("scrollamount")||this.scrollAmount||2,behavior:(l.attr("behavior")||"scroll").toLowerCase(),width:/left|right/.test(p)?o:n};-1==l.attr("loop")&&"slide"==c.behavior&&(c.loops=1),l.remove(),/left|right/.test(p)?h.find("> div").css("padding","0 "+o+"px"):h.find("> div").css("padding",n+"px 0"),h.bind("stop",function(){h.data("paused",!0)}).bind("pause",function(){h.data("paused",!0)}).bind("start",function(){h.data("paused",!1)}).bind("unpause",function(){h.data("paused",!1)}).data("marqueeState",c),r.push(u),u[c.axis]=a(c.dir,u,c),h.trigger("start"),d+1==s&&e()}),t(r)}}(jQuery);
+4 −6
Original line number Diff line number Diff line
@@ -18,20 +18,18 @@
	%if (stash('load_marquee')) {
	%= javascript '/static/jquery-1.10.2.min.js'
	%= javascript '/static/jquery-ui.min.js'
	%= javascript '/static/autocomplete.js'
	%= javascript '/static/collapse.js'
	%= javascript '/static/marquee.js'
	%= javascript '/static/dbf.min.js'
	%= javascript '/static/marquee.min.js'
	%= javascript begin
	$(function () {  $('marquee').marquee() });
	% end
	% } else {
	%= javascript '/static/jquery-1.10.2.min.js', defer => undef
	%= javascript '/static/jquery-ui.min.js', defer => undef
	%= javascript '/static/autocomplete.js', defer => undef
	%= javascript '/static/collapse.js', defer => undef
	%= javascript '/static/dbf.min.js', defer => undef
	% }
	% if (stash('with_geolocation')) {
	%= javascript '/static/geolocation.js', defer => undef
	%= javascript '/static/geolocation.min.js', defer => undef
	% }
</head>
<body style="<%= (stash('hide_opts') ? 'margin: 0; padding: 0;' : q{}) %>