From 1600a8f1ad388639f582566ccd7491537c7ffbb5 Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Mon, 3 Apr 2017 00:07:55 +0100 Subject: [PATCH] tidying up some stuff --- app/js/modules/bitcoin.js | 4 +- app/js/modules/train.js | 49 +---- gulpfile.js | 5 +- views/pages/slackV2-min.ejs | 392 ++++++++++++++++++++++++++++++++++++ views/pages/slackV2.ejs | 38 ++-- 5 files changed, 428 insertions(+), 60 deletions(-) create mode 100644 views/pages/slackV2-min.ejs diff --git a/app/js/modules/bitcoin.js b/app/js/modules/bitcoin.js index 312c0c9..d45f71b 100644 --- a/app/js/modules/bitcoin.js +++ b/app/js/modules/bitcoin.js @@ -17,7 +17,7 @@ let BitcoinModel = Backbone.Model.extend({ }, update: function () { this.getBTC(); - const now = new Date; + const now = new Date(); const mod = 60000 - (now.getTime() % 60000); let btcupdateFn = function() { @@ -28,7 +28,7 @@ let BitcoinModel = Backbone.Model.extend({ recalc: function () { let data = this.get('btcdata'); let lastGBP = data.lastGBP; - let lastUSD = data.lastUSD; + let lastUSD; let g = data.gbp; let u = data.usd; let lows = data.lows; diff --git a/app/js/modules/train.js b/app/js/modules/train.js index 58880d2..b585bed 100644 --- a/app/js/modules/train.js +++ b/app/js/modules/train.js @@ -8,7 +8,7 @@ let TrainModel = Backbone.Model.extend({ initialize: function () { - console.log(this.get('to')); + let fromStation = this.get('from'); let toStation = this.get('to'); let url = '/getnexttraintimes?from=' + fromStation + '&to=' + toStation; @@ -79,15 +79,15 @@ let TrainModel = Backbone.Model.extend({ }, success: function (data) { // getTrainsCB(data); - console.log('Got', data); + //console.log('Got', data); self.set('route', data); self.set('visible', true); }, error: function (xhr, type) { - console.log('ajax error'); - console.log(xhr); - console.log(type); + console.error('ajax error'); + console.error(xhr); + console.error(type); } }); } @@ -110,7 +110,7 @@ let TrainView = Backbone.View.extend({ 'click': 'showTrains' }, render: function () { - console.log('render!!'); + let output, status; let obj = this.model.get('trainData'); let visible = this.model.get('visible'); @@ -122,28 +122,6 @@ let TrainView = Backbone.View.extend({ this.$button.html(output); this.$button.removeClass('delayed').removeClass('ontime').addClass(status); - console.log('visible', visible); - - /* -
<%=locationName%> TO <%=filterLocationName%>
- - - - - - - <% trainServices.forEach(function (item) { %> - - - - - - - <% }) %> - -
DestinationTimeStatusPlatform
<%=item.destination[0].locationName%><%=item.sta%><%=item.eta%><%=item.platform%>
- */ - console.log('route', route); if (visible) { let ws = `
${route.locationName} TO ${route.filterLocationName}
@@ -153,17 +131,13 @@ let TrainView = Backbone.View.extend({ `; - console.log(typeof route.trainServices === 'object' && route.trainServices !== null); if (typeof route.trainServices === 'object' && route.trainServices !== null) { - for (item of route.trainServices) { - console.log(item); + for (let item of route.trainServices) { let dest = item.destination[0]; let via = dest.via !== null ? `${dest.via}` : ''; let platform = item.platform !== null ? item.platform : '💠'; let time = item.sta !== null ? item.sta : `D ${item.std}`; let status = item.eta !== null ? item.eta : item.etd; - // ws = ws + `
${dest.locationName} ${via}
`; - // ws = ws + '
' + item.sta + '
'; if (!item.isCancelled) { ws = ws + ` @@ -180,13 +154,11 @@ let TrainView = Backbone.View.extend({ `; } - console.log('item', item); } } if (typeof route.busServices === 'object' && route.busServices !== null) { - for (item of route.busServices) { - console.log(item); + for (let item of route.busServices) { let dest = item.destination[0]; let via = dest.via !== null ? `${dest.via}` : ''; let platform = item.platform !== null ? item.platform : ''; @@ -201,7 +173,6 @@ let TrainView = Backbone.View.extend({ `; - console.log('item', item); } } @@ -217,10 +188,10 @@ let TrainView = Backbone.View.extend({ //el: $('#myView').get(0) let self = this; let target = this.model.get('target'); - let html = `${target.toUpperCase()}: `; + let 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); diff --git a/gulpfile.js b/gulpfile.js index e474789..db2a4bf 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -72,4 +72,7 @@ gulp.task('vendor', function() { .pipe(concat('vendor.js')) .pipe(uglify({mangle: false})) .pipe(gulp.dest(dest + '/js')); - }); \ No newline at end of file + }); + + +gulp.task('default', ['appJS', 'vendor']); \ No newline at end of file diff --git a/views/pages/slackV2-min.ejs b/views/pages/slackV2-min.ejs new file mode 100644 index 0000000..7887376 --- /dev/null +++ b/views/pages/slackV2-min.ejs @@ -0,0 +1,392 @@ +<% include ../partials/head %> + + +
+
+
+
+
+
+
+
+
+ +
+ +
+ + + + + +
+ + + + +
+
Travel
+ +
+ +
+ +
+ +
+ + + +
+
+
Computer Software, etc.
+ +
+ +
+
Reference & Special sites
+ + +
+ + +
+ + +
+ +
+
+ + + + + + + diff --git a/views/pages/slackV2.ejs b/views/pages/slackV2.ejs index 63a132c..06ade13 100644 --- a/views/pages/slackV2.ejs +++ b/views/pages/slackV2.ejs @@ -73,7 +73,9 @@
  • WebSSH
  • Jade Tester
  • -
  • +
  • + +
  • @@ -105,7 +107,9 @@
    Package Tracking
    - +
    Weather
    @@ -226,9 +230,13 @@
    -
    Travel
    +
    Travel
    -
    + +
    +
    +
    +
    -
    Computer Software, etc.
    @@ -376,20 +383,15 @@
    Platform
    ${status} ${platform}