Skip to content

Instantly share code, notes, and snippets.

Created Mar 22, 2017

What would you like to do?
trend articles on local wiki
if ($("div#uptrends").hasClass("uptrends")){
(new mw.Api()).get({
format: 'json',
action: 'query',
list: 'mostviewed',
pvimlimit: 50,
}).done(function (data) {
var popular10 = data.query.mostviewed.slice(0, 10)
var elements = (item) {
var a = document.createElement('a')
a.href = mw.util.getUrl(item.title)
var li = document.createElement('li')
return li
var ul = document.createElement('ul')
elements.forEach(function (li) {
var uptrends = document.getElementById('uptrends')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.