Diferencia entre revisiones de «MediaWiki:Gadget-Arcanum-autofill-page.js»

De La Coppermind
Ir a la navegación Ir a la búsqueda
m (try this)
(Fbstj changed the content model of the page MediaWiki:Gadget-Arcanum-autofill-page.js from "wikitext" to "JavaScript")
Etiqueta: cambio de modelo de contenido
(Sin diferencias)

Revisión del 16:35 27 jul 2019

// 2018-08-22 auto-generate Cite:Arcanum pages for wob ref template

mw.hook('wikipage.editform').add(function () {
  // determine if this page is editing a Cite: Arcanum page
  const edit_box = document.querySelector('#editform textarea');
  // check that there is an edit box
  if (!edit_box || mw.config.get('wgCanonicalNamespace') !== 'Cite') return -1;
  // check that it's a page creation
  if (mw.config.get('wgArticleId') != 0) return -2;
  // check that it's an Arcanum page
  const page_name = mw.config.get('wgPageName');
  if (!page_name.startsWith('Cite:Arcanum-')) return -3;
  console.warn('gadget:', 'Arcanum-autofill-page')
})