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

Jump to navigation Jump to search
m (try)
m (try this)
const api = new mw.Api()
const edit = document.querySelector('textarea')
console.log('scanning for new files linking to '+ page_name)
mw.notify('scanning for new files linking to '+ page_name).then(function(note) {
 
const new_files = []
note.close()
if (!resp.query.pages[pid].linkshere) { mw.notification.notify('no files link to '+ page_name); console.warn('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); console.warn('no files link to '+ page_name); return; }
mw.notification.notify(new_files.count +'these new files link to ',+ page_name, new_files);
// TODO: make into a dropdown notice thing?
if (edit.value.includes('</gallery>')) {
// add the lines to the end of the current gallery