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

m
try this
m (try this)
m (try this)
})
 
function check_for_arcanum() {
/* auto-fill [[Cite: Arcanum-@entry]] pages*/
$(function fetch_arcanum() {;
 
const edit_box = document.querySelector('.editButtons');
// check that there is an edit box
if (!edit_box || mw.config.get('wgCanonicalNamespace') !== '') 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;
 
const entry = page_name.split('-')[1];
const url =return 'https://wob.coppermind.net/api/entry/'+ entry +'/';
})
fetch(url).then(function(resp){return resp.json();}).then(function (json) {;
/* auto-fill [[Cite: Arcanum-@entry]] pages*/
// deal with response;
$(function () { console.log('fetchedcheck_for_arcanum()) '+url});
console.log(json);
});
 
})