Участник:Script/luslogs.js

Материал из свободной русской энциклопедии «Традиция»
Перейти к: навигация, поиск
//on [[Special:Listusers]] the scripts adds users logs links, additionally on [[Special:Listusers/patroller]] links to users patrol logs
//usage:  if (wgCanonicalNamespace == 'Special' && wgCanonicalSpecialPageName == 'Listusers') importScript('user:script/listuserslogs.js')

addOnloadHook(listUsersLogs)

function listUsersLogs(){
 var content = document.getElementById('content')
 var ul = content.getElementsByTagName('ul')[0]
 if (!ul) return
 var row, user, lis = ul.getElementsByTagName('li')
 var isPatrol = (document.URL.indexOf('patroller') != -1)
 var lnk = '<a href="'+ wgServer + wgScript + '?title=Special:Log&user='
 for (var i=0; i<lis.length; i++){
   row = lis[i].innerHTML
   user = row.match (/>([^<]+)<\/a>/)
   if (user) user = user[1]; else continue
   row += '<small> (' + lnk + user + '">журналы</a>'
   if (isPatrol) row += ', ' + lnk + user + '&type=patrol">патрулирование</a>'
   row += ')</small>'
   lis[i].innerHTML = row
 }
}