User:Tim Laqua/monobook.js

function formatRecentChanges { if (wgCanonicalNamespace == 'Special' && wgCanonicalSpecialPageName == 'Recentchanges' ) { var colorPrimaryRow = '#FFFFFF'; var colorAltRow = '#EEEEEE'; var colorPatrolledRow = '#FFFF99'; var colorHeaderRow = '#cccccc'; var colorFooterRow = '#cccccc'; var columns = '7'; var colUL = document.getElementsByTagName('ul'); if ( colUL.length > 0 ) { var tableWrapper = document.createElement('table'); var tableNode = document.createElement('tbody'); tableWrapper.width = '100%'; var contentDiv = document.getElementById('content'); contentDiv.appendChild(tableWrapper); tableWrapper.appendChild(tableNode); for(var i=0; i<colUL.length; i++) { if (colUL[i].className == 'special') { var altRow = false; var nodeListHeading = document.getElementsByTagName('h4')[0]; var rowHeading = document.createElement('tr'); var cellHeading = document.createElement('td'); cellHeading.appendChild(nodeListHeading); cellHeading.colSpan = columns; rowHeading.appendChild(cellHeading); rowHeading.style.backgroundColor = colorHeaderRow; tableNode.appendChild(rowHeading); var colLI = colUL[i].getElementsByTagName('li'); for(var j=0; j/i; if (regexp.exec(cleanText)) { rowNode.style.backgroundColor = colorPatrolledRow; cleanText = cleanText.replace(regexp,''); } else { if (altRow) { rowNode.style.backgroundColor = colorAltRow; } else { rowNode.style.backgroundColor = colorPrimaryRow; }            }             altRow = altRow ? false : true; //check for minor edit flag regexp = //i; if (regexp.exec(cleanText)) { var flagMinor = cleanText.match(regexp)[0]; cleanText = cleanText.replace(regexp,''); } else { var flagMinor = ''; }            //check for new page flag regexp = //i; if (regexp.exec(cleanText)) { var flagNewpage = cleanText.match(regexp)[0]; cleanText = cleanText.replace(regexp,''); } else { var flagNewpage = ''; }            //check for bot flag regexp = //i; if (regexp.exec(cleanText)) { var flagBot = cleanText.match(regexp)[0]; cleanText = cleanText.replace(regexp,''); } else { var flagBot = ''; }            var flagNode = document.createElement('TD'); flagNode.innerHTML = flagNewpage + flagMinor + flagBot; flagNode.style.whiteSpace = 'nowrap'; var arrLI = cleanText.split(' . . '); var timeNode = document.createElement('TD'); timeNode.innerHTML = time; timeNode.style.whiteSpace = 'nowrap'; var contextNode = document.createElement('TD'); contextNode.innerHTML = arrLI[0]; contextNode.style.whiteSpace = 'nowrap'; if (arrLI.length == 4) { //standard entry var titleNode = document.createElement('TD'); titleNode.innerHTML = arrLI[1]; titleNode.style.whiteSpace = 'nowrap'; var changedNode = document.createElement('TD'); changedNode.innerHTML = arrLI[2].match(/\((.+)\)/)[1]; //changedNode.innerHTML = arrLI[2]; changedNode.style.whiteSpace = 'nowrap'; changedNode.style.textAlign = 'right'; var messageString = arrLI[3]; } else { //empty cell var titleNode = document.createElement('TD'); var changedNode = document.createElement('TD'); var messageString = arrLI[1]; }            var colMessage = messageString.match(/(<a.*?\))(.*$)/i);             var nameNode = document.createElement('TD');             var messageNode = document.createElement('TD');             if ( colMessage ) {               nameNode.innerHTML = colMessage[1];               nameNode.style.whiteSpace = 'nowrap';               if (colMessage[2] != )                 messageNode.innerHTML = colMessage[2].replace(/\(/, ).replace(/\)/, '');               else                  messageNode.innerHTML= ' ';             } else {               nameNode.innerHTML= ' ';               messageNode.innerHTML= ' ';             }             rowNode.appendChild(timeNode);             rowNode.appendChild(contextNode);             rowNode.appendChild(flagNode);             rowNode.appendChild(titleNode);             rowNode.appendChild(messageNode);             rowNode.appendChild(nameNode); rowNode.appendChild(changedNode); tableNode.appendChild(rowNode); }          colUL[i].parentNode.removeChild(colUL[i]); i--; //we just deleted a node. }      }     }   } } addOnloadHook(formatRecentChanges);