mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-26 22:04:01 +00:00
--HG-- rename : sites/dev.scrapy.org/htdocs/asc.png => sites/static.scrapy.org/asc.png rename : sites/dev.scrapy.org/htdocs/attachment.png => sites/static.scrapy.org/attachment.png rename : sites/dev.scrapy.org/htdocs/changeset.png => sites/static.scrapy.org/changeset.png rename : sites/dev.scrapy.org/htdocs/closedticket.png => sites/static.scrapy.org/closedticket.png rename : sites/dev.scrapy.org/htdocs/collapsed.png => sites/static.scrapy.org/collapsed.png rename : sites/dev.scrapy.org/htdocs/css/about.css => sites/static.scrapy.org/css/about.css rename : sites/dev.scrapy.org/htdocs/css/admin.css => sites/static.scrapy.org/css/admin.css rename : sites/dev.scrapy.org/htdocs/css/browser.css => sites/static.scrapy.org/css/browser.css rename : sites/dev.scrapy.org/htdocs/css/changeset.css => sites/static.scrapy.org/css/changeset.css rename : sites/dev.scrapy.org/htdocs/css/code.css => sites/static.scrapy.org/css/code.css rename : sites/dev.scrapy.org/htdocs/css/diff.css => sites/static.scrapy.org/css/diff.css rename : sites/dev.scrapy.org/htdocs/css/prefs.css => sites/static.scrapy.org/css/prefs.css rename : sites/dev.scrapy.org/htdocs/css/report.css => sites/static.scrapy.org/css/report.css rename : sites/dev.scrapy.org/htdocs/css/roadmap.css => sites/static.scrapy.org/css/roadmap.css rename : sites/dev.scrapy.org/htdocs/css/search.css => sites/static.scrapy.org/css/search.css rename : sites/dev.scrapy.org/htdocs/css/ticket.css => sites/static.scrapy.org/css/ticket.css rename : sites/dev.scrapy.org/htdocs/css/timeline.css => sites/static.scrapy.org/css/timeline.css rename : sites/dev.scrapy.org/htdocs/css/trac-0.11rc2.css.diff => sites/static.scrapy.org/css/trac-0.11rc2.css.diff rename : sites/dev.scrapy.org/htdocs/css/trac.css => sites/static.scrapy.org/css/trac.css rename : sites/dev.scrapy.org/htdocs/css/wiki.css => sites/static.scrapy.org/css/wiki.css rename : sites/dev.scrapy.org/htdocs/desc.png => sites/static.scrapy.org/desc.png rename : sites/dev.scrapy.org/htdocs/dots.gif => sites/static.scrapy.org/dots.gif rename : sites/dev.scrapy.org/htdocs/draft.png => sites/static.scrapy.org/draft.png rename : sites/dev.scrapy.org/htdocs/edit_toolbar.png => sites/static.scrapy.org/edit_toolbar.png rename : sites/dev.scrapy.org/htdocs/editedticket.png => sites/static.scrapy.org/editedticket.png rename : sites/dev.scrapy.org/htdocs/envelope.png => sites/static.scrapy.org/envelope.png rename : sites/dev.scrapy.org/htdocs/expanded.png => sites/static.scrapy.org/expanded.png rename : sites/dev.scrapy.org/htdocs/expander_normal.png => sites/static.scrapy.org/expander_normal.png rename : sites/dev.scrapy.org/htdocs/expander_normal_hover.png => sites/static.scrapy.org/expander_normal_hover.png rename : sites/dev.scrapy.org/htdocs/expander_open.png => sites/static.scrapy.org/expander_open.png rename : sites/dev.scrapy.org/htdocs/expander_open_hover.png => sites/static.scrapy.org/expander_open_hover.png rename : sites/dev.scrapy.org/htdocs/extlink.gif => sites/static.scrapy.org/extlink.gif rename : sites/dev.scrapy.org/htdocs/feed.png => sites/static.scrapy.org/feed.png rename : sites/dev.scrapy.org/htdocs/file.png => sites/static.scrapy.org/file.png rename : sites/dev.scrapy.org/htdocs/folder.png => sites/static.scrapy.org/folder.png rename : sites/dev.scrapy.org/htdocs/guide/basic-workflow.png => sites/static.scrapy.org/guide/basic-workflow.png rename : sites/dev.scrapy.org/htdocs/guide/original-workflow.png => sites/static.scrapy.org/guide/original-workflow.png rename : sites/dev.scrapy.org/htdocs/ics.png => sites/static.scrapy.org/ics.png rename : sites/dev.scrapy.org/htdocs/imggrid.png => sites/static.scrapy.org/imggrid.png rename : sites/dev.scrapy.org/htdocs/js/blame.js => sites/static.scrapy.org/js/blame.js rename : sites/dev.scrapy.org/htdocs/js/diff.js => sites/static.scrapy.org/js/diff.js rename : sites/dev.scrapy.org/htdocs/js/expand_dir.js => sites/static.scrapy.org/js/expand_dir.js rename : sites/dev.scrapy.org/htdocs/js/folding.js => sites/static.scrapy.org/js/folding.js rename : sites/dev.scrapy.org/htdocs/js/ie_pre7_hacks.js => sites/static.scrapy.org/js/ie_pre7_hacks.js rename : sites/dev.scrapy.org/htdocs/js/jquery.js => sites/static.scrapy.org/js/jquery.js rename : sites/dev.scrapy.org/htdocs/js/keyboard_nav.js => sites/static.scrapy.org/js/keyboard_nav.js rename : sites/dev.scrapy.org/htdocs/js/noconflict.js => sites/static.scrapy.org/js/noconflict.js rename : sites/dev.scrapy.org/htdocs/js/query.js => sites/static.scrapy.org/js/query.js rename : sites/dev.scrapy.org/htdocs/js/search.js => sites/static.scrapy.org/js/search.js rename : sites/dev.scrapy.org/htdocs/js/suggest.js => sites/static.scrapy.org/js/suggest.js rename : sites/dev.scrapy.org/htdocs/js/trac.js => sites/static.scrapy.org/js/trac.js rename : sites/dev.scrapy.org/htdocs/js/wikitoolbar.js => sites/static.scrapy.org/js/wikitoolbar.js rename : sites/dev.scrapy.org/htdocs/loading.gif => sites/static.scrapy.org/loading.gif rename : sites/dev.scrapy.org/htdocs/lock-locked.png => sites/static.scrapy.org/lock-locked.png rename : sites/dev.scrapy.org/htdocs/logo.jpg => sites/static.scrapy.org/logo.jpg rename : sites/dev.scrapy.org/htdocs/main-bg.jpg => sites/static.scrapy.org/main-bg.jpg rename : sites/dev.scrapy.org/htdocs/milestone.png => sites/static.scrapy.org/milestone.png rename : sites/dev.scrapy.org/htdocs/newticket.png => sites/static.scrapy.org/newticket.png rename : sites/dev.scrapy.org/htdocs/parent.png => sites/static.scrapy.org/parent.png rename : sites/dev.scrapy.org/htdocs/python.png => sites/static.scrapy.org/python.png rename : sites/dev.scrapy.org/htdocs/topbar_gradient.png => sites/static.scrapy.org/topbar_gradient.png rename : sites/dev.scrapy.org/htdocs/topbar_gradient2.png => sites/static.scrapy.org/topbar_gradient2.png rename : sites/dev.scrapy.org/htdocs/trac.ico => sites/static.scrapy.org/trac.ico rename : sites/dev.scrapy.org/htdocs/trac_banner.png => sites/static.scrapy.org/trac_banner.png rename : sites/dev.scrapy.org/htdocs/trac_logo_mini.png => sites/static.scrapy.org/trac_logo_mini.png rename : sites/dev.scrapy.org/htdocs/vgradient.png => sites/static.scrapy.org/vgradient.png rename : sites/dev.scrapy.org/htdocs/wiki.png => sites/static.scrapy.org/wiki.png extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%4023
103 lines
3.4 KiB
JavaScript
103 lines
3.4 KiB
JavaScript
|
|
(function($){
|
|
|
|
window.enableBlame = function(url, original_path) {
|
|
var message = null;
|
|
var message_rev = null;
|
|
|
|
/* for each blame cell containing a changeset link... */
|
|
var rev_paths = {};
|
|
$("table.code th.blame a").each(function() {
|
|
href = $(this).attr("href");
|
|
$(this).removeAttr("href");
|
|
rev_href = href.substr(href.indexOf("changeset/") + 10);
|
|
elts = rev_href.split("/");
|
|
var path = elts.slice(1).join("/");
|
|
if (path != original_path)
|
|
rev_paths["r"+elts[0]] = path;
|
|
});
|
|
|
|
/* for each blame cell... */
|
|
$("table.code th.blame").each(function() {
|
|
var rev = $(this).attr("class").split(" ")[1]; // "blame r123"
|
|
var path = rev_paths[rev] || original_path; // only found if != orig
|
|
|
|
if (!rev)
|
|
return;
|
|
|
|
$(this).css("cursor", "pointer").click(function() {
|
|
var row = this.parentNode;
|
|
var message_is_visible = message && message.css("display") == "block";
|
|
var highlight_rev = null;
|
|
|
|
function show() {
|
|
/* Display commit message for the selected revision */
|
|
|
|
var message_w = message.get(0).offsetWidth;
|
|
|
|
// limit message panel width to 3/5 of the row width
|
|
var row_w = row.offsetWidth;
|
|
var max_w = (3.0 * row_w / 5.0);
|
|
if (!message_w || message_w > max_w) {
|
|
message_w = max_w;
|
|
var borderw = (3+8)*2; // borderwidth + padding on both sides
|
|
message.css({width: message_w - borderw + "px"});
|
|
}
|
|
|
|
var row_offset = $(row).offset();
|
|
var left = row_offset.left + row.offsetWidth - message_w;
|
|
message.css({display: "block", top: row_offset.top+"px", left: left-2+"px"});
|
|
}
|
|
|
|
function hide() {
|
|
/* Hide commit message */
|
|
message.css({display: "none"});
|
|
|
|
/* Remove highlighting for lines of the current revision */
|
|
$("table.code th."+message_rev).each(function() {
|
|
$(this.parentNode).removeClass("hilite")
|
|
});
|
|
}
|
|
|
|
if (message_rev != rev) { // fetch a new revision
|
|
if (message_is_visible) {
|
|
hide();
|
|
}
|
|
message_rev = rev;
|
|
highlight_rev = message_rev;
|
|
|
|
$.get(url + rev.substr(1), {annotate: path}, function(data) {
|
|
// remove former message panel if any
|
|
if (message)
|
|
message.remove();
|
|
// create new message panel
|
|
message = $('<div class="message">').css("position", "absolute")
|
|
.append($('<div class="inlinebuttons">')
|
|
.append($('<input value="Close" type="button">').click(hide)))
|
|
.append($('<div>').html(data || "<strong>(no changeset information)</strong>"))
|
|
.appendTo("body");
|
|
|
|
// workaround non-clickable "Close" issue in Firefox
|
|
if ($.browser.mozilla)
|
|
message.find("div.inlinebuttons").next().css("clear", "right");
|
|
|
|
show();
|
|
});
|
|
} else if (message_is_visible) {
|
|
hide();
|
|
} else {
|
|
show();
|
|
highlight_rev = message_rev;
|
|
}
|
|
|
|
/* Highlight all lines of the current revision */
|
|
$("table.code th."+highlight_rev).each(function() {
|
|
$(this.parentNode).addClass("hilite")
|
|
});
|
|
|
|
});
|
|
});
|
|
}
|
|
|
|
})(jQuery);
|