Diff
checker
Testo
Testo
Immagini
Documenti
Excel
Cartelle
Legal
Enterprise
Applicazione per desktop
Prezzi
Accedi
Scarica Diffchecker Desktop
Confronta il testo
Trova la differenza tra due file di testo
Strumenti
Cronologia
Editor live
Nascondi spazi bianchi
Comprimi invariate
Senza a capo
Layout
Diviso
Unificato
Livello di dettaglio
Intelligente
Parola
Carattere
Stili testo
Modifica aspetto
Evidenziazione sintassi
Scegli sintassi
Ignora
Trasforma testo
Vai alla prima modifica
Modifica input
Diffchecker Desktop
Il modo più sicuro per usare Diffchecker. Ottieni l'app Diffchecker Desktop: i tuoi diff non lasciano mai il tuo computer!
Ottieni Desktop
ShareBuy view before and after Rivets
Creato
10 anni fa
Il diff non scade mai
Eliminare
Esporta
Condividere
Spiegare
73 rimozioni
Linee
Totale
Rimosso
Caratteri
Totale
Rimosso
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
71 linee
Copia tutti
31 aggiunte
Linee
Totale
Aggiunto
Caratteri
Totale
Aggiunto
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
33 linee
Copia tutti
Copia
Copiato
Copia
Copiato
var toCurrency = require('../templates/helpers/formatcurrency');
var ShareBuyView = Marionette.ItemView.extend({
var ShareBuyView = Marionette.ItemView.extend({
Copia
Copiato
Copia
Copiato
template:
require('../templates/
newbuy.hbs'),
template:
false,
bindings: {
html:
require('../templates/
sharebuy.html'),
'[name=symbol]': {
observe: 'symbol',
events: ['blur']
},
'[name=price]': {
observe: 'price',
onGet: 'numToStr',
onSet: 'strToNum'
},
'[name=quantity]': {
observe: 'quantity',
onGet: 'numToStr',
onSet: 'strToNum'
},
'[name=date]': 'date'
},
initialize: function (options) {
initialize: function (options) {
Copia
Copiato
Copia
Copiato
this.state =
new Backbone.Model();
this.state =
{
isNew
:
!this.pristineModel
,
hasSymbol
:
!!this.symbol
}
;
this.state.set('
isNew
',
!this.pristineModel
);
if (this.state.
isNew
&& this.symbol) {
this.state.set('
hasSymbol
',
!!this.symbol
)
;
if (this.state.
get('
isNew
')
&& this.symbol) {
this.model.set('symbol', this.symbol.get('name'));
this.model.set('symbol', this.symbol.get('name'));
}
}
},
},
Copia
Copiato
Copia
Copiato
onBeforeRender: function() {
if (this.view) {
this.view.unbind();
this.view = null;
}
this.attachElContent(this.html);
this.view = rivets.bind(this.el, this);
},
onRender: function () {
onRender: function () {
this.updateMeanPrice();
this.updateMeanPrice();
Copia
Copiato
Copia
Copiato
this.stickit();
this.stickit(this.state, {
'#remove-buy': {
observe: 'isNew',
onGet: function (value) {
return !value
},
visible: true
},
'[name=symbol]':{
attributes: [
{
name: 'disabled',
observe: 'hasSymbol',
onGet: function (value) {
return value
}
}]
}
})
},
},
Copia
Copiato
Copia
Copiato
onDestroy: function() {
if (this.view) {
this.view.unbind();
this.view = null;
}
updateMeanPrice: function() {
updateMeanPrice: function() {
Copia
Copiato
Copia
Copiato
this.
$el.find('
.mean
-p
rice
').text(
this.symbol ?
toCurrency(
this.symbol.simulateMeanPrice(this.model)
)
:
'--')
;
this.
state
.mean
P
rice
=
this.symbol ?
this.symbol.simulateMeanPrice(this.model)
:
undefined
;
this.
$el.find('
.current
-m
ean
-p
rice
').text(
this.symbol ?
toCurrency(
this.symbol.meanPrice
) : '--');
this.
state
.current
M
ean
P
rice
=
this.symbol ?
this.symbol.meanPrice
: undefined;
},
}
strToNum: function (val) {
if (val != null) {
return +val;
}
},
numToStr: function (val) {
if (val != null) {
return val.toString();
}
}
});
});
Diff salvati
Testo originale
Apri file
var toCurrency = require('../templates/helpers/formatcurrency'); var ShareBuyView = Marionette.ItemView.extend({ template: require('../templates/newbuy.hbs'), bindings: { '[name=symbol]': { observe: 'symbol', events: ['blur'] }, '[name=price]': { observe: 'price', onGet: 'numToStr', onSet: 'strToNum' }, '[name=quantity]': { observe: 'quantity', onGet: 'numToStr', onSet: 'strToNum' }, '[name=date]': 'date' }, initialize: function (options) { this.state = new Backbone.Model(); this.state.set('isNew', !this.pristineModel); this.state.set('hasSymbol', !!this.symbol); if (this.state.get('isNew') && this.symbol) { this.model.set('symbol', this.symbol.get('name')); } }, onRender: function () { this.updateMeanPrice(); this.stickit(); this.stickit(this.state, { '#remove-buy': { observe: 'isNew', onGet: function (value) { return !value }, visible: true }, '[name=symbol]':{ attributes: [ { name: 'disabled', observe: 'hasSymbol', onGet: function (value) { return value } }] } }) }, updateMeanPrice: function() { this.$el.find('.mean-price').text(this.symbol ? toCurrency(this.symbol.simulateMeanPrice(this.model)) : '--'); this.$el.find('.current-mean-price').text(this.symbol ? toCurrency(this.symbol.meanPrice) : '--'); }, strToNum: function (val) { if (val != null) { return +val; } }, numToStr: function (val) { if (val != null) { return val.toString(); } } });
Testo modificato
Apri file
var ShareBuyView = Marionette.ItemView.extend({ template: false, html: require('../templates/sharebuy.html'), initialize: function (options) { this.state = {isNew: !this.pristineModel, hasSymbol: !!this.symbol}; if (this.state.isNew && this.symbol) { this.model.set('symbol', this.symbol.get('name')); } }, onBeforeRender: function() { if (this.view) { this.view.unbind(); this.view = null; } this.attachElContent(this.html); this.view = rivets.bind(this.el, this); }, onRender: function () { this.updateMeanPrice(); }, onDestroy: function() { if (this.view) { this.view.unbind(); this.view = null; } updateMeanPrice: function() { this.state.meanPrice = this.symbol ? this.symbol.simulateMeanPrice(this.model) : undefined; this.state.currentMeanPrice = this.symbol ? this.symbol.meanPrice : undefined; } });
Trovare la differenza