| 250 | | * user.js のページがインストール画面でてうざいのをなんとかする。 |
| 251 | | */ |
| 252 | | , avoidGreasemonkeyInstallation : function () { |
| 253 | | // あんまり広範囲にやりたくないので決め打ち |
| 254 | | if (($.browser.mozilla || $.browser.safari) && location.pathname == "/share/browser/lang/javascript/userscripts") { |
| 255 | | $("a").each(function () { |
| 256 | | if (this.href.indexOf(".user.js") == this.href.length - 8) this.href += "?"; |
| 257 | | }); |
| 258 | | } |
| 259 | | } |
| 260 | | |
| 261 | | /** |
| 262 | | * user.js のページにインストールURLを追加する. |
| 263 | | */ |
| 264 | | , addGreasemonkeyInstallLink : function () { |
| 265 | | if (!(new RegExp("^/share/browser/lang/javascript/userscripts/.*\\.user\\.js")).test(location.pathname) || |
| 266 | | !$.browser.mozilla && !$.browser.safari) |
| 267 | | return; |
| 268 | | var uri = location.protocol + '//svn.coderepos.org' + location.pathname.replace('browser/', ''); |
| 269 | | $('<a/>') |
| 270 | | .attr({ |
| 271 | | href : uri, |
| 272 | | title : uri.split('/').slice(-1) + ' をインストールする' |
| 273 | | }) |
| 274 | | .text('インストール - ' + uri) |
| 275 | | .insertAfter($('h1:first')); |
| | 253 | * Userscripts のユーティリティ |
| | 254 | */ |
| | 255 | , addUserscriptsUtils : function () { |
| | 256 | if (($.browser.mozilla || $.browser.safari)) { |
| | 257 | // user.js のページがインストール画面でてうざいのをなんとかする。 |
| | 258 | // あんまり広範囲にやりたくないので決め打ち |
| | 259 | if (location.pathname == "/share/browser/lang/javascript/userscripts") { |
| | 260 | $("a").each(function () { |
| | 261 | if (this.href.indexOf(".user.js") == this.href.length - 8) this.href += "?"; |
| | 262 | }); |
| | 263 | } |
| | 264 | |
| | 265 | // user.js のページにインストールURLを追加する. |
| | 266 | if (location.pathname.match(/\.user\.js$/)) { |
| | 267 | var uri = TracUtils.getSourcePath(location); |
| | 268 | $('<a/>').attr({ |
| | 269 | href : uri, |
| | 270 | title : uri.split('/').slice(-1) + ' をインストールする' |
| | 271 | }) |
| | 272 | .text('インストール - ' + uri) |
| | 273 | .insertAfter($('h1:first')); |
| | 274 | } |
| | 275 | } |