Content deleted Content added
No edit summary |
m JJPMaster moved page User:JJPMaster/GreenAndGold.js to User:JJPMaster/Scripts/GreenAndGold.js: cleaning up my userspace |
||
(10 intermediate revisions by the same user not shown) | |||
Line 1:
$(function() {
const wikiSlash = mw.config.get("wgArticlePath").replace("$1", '');
const links = $("#mw-content-text").find(`a[href^='${wikiSlash}']`);
let titles = [];
let finalTitle;
$(links).each(function() {
titles.push(decodeURI($(this).attr("href").replace(wikiSlash, '')));
finalTitle = titles.join("|");▼
});
let queryableTitles = titles.slice(0, 40);
}▼
$.get('/w/api.php?' +▼
var params = {
$.param({▼
list: 'categorymembers',
prop: 'categories',▼
cmtitle: "Featured articles"
titles: finalTitle▼
▲ },
})).done(function(data) { console.log(data) });▼
api = new mw.Api();
api.get( params ).done( function ( data ) {
// var pages = data.query.pages,
// p;
// for ( p in pages ) {
// pages[ p ].categories.forEach( function ( cat ) {
// console.log( cat.title );
// } );
// }
console.log(data);
});
▲ // $.get('/w/api.php?' +
// format: 'json',
// action: 'query',
});
|