MediaWiki:Gadget-GlossaryGraph.js: Difference between revisions
Jump to navigation
Jump to search
AdminIsidore (talk | contribs) No edit summary |
AdminIsidore (talk | contribs) No edit summary |
||
| Line 11: | Line 11: | ||
var term = pageTitle.split(':').pop().toLowerCase(); | var term = pageTitle.split(':').pop().toLowerCase(); | ||
var smwQuery = encodeURIComponent('[[Category:Glossary Entries]]|?Glossary-Term|?Glossary-Definition | var smwQuery = encodeURIComponent('[[Category:Glossary Entries]]|?Glossary-Term|?Glossary-Definition'); | ||
new mw.Api().get({ | new mw.Api().get({ | ||
action: 'ask', | action: 'ask', | ||
query: smwQuery, | query: smwQuery, | ||
limit: 50, // Limit as separate param | |||
format: 'json' | format: 'json' | ||
}).done(function(data) { | }).done(function(data) { | ||
console.log('SMW API response:', data); | console.log('SMW API response:', data); | ||
var results = data.query.results || {}; | var results = data.query.results || {}; | ||
var links = []; | var links = []; | ||
| Line 95: | Line 96: | ||
.attr('cy', d => d.y); | .attr('cy', d => d.y); | ||
}); | }); | ||
}).fail(function( | }).fail(function(jqXHR, textStatus, errorThrown) { | ||
$container.text('Error: API request failed'); | $container.text('Error: API request failed'); | ||
console.error('SMW API error details:', error); | console.error('SMW API error details:', { | ||
status: textStatus, | |||
error: errorThrown, | |||
responseText: jqXHR.responseText | |||
}); | |||
}); | }); | ||
}); | }); | ||
}); | }); | ||
}); | }); | ||