RandomSec/extensions/wikidata/module/scripts/dialogs/perform-edits-dialog.js
2018-04-27 09:17:31 +02:00

45 lines
1.1 KiB
JavaScript

var PerformEditsDialog = {};
PerformEditsDialog.launch = function(logged_in_username) {
var self = this;
var frame = $(DOM.loadHTML("wikidata", "scripts/dialogs/perform-edits-dialog.html"));
var elmts = this._elmts = DOM.bind(frame);
this._level = DialogSystem.showDialog(frame);
var dismiss = function() {
DialogSystem.dismissUntil(self._level - 1);
};
elmts.loggedInUsername.text(logged_in_username);
frame.find('.cancel-button').click(function() {
dismiss();
});
elmts.performEditsButton.click(function() {
Refine.postProcess(
"wikidata",
"perform-wikibase-edits",
{},
{ strategy : "SNAK_QUALIFIERS",
action: "MERGE",
summary: elmts.editSummary.val(),
},
{ includeEngine: true, cellsChanged: true, columnStatsChanged: true },
{ onDone:
function() {
dismiss();
}
});
});
};
PerformEditsDialog.checkAndLaunch = function () {
ManageAccountDialog.ensureLoggedIn(function(logged_in_username) {
if (logged_in_username) {
PerformEditsDialog.launch(logged_in_username);
}
});
};