Diff
checker
Texte
Texte
Images
Documents
Excel
Dossiers
Legal
Enterprise
Application de bureau
Prix
Se connecter
Télécharger Diffchecker Desktop
Comparer le texte
Trouver la différence entre deux fichiers texte
Outils
Historique
Éditeur live
Masquer les espaces
Cacher identiques
Sans retour à la ligne
Vue
Divisé
Unifié
Niveau de précision
Intelligent
Mot
Caractère
Styles de texte
Modifier l’apparence
Coloration syntaxique
Choisir la syntaxe
Ignorer
Transformer le texte
Aller au premier écart
Modifier l'entrée
Diffchecker Desktop
La façon la plus sécurisée d'utiliser Diffchecker. Obtenez l'application Diffchecker Desktop : vos diffs ne quittent jamais votre ordinateur !
Obtenir Desktop
ShareBuy view before and after Rivets
Créé
il y a 10 ans
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
73 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
71 lignes
Copier tout
31 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
33 lignes
Copier tout
Copier
Copié
Copier
Copié
var toCurrency = require('../templates/helpers/formatcurrency');
var ShareBuyView = Marionette.ItemView.extend({
var ShareBuyView = Marionette.ItemView.extend({
Copier
Copié
Copier
Copié
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) {
Copier
Copié
Copier
Copié
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'));
}
}
},
},
Copier
Copié
Copier
Copié
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();
Copier
Copié
Copier
Copié
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
}
}]
}
})
},
},
Copier
Copié
Copier
Copié
onDestroy: function() {
if (this.view) {
this.view.unbind();
this.view = null;
}
updateMeanPrice: function() {
updateMeanPrice: function() {
Copier
Copié
Copier
Copié
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érences enregistrées
Texte d'origine
Ouvrir un fichier
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(); } } });
Texte modifié
Ouvrir un fichier
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; } });
Trouver la différence