Diferencia entre revisiones de «MediaWiki:Gadget-user-stats.js»

De La Coppermind
Ir a la navegación Ir a la búsqueda
m (?)
m (can't do anything with this junk)
Línea 16: Línea 16:
 
const edits = document.createElement('span')
 
const edits = document.createElement('span')
 
edits .classList.add('g-userlist-edits')
 
edits .classList.add('g-userlist-edits')
li.textContent = ''
+
//li.textContent = ''
li.append(link, ' ', tools, ' ', groups, ' ', created, ' ', edits, text.split(' '))
+
//li.append(link, ' ', tools, ' ', groups, ' ', created, ' ', edits, text.split(' '))
 
console.log('user-stats:', li)
 
console.log('user-stats:', li)
 
})// </each_user>
 
})// </each_user>

Revisión del 19:31 6 may 2020

const periods = {
  'second': 1000, 'minute': 1000 * 60, 'hour': 1000 * 60 * 60,
  'day': 1000 * 60 * 60 * 24, 'year': 1000 * 60 * 60 * 24 * 365,
}

mw.hook('Special:ListUsers').add(function user_stats(content){

Array.from($('li', content)).forEach(function each_user(li) {
 const text = li.textContent
 const link = li.querySelector('.mw-userlink')
 const tools = li.querySelector('.mw-usertoollinks')
 const groups = document.createElement('span')
 groups.classList.add('g-userlist-groups')
 const created = document.createElement('span')
 created.classList.add('g-userlist-created')
 const edits = document.createElement('span')
 edits .classList.add('g-userlist-edits')
 //li.textContent = ''
 //li.append(link, ' ', tools, ' ', groups, ' ', created, ' ', edits, text.split(' '))
 console.log('user-stats:', li)
})// </each_user>
})// </user_stats>

/// 
function edits_per_period(edits, since, period) { return +edits / ((new Date - new Date(since)) / period) }