45 lines
198 KiB
JavaScript
45 lines
198 KiB
JavaScript
|
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||
|
const SOCKETMANAGER=require("./js/v2/slackSocket"),{BitcoinModel:BitcoinModel,Bitcoin:Bitcoin}=require("./js/v2/bitcoin"),{EventModel:EventModel,EventView:EventView}=require("./js/v2/events"),{FxModel:FxModel,FxView:FxView}=require("./js/v2/fx"),{TrainModel:TrainModel,TrainView:TrainView}=require("./js/v2/train"),PasswordView=require("./js/v2/password"),WView=require("./js/v2/weatherV2");!function(e){const n=new SOCKETMANAGER,i=new BitcoinModel;n.setBTC(i),e.contractEnds=new EventView({model:new EventModel({event:new Date(2019,5,28),label:"Contract Ends:"})}),e.bitcoin=new Bitcoin({model:i}),e.fx=new FxView({model:new FxModel}),e.dbqglqView=new TrainView({model:new TrainModel({from:"dbe",to:"glq"})}),e.glqdbeView=new TrainView({model:new TrainModel({from:"glq",to:"dbe"})}),e.glqhymView=new TrainView({model:new TrainModel({from:"glq",to:"hym"})}),e.hymglqView=new TrainView({model:new TrainModel({from:"hym",to:"glq"})}),e.passwords=new PasswordView,e.wview=new WView({el:document.getElementById("weather")}),n.turnOn()}(window);
|
||
|
|
||
|
},{"./js/v2/bitcoin":2,"./js/v2/events":3,"./js/v2/fx":4,"./js/v2/password":5,"./js/v2/slackSocket":6,"./js/v2/train":7,"./js/v2/weatherV2":8}],2:[function(require,module,exports){
|
||
|
const $=require("jquery"),_=require("underscore"),Backbone=require("backbone"),BitcoinModel=Backbone.Model.extend({initialize:function(){this.set("url","/btc"),this.set("balanceUrl","/balance");this.set("btcdata",{lastGBP:0,lastUSD:0,lows:{gbp:0,usd:0},highs:{gbp:0,usd:0},eclass:"",balance:0,trend:0}),this.set("balance",0),this.update(),this.updateHourly()},update:function(){this.getBTC()},updateHourly:function(){this.getBalance()},recalc:function(){let t,e=this.get("btcdata"),s=e.lastGBP;const o=e.gbp,a=e.usd,n=e.lows,l=e.highs;let c=e.eclass;const i=e.balance;let r=e.trend;void 0!==r&&null!==r||(r=1),void 0!==o&&(0!==e.lastGBP?c=o>s?"up":"down":(n.gbp=o,n.usd=a,l.gbp=o,l.usd=a),s=o,t=a,o<n.gbp&&(n.gbp=o),a<n.usd&&(n.usd=a),l.gbp<o&&(l.gbp=o),l.usd<a&&(l.usd=a),e={lastGBP:s,lastUSD:t,lows:n,highs:l,eclass:c,balance:i,trend:r}),e.stub=Math.random(Number.MAX_SAFE_INTEGER).toString(32),this.set("btcdata",e)},getBTC:function(){console.log(">> getBTC");const t=this,e=this.get("url");$.ajax({type:"GET",url:e,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(e){let s=e.bpi.GBP.rate_float,o=e.bpi.USD.rate_float;const a=e.trend,n=t.get("btcdata");n.gbp=s,n.usd=o,n.trend=a,t.set("btcdata",n),t.recalc()},error:function(t,e){console.log("ajax error"),console.log(t),console.log(e)}})},getBalance:function(){const t=this,e=this.get("balanceUrl");$.ajax({type:"GET",url:e,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(e){const s=e.balance;t.set("balance",s),t.recalc()},error:function(t,e){console.log("ajax error"),console.log(t),console.log(e)}})},btcFromSocket:function(t){console.log(">> btc from the socket",t);const e=t.bpi.GBP.rate_float,s=t.bpi.USD.rate_float,o=t.trend,a=this.get("btcdata");a.gbp=e,a.usd=s,a.trend=o,this.set("btcdata",a),this.recalc()},balanceFromSocket:function(t){console.log(">> balance from the socket",t);const e=t.balance;this.set("balance",e),this.recalc()}}),Bitcoin=Backbone.View.extend({tagName:"div",initialize:function(){_.bindAll(this,"render"),this.model.bind("change",this.render),this.$btc=$("#btc"),this.$trend=$("#trend")},render:function(){const t=this.model.get("btcdata"),e=this.model.get("balance"),s=parseFloat(t.lastGBP)*parseFloat(e),o=`High: $${parseFloat(t.highs.usd.toFixed(2))} / Low $${parseFloat(t.lows.usd.toFixed(2))}`;let a="";a=t.trend>1?"trendUp":t.trend<1?"trendDown":"",this.$trend.removeClass(),this.$trend.addClass(a),this.$btc.removeClass(),this.$btc.addClass(t.eclass),this.$btc.html(`$${parseFloat(t.lastUSD.toFixed(2))} / £${parseFloat(t.lastGBP.toFixed(2))} <div>₿${e} £${parseFloat(s.toFixed(2))}</div>`),this.$btc.prop("title",o)}});module.exports={BitcoinModel:BitcoinModel,Bitcoin:Bitcoin};
|
||
|
|
||
|
},{"backbone":10,"jquery":11,"underscore":13}],3:[function(require,module,exports){
|
||
|
const $=require("jquery"),_=require("underscore"),Backbone=require("backbone"),EventModel=Backbone.Model.extend({initialize:function(){this.update()},getDays:function(e,t){const i=e.getTime();return(t.getTime()-i)/864e5},update:function(){const e=new Date,t=36e5-e.getTime()%36e5,i={};i.days=Math.ceil(this.getDays(e,this.get("event"))),i.weeks=Math.ceil(this.getDays(e,this.get("event"))/7),this.set("data",i);setTimeout(function(){this.update()}.bind(this),t+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(){const e=this.model.get("label"),t=this.model.get("data"),i=`${e} ${t.days} days / ${t.weeks} weeks`;this.$myEvent.empty().append(i)},initView:function(){const e=`<div class='mui-col-xs-12 mui-col-md-3' id="${this.id}"></div>`;this.$html=$(e),this.$events.append(this.$html),this.$myEvent=$(`#${this.id}`)}});module.exports={EventModel:EventModel,EventView:EventView};
|
||
|
|
||
|
},{"backbone":10,"jquery":11,"underscore":13}],4:[function(require,module,exports){
|
||
|
const $=require("jquery"),_=require("underscore"),Backbone=require("backbone"),FxModel=Backbone.Model.extend({initialize:function(){this.set("url","/fx"),this.set("fxdata",{}),this.update()},update:function(){this.getFX();const e=9e5-(new Date).getTime()%9e5;setTimeout(function(){this.update()}.bind(this),e+10)},getFX:function(){const e=this.get("url"),t=this;$.ajax({type:"GET",url:e,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(e){let o={};if(void 0!==e.rates){const t=1/e.rates.GBP,s=t*e.rates.SEK;o={usd:1,gbp:e.rates.GBP,sek:e.rates.SEK,gpbe:t,sekex:s}}t.set("fxdata",o)},error:function(e,t){console.log("ajax error"),console.log(e),console.log(t)}})}}),FxView=Backbone.View.extend({tagName:"div",initialize:function(){_.bindAll(this,"render"),this.model.bind("change",this.render),this.$fx=$("#fx")},render:function(){const e=this.model.get("fxdata");this.$fx.html(`£1 = $${parseFloat(e.gpbe.toFixed(2))} = ${parseFloat(e.sekex.toFixed(2))} SEK`)}});module.exports={FxModel:FxModel,FxView:FxView};
|
||
|
|
||
|
},{"backbone":10,"jquery":11,"underscore":13}],5:[function(require,module,exports){
|
||
|
const $=require("jquery"),_=require("underscore"),Backbone=require("backbone");Array.prototype.random=function(){return this[Math.floor(Math.random()*this.length)]};const PasswordView=Backbone.View.extend({el:"#passwords",passwordTemplate:_.template("<div>Long: <%=long%></div><div>Short: <%=short%></div>"),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});function randomAmount(e){let r="";for(let a=0;a<e;a++)r+=this.alpha.random();return r}function newClick(e){const r=`${this.left.random()} ${this.right.random()} ${this.numberCluster()}`.split(" ").join(this.whitespace.random()),a=`${this.randomAmount(5)} ${this.randomAmount(5)}`.split(" ").join(this.whitespace.random()),n=this.passwordTemplate({long:r,short:a});this.passwordOut.removeClass("mui--hide"),this.passwordOut.empty().append(n)}function numberCluster(){return this.numbers.random()+this.numbers.random()+this.numbers.random()}module.exports=PasswordView;
|
||
|
|
||
|
},{"backbone":10,"jquery":11,"underscore":13}],6:[function(require,module,exports){
|
||
|
"use strict";const _=require("underscore"),Backbone=require("backbone"),WEBSOCKET=require("./websocket"),SOCKETMANAGER=Backbone.Model.extend({initialize:function(){_.bindAll(this,"turnOn","turnOff"),this.listeningID=null,this.listening=!1,this.webSocket=new WEBSOCKET(this),this.on("message",function(t){console.log("On message",this.listening),this.listening&&this.checkItem(t)})},turnOn:function(){console.log("Socket now listening"),this.listening=!0},turnOff:function(){this.listening=!1},listenFor:function(t){this.listeningID=this.deviceId.indexOf(t)},checkItem:function(t){t.hasOwnProperty("id")&&(console.log("id:",t.id),"btc"===t.id&&void 0!==this.btc&&this.btc.btcFromSocket(t.data),"balance"===t.id&&void 0!==this.btc&&this.btc.balanceFromSocket(t.data))},setBTC:function(t){this.btc=t},setTrain:function(t){this.train=t},getUpdate:function(){this.webSocket.send("update")}});module.exports=SOCKETMANAGER;
|
||
|
|
||
|
},{"./websocket":9,"backbone":10,"underscore":13}],7:[function(require,module,exports){
|
||
|
const $=require("jquery"),_=require("underscore"),Backbone=require("backbone"),TrainModel=Backbone.Model.extend({initialize:function(){this.get("from"),this.get("to");const t=`https://traintimes.silvrtree.co.uk/getnexttraintimes?from=${this.get("from")}&to=${this.get("to")}`,e=`https://traintimes.silvrtree.co.uk/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(){const t=new Date,e=t.getHours(),i=e<6?36e5:6e4,s=i-t.getTime()%i;e>=6?this.getTrain():this.set("trainData",{eta:"OFF",sta:"OFF"});setTimeout(function(){this.update()}.bind(this),s+10)},getTrain:function(){const 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){console.log("ajax error"),console.log(t),console.log(e)}})},getRoute:function(){const 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){console.error("ajax error"),console.error(t),console.error(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(){const t=this.model.get("trainData"),e=this.model.get("visible"),i=this.model.get("route"),s="on time"===t.eta.toLowerCase()?t.sta:t.eta,o="on time"===t.eta.toLowerCase()?"ontime":"delayed";if(this.$button.html(s),this.$button.removeClass("delayed").removeClass("ontime").addClass(o),e){let t=`<div>${i.locationName} TO ${i.filterLocationName}</div>\n <table class="mui-table mui-table-bordered">\n <tr><th>Destination</th>\n <th>Time</th>\n <th>Status</th>\n <th>Platform</th></tr>\n `;const e=[];if("object"==typeof i.trainServices&&null!==i.trainServices)for(const s of i.trainServices){const i=s.destination[0],o=null!==i.via?`<em>${i.via}</em>`:"",n=null!==s.platform?s.platform:"💠",a=null!==s.sta?s.sta:`D ${s.std}`,r=null!==s.eta?s.eta:s.etd;e.push({location:i.locationName,time:a,status:r,platform:n,cancel:s.cancelReason,type:"train"}),t=s.isCancelled?`${t}<tr><td>${i.locationName} ${o}</td><td>${a}</td>\n <td colspan="2">❌ ${s.cancelReason}</td></tr>`:`${t}<tr><td>${i.locationName} ${o}</td>\n <td>${a}</td>\n <td>${r}</td>\n <td>${n}</td>\n </tr>`}if("object"==typeof i.busServices&&null!==i.busServices)for(const s of i.busServices){const i=s.destination[0],o=null!==i.via?`<em>${i.via}</em>`:"",n=null!==s.platform?s.platform:"",a=null!==s.sta?s.sta:`D ${s.std}`,r=null!==s.eta?s.eta:s.etd;e.push({location:i.locationName,time:a,status:r,platform:n,cancel:s.cancelReason,type:"bus"}),t=`${t}<tr><td>🚌 ${i.locationName} ${o}</td><td>${a}</td><td>${r}</td><td>${n}</td></tr>`}t=`${t}</table>`,this.$traintext.empty().html(t),this.$traintext.removeClass("mui--hide").addClass("mui--show")}else this.$traintext.removeClass("mui--show").addClass("mui--hide")},initView:function(){const t=this,e=this.model.get("target"),i=`<div class='mui-col-xs-12 mui-col-md-6'>${e.toUpperCase()}: <button class="mui-btn mui-btn--flat" id="${e}"></button></div>`;this.$html=$(i),this.$html.on("click",function(){t.model.getRoute()}),this.$trains.append(this.$html),this.$button=$(`#${e}`);this.$button.html("OFF"),this.$butto
|
||
|
|
||
|
},{"backbone":10,"jquery":11,"underscore":13}],8:[function(require,module,exports){
|
||
|
const $=require("jquery"),moment=require("moment"),_=require("underscore"),Backbone=require("backbone");function reduceOpenWeather(e){const t=moment(1e3*e.dt),i=e.weather[0];return{timestamp:e.dt,icon:`wi-owm-${i.id}`,summary:i.description,tempHigh:parseInt(e.temp.max,10),tempLow:parseInt(e.temp.min,10),tempMorn:parseInt(e.temp.morn,10),tempDay:parseInt(e.temp.day,10),tempEve:parseInt(e.temp.eve,10),tempNight:parseInt(e.temp.night,10),datelong:t.format(),time:e.dt,date:t.format("D/M"),day:t.format("ddd")}}function reduceDarkSky(e){const t=moment(1e3*e.time);return{timestamp:e.time,icon:weatherIcons.get(e.icon),summary:e.summary,tempHigh:parseInt(e.temperatureHigh,10),tempLow:parseInt(e.temperatureLow,10),datelong:t.format(),time:e.time,date:t.format("D/M"),day:t.format("ddd")}}const WCollection=Backbone.Collection.extend({url:"/weather",parse:function(e){return e.list.map(e=>reduceOpenWeather(e))}}),WView=Backbone.View.extend({tagName:"div",template:_.template('\n <% _.each(data, function(item) {%>\n<div class="card mui--z1 mui-col-md-6 mui-col-lg-4">\n <div class="mui-col-md-3 mui-col-xs-3">\n <div class="mui--text-accent mui--text-title day mui--text-center"><%= item.day %></div>\n <div class="mui--text-dark-secondary mui--text-subhead mui--text-center"><%= item.date %></div>\n </div>\n <div class="mui-col-md-7 mui-col-xs-7">\n <div>\n <i class="mui--text-headline wi <%= item.icon %>"></i>\n <span class="mui--text-display1 temp<%=item.tempHigh %>"><%= item.tempHigh %>°</span> /\n <span class="mui--text-headline temp<%=item.tempLow %>"><%= item.tempLow %>°</span>\n </div>\n <div class="mui--text-caption summary"><%= item.summary %></div>\n </div>\n <div class="mui-col-md-2 mui-col-xs-2">\n <div class="mui--text-caption"><%= item.tempMorn %>°</div>\n <div class="mui--text-caption"><%= item.tempDay %>°</div>\n <div class="mui--text-caption"><%= item.tempEve %>°</div>\n <div class="mui--text-caption"><%= item.tempNight %>°</div>\n </div>\n</div>\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){const e={data:this.collection.toJSON()};this.$el.html(this.template(e))}}});module.exports=WView;
|
||
|
|
||
|
},{"backbone":10,"jquery":11,"moment":12,"underscore":13}],9:[function(require,module,exports){
|
||
|
const WEBSOCKET=function(t){let e=["localhost","silvrtree.co.uk"],o="9000";"https:"===document.location.protocol?(e=`wss://${e[1]}`,o=""):(e=`ws://${e[0]}`,o="9000"),console.log(">> wsUrl",e),this.socket=null,this.timer=0,this.clock=null,this.startWebSocket=function(){"use strict";const t=""===o?e:`${e}:${o}`;console.log("Starting socket",t);const s=window.MozWebSocket?MozWebSocket:WebSocket;this.socket=new s(t,"stream"),this.socket.onopen=this.handleWebsocketOnOpen.bind(this),this.socket.onmessage=this.handleWebsocketMessage.bind(this),this.socket.onclose=this.handleWebsocketClose.bind(this),this.socket.onerror=function(t){console.error(t)}},this.send=function(t){console.log("Sending",t),this.socket.send(t)},this.handleData=function(e){t.trigger("message",e)},this.handleWebsocketOnOpen=function(){"use strict";this.retry=0,console.log("**** Websocket Connected ****"),this.clock=new Date},this.handleWebsocketMessage=function(t){let e;try{e=JSON.parse(t.data)}catch(t){}e&&this.handleData.call(this,e)},this.handleWebsocketClose=function(){console.error("WebSocket Connection Closed.");new Date;console.log("Socket alive for",.001);const t=this;console.log("Waiting ",15e3),this.timer=setTimeout(function(){t.startWebSocket()},15e3)},this.startWebSocket()};module.exports=WEBSOCKET;
|
||
|
|
||
|
},{}],10:[function(require,module,exports){
|
||
|
(function (global){
|
||
|
!function(t){var e="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global;if("function"==typeof define&&define.amd)define(["underscore","jquery","exports"],function(i,n,s){e.Backbone=t(e,s,i,n)});else if("undefined"!=typeof exports){var i,n=require("underscore");try{i=require("jquery")}catch(t){}t(e,exports,n,i)}else e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}(function(t,e,i,n){var s=t.Backbone,r=Array.prototype.slice;e.VERSION="1.4.0",e.$=n,e.noConflict=function(){return t.Backbone=s,this},e.emulateHTTP=!1,e.emulateJSON=!1;var o,a=e.Events={},h=/\s+/,u=function(t,e,n,s,r){var o,a=0;if(n&&"object"==typeof n){void 0!==s&&"context"in r&&void 0===r.context&&(r.context=s);for(o=i.keys(n);a<o.length;a++)e=u(t,e,o[a],n[o[a]],r)}else if(n&&h.test(n))for(o=n.split(h);a<o.length;a++)e=t(e,o[a],s,r);else e=t(e,n,s,r);return e};a.on=function(t,e,i){(this._events=u(l,this._events||{},t,e,{context:i,ctx:this,listening:o}),o)&&((this._listeners||(this._listeners={}))[o.id]=o,o.interop=!1);return this},a.listenTo=function(t,e,n){if(!t)return this;var s=t._listenId||(t._listenId=i.uniqueId("l")),r=this._listeningTo||(this._listeningTo={}),a=o=r[s];a||(this._listenId||(this._listenId=i.uniqueId("l")),a=o=r[s]=new v(this,t));var h=c(t,e,n,this);if(o=void 0,h)throw h;return a.interop&&a.on(e,n),this};var l=function(t,e,i,n){if(i){var s=t[e]||(t[e]=[]),r=n.context,o=n.ctx,a=n.listening;a&&a.count++,s.push({callback:i,context:r,ctx:r||o,listening:a})}return t},c=function(t,e,i,n){try{t.on(e,i,n)}catch(t){return t}};a.off=function(t,e,i){return this._events?(this._events=u(d,this._events,t,e,{context:i,listeners:this._listeners}),this):this},a.stopListening=function(t,e,n){var s=this._listeningTo;if(!s)return this;for(var r=t?[t._listenId]:i.keys(s),o=0;o<r.length;o++){var a=s[r[o]];if(!a)break;a.obj.off(e,n,this),a.interop&&a.off(e,n)}return i.isEmpty(s)&&(this._listeningTo=void 0),this};var d=function(t,e,n,s){if(t){var r,o=s.context,a=s.listeners,h=0;if(e||o||n){for(r=e?[e]:i.keys(t);h<r.length;h++){var u=t[e=r[h]];if(!u)break;for(var l=[],c=0;c<u.length;c++){var d=u[c];if(n&&n!==d.callback&&n!==d.callback._callback||o&&o!==d.context)l.push(d);else{var f=d.listening;f&&f.off(e,n)}}l.length?t[e]=l:delete t[e]}return t}for(r=i.keys(a);h<r.length;h++)a[r[h]].cleanup()}};a.once=function(t,e,i){var n=u(f,{},t,e,this.off.bind(this));return"string"==typeof t&&null==i&&(e=void 0),this.on(n,e,i)},a.listenToOnce=function(t,e,i){var n=u(f,{},e,i,this.stopListening.bind(this,t));return this.listenTo(t,n)};var f=function(t,e,n,s){if(n){var r=t[e]=i.once(function(){s(e,r),n.apply(this,arguments)});r._callback=n}return t};a.trigger=function(t){if(!this._events)return this;for(var e=Math.max(0,arguments.length-1),i=Array(e),n=0;n<e;n++)i[n]=arguments[n+1];return u(p,this._events,t,void 0,i),this};var p=function(t,e,i,n){if(t){var s=t[e],r=t.all;s&&r&&(r=r.slice()),s&&g(s,n),r&&g(r,[e].concat(n))}return t},g=function(t,e){var i,n=-1,s=t.length,r=e[0],o=e[1],a=e[2];switch(e.length){case 0:for(;++n<s;)(i=t[n]).callback.call(i.ctx);return;case 1:for(;++n<s;)(i=t[n]).callback.call(i.ctx,r);return;case 2:for(;++n<s;)(i=t[n]).callback.call(i.ctx,r,o);return;case 3:for(;++n<s;)(i=t[n]).callback.call(i.ctx,r,o,a);return;default:for(;++n<s;)(i=t[n]).callback.apply(i.ctx,e);return}},v=function(t,e){this.id=t._listenId,this.listener=t,this.obj=e,this.interop=!0,this.count=0,this._events=void 0};v.prototype.on=a.on,v.prototype.off=function(t,e){var i;this.interop?(this._events=u(d,this._events,t,e,{context:void 0,listeners:void 0}),i=!this._events):(this.count--,i=0===this.count),i&&this.cleanup()},v.prototype.cleanup=function(){delete this.listener._listeningTo[this.obj._listenId],this.interop||delete this.obj._listeners[this.id]},a.bind=a.on,a.unbind=a.off,i.extend(e,a);var m=e.Model=function(t,e){var n=t||{};e||(e={}),this.preinitialize.apply(this,arguments),this.cid=i.uniqueId(this.cidPrefix),this.attributes={},e.collection&&(this.collection=e.collection),e.parse&&(n=this.parse(n,e)||{});var s=i.result(t
|
||
|
|
||
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||
|
},{"jquery":11,"underscore":13}],11:[function(require,module,exports){
|
||
|
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},v=function(e){return null!=e&&e===e.window},y={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var i,o,a=(n=n||r).createElement("script");if(a.text=e,t)for(i in y)(o=t[i]||t.getAttribute&&t.getAttribute(i))&&a.setAttribute(i,o);n.head.appendChild(a).parentNode.removeChild(a)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b=function(e,t){return new b.fn.init(e,t)},w=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function T(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!v(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}b.fn=b.prototype={jquery:"3.4.1",constructor:b,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return b.each(this,e)},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},b.extend=b.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(b.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||b.isPlainObject(n)?n:{},i=!1,a[t]=b.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},b.extend({expando:"jQuery"+("3.4.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t){m(e,{nonce:t&&t.nonce})},each:function(e,t){var n,r=0;if(T(e))for(n=e.length;r<n&&!1!==t.call(e[r],r,e[r]);r++);else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(w,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(T(Object(e))?b.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,s=[];if(T(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(b.fn[Symbol.iterator]=n[Symbol.iterator]),b.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});var C=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,v,y,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ue(),k=ue(),S=ue(),N=ue(),A=function(e,t){return e===t&&(f=!0),0},D={}.hasOwnProperty,j=[],q=j.pop,L=j.push,H=j.push,O=j.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open
|
||
|
|
||
|
},{}],12:[function(require,module,exports){
|
||
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,t;function n(){return e.apply(null,arguments)}function s(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function i(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function r(e){return void 0===e}function a(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function o(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function u(e,t){var n,s=[];for(n=0;n<e.length;++n)s.push(t(e[n],n));return s}function l(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function h(e,t){for(var n in t)l(t,n)&&(e[n]=t[n]);return l(t,"toString")&&(e.toString=t.toString),l(t,"valueOf")&&(e.valueOf=t.valueOf),e}function d(e,t,n,s){return bt(e,t,n,s,!0).utc()}function c(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function f(e){if(null==e._isValid){var n=c(e),s=t.call(n.parsedDateParts,function(e){return null!=e}),i=!isNaN(e._d.getTime())&&n.overflow<0&&!n.empty&&!n.invalidMonth&&!n.invalidWeekday&&!n.weekdayMismatch&&!n.nullInput&&!n.invalidFormat&&!n.userInvalidated&&(!n.meridiem||n.meridiem&&s);if(e._strict&&(i=i&&0===n.charsLeftOver&&0===n.unusedTokens.length&&void 0===n.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return i;e._isValid=i}return e._isValid}function m(e){var t=d(NaN);return null!=e?h(c(t),e):c(t).userInvalidated=!0,t}t=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};var _=n.momentProperties=[];function y(e,t){var n,s,i;if(r(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),r(t._i)||(e._i=t._i),r(t._f)||(e._f=t._f),r(t._l)||(e._l=t._l),r(t._strict)||(e._strict=t._strict),r(t._tzm)||(e._tzm=t._tzm),r(t._isUTC)||(e._isUTC=t._isUTC),r(t._offset)||(e._offset=t._offset),r(t._pf)||(e._pf=c(t)),r(t._locale)||(e._locale=t._locale),_.length>0)for(n=0;n<_.length;n++)r(i=t[s=_[n]])||(e[s]=i);return e}var g=!1;function v(e){y(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===g&&(g=!0,n.updateOffset(this),g=!1)}function p(e){return e instanceof v||null!=e&&null!=e._isAMomentObject}function w(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function M(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=w(t)),n}function k(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(s=0;s<i;s++)(n&&e[s]!==t[s]||!n&&M(e[s])!==M(t[s]))&&a++;return a+r}function S(e){!1===n.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function D(e,t){var s=!0;return h(function(){if(null!=n.deprecationHandler&&n.deprecationHandler(null,e),s){for(var i,r=[],a=0;a<arguments.length;a++){if(i="","object"==typeof arguments[a]){for(var o in i+="\n["+a+"] ",arguments[0])i+=o+": "+arguments[0][o]+", ";i=i.slice(0,-2)}else i=arguments[a];r.push(i)}S(e+"\nArguments: "+Array.prototype.slice.call(r).join("")+"\n"+(new Error).stack),s=!1}return t.apply(this,arguments)},t)}var Y,O={};function T(e,t){null!=n.deprecationHandler&&n.deprecationHandler(e,t),O[e]||(S(t),O[e]=!0)}function b(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function x(e,t){var n,s=h({},e);for(n in t)l(t,n)&&(i(e[n])&&i(t[n])?(s[n]={},h(s[n],e[n]),h(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)l(e,n)&&!l(t,n)&&i(e[n])&&(s[n]=h({},s[n]));return s}function P(e){null!=e&&this.set(e)}n.suppressDeprecationWarnings=!1,n.deprecationHandler=null,Y=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)l(e,t)&&n.push(t);return n};var W={};function C(e,t){var n=e.toLowerCase();W[n]=W[n+"s"]=W[t]=e}function H(e){r
|
||
|
|
||
|
},{}],13:[function(require,module,exports){
|
||
|
(function (global){
|
||
|
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define("underscore",r):function(){var t=n._,e=r();n._=e,e.noConflict=function(){return n._=t,e}}()}(this,function(){var n="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||Function("return this")()||{},r=Array.prototype,t=Object.prototype,e="undefined"!=typeof Symbol?Symbol.prototype:null,u=r.push,o=r.slice,i=t.toString,a=t.hasOwnProperty,f=Array.isArray,c=Object.keys,l=Object.create,p=n.isNaN,s=n.isFinite,v=function(){};function h(n){return n instanceof h?n:this instanceof h?void(this._wrapped=n):new h(n)}var y=h.VERSION="1.10.2";function g(n,r,t){if(void 0===r)return n;switch(null==t?3:t){case 1:return function(t){return n.call(r,t)};case 3:return function(t,e,u){return n.call(r,t,e,u)};case 4:return function(t,e,u,o){return n.call(r,t,e,u,o)}}return function(){return n.apply(r,arguments)}}function d(n,r,t){return null==n?ur:Cn(n)?g(n,r,t):Ln(n)&&!Kn(n)?ir(n):or(n)}function m(n,r){return d(n,r,1/0)}function b(n,r,t){return h.iteratee!==m?h.iteratee(n,r):d(n,r,t)}function j(n,r){return r=null==r?n.length-1:+r,function(){for(var t=Math.max(arguments.length-r,0),e=Array(t),u=0;u<t;u++)e[u]=arguments[u+r];switch(r){case 0:return n.call(this,e);case 1:return n.call(this,arguments[0],e);case 2:return n.call(this,arguments[0],arguments[1],e)}var o=Array(r+1);for(u=0;u<r;u++)o[u]=arguments[u];return o[r]=e,n.apply(this,o)}}function _(n){if(!Ln(n))return{};if(l)return l(n);v.prototype=n;var r=new v;return v.prototype=null,r}function w(n){return function(r){return null==r?void 0:r[n]}}function x(n,r){return null!=n&&a.call(n,r)}function S(n,r){for(var t=r.length,e=0;e<t;e++){if(null==n)return;n=n[r[e]]}return t?n:void 0}h.iteratee=m;var A=Math.pow(2,53)-1,O=w("length");function M(n){var r=O(n);return"number"==typeof r&&r>=0&&r<=A}function E(n,r,t){var e,u;if(r=g(r,t),M(n))for(e=0,u=n.length;e<u;e++)r(n[e],e,n);else{var o=Sn(n);for(e=0,u=o.length;e<u;e++)r(n[o[e]],o[e],n)}return n}function N(n,r,t){r=b(r,t);for(var e=!M(n)&&Sn(n),u=(e||n).length,o=Array(u),i=0;i<u;i++){var a=e?e[i]:i;o[i]=r(n[a],a,n)}return o}function k(n){return function(r,t,e,u){var o=arguments.length>=3;return function(r,t,e,u){var o=!M(r)&&Sn(r),i=(o||r).length,a=n>0?0:i-1;for(u||(e=r[o?o[a]:a],a+=n);a>=0&&a<i;a+=n){var f=o?o[a]:a;e=t(e,r[f],f,r)}return e}(r,g(t,u,4),e,o)}}var I=k(1),T=k(-1);function B(n,r,t){var e=(M(n)?on:Tn)(n,r,t);if(void 0!==e&&-1!==e)return n[e]}function R(n,r,t){var e=[];return r=b(r,t),E(n,function(n,t,u){r(n,t,u)&&e.push(n)}),e}function F(n,r,t){r=b(r,t);for(var e=!M(n)&&Sn(n),u=(e||n).length,o=0;o<u;o++){var i=e?e[o]:o;if(!r(n[i],i,n))return!1}return!0}function q(n,r,t){r=b(r,t);for(var e=!M(n)&&Sn(n),u=(e||n).length,o=0;o<u;o++){var i=e?e[o]:o;if(r(n[i],i,n))return!0}return!1}function D(n,r,t,e){return M(n)||(n=On(n)),("number"!=typeof t||e)&&(t=0),ln(n,r,t)>=0}var W=j(function(n,r,t){var e,u;return Cn(r)?u=r:Kn(r)&&(e=r.slice(0,-1),r=r[r.length-1]),N(n,function(n){var o=u;if(!o){if(e&&e.length&&(n=S(n,e)),null==n)return;o=n[r]}return null==o?o:o.apply(n,t)})});function z(n,r){return N(n,or(r))}function P(n,r,t){var e,u,o=-1/0,i=-1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=M(n)?n:On(n)).length;a<f;a++)null!=(e=n[a])&&e>o&&(o=e);else r=b(r,t),E(n,function(n,t,e){((u=r(n,t,e))>i||u===-1/0&&o===-1/0)&&(o=n,i=u)});return o}function K(n,r,t){if(null==r||t)return M(n)||(n=On(n)),n[ar(n.length-1)];var e=M(n)?Dn(n):On(n),u=O(e);r=Math.max(Math.min(r,u),0);for(var o=u-1,i=0;i<r;i++){var a=ar(i,o),f=e[i];e[i]=e[a],e[a]=f}return e.slice(0,r)}function L(n,r){return function(t,e,u){var o=r?[[],[]]:{};return e=b(e,u),E(t,function(r,u){var i=e(r,u,t);n(o,r,i)}),o}}var V=L(function(n,r,t){x(n,t)?n[t].push(r):n[t]=[r]}),C=L(function(n,r,t){n[t]=r}),J=L(function(n,r,t){x(n,t)?n[t]++:n[t]=1}),U=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;var $=L(function(n,r,t){n[t?0:1].push(r)},!0);function G(n,r,t){return null
|
||
|
|
||
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||
|
},{}]},{},[1]);
|