update contract end
This commit is contained in:
parent
b6f5646c3e
commit
04d9089f30
@ -15,6 +15,7 @@ let BitcoinModel = Backbone.Model.extend({
|
||||
balance: 0.0
|
||||
};
|
||||
this.set('btcdata', data);
|
||||
this.set('balance', 0);
|
||||
this.update();
|
||||
this.updateHourly();
|
||||
},
|
||||
@ -22,7 +23,7 @@ let BitcoinModel = Backbone.Model.extend({
|
||||
this.getBTC();
|
||||
//this.getBalance();
|
||||
const now = new Date();
|
||||
const mod = 60000 - (now.getTime() % 60000);
|
||||
const mod = 300000 - (now.getTime() % 300000);
|
||||
|
||||
let btcupdateFn = function() {
|
||||
this.update();
|
||||
@ -82,7 +83,7 @@ let BitcoinModel = Backbone.Model.extend({
|
||||
balance
|
||||
};
|
||||
}
|
||||
|
||||
data.stub = Math.random(Number.MAX_SAFE_INTEGER).toString(32);
|
||||
|
||||
this.set('btcdata', data);
|
||||
// total = myBTC * g;
|
||||
@ -90,6 +91,7 @@ let BitcoinModel = Backbone.Model.extend({
|
||||
getBTC: function () {
|
||||
let self = this;
|
||||
let url = this.get('url');
|
||||
console.log('>> getBTC');
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
@ -135,10 +137,8 @@ let BitcoinModel = Backbone.Model.extend({
|
||||
},
|
||||
success: function (data) {
|
||||
let balance = data.balance;
|
||||
let btcdata = self.get('btcdata');
|
||||
btcdata.balance = balance;
|
||||
|
||||
self.set('btcdata', btcdata);
|
||||
self.set('balance', balance);
|
||||
self.recalc();
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
@ -158,14 +158,15 @@ let Bitcoin = Backbone.View.extend({
|
||||
},
|
||||
render: function () {
|
||||
let btcdata = this.model.get('btcdata');
|
||||
let balance = this.model.get('balance');
|
||||
//console.log(`Balance: ${btcdata.balance.toFixed(4)}`);
|
||||
//console.log(btcdata.lastGBP);
|
||||
let owned = parseFloat(btcdata.lastGBP) * parseFloat(btcdata.balance);
|
||||
let owned = parseFloat(btcdata.lastGBP) * parseFloat(balance);
|
||||
//console.log(`owned: ${owned}`);
|
||||
let title = 'High: $' + parseFloat(btcdata.highs.usd.toFixed(2)) + ' / Low $' + parseFloat(btcdata.lows.usd.toFixed(2));
|
||||
this.$btc.removeClass();
|
||||
this.$btc.addClass(btcdata.eclass);
|
||||
this.$btc.html(`$${parseFloat(btcdata.lastUSD.toFixed(2)) } / £${parseFloat(btcdata.lastGBP.toFixed(2))} <div>${btcdata.balance} £${parseFloat(owned.toFixed(2))}</div>` );
|
||||
this.$btc.html(`$${parseFloat(btcdata.lastUSD.toFixed(2)) } / £${parseFloat(btcdata.lastGBP.toFixed(2))} <div>₿${balance} £${parseFloat(owned.toFixed(2))}</div>` );
|
||||
this.$btc.prop('title', title);
|
||||
}
|
||||
});
|
||||
|
@ -58,7 +58,7 @@ let FxModel = Backbone.Model.extend({
|
||||
});
|
||||
|
||||
|
||||
let FxView = Backbone.View.extend({
|
||||
const FxView = Backbone.View.extend({
|
||||
tagName: 'div',
|
||||
initialize: function () {
|
||||
_.bindAll(this, 'render');
|
||||
|
@ -2,80 +2,82 @@
|
||||
* Created by mdonnel on 20/04/2017.
|
||||
*/
|
||||
_.templateSettings = {
|
||||
interpolate: /\{\{(.+?)\}\}/g
|
||||
evaluate: /\{\{(.+?)\}\}/g,
|
||||
interpolate: /\{\{=(.+?)\}\}/g,
|
||||
escape: /\{\{-(.+?)\}\}/g
|
||||
};
|
||||
|
||||
Array.prototype.random = function () {
|
||||
return this[Math.floor((Math.random() * this.length))];
|
||||
return this[Math.floor((Math.random() * this.length))];
|
||||
};
|
||||
|
||||
let PasswordView = Backbone.View.extend({
|
||||
el:'#passwords',
|
||||
passwordTemplate: _.template($('#password-template').html()),
|
||||
initialize: function() {
|
||||
this.alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
||||
this.whitespace = ['.', '~', '#', '!', '$', '+', '-', '+'];
|
||||
this.numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
||||
this.left = ['Alabama',
|
||||
'Alaska',
|
||||
'Arizona',
|
||||
'Maryland',
|
||||
'Nevada',
|
||||
'Mexico',
|
||||
'Texas',
|
||||
'Utah',
|
||||
'Glasgow',
|
||||
'Inverness',
|
||||
'Edinburgh',
|
||||
'Dumbarton',
|
||||
'Balloch',
|
||||
'Renton',
|
||||
'Cardross',
|
||||
'Dundee',
|
||||
'Paisley',
|
||||
'Hamilton',
|
||||
'Greenock',
|
||||
'Falkirk',
|
||||
'Irvine',
|
||||
'Renfrew',
|
||||
'Erskine',
|
||||
'London',
|
||||
'Hammersmith',
|
||||
'Islington',
|
||||
'Silver', 'Black', 'Yellow', 'Purple', 'White', 'Pink', 'Red', 'Orange', 'Brown', 'Green', 'Blue', 'Amber', 'Aqua', 'Azure', 'Bronze', 'Coral', 'Copper', 'Crimson', 'Cyan', 'Ginger', 'Gold', 'Indigo', 'Jade'
|
||||
const PasswordView = Backbone.View.extend({
|
||||
el: '#passwords',
|
||||
passwordTemplate: _.template($('#password-template').html()),
|
||||
initialize: function () {
|
||||
this.alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
||||
this.whitespace = ['.', '~', '#', '!', '$', '+', '-', '+'];
|
||||
this.numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
||||
this.left = ['Alabama',
|
||||
'Alaska',
|
||||
'Arizona',
|
||||
'Maryland',
|
||||
'Nevada',
|
||||
'Mexico',
|
||||
'Texas',
|
||||
'Utah',
|
||||
'Glasgow',
|
||||
'Inverness',
|
||||
'Edinburgh',
|
||||
'Dumbarton',
|
||||
'Balloch',
|
||||
'Renton',
|
||||
'Cardross',
|
||||
'Dundee',
|
||||
'Paisley',
|
||||
'Hamilton',
|
||||
'Greenock',
|
||||
'Falkirk',
|
||||
'Irvine',
|
||||
'Renfrew',
|
||||
'Erskine',
|
||||
'London',
|
||||
'Hammersmith',
|
||||
'Islington',
|
||||
'Silver', 'Black', 'Yellow', 'Purple', 'White', 'Pink', 'Red', 'Orange', 'Brown', 'Green', 'Blue', 'Amber', 'Aqua', 'Azure', 'Bronze', 'Coral', 'Copper', 'Crimson', 'Cyan', 'Ginger', 'Gold', 'Indigo', 'Jade'
|
||||
|
||||
];
|
||||
];
|
||||
|
||||
this.right = ['Aganju', 'Cygni', 'Akeron', 'Antares', 'Aragoth', 'Ardus', 'Carpenter', 'Cooper', 'Dahin', 'Capella', 'Endriago', 'Gallina', 'Fenris', 'Freya', 'Glenn', 'Grissom', 'Jotunheim', 'Kailaasa', 'Lagarto', 'Muspelheim', 'Nifleheim', 'Primus', 'Vega', 'Ragnarok', 'Shepard', 'Slayton', 'Tarsis', 'Mercury', 'Venus', 'Mars', 'Earth', 'Terra', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto', 'Europa', 'Ganymede', 'Callisto', 'Titan', 'Juno', 'Eridanus', 'Scorpius', 'Crux', 'Cancer', 'Taurus', 'Lyra', 'Andromeda', 'Virgo', 'Aquarius', 'Cygnus', 'Corvus', 'Taurus', 'Draco', 'Perseus', 'Pegasus', 'Gemini', 'Columbia', 'Bootes', 'Orion', 'Deneb', 'Merope', 'Agate', 'Amber', 'Beryl', 'Calcite', 'Citrine', 'Coral', 'Diamond', 'Emerald', 'Garnet', 'Jade', 'Lapis', 'Moonstone', 'Obsidian', 'Onyx', 'Opal', 'Pearl', 'Quartz', 'Ruby', 'Sapphire', 'Topaz', 'Iron', 'Lead', 'Nickel', 'Copper', 'Zinc', 'Tin', 'Manes', 'Argon', 'Neon', 'Alpha', 'Bravo', 'Charlie', 'Delta', 'Echo', 'Foxtrot', 'Golf', 'Hotel', 'India', 'Juliett', 'Kilo', 'Lima', 'Mike', 'November', 'Oscar', 'Papa', 'Quebec', 'Romeo', 'Sierra', 'Tango', 'Uniform', 'Victor', 'Whisky', 'Xray', 'Yankee', 'Zulu'];
|
||||
this.right = ['Aganju', 'Cygni', 'Akeron', 'Antares', 'Aragoth', 'Ardus', 'Carpenter', 'Cooper', 'Dahin', 'Capella', 'Endriago', 'Gallina', 'Fenris', 'Freya', 'Glenn', 'Grissom', 'Jotunheim', 'Kailaasa', 'Lagarto', 'Muspelheim', 'Nifleheim', 'Primus', 'Vega', 'Ragnarok', 'Shepard', 'Slayton', 'Tarsis', 'Mercury', 'Venus', 'Mars', 'Earth', 'Terra', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto', 'Europa', 'Ganymede', 'Callisto', 'Titan', 'Juno', 'Eridanus', 'Scorpius', 'Crux', 'Cancer', 'Taurus', 'Lyra', 'Andromeda', 'Virgo', 'Aquarius', 'Cygnus', 'Corvus', 'Taurus', 'Draco', 'Perseus', 'Pegasus', 'Gemini', 'Columbia', 'Bootes', 'Orion', 'Deneb', 'Merope', 'Agate', 'Amber', 'Beryl', 'Calcite', 'Citrine', 'Coral', 'Diamond', 'Emerald', 'Garnet', 'Jade', 'Lapis', 'Moonstone', 'Obsidian', 'Onyx', 'Opal', 'Pearl', 'Quartz', 'Ruby', 'Sapphire', 'Topaz', 'Iron', 'Lead', 'Nickel', 'Copper', 'Zinc', 'Tin', 'Manes', 'Argon', 'Neon', 'Alpha', 'Bravo', 'Charlie', 'Delta', 'Echo', 'Foxtrot', 'Golf', 'Hotel', 'India', 'Juliett', 'Kilo', 'Lima', 'Mike', 'November', 'Oscar', 'Papa', 'Quebec', 'Romeo', 'Sierra', 'Tango', 'Uniform', 'Victor', 'Whisky', 'Xray', 'Yankee', 'Zulu'];
|
||||
|
||||
|
||||
this.passwordOut = this.$('#passwordOut');
|
||||
_.bindAll(this, "newClick");
|
||||
},
|
||||
events: {
|
||||
"click #newPassword" : "newClick"
|
||||
},
|
||||
numberCluster: function () {
|
||||
return this.numbers.random() + this.numbers.random() + this.numbers.random();
|
||||
},
|
||||
randomAmount: function (i) {
|
||||
let str = '';
|
||||
this.passwordOut = this.$('#passwordOut');
|
||||
_.bindAll(this, "newClick");
|
||||
},
|
||||
events: {
|
||||
"click #newPassword": "newClick"
|
||||
},
|
||||
numberCluster: function () {
|
||||
return this.numbers.random() + this.numbers.random() + this.numbers.random();
|
||||
},
|
||||
randomAmount: function (i) {
|
||||
let str = '';
|
||||
|
||||
for (let t = 0; t < i; t++) {
|
||||
str = str + this.alpha.random();
|
||||
}
|
||||
for (let t = 0; t < i; t++) {
|
||||
str = str + this.alpha.random();
|
||||
}
|
||||
|
||||
return str;
|
||||
},
|
||||
newClick: function(e) {
|
||||
let long= (this.left.random() + ' ' + this.right.random() + ' ' + this.numberCluster()).split(' ').join(this.whitespace.random());
|
||||
let short = (this.randomAmount(5) + ' ' + this.randomAmount(5)).split(' ').join(this.whitespace.random());
|
||||
return str;
|
||||
},
|
||||
newClick: function (e) {
|
||||
let long = (this.left.random() + ' ' + this.right.random() + ' ' + this.numberCluster()).split(' ').join(this.whitespace.random());
|
||||
let short = (this.randomAmount(5) + ' ' + this.randomAmount(5)).split(' ').join(this.whitespace.random());
|
||||
|
||||
this.passwordOut.removeClass('mui--hide');
|
||||
this.passwordOut.empty().append(this.passwordTemplate({
|
||||
long: long,
|
||||
short: short
|
||||
}));
|
||||
}
|
||||
this.passwordOut.removeClass('mui--hide');
|
||||
this.passwordOut.empty().append(this.passwordTemplate({
|
||||
long: long,
|
||||
short: short
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -24,7 +24,7 @@
|
||||
</div>
|
||||
|
||||
<script type="text/template" id="password-template">
|
||||
<div>Long: {{= long }}</div><div>Short: {{= short }}</div>
|
||||
<div>Long: {{=long }}</div><div>Short: {{=short }}</div>
|
||||
</script>
|
||||
</body>
|
||||
<script src="libs/ejs.js"></script>
|
||||
@ -39,7 +39,7 @@
|
||||
<script src="js/modules/password.js"></script>
|
||||
<script src="app.js"></script>
|
||||
<script>
|
||||
|
||||
// slackV2.ejs
|
||||
(function (w) {
|
||||
navigator.geolocation.getCurrentPosition((show_weather) => {
|
||||
w.weather = new WeatherSlim({model: new WeatherModel({geo:show_weather})});
|
||||
@ -52,6 +52,7 @@
|
||||
w.glqhymView = new TrainView({model: new TrainModel({from: 'glq', to: 'hym'})});
|
||||
w.hymglqView = new TrainView({model: new TrainModel({from: 'hym', to: 'glq'})});
|
||||
|
||||
console.log(PasswordView);
|
||||
w.passwords = new PasswordView();
|
||||
|
||||
})(window);
|
||||
|
Loading…
Reference in New Issue
Block a user