Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

Commit

Permalink
Cleanup prettier warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed May 11, 2021
1 parent 20350f3 commit 0c7f8c9
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,82 +63,92 @@
/**
* Handle changes to the input widget
*/
mw.sanctions.ve.ui.AgreeInspector.prototype.onExpirationInputChange = function () {
var templateModel, parameterModel, key, value, inspector;
mw.sanctions.ve.ui.AgreeInspector.prototype.onExpirationInputChange =
function () {
var templateModel, parameterModel, key, value, inspector;

key = mw.sanctions.ve.ui.AgreeInspector.static.templateParameterKey;
value = this.expirationInput.getValue();
inspector = this;
key = mw.sanctions.ve.ui.AgreeInspector.static.templateParameterKey;
value = this.expirationInput.getValue();
inspector = this;

if (this.expirationInput.getValue()) {
// After the updates are done, we'll get onTransclusionModelChange
templateModel = inspector.transclusionModel.getParts()[0];
if (templateModel.hasParameter(key)) {
parameterModel = templateModel.getParameter(key);
parameterModel.setValue(value);
if (this.expirationInput.getValue()) {
// After the updates are done, we'll get onTransclusionModelChange
templateModel = inspector.transclusionModel.getParts()[0];
if (templateModel.hasParameter(key)) {
parameterModel = templateModel.getParameter(key);
parameterModel.setValue(value);
} else {
parameterModel = new ve.dm.MWParameterModel(
templateModel,
key,
value
);
templateModel.addParameter(parameterModel);
}
} else {
parameterModel = new ve.dm.MWParameterModel(templateModel, key, value);
templateModel.addParameter(parameterModel);
// Disable save button
inspector.setApplicableStatus();
}
} else {
// Disable save button
inspector.setApplicableStatus();
}
};
};

/**
* Handle the transclusion becoming ready
*/
mw.sanctions.ve.ui.AgreeInspector.prototype.onTransclusionReady = function () {
var templateModel, key;
mw.sanctions.ve.ui.AgreeInspector.prototype.onTransclusionReady =
function () {
var templateModel, key;

key = mw.sanctions.ve.ui.AgreeInspector.static.templateParameterKey;
key = mw.sanctions.ve.ui.AgreeInspector.static.templateParameterKey;

this.loaded = true;
this.$element.addClass('sanctions-ve-ui-agreeInspector-ready');
this.popPending();
this.loaded = true;
this.$element.addClass('sanctions-ve-ui-agreeInspector-ready');
this.popPending();

templateModel = this.transclusionModel.getParts()[0];
if (templateModel.hasParameter(key)) {
this.expirationInput.setValue(templateModel.getParameter(key).getValue());
}
};
templateModel = this.transclusionModel.getParts()[0];
if (templateModel.hasParameter(key)) {
this.expirationInput.setValue(
templateModel.getParameter(key).getValue()
);
}
};

/**
* Handles the transclusion model changing. This should only happen when we change
* the parameter, then get a callback.
*/
mw.sanctions.ve.ui.AgreeInspector.prototype.onTransclusionModelChange = function () {
if (this.loaded) {
this.altered = true;
this.setApplicableStatus();
}
};
mw.sanctions.ve.ui.AgreeInspector.prototype.onTransclusionModelChange =
function () {
if (this.loaded) {
this.altered = true;
this.setApplicableStatus();
}
};

/**
* Sets the abilities based on the current status
*
* If it's empty or invalid, it can not be inserted or updated.
*/
mw.sanctions.ve.ui.AgreeInspector.prototype.setApplicableStatus = function () {
var parts = this.transclusionModel.getParts(),
templateModel = parts[0],
key = mw.sanctions.ve.ui.AgreeInspector.static.templateParameterKey,
inspector = this;

// The template should always be there; the question is whether the first/only
// positional parameter is.
//
// If they edit an existing mention, and make it invalid, they should be able
// to cancel, but not save.
if (templateModel.hasParameter(key)) {
inspector.actions.setAbilities({
done: !!this.expirationInput.getValue(),
});
} else {
inspector.actions.setAbilities({ done: false });
}
};
mw.sanctions.ve.ui.AgreeInspector.prototype.setApplicableStatus =
function () {
var parts = this.transclusionModel.getParts(),
templateModel = parts[0],
key = mw.sanctions.ve.ui.AgreeInspector.static.templateParameterKey,
inspector = this;

// The template should always be there; the question is whether the first/only
// positional parameter is.
//
// If they edit an existing mention, and make it invalid, they should be able
// to cancel, but not save.
if (templateModel.hasParameter(key)) {
inspector.actions.setAbilities({
done: !!this.expirationInput.getValue(),
});
} else {
inspector.actions.setAbilities({ done: false });
}
};

/**
* Initialize UI of inspector
Expand Down Expand Up @@ -345,10 +355,11 @@
*/
mw.sanctions.ve.ui.AgreeInspector.prototype.getSelectedNode = function () {
// Parent method
var node = mw.sanctions.ve.ui.AgreeInspector.super.prototype.getSelectedNode.apply(
this,
arguments
);
var node =
mw.sanctions.ve.ui.AgreeInspector.super.prototype.getSelectedNode.apply(
this,
arguments
);
// Checks the model class
if (
node &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,25 @@
* @param {Object} [config] Configuration options
*/

mw.sanctions.ve.ui.AgreeWithDaysTool = function SanctionsVeUiAgreeWithDaysInspectorTool() {
var self = this;
$(function () {
var title = self.$element
.closest('.flow-topic')
.find('.flow-topic-title')
.text();
if (
title.match(
new RegExp(mw.config.get('wgSanctionsInsultingNameTopicTitle'))
)
) {
self.destroy();
}
});
// Parent constructor
mw.sanctions.ve.ui.AgreeWithDaysTool.super.apply(this, arguments);
};
mw.sanctions.ve.ui.AgreeWithDaysTool =
function SanctionsVeUiAgreeWithDaysInspectorTool() {
var self = this;
$(function () {
var title = self.$element
.closest('.flow-topic')
.find('.flow-topic-title')
.text();
if (
title.match(
new RegExp(mw.config.get('wgSanctionsInsultingNameTopicTitle'))
)
) {
self.destroy();
}
});
// Parent constructor
mw.sanctions.ve.ui.AgreeWithDaysTool.super.apply(this, arguments);
};

OO.inheritClass(mw.sanctions.ve.ui.AgreeWithDaysTool, ve.ui.InspectorTool);

Expand Down

0 comments on commit 0c7f8c9

Please sign in to comment.