Greasemonkey script for gitorious

gitorious提供了查看文件的功能,但是我发现只有第一层目录下的文件可以看,深层目录下的文件都不能看,会发生404 not found错误。论坛里也有人遇到同样的问题。因为不懂Rails,尝试apache mod_rewrite也以失败告终,没法子,自己写了一个greasemonkey脚本,把链接修改过来。

// ==UserScript==
// @name           Unescape Slash
// @namespace      http://example.com/projects/
// @include        http://example.com/projects/*
// ==/UserScript==

var allNodeFile, thisNodeFile, a;
allNodeFile = document.getElementsByClassName('node file');
thisNodeFile = 0;
for (var i = 0; i < allNodeFile.length; ++i) {
    thisNodeFile = allNodeFile[i];
    a = thisNodeFile.firstChild;
    a.href = a.href.replace(/%2F/g, '/');
}

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据