| 6 | | TRAC_BASE : 'http://coderepos.org/share' |
| | 6 | TRAC_BASE : 'http://coderepos.org/share', |
| | 7 | AUTHOR_ICONS : { |
| | 8 | //'tomoyo' : 'http://www.hatena.ne.jp/users/ma/mayuki/profile_s.gif' |
| | 9 | //'tomoyo' : 'id:mayuki' |
| | 10 | '*default*' : 'http://coderepos.org/share/htdocs/default-author-icon.png' |
| | 11 | , 'mayuki' : 'id:mayuki' |
| | 12 | , 'yappo' : 'id:yappo' |
| | 13 | , 'typester' : 'http://www.gravatar.com/avatar.php?gravatar_id=fbc6511bcc0649366086c0445fb456d3&size=16'//'id:typester' |
| | 14 | , 'kentaro' : 'id:antipop' |
| | 15 | , 'mizzy' : 'id:gosukenator' |
| | 16 | , 'charsbar' : 'id:charsbar' |
| | 17 | , 'secondlife' : 'id:secondlife' |
| | 18 | , 'kazeburo' : 'id:kazeburo' |
| | 19 | , 'otsune' : 'id:otsune' |
| | 20 | , 'hirose31' : 'id:hirose31' |
| | 21 | , 'nipotan' : 'id:nipotan' |
| | 22 | , 'itkz' : 'id:itkz' |
| | 23 | , 'xcezx' : 'id:xcezx' |
| | 24 | , 'nyarla' : 'id:nyarla-net' |
| | 25 | , 'tokuhirom' : 'id:tokuhirom' |
| | 26 | , 'daisuke' : 'id:lestrrat' |
| | 27 | , 'kana' : 'id:ka-nacht' |
| | 28 | , 'cho45' : 'id:cho45' |
| | 29 | , 'kan' : 'id:kan' |
| | 30 | , 'zigorou' : 'id:ZIGOROu' |
| | 31 | , 'masaki' : 'id:ikasam_a' |
| | 32 | , 'holidays-l' : 'id:holidays-l' |
| | 33 | , 'yoko' : 'id:yksk' |
| | 34 | , 'mattn' : 'id:mattn' |
| | 35 | , 'lopnor' : 'id:lopnor' |
| | 36 | , 'gyuque' : 'id:gyuque' |
| | 37 | , 'yugui' : 'id:yugui' |
| | 38 | , 'akihito' : 'id:t-akihito' |
| | 39 | , 'fujiwara' : 'id:sfujiwara' |
| | 40 | , 'yusukebe' : 'id:kamawada' |
| | 41 | , 'miyagawa' : 'id:miyagawa' |
| | 42 | , 'topia' : 'id:topia' |
| | 43 | , 'woremacx' : 'id:woremacx' |
| | 44 | , 'amachang' : 'id:amachang' |
| | 45 | , 'takesako' : 'id:TAKESAKO' |
| | 46 | , 'eto' : 'id:eto' |
| | 47 | , 'dankogai' : 'id:dankogai' |
| | 48 | , 'tomyhero' : 'id:tomyhero' |
| | 49 | , 'jknaoya' : 'id:jknaoya' |
| | 50 | , 'yasu' : 'id:hirata_yasuyuki' |
| | 51 | , 'holygrail' : 'id:HolyGrail' |
| | 52 | , 'elim' : 'id:elim' |
| | 53 | , 'cheebow' : 'id:cheebow' |
| | 54 | , 'ariela' : 'http://www.gravatar.com/avatar.php?gravatar_id=dd5dfb5d738d5b5fb1c9a8b234945ea6&size=16'//'id:transrain' |
| | 55 | } |
| | 107 | } |
| | 108 | } |
| | 109 | |
| | 110 | , AuthorIcons : { |
| | 111 | showAuthorIcons : function () { |
| | 112 | var authors = []; |
| | 113 | switch ($("#content").attr("class")) { |
| | 114 | case 'browser': |
| | 115 | $('//*[@id="info"]//th').each(function () { |
| | 116 | authors.push([this, $(this).text().match(/checked in by ([^,]+)/)[1]]); |
| | 117 | }); |
| | 118 | $('//*[@id="dirlist"]//span[@class="author"]').each(function () { |
| | 119 | authors.push([this, $(this).text().match(/^([^:]+):/)[1]]); |
| | 120 | }); |
| | 121 | break; |
| | 122 | case 'timeline': |
| | 123 | $('//*[@id="content"]//dt/a').each(function () { |
| | 124 | authors.push([this, this.lastChild.nodeValue.match(/by\s+(.+)$/)[1]]); |
| | 125 | }); |
| | 126 | break; |
| | 127 | case 'log': |
| | 128 | case 'changeset': |
| | 129 | authors = $('(//*[@id="overview"] | //*[@id="chglist"])//*[@class="author"]'); |
| | 130 | break; |
| | 131 | case 'wiki': |
| | 132 | if (/\/share\/wiki\/Committers\/([^\/]+)/.test(location.pathname)) { |
| | 133 | var author = RegExp.$1; |
| | 134 | var iconurl = TracUtils.AuthorIcons.getIconByAuthor(author); |
| | 135 | if (!iconurl) break; |
| | 136 | var img = $("<img width='16' height='16' alt='' class='committer-icon'/>").attr("src", iconurl); |
| | 137 | var h1 = $("//*[@id='searchable']/h1[1]"); |
| | 138 | if (h1.length) { |
| | 139 | h1.appendChild(img); |
| | 140 | } else { |
| | 141 | $("#content").prepend(img); |
| | 142 | } |
| | 143 | } else |
| | 144 | if (location.pathname == "/share/wiki") { |
| | 145 | // This is for committer list of CodeRepos. |
| | 146 | authors = $("//*[@id='Committers']/following-sibling::ul[1]//a[contains(@href, '/share/wiki/Committers/')]"); |
| | 147 | } |
| | 148 | break; |
| | 149 | default: break; |
| | 150 | } |
| | 151 | |
| | 152 | for (var i = 0, n = authors.length; i < n; i++) { |
| | 153 | TracUtils.AuthorIcons.insertIcon(authors[i]); |
| | 154 | } |
| | 155 | } |
| | 156 | |
| | 157 | , getIconByAuthor : function (author) { |
| | 158 | var iconUrl = TracUtils.AUTHOR_ICONS[author] || TracUtils.AUTHOR_ICONS["*default*"] |
| | 159 | |
| | 160 | // Hatena ID |
| | 161 | iconUrl = iconUrl.replace(/^id:(([\w-]{2})[\w-]*)/, 'http://www.hatena.ne.jp/users/$2/$1/profile_s.gif'); |
| | 162 | |
| | 163 | return iconUrl; |
| | 164 | } |
| | 165 | |
| | 166 | , insertIcon : function (authorEOrArray) { |
| | 167 | var authorE; |
| | 168 | var author; |
| | 169 | if (authorEOrArray instanceof Array) { |
| | 170 | authorE = $(authorEOrArray[0]); |
| | 171 | author = authorEOrArray[1]; |
| | 172 | } else { |
| | 173 | authorE = $(authorEOrArray); |
| | 174 | author = authorE.text().replace(/^\s+|\??\s*$/g, ''); |
| | 175 | } |
| | 176 | |
| | 177 | var iconurl = TracUtils.AuthorIcons.getIconByAuthor(author); |
| | 178 | if (!iconurl) return; |
| | 179 | |
| | 180 | var img = $("<img width='16' height='16' alt='' class='committer-icon'/>") |
| | 181 | .attr("src", iconurl) |
| | 182 | .css("margin-right", "0.5em"); |
| | 183 | |
| | 184 | var a = $("<a style='background-image: none ! important; padding-left: 0pt; border: none;'/>") |
| | 185 | .attr("href", TracUtils.AuthorIcons.getDiary(author)) |
| | 186 | .append(img); |
| | 187 | |
| | 188 | authorE.prepend(a); |
| | 189 | } |
| | 190 | |
| | 191 | , getDiary : function (author) { |
| | 192 | return 'http://coderepos.org/share/wiki/Committers/' + author; |