MediaWiki:Gadget-QuickDelete.js

Na Galipedia, a Wikipedia en galego.
/*global jQuery:false, mediaWiki:false, AjaxQuickDelete:false */
/*jshint curly:false, scripturl:true*/

(function($, mw) {
'use strict';

if (!window.AjaxQuickDelete) return;
var AQD = AjaxQuickDelete;

AQD.doInsertTagButtons = function() {

   var runInsert = function(buttons) {
      $.each(buttons, function(k, v) {
         mw.util.addPortletLink('p-tb', 'javascript:AjaxQuickDelete.insertTagOnPage("' + v.tag + '","' + v.img_summary + '","' + v.talk_tag + '","' + v.talk_summary + '","' + v.prompt_text + '");', v.label);
      });
   };
   
   AQD.insertTagButtons = [{
      label: AQD.i18n.toolboxLinkCopyvio,
      tag: '{' + '{copyvio|1=%PARAMETER%}}',
      talk_tag: '{' + '{subst:copyvionote|1=%FILE%}}',
      img_summary: 'Marking as possible copyvio because %PARAMETER%',
      talk_summary: 'Notification of possible copyright violation for %FILE%',
      prompt_text: AQD.i18n.reasonForCopyvio
   }, {
      label: AQD.i18n.toolboxLinkSource,
      tag: '{' + '{subst:nsd}}',
      talk_tag: '{' + '{subst:image source|1=%FILE%}}',
      img_summary: 'File has no source',
      talk_summary: '%FILE% does not have a source'

   }, {
      label: AQD.i18n.toolboxLinkPermission,
      tag: '{' + '{subst:npd}}',
      talk_tag: '{' + '{subst:image permission|1=%FILE%}}',
      img_summary: 'Missing permission',
      talk_summary: 'Please send permission for %FILE% to [[COM:OTRS|OTRS]]'
   }, {
      label: AQD.i18n.toolboxLinkLicense,
      tag: '{' + '{subst:nld}}',
      talk_tag: '{' + '{subst:image license|1=%FILE%}}',
      img_summary: 'Missing license',
      talk_summary: '%FILE% does not have a license'
   }];

  // if (6 === mw.config.get('wgNamespaceNumber')) { //modificado para que funcione en tódolos espazos de nomes
      // Merge the user defined buttons ([[Help:AjaxQuickDelete]]) into the optional buttons
      if (window.AjaxDeleteExtraButtons) AQD.insertTagButtons = AQD.insertTagButtons.concat(window.AjaxDeleteExtraButtons);
      runInsert(AQD.insertTagButtons);
  // }

   $(document).on('AjaxQuickDeleteExtraButtonsReady', function() {
      runInsert(window.AjaxDeleteExtraButtons);
   });
};
})(jQuery, mediaWiki);