diff --git a/app/js/modules/train.js b/app/js/modules/train.js index 2651769..2112bf9 100644 --- a/app/js/modules/train.js +++ b/app/js/modules/train.js @@ -18,23 +18,28 @@ let TrainModel = Backbone.Model.extend({ this.set('routeUrl', routeUrl); this.set('target', target); this.set('visible', false); + this.set('trainData', {eta:'OFF', sta: 'OFF'}); this.update(); }, update: function () { const now = new Date; - const mod = 60000 - (now.getTime() % 60000); const hours = now.getHours(); + const limit = (hours < 6) ? 3600000 : 60000; + + const mod = limit - (now.getTime() % limit); if (hours >= 6) { this.getTrain(); + } else { + this.set('trainData', {eta:'OFF', sta: 'OFF'}); } - let trainUpdateFn = function () { this.update(); }; + setTimeout(trainUpdateFn.bind(this), mod + 10); }, getTrain: function () { @@ -209,6 +214,11 @@ let TrainView = Backbone.View.extend({ this.$button = $(`#${target}`); + let output = 'OFF'; + let status = (output === 'on time') ? 'ontime' : 'delayed'; + + this.$button.html(output); + this.$button.removeClass('delayed').removeClass('ontime').addClass(status); let cevent = `click #$(target)`; this.events[cevent] = "showTrains"; diff --git a/app/live/js/app.js b/app/live/js/app.js index 8e11b17..6bde3c6 100644 --- a/app/live/js/app.js +++ b/app/live/js/app.js @@ -1 +1 @@ -"use strict";var BitcoinModel,Bitcoin,FxModel,FxView,_typeof,TrainModel,TrainView,WeatherModel,Weather,WeatherSlim,PasswordView,popitout,popitoutSmall,EventModel=Backbone.Model.extend({initialize:function(){this.update()},getDays:function(t,e){var i=void 0,a=void 0;return i=t.getTime(),a=e.getTime(),(a-i)/864e5},update:function(){var t,e=new Date,i=36e5-e.getTime()%36e5,a={};a.days=Math.ceil(this.getDays(e,this.get("event"))),a.weeks=Math.ceil(this.getDays(e,this.get("event"))/7),this.set("data",a),t=function(){this.update()},setTimeout(t.bind(this),i+10)}}),EventView=Backbone.View.extend({tagName:"div",initialize:function(){_.bindAll(this,"render"),this.model.bind("change",this.render),this.id="e_"+Math.random().toString(36).substr(2,9),this.$events=$("#events"),this.$myEvent=null,this.$el=this.$events,this.initView(),this.render()},render:function(){var t=this.model.get("label"),e=this.model.get("data"),i=t+" "+e.days+" days / "+e.weeks+" weeks";this.$myEvent.empty().append(i)},initView:function(){var t="
';this.$html=$(t),this.$events.append(this.$html),this.$myEvent=$("#"+this.id)}});BitcoinModel=Backbone.Model.extend({initialize:function(){this.set("url","/btc"),this.set("balanceUrl","/balance");var t={lastGBP:0,lastUSD:0,lows:{gbp:0,usd:0},highs:{gbp:0,usd:0},eclass:"",balance:0};this.set("btcdata",t),this.set("balance",0),this.update(),this.updateHourly()},update:function(){var t,e,i;this.getBTC(),t=new Date,e=3e5-t.getTime()%3e5,i=function(){this.update()},setTimeout(i.bind(this),e+10)},updateHourly:function(){var t,e,i;this.getBalance(),t=new Date,e=36e5-t.getTime()%36e5,i=function(){this.update()},setTimeout(i.bind(this),e+10)},recalc:function(){var t=this.get("btcdata"),e=t.lastGBP,i=void 0,a=t.gbp,n=t.usd,s=t.lows,o=t.highs,r=t.eclass,l=t.balance;void 0!==a&&(0!==t.lastGBP?r=a>e?"up":"down":(s.gbp=a,s.usd=n,o.gbp=a,o.usd=n),e=a,i=n,a₿"+e+" £"+parseFloat(i.toFixed(2))+""),this.$btc.prop("title",a)}}),FxModel=Backbone.Model.extend({initialize:function(){this.set("url","/fx"),this.set("fxdata",{}),this.update()},update:function(){var t,e,i;this.getFX(),t=new Date,e=9e5-t.getTime()%9e5,i=function(){this.update()},setTimeout(i.bind(this),e+10)},getFX:function(){var t=this.get("url"),e=this;$.ajax({type:"GET",url:t,data:"",dataType:"json",timeout:1e4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(t){var i=1/t.rates.GBP,a=i*t.rates.SEK,n={usd:1,gbp:t.rates.GBP,sek:t.rates.SEK,gpbe:i,sekex:a};e.set("fxdata",n)},error:function(t,e){}})}}),FxView=Backbone.View.extend({tagName:"div",initialize:function(){_.bindAll(this,"render"),this.model.bind("change",this.render),this.$fx=$("#fx")},render:function(){var t=this.model.get("fxdata");this.$fx.html("£1 = $"+parseFloat(t.gpbe.toFixed(2))+" = "+parseFloat(t.sekex.toFixed(2))+" SEK")}}),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},TrainModel=Backbone.Model.extend({initialize:function(){var t=this.get("from"),e=this.get("to"),i="/getnexttraintimes?from="+t+"&to="+e,a="/gettrains?from="+t+"&to="+e,n=t+e;this.set("url",i),this.set("routeUrl",a),this.set("target",n),this.set("visible",!1),this.update()},update:function(){var t,e=new Date,i=6e4-e.getTime()%6e4;e.getHours()>=6&&this.getTrain(),t=function(){this.update()},setTimeout(t.bind(this),i+10)},getTrain:function(){var t=this.get("url"),e=this;$.ajax({type:"GET",url:t,data:"",dataType:"json",timeout:1e4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(t){e.set("trainData",t)},error:function(t,e){}})},getRoute:function(){var t=this.get("routeUrl"),e=this;!0===this.get("visible")?this.set("visible",!1):$.ajax({type:"GET",url:t,data:"",dataType:"json",timeout:1e4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(t){e.set("route",t),e.set("visible",!0)},error:function(t,e){}})}}),TrainView=Backbone.View.extend({tagName:"div",initialize:function(){_.bindAll(this,"render"),this.model.bind("change",this.render),this.$trains=$("#trains"),this.$traininfo=$("#traininfo"),this.$traintext=$("#trainResults"),this.$el=this.$trains,this.initView()},events:{click:"showTrains"},render:function(){var t,e,i,a,n,s,o,r,l,d,h,u,c,m,p,g,b,f,w,v,y,T,A,C,$=void 0,x=void 0,S=this.model.get("trainData"),E=this.model.get("visible"),k=this.model.get("route");if($="on time"===S.eta.toLowerCase()?S.sta:S.eta,x="on time"===S.eta.toLowerCase()?"ontime":"delayed",this.$button.html($),this.$button.removeClass("delayed").removeClass("ontime").addClass(x),E){if(t="
"+k.locationName+" TO "+k.filterLocationName+'
\n \n \n \n \n \n ',e=[],"object"===_typeof(k.trainServices)&&null!==k.trainServices){i=!0,a=!1,n=void 0;try{for(s=k.trainServices[Symbol.iterator]();!(i=(o=s.next()).done);i=!0)r=o.value,l=r.destination[0],d=null!==l.via?""+l.via+"":"",h=null!==r.platform?r.platform:"💠",u=null!==r.sta?r.sta:"D "+r.std,c=null!==r.eta?r.eta:r.etd,e.push({location:l.locationName,time:u,status:c,platform:h,cancel:r.cancelReason,type:"train"}),t=r.isCancelled?t+"\n \n \n \n \n ":t+"\n \n \n \n \n "}catch(t){a=!0,n=t}finally{try{!i&&s.return&&s.return()}finally{if(a)throw n}}}if("object"===_typeof(k.busServices)&&null!==k.busServices){m=!0,p=!1,g=void 0;try{for(b=k.busServices[Symbol.iterator]();!(m=(f=b.next()).done);m=!0)w=f.value,v=w.destination[0],y=null!==v.via?""+v.via+"":"",T=null!==w.platform?w.platform:"",A=null!==w.sta?w.sta:"D "+w.std,C=null!==w.eta?w.eta:w.etd,e.push({location:v.locationName,time:A,status:C,platform:T,cancel:w.cancelReason,type:"bus"}),t=t+"\n \n \n \n \n "}catch(t){p=!0,g=t}finally{try{!m&&b.return&&b.return()}finally{if(p)throw g}}}t+="
DestinationTimeStatusPlatform
"+l.locationName+" "+d+""+u+'❌ '+r.cancelReason+"
"+l.locationName+" "+d+""+u+""+c+""+h+"
🚌 "+v.locationName+" "+y+""+A+""+C+""+T+"
",this.$traintext.empty().html(t),this.$traintext.removeClass("mui--hide").addClass("mui--show")}else this.$traintext.removeClass("mui--show").addClass("mui--hide")},initView:function(){var t,e=this,i=this.model.get("target"),a="
"+i.toUpperCase()+':
';this.$html=$(a),this.$html.on("click",function(){e.model.getRoute()}),this.$trains.append(this.$html),this.$button=$("#"+i),t="click #$(target)",this.events[t]="showTrains"},showTrains:function(){}}),WeatherModel=Backbone.Model.extend({initialize:function(){var t=this.get("geo");this.set("url","https://api.darksky.net/forecast/9ad2a41d420f3cf4960571bb886f710c/"+t.coords.latitude.toString()+","+t.coords.longitude.toString()+"?units=uk2&exclude=minutely,hourly,alerts,flags"),this.update()},update:function(){var t,e,i;this.getWeather(),t=new Date,e=18e5-t.getTime()%18e5,i=function(){this.update()},setTimeout(i.bind(this),e+10)},getWeather:function(){var t=this;$.ajax({type:"GET",url:t.get("url"),data:"",dataType:"jsonp",timeout:1e4,context:$("body"),contentType:"application/json",headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(e){var i={temperature:e.currently.temperature,icon:e.currently.icon,summary:e.currently.summary,daily:e.daily.summary};t.set(i)},error:function(t,e){}})}}),Weather=Backbone.View.extend({tagName:"div",initialize:function(){_.bindAll(this,"render"),this.model.bind("change",this.render),this.$weatherText=$("#weatherDescription"),this.$weatherTemp=$("#temp"),this.$weatherIcon=$("#weatherIcon")},render:function(){var t='';this.$weatherTemp.empty().html(parseInt(this.model.get("temperature"))+"°c "),this.$weatherText.empty().html(this.model.get("summary")),this.$weatherIcon.empty().html(t)}}),WeatherSlim=Backbone.View.extend({tagName:"div",initialize:function(){_.bindAll(this,"render"),this.model.bind("change",this.render),this.$weather=$("#weather"),this.render()},render:function(){var t=this.model.get("summary"),e=this.model.get("temperature"),i=this.model.get("daily"),a=t+" "+e+"° "+i+"";this.$weather.empty().html(a)}}),_.templateSettings={evaluate:/\{\{(.+?)\}\}/g,interpolate:/\{\{=(.+?)\}\}/g,escape:/\{\{-(.+?)\}\}/g},Array.prototype.random=function(){return this[Math.floor(Math.random()*this.length)]},PasswordView=Backbone.View.extend({el:"#passwords",passwordTemplate:_.template($("#password-template").html()),initialize:function(){this.alpha=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9"],this.whitespace=[".","~","#","!","$","+","-","+"],this.numbers=["0","1","2","3","4","5","6","7","8","9"],this.left=["Alabama","Alaska","Arizona","Maryland","Nevada","Mexico","Texas","Utah","Glasgow","Inverness","Edinburgh","Dumbarton","Balloch","Renton","Cardross","Dundee","Paisley","Hamilton","Greenock","Falkirk","Irvine","Renfrew","Erskine","London","Hammersmith","Islington","Silver","Black","Yellow","Purple","White","Pink","Red","Orange","Brown","Green","Blue","Amber","Aqua","Azure","Bronze","Coral","Copper","Crimson","Cyan","Ginger","Gold","Indigo","Jade"],this.right=["Aganju","Cygni","Akeron","Antares","Aragoth","Ardus","Carpenter","Cooper","Dahin","Capella","Endriago","Gallina","Fenris","Freya","Glenn","Grissom","Jotunheim","Kailaasa","Lagarto","Muspelheim","Nifleheim","Primus","Vega","Ragnarok","Shepard","Slayton","Tarsis","Mercury","Venus","Mars","Earth","Terra","Jupiter","Saturn","Uranus","Neptune","Pluto","Europa","Ganymede","Callisto","Titan","Juno","Eridanus","Scorpius","Crux","Cancer","Taurus","Lyra","Andromeda","Virgo","Aquarius","Cygnus","Corvus","Taurus","Draco","Perseus","Pegasus","Gemini","Columbia","Bootes","Orion","Deneb","Merope","Agate","Amber","Beryl","Calcite","Citrine","Coral","Diamond","Emerald","Garnet","Jade","Lapis","Moonstone","Obsidian","Onyx","Opal","Pearl","Quartz","Ruby","Sapphire","Topaz","Iron","Lead","Nickel","Copper","Zinc","Tin","Manes","Argon","Neon","Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel","India","Juliett","Kilo","Lima","Mike","November","Oscar","Papa","Quebec","Romeo","Sierra","Tango","Uniform","Victor","Whisky","Xray","Yankee","Zulu"],this.passwordOut=this.$("#passwordOut"),_.bindAll(this,"newClick")},events:{"click #newPassword":"newClick"},numberCluster:function(){return this.numbers.random()+this.numbers.random()+this.numbers.random()},randomAmount:function(t){var e,i="";for(e=0;e';this.$html=$(t),this.$events.append(this.$html),this.$myEvent=$("#"+this.id)}});BitcoinModel=Backbone.Model.extend({initialize:function(){this.set("url","/btc"),this.set("balanceUrl","/balance");var t={lastGBP:0,lastUSD:0,lows:{gbp:0,usd:0},highs:{gbp:0,usd:0},eclass:"",balance:0};this.set("btcdata",t),this.set("balance",0),this.update(),this.updateHourly()},update:function(){var t,e,i;this.getBTC(),t=new Date,e=3e5-t.getTime()%3e5,i=function(){this.update()},setTimeout(i.bind(this),e+10)},updateHourly:function(){var t,e,i;this.getBalance(),t=new Date,e=36e5-t.getTime()%36e5,i=function(){this.update()},setTimeout(i.bind(this),e+10)},recalc:function(){var t=this.get("btcdata"),e=t.lastGBP,i=void 0,a=t.gbp,n=t.usd,s=t.lows,o=t.highs,r=t.eclass,l=t.balance;void 0!==a&&(0!==t.lastGBP?r=a>e?"up":"down":(s.gbp=a,s.usd=n,o.gbp=a,o.usd=n),e=a,i=n,a₿"+e+" £"+parseFloat(i.toFixed(2))+""),this.$btc.prop("title",a)}}),FxModel=Backbone.Model.extend({initialize:function(){this.set("url","/fx"),this.set("fxdata",{}),this.update()},update:function(){var t,e,i;this.getFX(),t=new Date,e=9e5-t.getTime()%9e5,i=function(){this.update()},setTimeout(i.bind(this),e+10)},getFX:function(){var t=this.get("url"),e=this;$.ajax({type:"GET",url:t,data:"",dataType:"json",timeout:1e4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(t){var i=1/t.rates.GBP,a=i*t.rates.SEK,n={usd:1,gbp:t.rates.GBP,sek:t.rates.SEK,gpbe:i,sekex:a};e.set("fxdata",n)},error:function(t,e){}})}}),FxView=Backbone.View.extend({tagName:"div",initialize:function(){_.bindAll(this,"render"),this.model.bind("change",this.render),this.$fx=$("#fx")},render:function(){var t=this.model.get("fxdata");this.$fx.html("£1 = $"+parseFloat(t.gpbe.toFixed(2))+" = "+parseFloat(t.sekex.toFixed(2))+" SEK")}}),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},TrainModel=Backbone.Model.extend({initialize:function(){var t=this.get("from"),e=this.get("to"),i="/getnexttraintimes?from="+t+"&to="+e,a="/gettrains?from="+t+"&to="+e,n=t+e;this.set("url",i),this.set("routeUrl",a),this.set("target",n),this.set("visible",!1),this.set("trainData",{eta:"OFF",sta:"OFF"}),this.update()},update:function(){var t,e=new Date,i=e.getHours(),a=i<6?36e5:6e4,n=a-e.getTime()%a;i>=6?this.getTrain():this.set("trainData",{eta:"OFF",sta:"OFF"}),t=function(){this.update()},setTimeout(t.bind(this),n+10)},getTrain:function(){var t=this.get("url"),e=this;$.ajax({type:"GET",url:t,data:"",dataType:"json",timeout:1e4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(t){e.set("trainData",t)},error:function(t,e){}})},getRoute:function(){var t=this.get("routeUrl"),e=this;!0===this.get("visible")?this.set("visible",!1):$.ajax({type:"GET",url:t,data:"",dataType:"json",timeout:1e4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(t){e.set("route",t),e.set("visible",!0)},error:function(t,e){}})}}),TrainView=Backbone.View.extend({tagName:"div",initialize:function(){_.bindAll(this,"render"),this.model.bind("change",this.render),this.$trains=$("#trains"),this.$traininfo=$("#traininfo"),this.$traintext=$("#trainResults"),this.$el=this.$trains,this.initView()},events:{click:"showTrains"},render:function(){var t,e,i,a,n,s,o,r,l,d,h,u,c,m,p,g,b,f,w,v,y,T,C,$,A=void 0,x=void 0,S=this.model.get("trainData"),E=this.model.get("visible"),k=this.model.get("route");if(A="on time"===S.eta.toLowerCase()?S.sta:S.eta,x="on time"===S.eta.toLowerCase()?"ontime":"delayed",this.$button.html(A),this.$button.removeClass("delayed").removeClass("ontime").addClass(x),E){if(t="
"+k.locationName+" TO "+k.filterLocationName+'
\n \n \n \n \n \n ',e=[],"object"===_typeof(k.trainServices)&&null!==k.trainServices){i=!0,a=!1,n=void 0;try{for(s=k.trainServices[Symbol.iterator]();!(i=(o=s.next()).done);i=!0)r=o.value,l=r.destination[0],d=null!==l.via?""+l.via+"":"",h=null!==r.platform?r.platform:"💠",u=null!==r.sta?r.sta:"D "+r.std,c=null!==r.eta?r.eta:r.etd,e.push({location:l.locationName,time:u,status:c,platform:h,cancel:r.cancelReason,type:"train"}),t=r.isCancelled?t+"\n \n \n \n \n ":t+"\n \n \n \n \n "}catch(t){a=!0,n=t}finally{try{!i&&s.return&&s.return()}finally{if(a)throw n}}}if("object"===_typeof(k.busServices)&&null!==k.busServices){m=!0,p=!1,g=void 0;try{for(b=k.busServices[Symbol.iterator]();!(m=(f=b.next()).done);m=!0)w=f.value,v=w.destination[0],y=null!==v.via?""+v.via+"":"",T=null!==w.platform?w.platform:"",C=null!==w.sta?w.sta:"D "+w.std,$=null!==w.eta?w.eta:w.etd,e.push({location:v.locationName,time:C,status:$,platform:T,cancel:w.cancelReason,type:"bus"}),t=t+"\n \n \n \n \n "}catch(t){p=!0,g=t}finally{try{!m&&b.return&&b.return()}finally{if(p)throw g}}}t+="
DestinationTimeStatusPlatform
"+l.locationName+" "+d+""+u+'❌ '+r.cancelReason+"
"+l.locationName+" "+d+""+u+""+c+""+h+"
🚌 "+v.locationName+" "+y+""+C+""+$+""+T+"
",this.$traintext.empty().html(t),this.$traintext.removeClass("mui--hide").addClass("mui--show")}else this.$traintext.removeClass("mui--show").addClass("mui--hide")},initView:function(){var t,e,i,a=this,n=this.model.get("target"),s="
"+n.toUpperCase()+':
';this.$html=$(s),this.$html.on("click",function(){a.model.getRoute()}),this.$trains.append(this.$html),this.$button=$("#"+n),t="OFF",e="on time"===t?"ontime":"delayed",this.$button.html(t),this.$button.removeClass("delayed").removeClass("ontime").addClass(e),i="click #$(target)",this.events[i]="showTrains"},showTrains:function(){}}),WeatherModel=Backbone.Model.extend({initialize:function(){var t=this.get("geo");this.set("url","https://api.darksky.net/forecast/9ad2a41d420f3cf4960571bb886f710c/"+t.coords.latitude.toString()+","+t.coords.longitude.toString()+"?units=uk2&exclude=minutely,hourly,alerts,flags"),this.update()},update:function(){var t,e,i;this.getWeather(),t=new Date,e=18e5-t.getTime()%18e5,i=function(){this.update()},setTimeout(i.bind(this),e+10)},getWeather:function(){var t=this;$.ajax({type:"GET",url:t.get("url"),data:"",dataType:"jsonp",timeout:1e4,context:$("body"),contentType:"application/json",headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(e){var i={temperature:e.currently.temperature,icon:e.currently.icon,summary:e.currently.summary,daily:e.daily.summary};t.set(i)},error:function(t,e){}})}}),Weather=Backbone.View.extend({tagName:"div",initialize:function(){_.bindAll(this,"render"),this.model.bind("change",this.render),this.$weatherText=$("#weatherDescription"),this.$weatherTemp=$("#temp"),this.$weatherIcon=$("#weatherIcon")},render:function(){var t='';this.$weatherTemp.empty().html(parseInt(this.model.get("temperature"))+"°c "),this.$weatherText.empty().html(this.model.get("summary")),this.$weatherIcon.empty().html(t)}}),WeatherSlim=Backbone.View.extend({tagName:"div",initialize:function(){_.bindAll(this,"render"),this.model.bind("change",this.render),this.$weather=$("#weather"),this.render()},render:function(){var t=this.model.get("summary"),e=this.model.get("temperature"),i=this.model.get("daily"),a=t+" "+e+"° "+i+"";this.$weather.empty().html(a)}}),_.templateSettings={evaluate:/\{\{(.+?)\}\}/g,interpolate:/\{\{=(.+?)\}\}/g,escape:/\{\{-(.+?)\}\}/g},Array.prototype.random=function(){return this[Math.floor(Math.random()*this.length)]},PasswordView=Backbone.View.extend({el:"#passwords",passwordTemplate:_.template($("#password-template").html()),initialize:function(){this.alpha=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9"],this.whitespace=[".","~","#","!","$","+","-","+"],this.numbers=["0","1","2","3","4","5","6","7","8","9"],this.left=["Alabama","Alaska","Arizona","Maryland","Nevada","Mexico","Texas","Utah","Glasgow","Inverness","Edinburgh","Dumbarton","Balloch","Renton","Cardross","Dundee","Paisley","Hamilton","Greenock","Falkirk","Irvine","Renfrew","Erskine","London","Hammersmith","Islington","Silver","Black","Yellow","Purple","White","Pink","Red","Orange","Brown","Green","Blue","Amber","Aqua","Azure","Bronze","Coral","Copper","Crimson","Cyan","Ginger","Gold","Indigo","Jade"],this.right=["Aganju","Cygni","Akeron","Antares","Aragoth","Ardus","Carpenter","Cooper","Dahin","Capella","Endriago","Gallina","Fenris","Freya","Glenn","Grissom","Jotunheim","Kailaasa","Lagarto","Muspelheim","Nifleheim","Primus","Vega","Ragnarok","Shepard","Slayton","Tarsis","Mercury","Venus","Mars","Earth","Terra","Jupiter","Saturn","Uranus","Neptune","Pluto","Europa","Ganymede","Callisto","Titan","Juno","Eridanus","Scorpius","Crux","Cancer","Taurus","Lyra","Andromeda","Virgo","Aquarius","Cygnus","Corvus","Taurus","Draco","Perseus","Pegasus","Gemini","Columbia","Bootes","Orion","Deneb","Merope","Agate","Amber","Beryl","Calcite","Citrine","Coral","Diamond","Emerald","Garnet","Jade","Lapis","Moonstone","Obsidian","Onyx","Opal","Pearl","Quartz","Ruby","Sapphire","Topaz","Iron","Lead","Nickel","Copper","Zinc","Tin","Manes","Argon","Neon","Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel","India","Juliett","Kilo","Lima","Mike","November","Oscar","Papa","Quebec","Romeo","Sierra","Tango","Uniform","Victor","Whisky","Xray","Yankee","Zulu"],this.passwordOut=this.$("#passwordOut"),_.bindAll(this,"newClick")},events:{"click #newPassword":"newClick"},numberCluster:function(){return this.numbers.random()+this.numbers.random()+this.numbers.random()},randomAmount:function(t){var e,i="";for(e=0;e