MediaWiki:Gadget-Adiutor-PMR.js
Dıqqat: Ózgerislerińiz kóriniwi ushın jańa sazlawlarıńızdı saqlaǵannan keyin brauzerdiń keshin tazalaw kerek:
Google Chrome: Ctrl+Shift+R, Mozilla Firefox: Ctrl+Shift+R, Intenet Explorer: Ctrl+F5, Safari: Cmd+Shift+R, Konqueror: F5, Opera: Tools → Preferences arqalı keshti tazalań.
/*
* Adiutor: A gadget to assist various user actions
* Author: Vikipolimer
* Licencing and attribution: [[:tr:VP:Adiutor#Lisanslama ve atıf]]
* Module: Page move requests
*/
/* <nowiki> */
$.when(mw.loader.using(["mediawiki.user", "oojs-ui-core", "oojs-ui-windows", ]), $.ready).then(function() {
var mwConfig = mw.config.get(["wgAction", "wgPageName", "wgTitle", "wgUserGroups", "wgUserName", "wgCanonicalNamespace", "wgNamespaceNumber"]);
api = new mw.Api();
function PageMoveRequestDialog(config) {
PageMoveRequestDialog.super.call(this, config);
}
OO.inheritClass(PageMoveRequestDialog, OO.ui.ProcessDialog);
PageMoveRequestDialog.static.name = 'PageMoveRequestDialog';
PageMoveRequestDialog.static.title = 'Adiutor — Kóshiriw';
PageMoveRequestDialog.static.actions = [{
action: 'save',
label: 'Orınlaw',
flags: ['primary', 'progressive']
}, {
label: 'Jabıw',
flags: 'safe'
}];
PageMoveRequestDialog.prototype.initialize = function() {
PageMoveRequestDialog.super.prototype.initialize.apply(this, arguments);
var headerTitle = new OO.ui.MessageWidget({
type: 'notice',
inline: true,
label: new OO.ui.HtmlSnippet('<strong>Betti kóshiriwge talaban sıpatında belgilew</strong><br><small>«Kóshiriw» bettiń atın ózgertiw ushın qollanıladı. Tómende bettiń jańa atı hám ózgertiliw sebebi kórsetiliwi tiyis.</small>')
});
var RequestRationale = new OO.ui.FieldsetLayout({
label: '',
});
RequestRationale.addItems([
new OO.ui.FieldLayout(NewPageName = new OO.ui.TextInputWidget({
value: '',
indicator: 'required',
}), {
label: 'Jańa atı',
}),
new OO.ui.FieldLayout(rationaleInput = new OO.ui.MultilineTextInputWidget({
placeholder: 'Bul jerde bettiń atın ózgertiw sebebin kórsetiń.',
value: '',
indicator: 'required',
}), {
label: 'Sebebi',
align: 'inline',
}),
]);
this.content = new OO.ui.PanelLayout({
padded: true,
expanded: false
});
this.content.$element.prepend(headerTitle.$element, '<br><hr><br>', RequestRationale.$element, '<br>', rationaleInput.$element);
this.$body.prepend(this.content.$element);
};
PageMoveRequestDialog.prototype.getActionProcess = function(action) {
var dialog = this;
if(action) {
return new OO.ui.Process(function() {
createRequest(NewPageName, rationaleInput);
dialog.close({
action: action
});
});
}
return PageMoveRequestDialog.super.prototype.getActionProcess.call(this, action);
};
var windowManager = new OO.ui.WindowManager();
$(document.body).prepend(windowManager.$element);
var dialog = new PageMoveRequestDialog();
windowManager.addWindows([dialog]);
windowManager.openWindow(dialog);
function createRequest(NewPageName, rationaleInput) {
api.postWithToken('csrf', {
action: 'edit',
title: mwConfig.wgPageName,
prependtext: '{{kóshiriwge |1= ' + NewPageName.value + '|sebep= ' + rationaleInput.value + ' }}',
summary: 'Bet kóshiriwge talaban sıpatında kórsetildi',
tags: 'Adiutor',
format: 'json'
}).done(function() {
window.location = mwConfig.wgPageName;
});
}
});
/* </nowiki> */