User:Sophiedp/global.js

//Credit to all the people who helped me put this together var token; mw.loader.using('mediawiki.api', function {   new mw.Api.get({ action: 'query', meta: 'userinfo', uiprop: 'options', format: 'json' }).done(function(op) { token = op.query.userinfo.options.watchlisttoken; }); }); var file = 'global.js?ref=master'; var url = 'https://gitlab.com/api/v4/projects/4705466/repository/files/' + file; var data = { body: { private_token: token } }; fetch(url, data).then(function (r) {   return r.text; }).then(console.log);