// nieaktywne
// https://pl.wikipedia.orghttps://wiki386.com/pl/Wikipedia:Kawiarenka/Kwestie_techniczne#MediaWiki:Gadget-WMPL-share
// https://pl.wikipedia.org/w/index.php?title=Wikipedia:Kawiarenka/Kwestie_techniczne&oldid=69233152#MediaWiki:Gadget-WMPL-share
/*
Gadżet do zgłaszania artykułów do umieszczenia w mediach społecznościowych przez WMPL
Autor: Wargo
Licencja: Public domain
*/
/*
jQuery(document).ready(function() {
var ns = mw.config.get('wgNamespaceNumber');
var title = mw.config.get('wgPageName');
mw.messages.set({
"wmpl-share-open" : "Zaproponuj do mediów społecznościowych",
"wmpl-share-title" : "Zaproponuj do mediów społecznościowych",
"wmpl-share-info" : "Ten formularz służy do zgłaszania artykułów do udostępnienia w mediach społecznościowych prowadzonych przez Wikimedia Polska.\n\nNapisz dlaczego ten artykuł jest ciekawy/zaproponuj tekst.",
"wmpl-share-default-reason" : "",
"wmpl-share-error" : "Wystąpił błąd podczas wysyłania",
"wmpl-share-editsummary" : "Nowe zgłoszenie",
"wmpl-share-success" : "Zgłoszenie wysłane."
});
var wmpl_share_target = "Wikipedia:Wikipedia w mediach/Zgłoszenia";
function openShareDialog()
{
function ShareDialog(config) {
ShareDialog.super.call(this, config);
}
OO.inheritClass(ShareDialog, OO.ui.ProcessDialog);
ShareDialog.static.name = 'ShareDialog';
ShareDialog.static.title = mw.messages.get('wmpl-share-title');
ShareDialog.static.actions = [
{label: 'Zgłoś', flags: 'primary', action: 'save'},
{label: 'Anuluj', flags: 'safe'}
];
ShareDialog.prototype.initialize = function() {
ShareDialog.super.prototype.initialize.apply(this,arguments);
this.panel = new OO.ui.PanelLayout({padded: true, expanded: false});
this.content = new OO.ui.FieldsetLayout();
this.ReasonInput = new OO.ui.MultilineTextInputWidget({
value: mw.messages.get('wmpl-share-default-reason'),
multiline: true,
autosize: true,
maxRows: 4
});
this.field = new OO.ui.FieldLayout(this.ReasonInput, {
label: mw.messages.get('wmpl-share-info'),
align: 'top'
});
this.checkbox1 = new OO.ui.CheckboxInputWidget({
value: 'true',
selected: false
}),
this.content.addItems();
this.panel.$element.append(this.content.$element);
this.$body.append(this.panel.$element);
this.ReasonInput.connect(this, {'change': 'onReasonInputChange'});
};
ShareDialog.prototype.onReasonInputChange = function (value) {
this.actions.setAbilities({
save: !!value.length
});
};
ShareDialog.prototype.getActionProcess = function (action) {
var dialog = this;
if (action == "save") {
return new OO.ui.Process(function () {
var reason = dialog.ReasonInput.getValue();
var title = mw.config.get('wgPageName');
var text = ''+']\n\n'+reason+'\n\nZgłasza: ~~'+'~~';
var section = title;
var dfd = $.Deferred();
new mw.Api().postWithEditToken({action: 'edit', title: wmpl_share_target, section: 'new', sectiontitle: title, text: text, summary: mw.messages.get('wmpl-share-editsummary')})
.fail(function(code, error){
dfd.reject(new OO.ui.Error(mw.messages.get('wmpl-share-error')+"\n"+error.error.info, {recoverable: true}));
})
.done(function(data){
dialog.close({action: action});
if(dialog.checkbox1.isSelected())
{
window.location.href = 'https://wiki386.com/pl/'+wmpl_share_target+'#'+title;
}
else
{
mw.notify(mw.messages.get('wmpl-share-success'), {type: 'success', autoHide: false});
}
dfd.resolve();
});
return dfd;
});
}
return ShareDialog.super.prototype.getActionProcess.call(this, action);
};
var windowManager = new OO.ui.WindowManager();
$(document.body).append(windowManager.$element);
var dialog = new ShareDialog();
windowManager.addWindows();
windowManager.openWindow(dialog);
}
if(ns == 0 && mw.config.get('wgArticleId') > 0)
{
var share = mw.util.addPortletLink('p-tb', '#', mw.messages.get('wmpl-share-open'), 'link-dialog-share');
if(share) {
share.onclick = function(event) {event.preventDefault(); openShareDialog();};
}
}
});
*/