| 14 | | SVN_REPOS_BASE : 'http://svn.coderepos.org/share', |
| 15 | | TRAC_BASE : 'http://coderepos.org/share', |
| 16 | | AUTHOR_ICONS : { |
| 17 | | //'tomoyo' : 'http://www.hatena.ne.jp/users/ma/mayuki/profile_s.gif' |
| 18 | | //'tomoyo' : 'id:mayuki' |
| 19 | | '*default*' : 'http://coderepos.org/share/htdocs/default-author-icon.png' |
| 20 | | , 'mayuki' : 'id:mayuki' |
| 21 | | , 'yappo' : 'id:yappo' |
| 22 | | , 'typester' : 'http://en.gravatar.com/avatar/fbc6511bcc0649366086c0445fb456d3?s=16'//'id:typester' |
| 23 | | , 'kentaro' : 'id:antipop' |
| 24 | | , 'mizzy' : 'id:gosukenator' |
| 25 | | , 'charsbar' : 'id:charsbar' |
| 26 | | , 'secondlife' : 'id:secondlife' |
| 27 | | , 'kazeburo' : 'id:kazeburo' |
| 28 | | , 'otsune' : 'id:otsune' |
| 29 | | , 'hirose31' : 'id:hirose31' |
| 30 | | , 'nipotan' : 'id:nipotan' |
| 31 | | , 'itkz' : 'id:ITKz' |
| 32 | | , 'xcezx' : 'id:xcezx' |
| 33 | | , 'nyarla' : 'id:nyarla-net' |
| 34 | | , 'tokuhirom' : 'id:tokuhirom' |
| 35 | | , 'daisuke' : 'id:lestrrat' |
| 36 | | , 'kana' : 'id:ka-nacht' |
| 37 | | , 'cho45' : 'id:cho45' |
| 38 | | , 'kan' : 'id:kan' |
| 39 | | , 'zigorou' : 'id:ZIGOROu' |
| 40 | | , 'masaki' : 'id:ikasam_a' |
| 41 | | , 'holidays-l' : 'id:holidays-l' |
| 42 | | , 'yoko' : 'id:yksk' |
| 43 | | , 'mattn' : 'id:mattn' |
| 44 | | , 'lopnor' : 'id:lopnor' |
| 45 | | , 'gyuque' : 'id:gyuque' |
| 46 | | , 'yugui' : 'id:yugui' |
| 47 | | , 'akihito' : 'id:t-akihito' |
| 48 | | , 'fujiwara' : 'id:sfujiwara' |
| 49 | | , 'yusukebe' : 'id:kamawada' |
| 50 | | , 'miyagawa' : 'id:miyagawa' |
| 51 | | , 'topia' : 'id:topia' |
| 52 | | , 'woremacx' : 'id:woremacx' |
| 53 | | , 'amachang' : 'id:amachang' |
| 54 | | , 'takesako' : 'id:TAKESAKO' |
| 55 | | , 'eto' : 'id:eto' |
| 56 | | , 'dankogai' : 'id:dankogai' |
| 57 | | , 'jknaoya' : 'id:jknaoya' |
| 58 | | , 'yasu' : 'id:hirata_yasuyuki' |
| 59 | | , 'holygrail' : 'id:HolyGrail' |
| 60 | | , 'elim' : 'id:elim' |
| 61 | | , 'cheebow' : 'id:cheebow' |
| 62 | | , 'ariela' : 'http://en.gravatar.com/avatar/dd5dfb5d738d5b5fb1c9a8b234945ea6?s=16'//'id:transrain' |
| 63 | | , 'tomyhero' : 'id:tomyhero' |
| 64 | | , 'hetappi' : 'id:hetappi' |
| 65 | | , 'coji' : 'id:coji' |
| 66 | | , 'takemaru' : 'id:teahut' |
| 67 | | , 'akasata' : 'id:akasata' |
| 68 | | , 'okuryu' : 'id:okuryu' |
| 69 | | , 'tasuku' : 'id:tasukuchan' |
| 70 | | , 'snj14' : 'id:snj14' |
| 71 | | , 'shachi' : 'id:shachi_kk' |
| 72 | | , 'omoon' : 'id:omoon' |
| 73 | | , 'aerith' : 'id:aerith' |
| 74 | | , 'clouder' : 'id:clouder' |
| 75 | | , 'takkyun' : 'id:simpleboxes' |
| 76 | | , 'naoya_t' : 'http://ntzone.info/misc/keroro.gif' |
| 77 | | , 'takefumi' : 'id:takefumi' |
| 78 | | , 'walf443' : 'id:walf443' |
| 79 | | , 'psychs' : 'id:Psychs' |
| 80 | | , 'ewigkeit' : 'id:Ewigkeit' |
| 81 | | , 'yoshiori' : 'id:Yoshiori' |
| 82 | | , 'dev0000' : 'http://www.developer0000.jp/16.jpg' |
| 83 | | , 'machu' : 'id:kmachu' |
| 84 | | , 'norio_s' : 'id:norio_s' |
| 85 | | , 'hsbt' : 'id:h-sbt' |
| 86 | | , 'nori090' : 'id:nori090' |
| 87 | | , 'lyokato' : 'id:lyokato' |
| 88 | | , 'drgqst' : 'id:drgqst' |
| 89 | | , 'mrkn' : 'id:mrkn' |
| 90 | | , 'tfunato' : 'id:tfunato' |
| 91 | | , 'tsuka' : 'id:tsuka05' |
| 92 | | , 'niw' : 'id:niw' |
| 93 | | , 'tomi-ru' : 'id:tomi-ru' |
| 94 | | , 'yto' : 'id:yto' |
| 95 | | , 'motemen' : 'id:motemen' |
| 96 | | , 'shyouhei' : 'http://mput.dip.jp/mput/images/icon.jpg' |
| 97 | | , 'm-takagi' : 'http://en.gravatar.com/avatar/c3f5a6e729b57f99cb9e7b3ca60152aa?s=16' |
| 98 | | , 'takano32' : 'id:takano32' |
| 99 | | , 'kakutani' : 'id:kakutani' |
| 100 | | , 'poppen' : 'id:poppen' |
| 101 | | , 'kotas' : 'id:kotas' |
| 102 | | , 'nekokak' : 'id:nekokak' |
| 103 | | , 'tosik' : 'id:tosik' |
| 104 | | , 'fbis' : 'id:fbis' |
| 105 | | , 'rsk' : 'id:rsky' |
| 106 | | , 'mallowlabs' : 'id:mallowlabs' |
| 107 | | , 'nakamud' : 'http://s3.amazonaws.com/twitter_production/profile_images/35752262/SP_mu-toko_mini.jpg' |
| 108 | | , 'chiba' : 'id:nihen' |
| 109 | | , 'funaki' : 'id:nob_funaki' |
| 110 | | , 'dzfl' : 'id:dzfl' |
| 111 | | , 'shimooka' : 'id:shimooka' |
| 112 | | //, 'noriaki' : 'http://s3.amazonaws.com/twitter_production/profile_images/40454133/2f94929d_mini.jpg'//FIXME: 404 |
| 113 | | , 'suztomo' : 'id:suztomo' |
| 114 | | , 'klm' : 'id:k1m' |
| 115 | | , 'akio0911' : 'id:akio0911' |
| 116 | | , 'cactusman' : 'id:cactusman' |
| 117 | | , 'vkgtaro' : 'id:vkgtaro' |
| 118 | | , 'todesking' : 'http://data.tumblr.com/avatar_1fe558be2f23_16.gif' |
| 119 | | , 'sho' : 'id:sho' |
| 120 | | , 'a2c' : 'id:a2c' |
| 121 | | , 'hidek' : 'http://en.gravatar.com/avatar/7d55041891ece2f35375108aa2d27255?s=16'//'id:hide-K'' |
| 122 | | , 'yhara' : 'id:yhara' |
| 123 | | , 'PoohKid' : 'id:PoohKid' |
| 124 | | , 'samurai20000' : 'id:samurai20000' |
| 125 | | , 'yasuyuki' : 'id:YaSuYuKi' |
| 126 | | , 'mootoh' : 'id:moira' |
| 127 | | , 'tokada' : 'id:tokada' |
| 128 | | , 'llamerada' : 'id:llamerada' |
| 129 | | , 'shn' : 'id:shn' |
| 130 | | , 'nejimaki' : 'id:firewood' |
| 131 | | , 'kan' : 'id:mikihoshi' |
| 132 | | , 'hideden' : 'id:hideden' |
| 133 | | , 'niku' : 'http://niku.name/favicon.ico' |
| 134 | | , 'ohac' : 'id:ohac' |
| 135 | | , 'hio' : 'http://en.gravatar.com/avatar/a72d2120c066d47ad3d29c17b2f4db72?s=16' |
| 136 | | , 'os0x' : 'id:os0x' |
| 137 | | , 'akiyan' : 'id:akiyan' |
| 138 | | , 'inudog' : 'http://eringi.com/favicon.ico' |
| 139 | | , 'suzuki' : 'id:zatsubun' |
| 140 | | , 'haruka' : 'http://drumsoft.com/favicon.ico' |
| 141 | | , 'syttru' : 'id:syttru' |
| 142 | | , 'iskwrsk' : 'id:iskwrsk' |
| 143 | | , 'komatsuna' : 'http://data.tumblr.com/avatar_82a9ef4053ec_30.gif' |
| 144 | | , 'tarchan' : 'id:tarchan' |
| 145 | | , 'tyoro' : 'id:tyoro1210' |
| 146 | | , 'Sore_0' : 'id:Sore_0' |
| 147 | | , 'teramako' : 'id:teramako' |
| 148 | | , 'kamipo' : 'id:kamipo' |
| 149 | | , 'ihag' : 'id:ihag' |
| 150 | | , 'valda' : 'http://data.tumblr.com/avatar_a5fb0192ec7d_16.gif' |
| 151 | | , 'gan2' : 'id:gan2' |
| 152 | | , 'sasezaki' : 'id:sasezaki' |
| 153 | | , 'kdoya' : 'id:kdoya' |
| 154 | | , 'stomita' : 'id:shinichitomita' |
| 155 | | , 'cesare' : 'id:cesare' |
| 156 | | , 'ku' : 'id:ku0522' |
| 157 | | , 'DotMG' : 'http://dotmg.net/favicon.ico' |
| 158 | | , 'akihirox' : 'id:akihirox' |
| 159 | | , 'ha1t' : 'id:ha1t' |
| 160 | | , 'hiro_y' : 'id:hiro_y' |
| 161 | | , 'hiratara' : 'id:hiratara' |
| 162 | | , 'sotarok' : 'id:sotarok' |
| 163 | | , 'bto' : 'http://bz2.jp/myself.jpg' |
| 164 | | , 'quek' : 'id:quek' |
| 165 | | , 'SKAhack' : 'id:SKAhack' |
| 166 | | , 'discypus' : 'http://discypus.jp/favicon.ico' |
| 167 | | , 'maru_cc' : 'id:maru_cc' |
| 168 | | , 'key' : 'http://en.gravatar.com/avatar/57eb5b1713206c5edb521dde99cc5f30?s=16' |
| 169 | | , 'matarillo' : 'id:matarillo' |
| 170 | | , 'stellaqua' : 'id:stellaqua' |
| 171 | | , 'hiraku' : 'http://www.hinet.mydns.jp/hiraku.png' |
| 172 | | , 'heavenshell' : 'id:heavenshell' |
| 173 | | , 'toby_net' : 'id:toby' |
| 174 | | , 'bonnu' : 'id:boxphere' |
| 175 | | , 'kga' : 'id:KGA' |
| 176 | | , 'wakapon' : 'id:w-a_k-a_p-o_n' |
| 177 | | , 'hakobe' : 'id:hakobe932' |
| 178 | | , 'from_kyushu' : 'id:from_kyushu' |
| 179 | | , 'anatoo' : 'id:anatoo' |
| 180 | | , 'kumatch' : 'id:hato_kumatch' |
| 181 | | , 'keisuken' : 'id:keisuke_n' |
| 182 | | , 'yaa' : 'id:YAA' |
| 183 | | , 'mariot' : 'id:mariot1218' |
| 184 | | , 'kshimo69' : 'id:kshimo69' |
| 185 | | , 'fujidig' : 'id:chaperatta' |
| 186 | | , 'wozozo' : 'id:wozozo' |
| 187 | | , 'riaf' : 'id:riaf' |
| 188 | | , 'michisu' : 'id:michisu' |
| 189 | | , 'javascripter' : 'id:javascripter' |
| 190 | | , 'nothingmuch' : 'http://en.gravatar.com/avatar/81912bc5ca02376f99a5ee44531dee27?s=16' |
| 191 | | , 'dragon3' : 'id:dragon3' |
| 192 | | , 'oppara' : 'id:oppara' |
| 193 | | , 'MichaeL' : 'id:MichaeL' |
| 194 | | , 'fd0' : 'id:fd0' |
| 195 | | , 'kiske' : 'id:Kiske' |
| 196 | | , 'ishihara' : 'id:m4i' |
| 197 | | , 'whym' : 'id:whym' |
| 198 | | , 'anekos' : 'id:nokturnalmortum' |
| 199 | | , 'sakito' : 'id:sakito' |
| 200 | | , 'Yuichirou' : 'id:Yuichirou' |
| 201 | | , 'mux03' : 'id:mux03' |
| 202 | | , 'rewish' : 'id:Rewish' |
| 203 | | , 'yudoufu' : 'id:Yudoufu' |
| 204 | | , 'n0ts' : 'id:n0ts' |
| 205 | | , 'yuroyoro' : 'id:yuroyoro' |
| 206 | | , 'g000001' : 'id:g000001' |
| 207 | | } |
| 208 | | |
| 209 | | , installAll : function () { |
| 210 | | TracUtils.addJumpToReposLink(); |
| 211 | | TracUtils.clickableCodeArea(); |
| 212 | | TracUtils.addBodyClass(); |
| 213 | | TracUtils.addCommitterRecentCommits(); |
| 214 | | TracUtils.addRecentChangesForProject(); |
| 215 | | TracUtils.addUserscriptsUtils(); |
| 216 | | TracUtils.AuthorIcons.showAuthorIcons(); |
| 217 | | } |
| 218 | | |
| 219 | | , isWikiStart : function () { |
| 220 | | var pn = location.pathname |
| 221 | | return ( |
| 222 | | pn == "/share/wiki/WikiStart" || |
| 223 | | pn == "/share/wiki/" || |
| 224 | | pn == "/share/wiki" || |
| 225 | | pn == "/share/" || |
| 226 | | pn == "/share" |
| 227 | | ); |
| 228 | | } |
| 229 | | |
| 230 | | , getSourcePath : function (tracPath) { |
| 231 | | return String(tracPath).replace(TracUtils.TRAC_BASE + "/browser", TracUtils.SVN_REPOS_BASE).replace(/\?.*$/, ''); |
| 232 | | } |
| 233 | | |
| 234 | | /** |
| 235 | | * Browse Source のときに該当する svn web にすぐ翔べるリンクと |
| 236 | | * ?rev= をはずすリンクを追加 |
| 237 | | */ |
| 238 | | , addJumpToReposLink : function () { |
| 239 | | var aboutLink = $("#metanav li.last a"); |
| 240 | | if (location.pathname.indexOf("/share/browser") == 0) { |
| 241 | | var sourcePath = TracUtils.getSourcePath(location); |
| 242 | | aboutLink.replaceWith( |
| 243 | | $("<a title='Jump to Repository'>SVN Web</a>").attr("href", sourcePath) |
| 244 | | ); |
| 245 | | $("#ctxtnav li:first").after($("<li/>").append($("<a>SVN Web</a>").attr("href", sourcePath))); |
| 246 | | $("#ctxtnav li:first").after($("<li/>").append($("<a>Latest Revision</a>").attr("href", location.pathname))); |
| 247 | | } else { |
| 248 | | aboutLink.replaceWith( |
| 249 | | $("<a title='Jump to Repository'>SVN Web</a>").attr("href", TracUtils.SVN_REPOS_BASE) |
| 250 | | ); |
| 251 | | } |
| 252 | | } |
| 253 | | |
| 254 | | /** |
| 255 | | * Wiki に書かれた JS のコードを実行可能に |
| 256 | | * 冒頭に //Executable と書くと実行できるようになる。 |
| 257 | | */ |
| 258 | | , clickableCodeArea : function () { |
| 259 | | var start = "//Executable"; |
| 260 | | $("//*[@id='content']//div[@class='code']/pre[contains(.//span[@class='code-comment'],'"+start+"')]").each(function () { |
| 261 | | var e = $(this); |
| 262 | | var js = e.text(); |
| 263 | | var a = $("<a href='javascript:void(156)'>Click to execute.</a>").click(function () { |
| 264 | | eval(js); |
| 265 | | }).css({ |
| 266 | | fontSize : "80%", |
| 267 | | fontWeight : "bold", |
| 268 | | border : "1px solid #ccc", |
| 269 | | display : "block", |
| 270 | | width : "10em", |
| 271 | | padding : "0.2em", |
| 272 | | margin : "0 auto 0.2em 0", |
| 273 | | textAlign : "center" |
| 274 | | }).insertBefore(e.parent()); |
| 275 | | }); |
| 276 | | } |
| 277 | | |
| 278 | | /** |
| 279 | | * CSS 補佐用 (IE6 で CSS セレクタの対応が貧弱なため) |
| 280 | | */ |
| 281 | | , addBodyClass : function () { |
| 282 | | if (location.pathname.indexOf("/share/wiki/Committers") == 0) { |
| 283 | | document.body.className = "committer"; |
| 284 | | } |
| 285 | | if (TracUtils.isWikiStart()) { |
| 286 | | $("//*[@id='Committers']/following-sibling::ul[1]").addClass("committer-list"); |
| 287 | | $("//*[@id='Projects']/following-sibling::ul[1]").addClass("project-list"); |
| 288 | | } |
| 289 | | } |
| 290 | | |
| 291 | | /** |
| 292 | | * コミッタページにその人の最近のコミットリストを表示する。 |
| 293 | | * Trac の検索機能を使っているので、コミットログに名前をかきまくると |
| 294 | | * 検索結果の1ページ目 == 10個しかみていないので |
| 295 | | * その人の最近のコミットがなかったことになるいじめができる。 |
| 296 | | */ |
| 297 | | , addCommitterRecentCommits : function () { |
| 298 | | if (!location.search && !/^\/share\/wiki\/Committers\/([^\/]{3,})/.test(location.pathname)) return; |
| 299 | | var author = RegExp.$1; |
| 300 | | $.get(TracUtils.TRAC_BASE+"/search?q="+author+"&noquickjump=1&changeset=on", {}, function (data) { |
| 301 | | $("<div class='recent-commits'><h2>Recent Commits</h2></div>").append( |
| 302 | | $(data).xfind(".//dl") |
| 303 | | .xfind("dd[span[@class='author'] != 'By "+author+"']") |
| 304 | | .xfind("preceding-sibling::dt[1] | preceding-sibling::dd[1]").remove().end() |
| 305 | | .remove().end() |
| 306 | | ).appendTo($("#searchable, #content").get(0)); |
| 307 | | }); |
| 308 | | } |
| 309 | | |
| 310 | | /** |
| 311 | | * プロジェクトページへ最近のコミットリストを表示する。 |
| 312 | | * {{{ |
| 313 | | * svn co http://svn.coderepos.org/share/... |
| 314 | | * }}} |
| 315 | | * のように co と checkout, export の書いてあるページが対象。 |
| 316 | | */ |
| 317 | | , addRecentChangesForProject : function () { |
| 318 | | // IE だとなぜかどうしようもなく遅いので処理しない |
| 319 | | if ($.browser.msie || !TracUtils.isWikiStart() && location.pathname.indexOf("/share/wiki/") != 0) return; |
| 320 | | var target_re = RegExp("svn +(?:c(?:o|heckout)|export) +"+TracUtils.SVN_REPOS_BASE+"(\\S+)"); |
| 321 | | $("#searchable pre").each(function () { |
| 322 | | var m = $(this).text().match(target_re); |
| 323 | | if (!m) return; |
| 324 | | var path = m[1].replace(/\/trunk\/?$/, ""); |
| 325 | | var url = TracUtils.TRAC_BASE + "/log" + path; |
| 326 | | $.get(url, {}, function (data) { |
| 327 | | // 高速化と、jQuery がだす getElementsByTagName がないという |
| 328 | | // エラーを回避するため正規表現 |
| 329 | | data = data.match(/<table id="chglist"[\S\s]+<\/table>/)[0]; |
| 330 | | $("<div><h2><a href='"+url+"'>Project Recent Changes</a></h2></div>") |
| 331 | | .append( |
| 332 | | $(data) |
| 333 | | .find("tr:gt(10)").remove().end() |
| 334 | | .find("th.diff, td.diff, th.change, td.change, th.rev, td.rev").remove().end() |
| 335 | | ) |
| 336 | | .appendTo("#searchable"); |
| 337 | | }); |
| 338 | | return false; |
| 339 | | }); |
| 340 | | } |
| 341 | | |
| 342 | | /** |
| 343 | | * Userscripts のユーティリティ |
| 344 | | */ |
| 345 | | , addUserscriptsUtils : function () { |
| 346 | | if (!$.browser.mozilla && !$.browser.safari) return; |
| 347 | | // 尻? |
| 348 | | var isUserJS = function (path) { |
| 349 | | return /\.user\.js$/.test(path); |
| 350 | | }; |
| 351 | | // user.js のページでインストール画面がでてうざいのをなんとかする。 |
| 352 | | // あんまり広範囲にやりたくないので決め打ち |
| 353 | | if (location.pathname.indexOf("/share/browser/lang/javascript/userscripts") == 0) { |
| 354 | | $("a").each(function () { |
| 355 | | if (isUserJS(this.href)) this.href += "?"; |
| 356 | | }); |
| 357 | | } |
| 358 | | |
| 359 | | // user.js のページにインストール URL を追加する. |
| 360 | | if (isUserJS(location.pathname)) { |
| 361 | | var uri = TracUtils.getSourcePath(location); |
| 362 | | $("<a/>").attr({ |
| 363 | | href : uri, |
| 364 | | title : uri.split("/").slice(-1) + " をインストールする" |
| 365 | | }) |
| 366 | | .text("インストール - " + uri) |
| 367 | | .insertAfter($("h1:first")); |
| 368 | | } |
| 369 | | } |
| 370 | | |
| 371 | | /** |
| 372 | | * Trac のあらゆるところに設定されたアイコンを表示する。 |
| 373 | | * TracAuthorIcon.js を jQuery/XPath 依存にして簡略化したもの |
| 374 | | */ |
| 375 | | , AuthorIcons : { |
| 376 | | showAuthorIcons : function () { |
| 377 | | var authors = []; |
| 378 | | switch ($("#content").attr("class")) { |
| 379 | | case 'browser': |
| 380 | | $('//*[@id="info"]//th').each(function () { |
| 381 | | authors.push([this, $(this).text().match(/checked in by ([^,]+)/)[1]]); |
| 382 | | }); |
| 383 | | $('//*[@id="dirlist"]//span[@class="author"]').each(function () { |
| 384 | | authors.push([this, $(this).text().match(/^([^:]+):/)[1]]); |
| 385 | | }); |
| 386 | | break; |
| 387 | | case 'timeline': |
| 388 | | $('//*[@id="content"]//dt//span[@class="author"]').each(function () { |
| 389 | | authors.push([this, $(this).text()]); |
| 390 | | }); |
| 391 | | break; |
| 392 | | case 'log': |
| 393 | | case 'changeset': |
| 394 | | authors = $('(//*[@id="overview"] | //*[@id="chglist"])//*[@class="author"]'); |
| 395 | | break; |
| 396 | | case 'wiki': |
| 397 | | if (/^\/share\/wiki\/Committers\/([^\/]+)/.test(location.pathname)) { |
| 398 | | var author = RegExp.$1; |
| 399 | | var iconurl = TracUtils.AuthorIcons.getIconByAuthor(author); |
| 400 | | if (!iconurl) break; |
| 401 | | var img = $("<img width='16' height='16' alt='' class='committer-icon'/>").attr("src", iconurl); |
| 402 | | var h1 = $("//*[@id='searchable']/h1[1]"); |
| 403 | | if (h1.length) { |
| 404 | | h1.append(img); |
| 405 | | } else { |
| 406 | | $("#content").prepend(img); |
| 407 | | } |
| 408 | | } |
| 409 | | else if (TracUtils.isWikiStart()) { |
| 410 | | // This is for committers list of CodeRepos. |
| 411 | | // var authors |
| 412 | | $.each($("//*[@id='Committers']/following-sibling::ul[1]//a[contains(@href, '/share/wiki/Committers/')]"), function() { |
| 413 | | authors.push([this, $(this).text().match(/Committer:([^,]+)/)[1]]); |
| 414 | | }) |
| 415 | | } |
| 416 | | break; |
| 417 | | default: break; |
| 418 | | } |
| 419 | | |
| 420 | | for (var i = authors.length; i --> 0; TracUtils.AuthorIcons.insertIcon(authors[i])); |
| 421 | | |
| 422 | | $("#metanav ul li.first").each(function () { |
| 423 | | var uname = $(this).text().match(/logged in as ([^,]+)/); |
| 424 | | if (!uname) return; |
| 425 | | var a = $("<a/>").attr("href", TracUtils.AuthorIcons.getAuthorPage(uname[1])).append(uname[1]); |
| 426 | | a.appendTo( |
| 427 | | $(this).empty().append("logged in as ") |
| 428 | | ); |
| 429 | | TracUtils.AuthorIcons.insertIcon(a); |
| 430 | | }); |
| 431 | | } |
| 432 | | |
| 433 | | , getIconByAuthor : function (author) { |
| 434 | | var iconUrl = TracUtils.AUTHOR_ICONS[author] || TracUtils.AUTHOR_ICONS["*default*"]; |
| 435 | | |
| 436 | | // Hatena ID |
| 437 | | iconUrl = iconUrl.replace(/^id:(([a-zA-Z][\w-])[\w-]{0,29}[a-zA-Z\d])/, 'http://www.hatena.ne.jp/users/$2/$1/profile_s.gif'); |
| 438 | | |
| 439 | | return iconUrl; |
| 440 | | } |
| 441 | | |
| 442 | | , insertIcon : function (authorEOrArray) { |
| 443 | | var authorE, author; |
| 444 | | if (authorEOrArray instanceof Array) { |
| 445 | | authorE = $(authorEOrArray[0]); |
| 446 | | author = authorEOrArray[1]; |
| 447 | | } else { |
| 448 | | authorE = $(authorEOrArray); |
| 449 | | author = authorE.text().replace(/^\s+|\??\s*$/g, ''); |
| 450 | | } |
| 451 | | |
| 452 | | var iconurl = TracUtils.AuthorIcons.getIconByAuthor(author); |
| 453 | | if (!iconurl) return; |
| 454 | | |
| 455 | | var img = $("<img width='16' height='16' alt='' class='committer-icon'/>") |
| 456 | | .attr("src", iconurl) |
| 457 | | .css("margin-right", "0.5em"); |
| 458 | | |
| 459 | | var a = $("<a style='background-image: none ! important; padding-left: 0pt; border: none;'/>") |
| 460 | | .attr("href", TracUtils.AuthorIcons.getAuthorPage(author)) |
| 461 | | .append(img); |
| 462 | | |
| 463 | | authorE.prepend(a); |
| 464 | | |
| 465 | | // workarround for IE |
| 466 | | if ($.browser.msie && $("#content").attr("class") == 'timeline') { |
| 467 | | $(a).parent().css({backgroundColor: 'white'}); |
| 468 | | } |
| 469 | | } |
| 470 | | |
| 471 | | , getAuthorPage : function (author) { |
| 472 | | return TracUtils.TRAC_BASE + "/wiki/Committers/" + author; |
| 473 | | } |
| 474 | | } |
| | 14 | SVN_REPOS_BASE : 'http://svn.coderepos.org/share', |
| | 15 | TRAC_BASE : 'http://coderepos.org/share', |
| | 16 | AUTHOR_ICONS : { |
| | 17 | //'tomoyo' : 'http://www.hatena.ne.jp/users/ma/mayuki/profile_s.gif' |
| | 18 | //'tomoyo' : 'id:mayuki' |
| | 19 | '*default*' : 'http://coderepos.org/share/htdocs/default-author-icon.png' |
| | 20 | , 'mayuki' : 'id:mayuki' |
| | 21 | , 'yappo' : 'id:yappo' |
| | 22 | , 'typester' : 'http://en.gravatar.com/avatar/fbc6511bcc0649366086c0445fb456d3?s=16'//'id:typester' |
| | 23 | , 'kentaro' : 'id:antipop' |
| | 24 | , 'mizzy' : 'id:gosukenator' |
| | 25 | , 'charsbar' : 'id:charsbar' |
| | 26 | , 'secondlife' : 'id:secondlife' |
| | 27 | , 'kazeburo' : 'id:kazeburo' |
| | 28 | , 'otsune' : 'id:otsune' |
| | 29 | , 'hirose31' : 'id:hirose31' |
| | 30 | , 'nipotan' : 'id:nipotan' |
| | 31 | , 'itkz' : 'id:ITKz' |
| | 32 | , 'xcezx' : 'id:xcezx' |
| | 33 | , 'nyarla' : 'id:nyarla-net' |
| | 34 | , 'tokuhirom' : 'id:tokuhirom' |
| | 35 | , 'daisuke' : 'id:lestrrat' |
| | 36 | , 'kana' : 'id:ka-nacht' |
| | 37 | , 'cho45' : 'id:cho45' |
| | 38 | , 'kan' : 'id:kan' |
| | 39 | , 'zigorou' : 'id:ZIGOROu' |
| | 40 | , 'masaki' : 'id:ikasam_a' |
| | 41 | , 'holidays-l' : 'id:holidays-l' |
| | 42 | , 'yoko' : 'id:yksk' |
| | 43 | , 'mattn' : 'id:mattn' |
| | 44 | , 'lopnor' : 'id:lopnor' |
| | 45 | , 'gyuque' : 'id:gyuque' |
| | 46 | , 'yugui' : 'id:yugui' |
| | 47 | , 'akihito' : 'id:t-akihito' |
| | 48 | , 'fujiwara' : 'id:sfujiwara' |
| | 49 | , 'yusukebe' : 'id:kamawada' |
| | 50 | , 'miyagawa' : 'id:miyagawa' |
| | 51 | , 'topia' : 'id:topia' |
| | 52 | , 'woremacx' : 'id:woremacx' |
| | 53 | , 'amachang' : 'id:amachang' |
| | 54 | , 'takesako' : 'id:TAKESAKO' |
| | 55 | , 'eto' : 'id:eto' |
| | 56 | , 'dankogai' : 'id:dankogai' |
| | 57 | , 'jknaoya' : 'id:jknaoya' |
| | 58 | , 'yasu' : 'id:hirata_yasuyuki' |
| | 59 | , 'holygrail' : 'id:HolyGrail' |
| | 60 | , 'elim' : 'id:elim' |
| | 61 | , 'cheebow' : 'id:cheebow' |
| | 62 | , 'ariela' : 'http://en.gravatar.com/avatar/dd5dfb5d738d5b5fb1c9a8b234945ea6?s=16'//'id:transrain' |
| | 63 | , 'tomyhero' : 'id:tomyhero' |
| | 64 | , 'hetappi' : 'id:hetappi' |
| | 65 | , 'coji' : 'id:coji' |