User talk:Alex Smotrov/logpage.js

Latest comment: 16 years ago by Alex Smotrov in topic Sortable

logPage edit

Script converts Special:Log into a nice easy to read table.


The following example shows new user registration, image upload and user block.

       
16:33
30 Aug
  SomeNewUser
16:32
30 Aug
  Example.jpg SomeLoader (t c) Photo of Mickey Mouse taken by his friend in 2004.
16:30
30 Aug
  SomeUser (t)

1 day

Admin (t c) Vandalism
16:29
30 Aug
… … …


You can try it without installation, just open logs, paste this into browser address field, press Enter: javascript:addOnloadHook=function(f){f()};importScript('User:Alex_Smotrov/logpage.js')


Notes
  • there is a [show list] switch if you want to look at the original list
  • the 2nd column icon is sometimes a link (such as undo move)
  • in blocks options, "account creation blocked" and "anon. only" (for IP) are considered "standard"


Parameters:

Appearance
#logTable
.logtime .logicon .logcontent
 <div>
.loguser .logcomment
 <div>

logPageCSS specifies additional CSS for the log table.

All table cells have CSS classes; "content" and "comment" are wrapped in additional divs (see the diagram on the right)

The default is:

logPageCSS = '.logcomment div {overflow:auto}'  //scroll very long comment inside cell


Example CSS:

logPageCSS = 
'#logTable {font-size:smaller}' + //smallef font
'.logcontent div, .logcomment div {overflow:auto}' + //scrolling
'.logtime {text-align:center}'


Loading
logMaxRows = 50 will prevent the script from generating table if the log has more than 50 rows. This might be useful for an old slow computer. Setting this to 0 is also possible. Then you have to click [show table] link to see the table.
No talk/contribs links
logNoUserLinks = true will remove "talk" / "contribs" links from the user User (t c) who performed the action.
Short date format
  • logDateIn — initial date format in log (depends on your preferences)
  • logDateOut — new short date format

The script uses replace(logDateIn, logDateOut) to convert date to shorter form. By default it's

logDateIn = /(\d\d:\d\d), (\d\d?) (\S\S\S)\S* (\d\d\d\d)/
logDateOut = '$1 $2&nbsp;$3'

which makes "15:59, 27 September 2007" into "15:59 27 Sep"

For example, if you set "2001-01-15T16:12:34" timestamp in preferences (which is the only way to see seconds in logs/history by the way), then settings

logDateIn = /\d\d\d\d-(\d\d)-(\d\d)T(\d\d):(\d\d):\d\d/  
logDateOut = '$3:$4 $2-$1'

will make it into «16:12 15-01» in the table.


Example of the script usage in your monobook.js:

logDateIn = /(\d\d:\d\d), (\d\d?) (\S\S\S)\S* \d\d(\d\d)/
logDateOut = '$1 $2 $3 $4' //show date as 15:59 27 Sep 07
logNoUserLinks = true //no talk.contrib links
logMaxRows = 0 //do not draw tablew on page load
importScript('User:Alex_Smotrov/logpage.js')

Discussion edit

Sortable edit

Would it be possible to make such a table sortable? -- Ned Scott 06:09, 5 February 2008 (UTC)Reply

I already tried to make it sortable before, didn't work. This time I found and fixed the problem. It's sortable now, except for 2nd "action" column which doesn't have any text. It doesn't seem very useful though :) ∴ AlexSm 22:22, 5 February 2008 (UTC)Reply