MediaWiki:Gadget-QICvote.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 1:
// [[File:Wikipedia_Gadget-popups.js]] Pop-ups imported from enWP
mw.loader.using( 'mediawiki.api.edit' ).done(function() {
'use strict';
Line 34 ⟶ 35:
action: 'edit',
title: title,
section: section,
summary: "adding support",
text: content,
token: mw.user.tokens.get('editToken'),
section: section,
},
dataType: 'json',
Line 55 ⟶ 56:
});
}
 
function getSectionId(element)
{
var url = $(element).parent().parent().parent().find('h2 span a').last().attr('href');
var results = new RegExp('[\?&]section=([^&#]*)').exec(url);
return results[1] || 0;
}
function createCombo ()
{
var $cmb =$('<select name="wplanguage" />');
});
$cmb.append($("<option/>", {
value: 'Promotion',
text: 'Promotion'
}));
$cmb.append($("<option/>", {
value: 'Decline',
text: 'Decline'
}));
$cmb.append($("<option/>", {
value: 'Nomination',
text: 'Comment'
}));
return $cmb;
}
function confirmSave() {
getSection(title, section).then ( function(content) {
console.log(content); //Conten
editSection(title, section, content"sample");
});
}
if (mw.config.get('wgPageName') == "User:The_Photographer/QIC") {
 
$(".gallerybox").each(function() {
var $cmbsupport = $('<input class="btn_support" type="button" value="Support"/>');
var section = $(this).parentappend().parent().find('h2 span').first().attr('id'$support);
$var section = getSectionId(this).append($cmb);
$cmbsupport.on("change", function() {
getSection(title, section).then ( function(content) {
console.log(content);
editSection(title, section, content);
});
});