diff --git a/app.js b/app.js
index 66a6652..890cd6e 100644
--- a/app.js
+++ b/app.js
@@ -1,38 +1,36 @@
-/*var app = require('express').createServer();
+/* var app = require('express').createServer();
app.get('/', function(req, res) {
res.send('Hello from AppFog.com');
});
app.listen(process.env.VCAP_APP_PORT || 3000);*/
-
-var express = require('express'), path = require('path'), http = require('http');
+var express = require('express'), path = require('path'), http = require('http');
var app = express();
app.configure(function() {
app.set('port', process.env.VCAP_APP_PORT || 3000);
app.use(express.logger('dev'));
+
/* 'default', 'short', 'tiny', 'dev' */
- app.use(express.methodOverride());
+ app.use(express.methodOverride());
app.use(express.bodyParser());
- app.use(function(req, res, next) {
- res.header("Access-Control-Allow-Origin", "*");
- res.header("Access-Control-Allow-Headers", "X-Requested-With");
- next();
- });
+ app.use(function(req, res, next) {
+ res.header('Access-Control-Allow-Origin', '*');
+ res.header('Access-Control-Allow-Headers', 'X-Requested-With');
+ next();
+ });
app.use(app.router);
app.use(express.static(path.join(__dirname, 'www')));
-app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
+ app.use(express.errorHandler({ 'dumpExceptions': true, 'showStack': true }));
});
-
/**
* Routing handlers
*/
-
/**
* create the server
*/
http.createServer(app).listen(app.get('port'), function() {
- console.log("Express server listening on port " + app.get('port'));
+ console.log(`Express server listening on port ${ app.get('port')}`);
});
diff --git a/app/css/weather.css b/app/css/weather.css
new file mode 100644
index 0000000..0705216
--- /dev/null
+++ b/app/css/weather.css
@@ -0,0 +1,82 @@
+.card {
+ position: relative;
+ background-color: #fff;
+ min-height: 72px;
+}
+
+.mui--text-display3 {
+ font-family: "Roboto Slab", "Helvetica Neue", Helvetica, Arial;
+}
+
+.temp0, .temp1, .temp2, .temp3, .temp4, .temp5 {
+ color: rgb(80, 181, 221)
+}
+
+.temp6 {
+ color: rgb(78, 178, 206)
+}
+
+.temp7 {
+ color: rgb(76, 176, 190)
+}
+
+.temp8 {
+ color: rgb(73, 173, 175)
+}
+
+.temp9 {
+ color: rgb(72, 171, 159)
+}
+
+.temp10 {
+ color: rgb(70, 168, 142)
+}
+
+.temp11 {
+ color: rgb(68, 166, 125)
+}
+
+.temp12 {
+ color: rgb(66, 164, 108)
+}
+
+.temp13 {
+ color: rgb(102, 173, 94)
+}
+
+.temp14 {
+ color: rgb(135, 190, 64)
+}
+
+.temp15 {
+ color: rgb(179, 204, 26)
+}
+
+.temp16 {
+ color: rgb(214, 213, 28)
+}
+
+.temp17 {
+ color: rgb(249, 202, 3)
+}
+
+.temp18 {
+ color: rgb(246, 181, 3)
+}
+
+.temp19 {
+ color: rgb(244, 150, 26)
+}
+
+.temp20 {
+ color: rgb(236, 110, 5)
+}
+
+.day {
+ font-family: "Roboto Slab", "Helvetica Neue", Helvetica, Arial, SansSerif;
+ text-transform: uppercase;
+}
+
+.summary::first-letter {
+ text-transform: capitalize
+}
\ No newline at end of file
diff --git a/app/js/modules/bitcoin.js b/app/js/modules/bitcoin.js
index 3314788..91e7b64 100644
--- a/app/js/modules/bitcoin.js
+++ b/app/js/modules/bitcoin.js
@@ -22,7 +22,7 @@ const BitcoinModel = Backbone.Model.extend({
},
'update': function () {
this.getBTC();
- // this.getBalance();
+ // this.getBalance();
const now = new Date();
const mod = 300000 - (now.getTime() % 300000);
@@ -94,7 +94,7 @@ const BitcoinModel = Backbone.Model.extend({
data.stub = Math.random(Number.MAX_SAFE_INTEGER).toString(32);
this.set('btcdata', data);
- // total = myBTC * g;
+ // total = myBTC * g;
},
'getBTC': function () {
console.log('>> getBTC');
@@ -106,7 +106,7 @@ const BitcoinModel = Backbone.Model.extend({
'data': '',
'dataType': 'json',
'timeout': 10000,
- // contentType: ('application/json'),
+ // contentType: ('application/json'),
'headers': {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
@@ -139,7 +139,7 @@ const BitcoinModel = Backbone.Model.extend({
'data': '',
'dataType': 'json',
'timeout': 10000,
- // contentType: ('application/json'),
+ // contentType: ('application/json'),
'headers': {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
@@ -159,7 +159,7 @@ const BitcoinModel = Backbone.Model.extend({
});
},
'btcFromSocket': function (data) {
- let self = this;
+ const self = this;
console.log('>> btc from the socket', data);
const gbp = data.bpi.GBP.rate_float;
const usd = data.bpi.USD.rate_float;
@@ -172,7 +172,7 @@ const BitcoinModel = Backbone.Model.extend({
self.recalc();
},
'balanceFromSocket': function (data) {
- let self = this;
+ const self = this;
console.log('>> balance from the socket', data);
const balance = data.balance;
@@ -191,10 +191,10 @@ const Bitcoin = Backbone.View.extend({
'render': function () {
const btcdata = this.model.get('btcdata');
const balance = this.model.get('balance');
- // console.log(`Balance: ${btcdata.balance.toFixed(4)}`);
- // console.log(btcdata.lastGBP);
+ // console.log(`Balance: ${btcdata.balance.toFixed(4)}`);
+ // console.log(btcdata.lastGBP);
const owned = parseFloat(btcdata.lastGBP) * parseFloat(balance);
- // console.log(`owned: ${owned}`);
+ // console.log(`owned: ${owned}`);
const title = `High: $${ parseFloat(btcdata.highs.usd.toFixed(2)) } / Low $${ parseFloat(btcdata.lows.usd.toFixed(2))}`;
let trendClass = '';
@@ -203,7 +203,7 @@ const Bitcoin = Backbone.View.extend({
else if (btcdata.trend < 1.00)
trendClass = 'trendDown';
else
- trendClass = '';
+ trendClass = '';
this.$trend.removeClass();
this.$trend.addClass(trendClass);
diff --git a/app/js/modules/train.js b/app/js/modules/train.js
index 37dc340..510698e 100644
--- a/app/js/modules/train.js
+++ b/app/js/modules/train.js
@@ -10,9 +10,9 @@ const TrainModel = Backbone.Model.extend({
'initialize': function () {
const fromStation = this.get('from');
const toStation = this.get('to');
- const url = `/getnexttraintimes?from=${ fromStation }&to=${ toStation}`;
- const routeUrl = `/gettrains?from=${ fromStation }&to=${ toStation}`;
- const target = fromStation + toStation;
+ const url = `/getnexttraintimes?from=${ this.get('from') }&to=${ this.get('to')}`;
+ const routeUrl = `/gettrains?from=${ this.get('from') }&to=${ this.get('to')}`;
+ const target = this.get('from') + this.get('to');
this.set('url', url);
this.set('routeUrl', routeUrl);
this.set('target', target);
@@ -30,7 +30,7 @@ const TrainModel = Backbone.Model.extend({
if (hours >= 6)
this.getTrain();
else
- this.set('trainData', { 'eta':'OFF', 'sta': 'OFF' });
+ this.set('trainData', { 'eta':'OFF', 'sta': 'OFF' });
const trainUpdateFn = function () {
this.update();
@@ -69,32 +69,32 @@ const TrainModel = Backbone.Model.extend({
if (this.get('visible') === true)
this.set('visible', false);
else
- $.ajax({
- 'type': 'GET',
- 'url': url,
- 'data': '',
- 'dataType': 'json',
+ $.ajax({
+ 'type': 'GET',
+ 'url': url,
+ 'data': '',
+ 'dataType': 'json',
- 'timeout': 10000,
- 'headers': {
- 'Access-Control-Allow-Origin': '*',
- 'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
- 'Access-Control-Allow-Headers': 'Content-Type'
+ 'timeout': 10000,
+ 'headers': {
+ 'Access-Control-Allow-Origin': '*',
+ 'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
+ 'Access-Control-Allow-Headers': 'Content-Type'
- },
- 'success': function (data) {
- // getTrainsCB(data);
- // console.log('Got', data);
+ },
+ 'success': function (data) {
+ // getTrainsCB(data);
+ // console.log('Got', data);
- self.set('route', data);
- self.set('visible', true);
- },
- 'error': function (xhr, type) {
- console.error('ajax error');
- console.error(xhr);
- console.error(type);
- }
- });
+ self.set('route', data);
+ self.set('visible', true);
+ },
+ 'error': function (xhr, type) {
+ console.error('ajax error');
+ console.error(xhr);
+ console.error(type);
+ }
+ });
}
});
@@ -161,8 +161,8 @@ const TrainView = Backbone.View.extend({
const time = item.sta !== null ? item.sta : `D ${item.std}`;
const status = item.eta !== null ? item.eta : item.etd;
services.push({ 'location':dest.locationName, 'time':time, 'status':status, 'platform':platform, 'cancel':item.cancelReason, 'type':'bus' });
- // ws = ws + `
${dest.locationName} Bus ${via}
`;
- // ws = ws + '';
+ // ws = ws + `${dest.locationName} Bus ${via}
`;
+ // ws = ws + '';
ws = `${ws }🚌 ${dest.locationName} ${via} | ${time} | ${status} | ${platform} |
`;
}
@@ -171,21 +171,21 @@ const TrainView = Backbone.View.extend({
this.$traintext.removeClass('mui--hide').addClass('mui--show');
}
else
- this.$traintext.removeClass('mui--show').addClass('mui--hide');
+ this.$traintext.removeClass('mui--show').addClass('mui--hide');
},
'initView': function () {
- // el: $('#myView').get(0)
+ // el: $('#myView').get(0)
const self = this;
const target = this.model.get('target');
const html = `${target.toUpperCase()}:
`;
this.$html = $(html);
this.$html.on('click', function () {
-// console.log(self)
+ // console.log(self)
self.model.getRoute();
});
this.$trains.append(this.$html);
-// this.el = `#${target}`;
+ // this.el = `#${target}`;
this.$button = $(`#${target}`);
diff --git a/app/js/modules/weatherV2.js b/app/js/modules/weatherV2.js
new file mode 100644
index 0000000..8280a49
--- /dev/null
+++ b/app/js/modules/weatherV2.js
@@ -0,0 +1,80 @@
+function reduceOpenWeather(item) {
+ // Openweather returns timestamps in seconds. Moment requires them in milliseconds.
+
+ const ts = moment(item.dt * 1000);
+ const weatherBlock = item.weather[0];
+
+ return {
+ 'timestamp': item.dt,
+ 'icon': `wi-owm-${weatherBlock.id}`,
+ 'summary': weatherBlock.description,
+ 'tempHigh': parseInt(item.temp.max, 10),
+ 'tempLow': parseInt(item.temp.min, 10),
+ 'datelong': ts.format(),
+ 'time': item.dt,
+ 'date': ts.format('D/M'),
+ 'day': ts.format('ddd')
+
+ };
+}
+
+function reduceDarkSky(item) {
+ const ts = moment(item.time * 1000);
+
+ return {
+ 'timestamp': item.time,
+ 'icon': weatherIcons.get(item.icon),
+ 'summary': item.summary,
+ 'tempHigh': parseInt(item.temperatureHigh, 10),
+ 'tempLow': parseInt(item.temperatureLow, 10),
+ 'datelong': ts.format(),
+ 'time': item.time,
+ 'date': ts.format('D/M'),
+ 'day': ts.format('ddd')
+
+ };
+}
+
+const WCollection = Backbone.Collection.extend({
+ 'url': '/weather',
+ 'parse': function(data) {
+ return data.list.map((item) => {
+ // Reduce the data
+ return reduceOpenWeather(item);
+ });
+ }
+});
+
+const WView = Backbone.View.extend({
+ 'tagName': 'div',
+ 'template': _.template(`
+ <% _.each(data, function(item) {%>
+
+
+
<%= item.day %>
+
<%= item.date %>
+
+
+
+
+ <%= item.tempHigh %>° /
+ <%= item.tempLow %>°
+
<%= item.summary %>
+
+
+ <% });
+ %>`),
+ 'initialize': function() {
+ _.bindAll(this, 'render');
+ this.collection = new WCollection();
+ this.listenTo(this.collection, 'reset sync', _.debounce(_.bind(this.render), 128));
+ this.collection.fetch();
+ },
+ 'render': function() {
+ if (this.collection.length !== 0) {
+ const data = { 'data':this.collection.toJSON() };
+ this.$el.html(this.template(data));
+ }
+ }
+
+});
diff --git a/app/live/js/app.js b/app/live/js/app.js
index a86cdcb..4c83c11 100644
--- a/app/live/js/app.js
+++ b/app/live/js/app.js
@@ -1,734 +1 @@
-'use strict';
-
-/**
- * Created by mdonnel on 10/04/2017.
- */
-var EventModel = Backbone.Model.extend({
- 'initialize': function initialize() {
- this.update();
- },
- 'getDays': function getDays(startdate, enddate) {
- var r = void 0,
- s = void 0,
- e = void 0;
- s = startdate.getTime();
- e = enddate.getTime();
- r = (e - s) / (24 * 60 * 60 * 1000);
-
- return r;
- },
- 'update': function update() {
- var now = new Date();
- var mod = 3600000 - now.getTime() % 3600000;
- var data = {};
- data.days = Math.ceil(this.getDays(now, this.get('event')));
- data.weeks = Math.ceil(this.getDays(now, this.get('event')) / 7);
- this.set('data', data);
-
- var clockFn = function clockFn() {
- this.update();
- };
-
- setTimeout(clockFn.bind(this), mod + 10);
- }
-});
-
-var EventView = Backbone.View.extend({
- 'tagName': 'div',
- 'initialize': function initialize() {
- _.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 render() {
- var label = this.model.get('label');
- var data = this.model.get('data');
- var str = label + ' ' + data.days + ' days / ' + data.weeks + ' weeks';
- this.$myEvent.empty().append(str);
- },
- 'initView': function initView() {
- var html = '';
- this.$html = $(html);
- this.$events.append(this.$html);
- this.$myEvent = $('#' + this.id);
- }
-});
-'use strict';
-
-/**
- * Created by mdonnel on 22/03/2017.
- */
-
-var BitcoinModel = Backbone.Model.extend({
- 'initialize': function initialize() {
- this.set('url', '/btc');
- this.set('balanceUrl', '/balance');
- var data = {
- 'lastGBP': 0.0,
- 'lastUSD': 0.0,
- 'lows': { 'gbp': 0, 'usd': 0 },
- 'highs': { 'gbp': 0, 'usd': 0 },
- 'eclass': '',
- 'balance': 0.0,
- 'trend': 0
- };
- this.set('btcdata', data);
- this.set('balance', 0);
- this.update();
- this.updateHourly();
- },
- 'update': function update() {
- this.getBTC();
- // this.getBalance();
- var now = new Date();
- var mod = 300000 - now.getTime() % 300000;
-
- var btcupdateFn = function btcupdateFn() {
- this.update();
- };
- setTimeout(btcupdateFn.bind(this), mod + 10);
- },
- 'updateHourly': function updateHourly() {
- this.getBalance();
- var now = new Date();
- var mod = 3600000 - now.getTime() % 3600000;
-
- var btcupdateFn = function btcupdateFn() {
- this.update();
- };
- setTimeout(btcupdateFn.bind(this), mod + 10);
- },
- 'recalc': function recalc() {
- var data = this.get('btcdata');
- var lastGBP = data.lastGBP;
- var lastUSD = void 0;
- var g = data.gbp;
- var u = data.usd;
- var lows = data.lows;
- var highs = data.highs;
- var eclass = data.eclass;
- var balance = data.balance;
- var trend = data.trend;
-
- if (trend === undefined || trend === null) trend = 1;
-
- if (g !== undefined) {
- if (data.lastGBP !== 0) {
- if (g > lastGBP) {
- eclass = 'up';
- } else {
- eclass = 'down';
- }
- } else {
- lows.gbp = g;
- lows.usd = u;
-
- highs.gbp = g;
- highs.usd = u;
- }
- lastGBP = g;
- lastUSD = u;
-
- if (g < lows.gbp) lows.gbp = g;
- if (u < lows.usd) lows.usd = u;
-
- if (highs.gbp < g) highs.gbp = g;
- if (highs.usd < u) highs.usd = u;
-
- data = {
- lastGBP: lastGBP,
- lastUSD: lastUSD,
- lows: lows,
- highs: highs,
- eclass: eclass,
- balance: balance,
- trend: trend
- };
- }
- data.stub = Math.random(Number.MAX_SAFE_INTEGER).toString(32);
-
- this.set('btcdata', data);
- // total = myBTC * g;
- },
- 'getBTC': function getBTC() {
- var self = this;
- var url = this.get('url');
- $.ajax({
- 'type': 'GET',
- 'url': url,
- 'data': '',
- 'dataType': 'json',
- 'timeout': 10000,
- // 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 success(data) {
- var gbp = data.bpi.GBP.rate_float,
- usd = data.bpi.USD.rate_float;
- var trend = data.trend;
- var btcdata = self.get('btcdata');
- btcdata.gbp = gbp;
- btcdata.usd = usd;
- btcdata.trend = trend;
- self.set('btcdata', btcdata);
- self.recalc();
- },
- 'error': function error(xhr, type) {
- void 0;
- void 0;
- void 0;
- }
- });
- },
- 'getBalance': function getBalance() {
- var self = this;
- var url = this.get('balanceUrl');
- $.ajax({
- 'type': 'GET',
- 'url': url,
- 'data': '',
- 'dataType': 'json',
- 'timeout': 10000,
- // 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 success(data) {
- var balance = data.balance;
-
- self.set('balance', balance);
- self.recalc();
- },
- 'error': function error(xhr, type) {
- void 0;
- void 0;
- void 0;
- }
- });
- }
-});
-var Bitcoin = Backbone.View.extend({
- 'tagName': 'div',
- 'initialize': function initialize() {
- _.bindAll(this, 'render');
- this.model.bind('change', this.render);
- this.$btc = $('#btc');
- this.$trend = $('#trend');
- },
- 'render': function render() {
- var btcdata = this.model.get('btcdata');
- var balance = this.model.get('balance');
- // console.log(`Balance: ${btcdata.balance.toFixed(4)}`);
- // console.log(btcdata.lastGBP);
- var owned = parseFloat(btcdata.lastGBP) * parseFloat(balance);
- // console.log(`owned: ${owned}`);
- var title = 'High: $' + parseFloat(btcdata.highs.usd.toFixed(2)) + ' / Low $' + parseFloat(btcdata.lows.usd.toFixed(2));
- var trendClass = '';
-
- if (btcdata.trend > 1.00) trendClass = 'trendUp';else if (btcdata.trend < 1.00) trendClass = 'trendDown';else trendClass = '';
-
- this.$trend.removeClass();
- this.$trend.addClass(trendClass);
- this.$btc.removeClass();
- this.$btc.addClass(btcdata.eclass);
- this.$btc.html('$' + parseFloat(btcdata.lastUSD.toFixed(2)) + ' / £' + parseFloat(btcdata.lastGBP.toFixed(2)) + ' ₿' + balance + ' £' + parseFloat(owned.toFixed(2)) + '
');
- this.$btc.prop('title', title);
- }
-});
-'use strict';
-
-/**
- * Created by mdonnel on 22/03/2017.
- */
-
-var FxModel = Backbone.Model.extend({
- 'initialize': function initialize() {
- this.set('url', '/fx');
- this.set('fxdata', {});
- this.update();
- },
- 'update': function update() {
- this.getFX();
- var now = new Date();
- var mod = 900000 - now.getTime() % 900000;
-
- var fxUpdateFn = function fxUpdateFn() {
- this.update();
- };
- setTimeout(fxUpdateFn.bind(this), mod + 10);
- },
- 'getFX': function getFX() {
- var url = this.get('url');
- var self = this;
- $.ajax({
- 'type': 'GET',
- 'url': url,
- 'data': '',
- 'dataType': 'json',
-
- 'timeout': 10000,
-
- // 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 success(data) {
- var fxdata = {};
- if (data.rates !== undefined) {
- var gpbex = 1 / data.rates.GBP;
- var sekex = gpbex * data.rates.SEK;
- fxdata = {
- 'usd': 1,
- 'gbp': data.rates.GBP,
- 'sek': data.rates.SEK,
- 'gpbe': gpbex,
- 'sekex': sekex
- };
- }
-
- self.set('fxdata', fxdata);
- },
- 'error': function error(xhr, type) {
- void 0;
- void 0;
- void 0;
- }
- });
- }
-});
-
-var FxView = Backbone.View.extend({
- 'tagName': 'div',
- 'initialize': function initialize() {
- _.bindAll(this, 'render');
- this.model.bind('change', this.render);
- this.$fx = $('#fx');
- },
- 'render': function render() {
- var fxdata = this.model.get('fxdata');
- this.$fx.html('£1 = $' + parseFloat(fxdata.gpbe.toFixed(2)) + ' = ' + parseFloat(fxdata.sekex.toFixed(2)) + ' SEK');
- }
-});
-'use strict';
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-/**
- *
- * User: Martin Donnelly
- * Date: 2016-10-03
- * Time: 14:20
- *
- */
-
-var TrainModel = Backbone.Model.extend({
- 'initialize': function initialize() {
- var fromStation = this.get('from');
- var toStation = this.get('to');
- var url = '/getnexttraintimes?from=' + fromStation + '&to=' + toStation;
- var routeUrl = '/gettrains?from=' + fromStation + '&to=' + toStation;
- var target = fromStation + toStation;
- this.set('url', url);
- this.set('routeUrl', routeUrl);
- this.set('target', target);
- this.set('visible', false);
- this.set('trainData', { 'eta': 'OFF', 'sta': 'OFF' });
- this.update();
- },
- 'update': function update() {
- var now = new Date();
- var hours = now.getHours();
- var limit = hours < 6 ? 3600000 : 60000;
-
- var mod = limit - now.getTime() % limit;
-
- if (hours >= 6) this.getTrain();else this.set('trainData', { 'eta': 'OFF', 'sta': 'OFF' });
-
- var trainUpdateFn = function trainUpdateFn() {
- this.update();
- };
-
- setTimeout(trainUpdateFn.bind(this), mod + 10);
- },
- 'getTrain': function getTrain() {
- var url = this.get('url');
- var self = this;
- $.ajax({
- 'type': 'GET',
- 'url': url,
- 'data': '',
- 'dataType': 'json',
- 'timeout': 10000,
- 'headers': {
- 'Access-Control-Allow-Origin': '*',
- 'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
- 'Access-Control-Allow-Headers': 'Content-Type'
- },
- 'success': function success(data) {
- self.set('trainData', data);
- },
- 'error': function error(xhr, type) {
- void 0;
- void 0;
- void 0;
- }
- });
- },
- 'getRoute': function getRoute() {
- var url = this.get('routeUrl');
- var self = this;
-
- if (this.get('visible') === true) this.set('visible', false);else $.ajax({
- 'type': 'GET',
- 'url': url,
- 'data': '',
- 'dataType': 'json',
-
- 'timeout': 10000,
- 'headers': {
- 'Access-Control-Allow-Origin': '*',
- 'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
- 'Access-Control-Allow-Headers': 'Content-Type'
-
- },
- 'success': function success(data) {
- // getTrainsCB(data);
- // console.log('Got', data);
-
- self.set('route', data);
- self.set('visible', true);
- },
- 'error': function error(xhr, type) {
- void 0;
- void 0;
- void 0;
- }
- });
- }
-});
-
-var TrainView = Backbone.View.extend({
- 'tagName': 'div',
- 'initialize': function initialize() {
- _.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 render() {
- var obj = this.model.get('trainData');
- var visible = this.model.get('visible');
- var route = this.model.get('route');
-
- var output = obj.eta.toLowerCase() === 'on time' ? obj.sta : obj.eta;
- var status = obj.eta.toLowerCase() === 'on time' ? 'ontime' : 'delayed';
-
- this.$button.html(output);
- this.$button.removeClass('delayed').removeClass('ontime').addClass(status);
-
- if (visible) {
- var ws = '' + route.locationName + ' TO ' + route.filterLocationName + '
\n \n Destination | \n Time | \n Status | \n Platform |
\n ';
-
- var services = [];
- if (_typeof(route.trainServices) === 'object' && route.trainServices !== null) {
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
-
- try {
- for (var _iterator = route.trainServices[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var _item = _step.value;
-
- var dest = _item.destination[0];
- var via = dest.via !== null ? '' + dest.via + '' : '';
- var platform = _item.platform !== null ? _item.platform : '💠';
- var time = _item.sta !== null ? _item.sta : 'D ' + _item.std;
- var _status = _item.eta !== null ? _item.eta : _item.etd;
-
- services.push({ 'location': dest.locationName, 'time': time, 'status': _status, 'platform': platform, 'cancel': _item.cancelReason, 'type': 'train' });
- if (!_item.isCancelled) ws = ws + '' + dest.locationName + ' ' + via + ' | \n ' + time + ' | \n ' + _status + ' | \n ' + platform + ' | \n
';else ws = ws + '' + dest.locationName + ' ' + via + ' | ' + time + ' | \n \u274C ' + _item.cancelReason + ' |
';
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
- }if (_typeof(route.busServices) === 'object' && route.busServices !== null) {
- var _iteratorNormalCompletion2 = true;
- var _didIteratorError2 = false;
- var _iteratorError2 = undefined;
-
- try {
- for (var _iterator2 = route.busServices[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
- var _item2 = _step2.value;
-
- var _dest = _item2.destination[0];
- var _via = _dest.via !== null ? '' + _dest.via + '' : '';
- var _platform = _item2.platform !== null ? _item2.platform : '';
- var _time = _item2.sta !== null ? _item2.sta : 'D ' + _item2.std;
- var _status2 = _item2.eta !== null ? _item2.eta : _item2.etd;
- services.push({ 'location': _dest.locationName, 'time': _time, 'status': _status2, 'platform': _platform, 'cancel': _item2.cancelReason, 'type': 'bus' });
- // ws = ws + `${dest.locationName} Bus ${via}
`;
- // ws = ws + '';
- ws = ws + '\uD83D\uDE8C ' + _dest.locationName + ' ' + _via + ' | ' + _time + ' | ' + _status2 + ' | ' + _platform + ' |
';
- }
- } catch (err) {
- _didIteratorError2 = true;
- _iteratorError2 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
- _iterator2.return();
- }
- } finally {
- if (_didIteratorError2) {
- throw _iteratorError2;
- }
- }
- }
- }ws = ws + '
';
- this.$traintext.empty().html(ws);
- this.$traintext.removeClass('mui--hide').addClass('mui--show');
- } else this.$traintext.removeClass('mui--show').addClass('mui--hide');
- },
- 'initView': function initView() {
- // el: $('#myView').get(0)
- var self = this;
- var target = this.model.get('target');
- var html = '' + target.toUpperCase() + ':
';
- this.$html = $(html);
- this.$html.on('click', function () {
- // console.log(self)
- self.model.getRoute();
- });
- this.$trains.append(this.$html);
-
- // this.el = `#${target}`;
-
- this.$button = $('#' + target);
-
- var output = 'OFF';
- var status = output === 'on time' ? 'ontime' : 'delayed';
-
- this.$button.html(output);
- this.$button.removeClass('delayed').removeClass('ontime').addClass(status);
-
- var cevent = 'click #$(target)';
- this.events[cevent] = 'showTrains';
- },
- 'showTrains': function showTrains() {
- void 0;
- }
-
-});
-'use strict';
-
-/**
- *
- * User: Martin Donnelly
- * Date: 2016-10-03
- * Time: 14:20
- *
- */
-
-var WeatherModel = Backbone.Model.extend({
- 'initialize': function initialize() {
- var geo = this.get('geo');
- this.set('url', 'https://api.darksky.net/forecast/9ad2a41d420f3cf4960571bb886f710c/' + geo.coords.latitude.toString() + ',' + geo.coords.longitude.toString() + '?units=uk2&exclude=minutely,hourly,alerts,flags');
- this.update();
- },
- 'update': function update() {
- var _this = this;
-
- this.getWeather();
- var now = new Date();
- var mod = 1800000 - now.getTime() % 1800000;
- var weatherTrigger = function weatherTrigger() {
- _this.update();
- };
-
- setTimeout(weatherTrigger.bind(this), mod + 10);
- },
- 'getWeather': function getWeather() {
- var self = this;
- $.ajax({
- 'type': 'GET',
- 'url': self.get('url'),
- 'data': '',
- 'dataType': 'jsonp',
- 'timeout': 10000,
- '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 success(data) {
- var stored = {
- 'temperature': data.currently.temperature,
- 'icon': data.currently.icon,
- 'summary': data.currently.summary,
- 'daily': data.daily.summary
- };
- self.set(stored);
- },
- 'error': function error(xhr, type) {
- void 0;
- void 0;
- void 0;
- }
- });
- }
-});
-
-var Weather = Backbone.View.extend({
- 'tagName': 'div',
- 'initialize': function initialize() {
- _.bindAll(this, 'render');
- this.model.bind('change', this.render);
- this.$weatherText = $('#weatherDescription');
- this.$weatherTemp = $('#temp');
- this.$weatherIcon = $('#weatherIcon');
- },
- 'render': function render() {
- void 0;
-
- var ws = '';
-
- this.$weatherTemp.empty().html(parseInt(this.model.get('temperature')) + '°c ');
- this.$weatherText.empty().html(this.model.get('summary'));
-
- this.$weatherIcon.empty().html(ws);
- }
-
-});
-
-var WeatherSlim = Backbone.View.extend({
- 'tagName': 'div',
- 'initialize': function initialize() {
- _.bindAll(this, 'render');
- this.model.bind('change', this.render);
- this.$weather = $('#weather');
- this.render();
- },
- 'render': function render() {
- var summary = this.model.get('summary');
- var temp = this.model.get('temperature');
- var daily = this.model.get('daily');
-
- var ws = summary + ' ' + temp + '° ' + daily + '';
-
- this.$weather.empty().html(ws);
- }
-
-});
-'use strict';
-
-/**
- * Created by mdonnel on 20/04/2017.
- */
-/*_.templateSettings = {
- 'evaluate': /\{\{(.+?)\}\}/g,
- 'interpolate': /\{\{=(.+?)\}\}/g,
- 'escape': /\{\{-(.+?)\}\}/g
-};*/
-
-Array.prototype.random = function () {
- return this[Math.floor(Math.random() * this.length)];
-};
-
-var PasswordView = Backbone.View.extend({
- 'el': '#passwords',
- 'passwordTemplate': _.template('Long: <%=long%>
Short: <%=short%>
'),
- 'initialize': function initialize() {
- 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': numberCluster,
- 'randomAmount': randomAmount,
- 'newClick': newClick
-
-});
-
-function randomAmount(i) {
- var str = '';
-
- for (var t = 0; t < i; t++) {
- str = str + this.alpha.random();
- }return str;
-}
-
-function newClick(e) {
- var long = (this.left.random() + ' ' + this.right.random() + ' ' + this.numberCluster()).split(' ').join(this.whitespace.random());
- var short = (this.randomAmount(5) + ' ' + this.randomAmount(5)).split(' ').join(this.whitespace.random());
- var html = this.passwordTemplate({
- 'long': long,
- 'short': short
- });
- this.passwordOut.removeClass('mui--hide');
- this.passwordOut.empty().append(html);
-}
-
-function numberCluster() {
- return this.numbers.random() + this.numbers.random() + this.numbers.random();
-}
-'use strict';
-
-(function () {
- document.title = 'Slack';
-})();
-
-var popitout = function popitout(url) {
- var newwindow = window.open(url, 'name', 'height=600,width=570');
- if (window.focus) {
- newwindow.focus();
- }
- return false;
-};
-
-var popitoutSmall = function popitoutSmall(url) {
- var newwindow = window.open(url, 'name', 'height=400,width=520');
- if (window.focus) {
- newwindow.focus();
- }
- return false;
-};
\ No newline at end of file
+"use strict";function reduceOpenWeather(t){var e=moment(1e3*t.dt),i=t.weather[0];return{timestamp:t.dt,icon:"wi-owm-"+i.id,summary:i.description,tempHigh:parseInt(t.temp.max,10),tempLow:parseInt(t.temp.min,10),datelong:e.format(),time:t.dt,date:e.format("D/M"),day:e.format("ddd")}}function reduceDarkSky(t){var e=moment(1e3*t.time);return{timestamp:t.time,icon:weatherIcons.get(t.icon),summary:t.summary,tempHigh:parseInt(t.temperatureHigh,10),tempLow:parseInt(t.temperatureLow,10),datelong:e.format(),time:t.time,date:e.format("D/M"),day:e.format("ddd")}}function randomAmount(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,trend:0};this.set("btcdata",t),this.set("balance",0),this.update(),this.updateHourly()},update:function(){this.getBTC(),(new Date).getTime()},updateHourly:function(){this.getBalance(),(new Date).getTime()},recalc:function(){var t=this.get("btcdata"),e=t.lastGBP,i=void 0,n=t.gbp,s=t.usd,a=t.lows,o=t.highs,r=t.eclass,l=t.balance,d=t.trend;void 0!==d&&null!==d||(d=1),void 0!==n&&(0!==t.lastGBP?r=n>e?"up":"down":(a.gbp=n,a.usd=s,o.gbp=n,o.usd=s),e=n,i=s,n1?"trendUp":t.trend<1?"trendDown":"",this.$trend.removeClass(),this.$trend.addClass(s),this.$btc.removeClass(),this.$btc.addClass(t.eclass),this.$btc.html("$"+parseFloat(t.lastUSD.toFixed(2))+" / £"+parseFloat(t.lastGBP.toFixed(2))+" ₿"+e+" £"+parseFloat(i.toFixed(2))+"
"),this.$btc.prop("title",n)}}),FxModel=Backbone.Model.extend({initialize:function(){this.set("url","/fx"),this.set("fxdata",{}),this.update()},update:function(){var t,e;this.getFX(),t=9e5-(new Date).getTime()%9e5,e=function(){this.update()},setTimeout(e.bind(this),t+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,n,s={};void 0!==t.rates&&(n=(i=1/t.rates.GBP)*t.rates.SEK,s={usd:1,gbp:t.rates.GBP,sek:t.rates.SEK,gpbe:i,sekex:n}),e.set("fxdata",s)},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(){this.get("from"),this.get("to");var t="/getnexttraintimes?from="+this.get("from")+"&to="+this.get("to"),e="/gettrains?from="+this.get("from")+"&to="+this.get("to"),i=this.get("from")+this.get("to");this.set("url",t),this.set("routeUrl",e),this.set("target",i),this.set("visible",!1),this.set("trainData",{eta:"OFF",sta:"OFF"}),this.update()},update:function(){var t,e=new Date,i=e.getHours(),n=i<6?36e5:6e4,s=n-e.getTime()%n;i>=6?this.getTrain():this.set("trainData",{eta:"OFF",sta:"OFF"}),t=function(){this.update()},setTimeout(t.bind(this),s+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,n,s,a,o,r,l,d,c,h,u,m,p,b,f,g,v,w,y,T,C,k,A=this.model.get("trainData"),S=this.model.get("visible"),x=this.model.get("route"),$="on time"===A.eta.toLowerCase()?A.sta:A.eta,E="on time"===A.eta.toLowerCase()?"ontime":"delayed";if(this.$button.html($),this.$button.removeClass("delayed").removeClass("ontime").addClass(E),S){if(t=""+x.locationName+" TO "+x.filterLocationName+'
\n \n Destination | \n Time | \n Status | \n Platform |
\n ',e=[],"object"===_typeof(x.trainServices)&&null!==x.trainServices){i=!0,n=!1,s=void 0;try{for(a=x.trainServices[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)d=null!==(l=(r=o.value).destination[0]).via?""+l.via+"":"",c=null!==r.platform?r.platform:"💠",h=null!==r.sta?r.sta:"D "+r.std,u=null!==r.eta?r.eta:r.etd,e.push({location:l.locationName,time:h,status:u,platform:c,cancel:r.cancelReason,type:"train"}),t=r.isCancelled?t+""+l.locationName+" "+d+" | "+h+' | \n ❌ '+r.cancelReason+" |
":t+""+l.locationName+" "+d+" | \n "+h+" | \n "+u+" | \n "+c+" | \n
"}catch(t){n=!0,s=t}finally{try{!i&&a.return&&a.return()}finally{if(n)throw s}}}if("object"===_typeof(x.busServices)&&null!==x.busServices){m=!0,p=!1,b=void 0;try{for(f=x.busServices[Symbol.iterator]();!(m=(g=f.next()).done);m=!0)y=null!==(w=(v=g.value).destination[0]).via?""+w.via+"":"",T=null!==v.platform?v.platform:"",C=null!==v.sta?v.sta:"D "+v.std,k=null!==v.eta?v.eta:v.etd,e.push({location:w.locationName,time:C,status:k,platform:T,cancel:v.cancelReason,type:"bus"}),t=t+"🚌 "+w.locationName+" "+y+" | "+C+" | "+k+" | "+T+" |
"}catch(t){p=!0,b=t}finally{try{!m&&f.return&&f.return()}finally{if(p)throw b}}}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,n=this,s=this.model.get("target"),a=""+s.toUpperCase()+':
';this.$html=$(a),this.$html.on("click",function(){n.model.getRoute()}),this.$trains.append(this.$html),this.$button=$("#"+s),e="on time"===(t="OFF")?"ontime":"delayed",this.$button.html(t),this.$button.removeClass("delayed").removeClass("ontime").addClass(e),i="click #$(target)",this.events[i]="showTrains"},showTrains:function(){}}),WCollection=Backbone.Collection.extend({url:"/weather",parse:function(t){return t.list.map(function(t){return reduceOpenWeather(t)})}}),WView=Backbone.View.extend({tagName:"div",template:_.template('\n <% _.each(data, function(item) {%>\n \n
\n
<%= item.day %>
\n
<%= item.date %>
\n
\n
\n
\n \n <%= item.tempHigh %>° /\n <%= item.tempLow %>°
\n
<%= item.summary %>
\n
\n
\n <% }); \n %>'),initialize:function(){_.bindAll(this,"render"),this.collection=new WCollection,this.listenTo(this.collection,"reset sync",_.debounce(_.bind(this.render),128)),this.collection.fetch()},render:function(){if(0!==this.collection.length){var t={data:this.collection.toJSON()};this.$el.html(this.template(t))}}}),Array.prototype.random=function(){return this[Math.floor(Math.random()*this.length)]},PasswordView=Backbone.View.extend({el:"#passwords",passwordTemplate:_.template("Long: <%=long%>
Short: <%=short%>
"),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:numberCluster,randomAmount:randomAmount,newClick:newClick}),document.title="Slack",popitout=function(t){var e=window.open(t,"name","height=600,width=570");return window.focus&&e.focus(),!1},popitoutSmall=function(t){var e=window.open(t,"name","height=400,width=520");return window.focus&&e.focus(),!1};
\ No newline at end of file
diff --git a/app/live/js/vendor.js b/app/live/js/vendor.js
index 08e7d69..2aaa266 100644
--- a/app/live/js/vendor.js
+++ b/app/live/js/vendor.js
@@ -1,3 +1,18 @@
-!function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t)}):e(t)}(this,function(t){var e=function(){function $(t){return null==t?String(t):S[C.call(t)]||"object"}function F(t){return"function"==$(t)}function k(t){return null!=t&&t==t.window}function M(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function R(t){return"object"==$(t)}function Z(t){return R(t)&&!k(t)&&Object.getPrototypeOf(t)==Object.prototype}function z(t){var e=!!t&&"length"in t&&t.length,n=r.type(t);return"function"!=n&&!k(t)&&("array"==n||0===e||"number"==typeof e&&e>0&&e-1 in t)}function q(t){return a.call(t,function(t){return null!=t})}function H(t){return t.length>0?r.fn.concat.apply([],t):t}function I(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function V(t){return t in l?l[t]:l[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function _(t,e){return"number"!=typeof e||h[I(t)]?e:e+"px"}function B(t){var e,n;return c[t]||(e=f.createElement(t),f.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),c[t]=n),c[t]}function U(t){return"children"in t?u.call(t.children):r.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function X(t,e){var n,r=t?t.length:0;for(n=0;r>n;n++)this[n]=t[n];this.length=r,this.selector=e||""}function J(t,r,i){for(n in r)i&&(Z(r[n])||L(r[n]))?(Z(r[n])&&!Z(t[n])&&(t[n]={}),L(r[n])&&!L(t[n])&&(t[n]=[]),J(t[n],r[n],i)):r[n]!==e&&(t[n]=r[n])}function W(t,e){return null==e?r(t):r(t).filter(e)}function Y(t,e,n,r){return F(e)?e.call(t,n,r):e}function G(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function K(t,n){var r=t.className||"",i=r&&r.baseVal!==e;return n===e?i?r.baseVal:r:void(i?r.baseVal=n:t.className=n)}function Q(t){try{return t?"true"==t||"false"!=t&&("null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?r.parseJSON(t):t):t}catch(e){return t}}function tt(t,e){e(t);for(var n=0,r=t.childNodes.length;r>n;n++)tt(t.childNodes[n],e)}var e,n,r,i,O,P,o=[],s=o.concat,a=o.filter,u=o.slice,f=t.document,c={},l={},h={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},p=/^\s*<(\w+|!)[^>]*>/,d=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,g=/^(?:body|html)$/i,y=["val","css","html","text","data","width","height","offset"],x=["after","prepend","before","append"],b=f.createElement("table"),E=f.createElement("tr"),j={tr:f.createElement("tbody"),tbody:b,thead:b,tfoot:b,td:E,th:E,"*":f.createElement("div")},w=/complete|loaded|interactive/,T=/^[\w-]*$/,S={},C=S.toString,N={},A=f.createElement("div"),D={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},L=Array.isArray||function(t){return t instanceof Array};return N.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var r,i=t.parentNode,o=!i;return o&&(i=A).appendChild(t),r=~N.qsa(i,e).indexOf(t),o&&A.removeChild(t),r},O=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},P=function(t){return a.call(t,function(e,n){return t.indexOf(e)==n})},N.fragment=function(t,n,i){var o,s,a;return d.test(t)&&(o=r(f.createElement(RegExp.$1))),o||(t.replace&&(t=t.replace(/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,"<$1>$2>")),n===e&&(n=p.test(t)&&RegExp.$1),n in j||(n="*"),a=j[n],a.innerHTML=""+t,o=r.each(u.call(a.childNodes),function(){a.removeChild(this)})),Z(i)&&(s=r(o),r.each(i,function(t,e){y.indexOf(t)>-1?s[t](e):s.attr(t,e)})),o},N.Z=function(t,e){return new X(t,e)},N.isZ=function(t){return t instanceof N.Z},N.init=function(t,n){var i;if(!t)return N.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&p.test(t))i=N.fragment(t,RegExp.$1,n),t=null;else{if(n!==e)return r(n).find(t);i=N.qsa(f,t)}else{if(F(t))return r(f).ready(t);if(N.isZ(t))return t;if(L(t))i=q(t);else if(R(t))i=[t],t=null;else if(p.test(t))i=N.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==e)return r(n).find(t);i=N.qsa(f,t)}}return N.Z(i,t)},r=function(t,e){return N.init(t,e)},r.extend=function(t){var e,n=u.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){J(t,n,e)}),t},N.qsa=function(t,e){var n,r="#"==e[0],i=!r&&"."==e[0],o=r||i?e.slice(1):e,s=T.test(o);return t.getElementById&&s&&r?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:u.call(s&&!r&&t.getElementsByClassName?i?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},r.contains=f.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},r.type=$,r.isFunction=F,r.isWindow=k,r.isArray=L,r.isPlainObject=Z,r.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},r.isNumeric=function(t){var e=Number(t),n=typeof t;return null!=t&&"boolean"!=n&&("string"!=n||t.length)&&!isNaN(e)&&isFinite(e)||!1},r.inArray=function(t,e,n){return o.indexOf.call(e,t,n)},r.camelCase=O,r.trim=function(t){return null==t?"":String.prototype.trim.call(t)},r.uuid=0,r.support={},r.expr={},r.noop=function(){},r.map=function(t,e){var n,i,o,r=[];if(z(t))for(i=0;i=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return o.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return F(t)?this.not(this.not(t)):r(a.call(this,function(e){return N.matches(e,t)}))},add:function(t,e){return r(P(this.concat(r(t,e))))},is:function(t){return this.length>0&&N.matches(this[0],t)},not:function(t){var n=[];if(F(t)&&t.call!==e)this.each(function(e){t.call(this,e)||n.push(this)});else{var i="string"==typeof t?this.filter(t):z(t)&&F(t.item)?u.call(t):r(t);this.forEach(function(t){i.indexOf(t)<0&&n.push(t)})}return r(n)},has:function(t){return this.filter(function(){return R(t)?r.contains(this,t):r(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!R(t)?t:r(t)},last:function(){var t=this[this.length-1];return t&&!R(t)?t:r(t)},find:function(t){var n=this;return t?"object"==typeof t?r(t).filter(function(){var t=this;return o.some.call(n,function(e){return r.contains(e,t)})}):1==this.length?r(N.qsa(this[0],t)):this.map(function(){return N.qsa(this,t)}):r()},closest:function(t,e){var n=[],i="object"==typeof t&&r(t);return this.each(function(r,o){for(;o&&!(i?i.indexOf(o)>=0:N.matches(o,t));)o=o!==e&&!M(o)&&o.parentNode;o&&n.indexOf(o)<0&&n.push(o)}),r(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=r.map(n,function(t){return(t=t.parentNode)&&!M(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return W(e,t)},parent:function(t){return W(P(this.pluck("parentNode")),t)},children:function(t){return W(this.map(function(){return U(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||u.call(this.childNodes)})},siblings:function(t){return W(this.map(function(t,e){return a.call(U(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return r.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=B(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=F(t);if(this[0]&&!e)var n=r(t).get(0),i=n.parentNode||this.length>1;return this.each(function(o){r(this).wrapAll(e?t.call(this,o):i?n.cloneNode(!0):n)})},wrapAll:function(t){if(this[0]){r(this[0]).before(t=r(t));for(var e;(e=t.children()).length;)t=e.first();r(t).append(this)}return this},wrapInner:function(t){var e=F(t);return this.each(function(n){var i=r(this),o=i.contents(),s=e?t.call(this,n):t;o.length?o.wrapAll(s):i.append(s)})},unwrap:function(){return this.parent().each(function(){r(this).replaceWith(r(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var n=r(this);(t===e?"none"==n.css("display"):t)?n.show():n.hide()})},prev:function(t){return r(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return r(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;r(this).empty().append(Y(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=Y(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this.pluck("textContent").join(""):null},attr:function(t,r){var i;return"string"!=typeof t||1 in arguments?this.each(function(e){if(1===this.nodeType)if(R(t))for(n in t)G(this,n,t[n]);else G(this,t,Y(this,r,e,this.getAttribute(t)))}):0 in this&&1==this[0].nodeType&&null!=(i=this[0].getAttribute(t))?i:e},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){G(this,t)},this)})},prop:function(t,e){return t=D[t]||t,1 in arguments?this.each(function(n){this[t]=Y(this,e,n,this[t])}):this[0]&&this[0][t]},removeProp:function(t){return t=D[t]||t,this.each(function(){delete this[t]})},data:function(t,n){var r="data-"+t.replace(/([A-Z])/g,"-$1").toLowerCase(),i=1 in arguments?this.attr(r,n):this.attr(r);return null!==i?Q(i):e},val:function(t){return 0 in arguments?(null==t&&(t=""),this.each(function(e){this.value=Y(this,t,e,this.value)})):this[0]&&(this[0].multiple?r(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(e){if(e)return this.each(function(t){var n=r(this),i=Y(this,e,t,n.offset()),o=n.offsetParent().offset(),s={top:i.top-o.top,left:i.left-o.left};"static"==n.css("position")&&(s.position="relative"),n.css(s)});if(!this.length)return null;if(f.documentElement!==this[0]&&!r.contains(f.documentElement,this[0]))return{top:0,left:0};var n=this[0].getBoundingClientRect();return{left:n.left+t.pageXOffset,top:n.top+t.pageYOffset,width:Math.round(n.width),height:Math.round(n.height)}},css:function(t,e){if(arguments.length<2){var i=this[0];if("string"==typeof t){if(!i)return;return i.style[O(t)]||getComputedStyle(i,"").getPropertyValue(t)}if(L(t)){if(!i)return;var o={},s=getComputedStyle(i,"");return r.each(t,function(t,e){o[e]=i.style[O(e)]||s.getPropertyValue(e)}),o}}var a="";if("string"==$(t))e||0===e?a=I(t)+":"+_(t,e):this.each(function(){this.style.removeProperty(I(t))});else for(n in t)t[n]||0===t[n]?a+=I(n)+":"+_(n,t[n])+";":this.each(function(){this.style.removeProperty(I(n))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(r(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return!!t&&o.some.call(this,function(t){return this.test(K(t))},V(t))},addClass:function(t){return t?this.each(function(e){if("className"in this){i=[];var n=K(this);Y(this,t,e,n).split(/\s+/g).forEach(function(t){r(this).hasClass(t)||i.push(t)},this),i.length&&K(this,n+(n?" ":"")+i.join(" "))}}):this},removeClass:function(t){return this.each(function(n){if("className"in this){if(t===e)return K(this,"");i=K(this),Y(this,t,n,i).split(/\s+/g).forEach(function(t){i=i.replace(V(t)," ")}),K(this,i.trim())}})},toggleClass:function(t,n){return t?this.each(function(i){var o=r(this);Y(this,t,i,K(this)).split(/\s+/g).forEach(function(t){(n===e?!o.hasClass(t):n)?o.addClass(t):o.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var n="scrollTop"in this[0];return t===e?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var n="scrollLeft"in this[0];return t===e?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),i=g.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(r(t).css("margin-top"))||0,n.left-=parseFloat(r(t).css("margin-left"))||0,i.top+=parseFloat(r(e[0]).css("border-top-width"))||0,i.left+=parseFloat(r(e[0]).css("border-left-width"))||0,{top:n.top-i.top,left:n.left-i.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||f.body;t&&!g.test(t.nodeName)&&"static"==r(t).css("position");)t=t.offsetParent;return t})}},r.fn.detach=r.fn.remove,["width","height"].forEach(function(t){var n=t.replace(/./,function(t){return t[0].toUpperCase()});r.fn[t]=function(i){var o,s=this[0];return i===e?k(s)?s["inner"+n]:M(s)?s.documentElement["scroll"+n]:(o=this.offset())&&o[t]:this.each(function(e){s=r(this),s.css(t,Y(this,i,e,s[t]()))})}}),x.forEach(function(n,i){var o=i%2;r.fn[n]=function(){var n,a,s=r.map(arguments,function(t){var i=[];return n=$(t),"array"==n?(t.forEach(function(t){return t.nodeType!==e?i.push(t):r.zepto.isZ(t)?i=i.concat(t.get()):void(i=i.concat(N.fragment(t)))}),i):"object"==n||null==t?t:N.fragment(t)}),u=this.length>1;return s.length<1?this:this.each(function(e,n){a=o?n:n.parentNode,n=0==i?n.nextSibling:1==i?n.firstChild:2==i?n:null;var c=r.contains(f.documentElement,a);s.forEach(function(e){if(u)e=e.cloneNode(!0);else if(!a)return r(e).remove();a.insertBefore(e,n),c&&tt(e,function(e){if(!(null==e.nodeName||"SCRIPT"!==e.nodeName.toUpperCase()||e.type&&"text/javascript"!==e.type||e.src)){var n=e.ownerDocument?e.ownerDocument.defaultView:t;n.eval.call(n,e.innerHTML)}})})})},r.fn[o?n+"To":"insert"+(i?"Before":"After")]=function(t){return r(t)[n](this),this}}),N.Z.prototype=X.prototype=r.fn,N.uniq=P,N.deserializeValue=Q,r.zepto=N,r}();return t.Zepto=e,void 0===t.$&&(t.$=e),function(e){function h(t){return t._zid||(t._zid=n++)}function p(t,e,n,r){if(e=d(e),e.ns)var i=m(e.ns);return(a[h(t)]||[]).filter(function(t){return t&&(!e.e||t.e==e.e)&&(!e.ns||i.test(t.ns))&&(!n||h(t.fn)===h(n))&&(!r||t.sel==r)})}function d(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function m(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function g(t,e){return t.del&&!f&&t.e in c||!!e}function v(t){return l[t]||f&&c[t]||t}function y(t,n,i,o,s,u,f){var c=h(t),p=a[c]||(a[c]=[]);n.split(/\s/).forEach(function(n){if("ready"==n)return e(document).ready(i);var a=d(n);a.fn=i,a.sel=s,a.e in l&&(i=function(t){var n=t.relatedTarget;return!n||n!==this&&!e.contains(this,n)?a.fn.apply(this,arguments):void 0}),a.del=u;var c=u||i;a.proxy=function(e){if(e=T(e),!e.isImmediatePropagationStopped()){e.data=o;var n=c.apply(t,e._args==r?[e]:[e].concat(e._args));return n===!1&&(e.preventDefault(),e.stopPropagation()),n}},a.i=p.length,p.push(a),"addEventListener"in t&&t.addEventListener(v(a.e),a.proxy,g(a,f))})}function x(t,e,n,r,i){var o=h(t);(e||"").split(/\s/).forEach(function(e){p(t,e,n,r).forEach(function(e){delete a[o][e.i],"removeEventListener"in t&&t.removeEventListener(v(e.e),e.proxy,g(e,i))})})}function T(t,n){return(n||!t.isDefaultPrevented)&&(n||(n=t),e.each(w,function(e,r){var i=n[e];t[e]=function(){return this[r]=b,i&&i.apply(n,arguments)},t[r]=E}),t.timeStamp||(t.timeStamp=Date.now()),(n.defaultPrevented!==r?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(t.isDefaultPrevented=b)),t}function S(t){var e,n={originalEvent:t};for(e in t)j.test(e)||t[e]===r||(n[e]=t[e]);return T(n,t)}var r,n=1,i=Array.prototype.slice,o=e.isFunction,s=function(t){return"string"==typeof t},a={},u={},f="onfocusin"in t,c={focus:"focusin",blur:"focusout"},l={mouseenter:"mouseover",mouseleave:"mouseout"};u.click=u.mousedown=u.mouseup=u.mousemove="MouseEvents",e.event={add:y,remove:x},e.proxy=function(t,n){var r=2 in arguments&&i.call(arguments,2);if(o(t)){var a=function(){return t.apply(n,r?r.concat(i.call(arguments)):arguments)};return a._zid=h(t),a}if(s(n))return r?(r.unshift(t[n],t),e.proxy.apply(null,r)):e.proxy(t[n],t);throw new TypeError("expected function")},e.fn.bind=function(t,e,n){return this.on(t,e,n)},e.fn.unbind=function(t,e){return this.off(t,e)},e.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var b=function(){return!0},E=function(){return!1},j=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,w={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};e.fn.delegate=function(t,e,n){return this.on(e,t,n)},e.fn.undelegate=function(t,e,n){return this.off(e,t,n)},e.fn.live=function(t,n){return e(document.body).delegate(this.selector,t,n),this},e.fn.die=function(t,n){return e(document.body).undelegate(this.selector,t,n),this},e.fn.on=function(t,n,a,u,f){var c,l,h=this;return t&&!s(t)?(e.each(t,function(t,e){h.on(t,n,a,e,f)}),h):(s(n)||o(u)||u===!1||(u=a,a=n,n=r),(u===r||a===!1)&&(u=a,a=r),u===!1&&(u=E),h.each(function(r,o){f&&(c=function(t){return x(o,t.type,u),u.apply(this,arguments)}),n&&(l=function(t){var r,s=e(t.target).closest(n,o).get(0);return s&&s!==o?(r=e.extend(S(t),{currentTarget:s,liveFired:o}),(c||u).apply(s,[r].concat(i.call(arguments,1)))):void 0}),y(o,t,u,a,n,l||c)}))},e.fn.off=function(t,n,i){var a=this;return t&&!s(t)?(e.each(t,function(t,e){a.off(t,n,e)}),a):(s(n)||o(i)||i===!1||(i=n,n=r),i===!1&&(i=E),a.each(function(){x(this,t,i,n)}))},e.fn.trigger=function(t,n){return t=s(t)||e.isPlainObject(t)?e.Event(t):T(t),t._args=n,this.each(function(){t.type in c&&"function"==typeof this[t.type]?this[t.type]():"dispatchEvent"in this?this.dispatchEvent(t):e(this).triggerHandler(t,n)})},e.fn.triggerHandler=function(t,n){var r,i;return this.each(function(o,a){r=S(s(t)?e.Event(t):t),r._args=n,r.target=a,e.each(p(a,t.type||t),function(t,e){return i=e.proxy(r),!r.isImmediatePropagationStopped()&&void 0})}),i},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(t){e.fn[t]=function(e){return 0 in arguments?this.bind(t,e):this.trigger(t)}}),e.Event=function(t,e){s(t)||(e=t,t=e.type);var n=document.createEvent(u[t]||"Events"),r=!0;if(e)for(var i in e)"bubbles"==i?r=!!e[i]:n[i]=e[i];return n.initEvent(t,r,!0),T(n)}}(e),function(e){function p(t,n,r){var i=e.Event(n);return e(t).trigger(i,r),!i.isDefaultPrevented()}function d(t,e,n,i){return t.global?p(e||r,n,i):void 0}function m(t){t.global&&0==e.active++&&d(t,null,"ajaxStart")}function g(t){t.global&&!--e.active&&d(t,null,"ajaxStop")}function v(t,e){var n=e.context;return e.beforeSend.call(n,t,e)!==!1&&d(e,n,"ajaxBeforeSend",[t,e])!==!1&&void d(e,n,"ajaxSend",[t,e])}function y(t,e,n,r){var i=n.context,o="success";n.success.call(i,t,o,e),r&&r.resolveWith(i,[t,o,e]),d(n,i,"ajaxSuccess",[e,n,t]),b(o,e,n)}function x(t,e,n,r,i){var o=r.context;r.error.call(o,n,e,t),i&&i.rejectWith(o,[n,e,t]),d(r,o,"ajaxError",[n,r,t||e]),b(e,n,r)}function b(t,e,n){var r=n.context;n.complete.call(r,e,t),d(n,r,"ajaxComplete",[e,n]),g(n)}function E(t,e,n){if(n.dataFilter==j)return t;var r=n.context;return n.dataFilter.call(r,t,e)}function j(){}function w(t){return t&&(t=t.split(";",2)[0]),t&&(t==c?"html":t==f?"json":a.test(t)?"script":u.test(t)&&"xml")||"text"}function T(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function S(t){t.processData&&t.data&&"string"!=e.type(t.data)&&(t.data=e.param(t.data,t.traditional)),!t.data||t.type&&"GET"!=t.type.toUpperCase()&&"jsonp"!=t.dataType||(t.url=T(t.url,t.data),t.data=void 0)}function C(t,n,r,i){return e.isFunction(n)&&(i=r,r=n,n=void 0),e.isFunction(r)||(i=r,r=void 0),{url:t,data:n,success:r,dataType:i}}function O(t,n,r,i){var o,s=e.isArray(n),a=e.isPlainObject(n);e.each(n,function(n,u){o=e.type(u),i&&(n=r?i:i+"["+(a||"object"==o||"array"==o?n:"")+"]"),!i&&s?t.add(u.name,u.value):"array"==o||!r&&"object"==o?O(t,u,r,n):t.add(n,u)})}var i,o,n=+new Date,r=t.document,a=/^(?:text|application)\/javascript/i,u=/^(?:text|application)\/xml/i,f="application/json",c="text/html",l=/^\s*$/,h=r.createElement("a");h.href=t.location.href,e.active=0,e.ajaxJSONP=function(i,o){if(!("type"in i))return e.ajax(i);var c,p,s=i.jsonpCallback,a=(e.isFunction(s)?s():s)||"Zepto"+n++,u=r.createElement("script"),f=t[a],l=function(t){e(u).triggerHandler("error",t||"abort")},h={abort:l};return o&&o.promise(h),e(u).on("load error",function(n,r){clearTimeout(p),e(u).off().remove(),"error"!=n.type&&c?y(c[0],h,i,o):x(null,r||"error",h,i,o),t[a]=f,c&&e.isFunction(f)&&f(c[0]),f=c=void 0}),v(h,i)===!1?(l("abort"),h):(t[a]=function(){c=arguments},u.src=i.url.replace(/\?(.+)=\?/,"?$1="+a),r.head.appendChild(u),i.timeout>0&&(p=setTimeout(function(){l("timeout")},i.timeout)),h)},e.ajaxSettings={type:"GET",beforeSend:j,success:j,error:j,complete:j,context:null,global:!0,xhr:function(){return new t.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:f,xml:"application/xml, text/xml",html:c,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0,dataFilter:j},e.ajax=function(n){var u,f,s=e.extend({},n||{}),a=e.Deferred&&e.Deferred();for(i in e.ajaxSettings)void 0===s[i]&&(s[i]=e.ajaxSettings[i]);m(s),s.crossDomain||(u=r.createElement("a"),u.href=s.url,u.href=u.href,s.crossDomain=h.protocol+"//"+h.host!=u.protocol+"//"+u.host),s.url||(s.url=t.location.toString()),(f=s.url.indexOf("#"))>-1&&(s.url=s.url.slice(0,f)),S(s);var c=s.dataType,p=/\?.+=\?/.test(s.url);if(p&&(c="jsonp"),s.cache!==!1&&(n&&n.cache===!0||"script"!=c&&"jsonp"!=c)||(s.url=T(s.url,"_="+Date.now())),"jsonp"==c)return p||(s.url=T(s.url,s.jsonp?s.jsonp+"=?":s.jsonp===!1?"":"callback=?")),e.ajaxJSONP(s,a);var P,d=s.accepts[c],g={},b=function(t,e){g[t.toLowerCase()]=[t,e]},C=/^([\w-]+:)\/\//.test(s.url)?RegExp.$1:t.location.protocol,N=s.xhr(),O=N.setRequestHeader;if(a&&a.promise(N),s.crossDomain||b("X-Requested-With","XMLHttpRequest"),b("Accept",d||"*/*"),(d=s.mimeType||d)&&(d.indexOf(",")>-1&&(d=d.split(",",2)[0]),N.overrideMimeType&&N.overrideMimeType(d)),(s.contentType||s.contentType!==!1&&s.data&&"GET"!=s.type.toUpperCase())&&b("Content-Type",s.contentType||"application/x-www-form-urlencoded"),s.headers)for(o in s.headers)b(o,s.headers[o]);if(N.setRequestHeader=b,N.onreadystatechange=function(){if(4==N.readyState){N.onreadystatechange=j,clearTimeout(P);var t,n=!1;if(N.status>=200&&N.status<300||304==N.status||0==N.status&&"file:"==C){if(c=c||w(s.mimeType||N.getResponseHeader("content-type")),"arraybuffer"==N.responseType||"blob"==N.responseType)t=N.response;else{t=N.responseText;try{t=E(t,c,s),"script"==c?(0,eval)(t):"xml"==c?t=N.responseXML:"json"==c&&(t=l.test(t)?null:e.parseJSON(t))}catch(r){n=r}if(n)return x(n,"parsererror",N,s,a)}y(t,N,s,a)}else x(N.statusText||null,N.status?"error":"abort",N,s,a)}},v(N,s)===!1)return N.abort(),x(null,"abort",N,s,a),N;var A=!("async"in s)||s.async;if(N.open(s.type,s.url,A,s.username,s.password),s.xhrFields)for(o in s.xhrFields)N[o]=s.xhrFields[o];for(o in g)O.apply(N,g[o]);return s.timeout>0&&(P=setTimeout(function(){N.onreadystatechange=j,N.abort(),x(null,"timeout",N,s,a)},s.timeout)),N.send(s.data?s.data:null),N},e.get=function(){return e.ajax(C.apply(null,arguments))},e.post=function(){var t=C.apply(null,arguments);return t.type="POST",e.ajax(t)},e.getJSON=function(){var t=C.apply(null,arguments);return t.dataType="json",e.ajax(t)},e.fn.load=function(t,n,r){if(!this.length)return this;var a,i=this,o=t.split(/\s/),u=C(t,n,r),f=u.success;return o.length>1&&(u.url=o[0],a=o[1]),u.success=function(t){i.html(a?e("").html(t.replace(/