// ==UserScript== // @name InsideTrac - Inside Trac // @namespace http://www.insidetrac.org/ // @description InsideTrac - Issue Tracking Notification Script // @include * // ==/UserScript== (function () { var trachost = 'http://www.insidetrac.org/trac'; String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } function createLink(linktext, href) { var textNode = document.createTextNode(linktext); var a = document.createElement('a'); a.setAttribute('href', href); a.appendChild(textNode); return a; } function createTableCellLink(elname, linktext, href, className) { className = className ? className : ""; var a = createLink(linktext, href); td = document.createElement(elname); td.appendChild(a); if (className) { td.setAttribute('class', className); } return td; } function getTextNodes(root) { ret = ""; for (var i=0; i 0) { ret = ret + " " + getTextNodes(el); } } return ret.trim(); } function getLinkRef(root) { ret = ""; for (var i=0; i 0) { ret = getLinkRef(el); if (ret) { return ret; }; } } return ret.trim(); } // sourceforge var sfnet = new RegExp("sf.net$|sourceforge.net$"); var m = sfnet.exec(location.host); if (m != null) { els = document.getElementsByClassName('tracker'); for (var i=0; i= 1) { thead = theads[0]; trs = thead.getElementsByTagName('tr'); if (trs.length >= 2) { th1 = createTableCellLink( 'th', 'IT:Inside Trac', trachost, '' ); th2 = createTableCellLink( 'th', 'IT:Inside Trac', trachost, '' ); trs[0].appendChild(th1); trs[1].appendChild(th2); } } tbodies = tbl.getElementsByTagName('tbody'); if (tbodies.length >= 1) { tbody = tbodies[0]; trs = tbody.getElementsByTagName('tr'); for (var j=0; j 0) { tbodies = tables[0].getElementsByTagName('tbody'); if (tbodies.length > 0) { trs = tbodies[0].getElementsByTagName('tr'); if (trs.length > 0) { tr = trs[0]; tr.appendChild(createTableCellLink( 'th', 'IT:Inside Trac', trachost, 'issues-list-milestone' )); for (var i=1; i