Merge #2111 from gasi: Autofix: Move Debug Logs From GitHub Gists to debuglogs.org
- [x] Apply ESLint autofixes in preparation of changes to debug log publish change.
- [x] Remove now unnecessary `/* eslint-env browser */` directives from some files. This is now part of our per-folder ESLint configuration.
Manual changes: 77cc9b61c9..0cf64f5083
pull/1/head
commit
770e4ac96b
@ -1,66 +1,69 @@
|
|||||||
/*
|
/* global i18n: false */
|
||||||
* vim: ts=4:sw=4:expandtab
|
/* global Whisper: false */
|
||||||
*/
|
|
||||||
|
// eslint-disable-next-line func-names
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
window.Whisper = window.Whisper || {};
|
|
||||||
|
|
||||||
Whisper.DebugLogLinkView = Whisper.View.extend({
|
window.Whisper = window.Whisper || {};
|
||||||
templateName: 'debug-log-link',
|
|
||||||
initialize: function(options) {
|
|
||||||
this.url = options.url;
|
|
||||||
},
|
|
||||||
render_attributes: function() {
|
|
||||||
return {
|
|
||||||
url: this.url,
|
|
||||||
reportIssue: i18n('reportIssue')
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Whisper.DebugLogView = Whisper.View.extend({
|
|
||||||
templateName: 'debug-log',
|
|
||||||
className: 'debug-log modal',
|
|
||||||
initialize: function() {
|
|
||||||
this.render();
|
|
||||||
this.$('textarea').val(i18n('loading'));
|
|
||||||
|
|
||||||
window.log.fetch().then(function(text) {
|
Whisper.DebugLogLinkView = Whisper.View.extend({
|
||||||
this.$('textarea').val(text);
|
templateName: 'debug-log-link',
|
||||||
}.bind(this));
|
initialize(options) {
|
||||||
},
|
this.url = options.url;
|
||||||
events: {
|
},
|
||||||
'click .submit': 'submit',
|
render_attributes() {
|
||||||
'click .close': 'close'
|
return {
|
||||||
},
|
url: this.url,
|
||||||
render_attributes: {
|
reportIssue: i18n('reportIssue'),
|
||||||
title: i18n('submitDebugLog'),
|
};
|
||||||
cancel: i18n('cancel'),
|
},
|
||||||
submit: i18n('submit'),
|
});
|
||||||
close: i18n('gotIt'),
|
Whisper.DebugLogView = Whisper.View.extend({
|
||||||
debugLogExplanation: i18n('debugLogExplanation')
|
templateName: 'debug-log',
|
||||||
},
|
className: 'debug-log modal',
|
||||||
close: function(e) {
|
initialize() {
|
||||||
e.preventDefault();
|
this.render();
|
||||||
this.remove();
|
this.$('textarea').val(i18n('loading'));
|
||||||
},
|
|
||||||
submit: function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var text = this.$('textarea').val();
|
|
||||||
if (text.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
log.publish(text).then(function(url) {
|
|
||||||
var view = new Whisper.DebugLogLinkView({
|
|
||||||
url: url,
|
|
||||||
el: this.$('.result')
|
|
||||||
});
|
|
||||||
this.$('.loading').removeClass('loading');
|
|
||||||
view.render();
|
|
||||||
this.$('.link').focus().select();
|
|
||||||
}.bind(this));
|
|
||||||
this.$('.buttons, textarea').remove();
|
|
||||||
this.$('.result').addClass('loading');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
})();
|
// eslint-disable-next-line more/no-then
|
||||||
|
window.log.fetch().then((text) => {
|
||||||
|
this.$('textarea').val(text);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
events: {
|
||||||
|
'click .submit': 'submit',
|
||||||
|
'click .close': 'close',
|
||||||
|
},
|
||||||
|
render_attributes: {
|
||||||
|
title: i18n('submitDebugLog'),
|
||||||
|
cancel: i18n('cancel'),
|
||||||
|
submit: i18n('submit'),
|
||||||
|
close: i18n('gotIt'),
|
||||||
|
debugLogExplanation: i18n('debugLogExplanation'),
|
||||||
|
},
|
||||||
|
close(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
this.remove();
|
||||||
|
},
|
||||||
|
submit(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const text = this.$('textarea').val();
|
||||||
|
if (text.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line more/no-then
|
||||||
|
window.log.publish(text).then((url) => {
|
||||||
|
const view = new Whisper.DebugLogLinkView({
|
||||||
|
url,
|
||||||
|
el: this.$('.result'),
|
||||||
|
});
|
||||||
|
this.$('.loading').removeClass('loading');
|
||||||
|
view.render();
|
||||||
|
this.$('.link').focus().select();
|
||||||
|
});
|
||||||
|
this.$('.buttons, textarea').remove();
|
||||||
|
this.$('.result').addClass('loading');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
Loading…
Reference in New Issue