// ==UserScript== // @name CAcert - notes for certs // @namespace http://khopis.com/scripts // @description Notes for specific certificiates // @include https://*.cacert.org/account.php?* // @include https://cacert.org/account.php?* // ==/UserScript== // This is a tab-delimited list mapping cert IDs/expirations to notes // You can comment lines with a leading hash var data = "" + (); var notes = new Array; // we'll use this as an associative array (aka HASH) notes["Cert ID"] = "Notes"; var data = data.split("\n"); for (var d=0, dl=data.length; d < dl; d++) { var entry = data[d].split(/\s*\t\s*/); if (entry[0] && entry[1] && entry[0][0] != "#") { notes[entry[0]] = entry[1]; } } // returns a new table cell (TD) containing the given text function newCell(content) { var newcell = document.createElement("td"); newcell.className = "DataTD"; newcell.appendChild( document.createTextNode(content) ); return newcell; } var rows = document.getElementsByTagName("tr"); for (var r=0, rl=rows.length; r < rl; r++) { cells = rows[r].getElementsByTagName("td"); if (cells.length > 4 ) { var certId = cells[2].innerHTML.match(/\bcert=\d+/); if (!certId && rows[r].innerHTML.match(/CommonName|Email Address/) ) { certId = "Cert ID"; } if (certId) { certId = certId.toString().replace(/.*=/,""); // Add the Cert ID column. Comment this line to remove it. rows[r].insertBefore( newCell(certId), cells[3] ); var note = notes[certId]; // by Cert ID if (!note) { note = notes[ cells[cells.length-1].innerHTML ]; } // by date if (note) { rows[r].appendChild( newCell(note) ); } } } else if (cells && cells[0] && cells[0].colSpan > 4) { cells[0].colSpan += 2; } }