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

m
use the object returner not the promise thing
m (try this)
m (use the object returner not the promise thing)
const api = new mw.Api()
const edit = document.querySelector('textarea')
const note = mw.notification.notify('scanning for new files linking to '+ page_name)
 
api.get({
const new_files = []
note.close()
if (!resp.query.pages[pid].linkshere) { mw.notification.notify('no files link to '+ page_name); return; }
const pages = resp.query.pages[pid].linkshere.map(function(page) { return page.title.split(':')[1] })
for (var i in pages) {
}
// don't change the page if there's nothing to change
if (new_files.length == 0) { mw.notification.notify('no new files link to '+ page_name); return; }
mw.notification.notify('these files link to', page_name, new_files);
// TODO: make into a dropdown notice thing?
if (edit.value.includes('</gallery>')) {