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

Jump to navigation Jump to search
m (fix message)
m (+docs)
if (!page_name.startsWith('Coppermind:Artists/')) { return; }
 
const api = new mw.Api()
const edit = document.querySelector('textarea')
// show pending progress
mw.notify('scanning for new files linking to '+ page_name).then(function(note) {
// perform API query
 
api;(new mw.Api()).get({
action: "query",
format: "json",
const pid = Object.keys(resp.query.pages)[0]
const new_files = []
// hide progress notification
note.close()
// determine which new files link here
if (!resp.query.pages[pid].linkshere) { mw.notify('no files link to '+ page_name); return; }
const pages = resp.query.pages[pid].linkshere.map(function(page) { return page.title.split(':')[1] })