(function () { var settings = allure.getPluginSettings('screen-diff', { diffType: 'diff' }); function renderImage(src) { return ( '
' + data.error + ''; }, }); var AttachmentView = Backbone.Marionette.View.extend({ regions: { subView: '.screen-diff-view', }, template: function () { return ''; }, onRender: function () { jQuery .getJSON(this.options.sourceUrl) .then(this.renderScreenDiffView.bind(this), this.renderErrorView.bind(this)); }, renderErrorView: function (error) { console.log(error); this.showChildView( 'subView', new ErrorView({ error: error.statusText, }), ); }, renderScreenDiffView: function (data) { this.showChildView( 'subView', new ScreenDiffView({ diffImage: data.diff, actualImage: data.actual, expectedImage: data.expected, }), ); }, }); var ScreenDiffView = Backbone.Marionette.View.extend({ className: 'pane__section', events: function () { return { ['click [name="screen-diff-type-' + this.cid + '"]']: 'onDiffTypeChange', 'mousemove .screen-diff__overlay': 'onOverlayMove', }; }, initialize: function (options) { this.diffImage = options.diffImage; this.actualImage = options.actualImage; this.expectedImage = options.expectedImage; this.radioName = 'screen-diff-type-' + this.cid; }, templateContext: function () { return { diffType: settings.get('diffType'), diffImage: this.diffImage, actualImage: this.actualImage, expectedImage: this.expectedImage, radioName: this.radioName, }; }, template: function (data) { if (!data.diffImage && !data.actualImage && !data.expectedImage) { return ''; } return ( '