Difference between revisions of "User:Fbstj/gadget/history-test.js"

m
try this
m (+thing)
m (try this)
// 2019-03-03 autofill artist pages
;mw.hook('wikipage.editform').add(function () {
 
const page_name = mw.config.get('wgPageName')
if (!page_name.startsWith('Coppermind:Artist/')) { return; }
const api = new mw.Api()
 
console.log('editing', mw.config.get('wgPageName'), document.querySelector('textarea'))
 
api.get({
action: "query",
format: "json",
prop: "linkshere",
titles: page_name,
lhnamespace: "6", // File: namespace only
}).then(resp => console.log(resp.query))
 
});