Page: Compare 2 commits

This commit is contained in:
Unknwon 2014-10-10 21:40:51 -04:00
parent 54930c001d
commit b2632dec09
19 changed files with 379 additions and 145 deletions

View file

@ -299,6 +299,9 @@ function initCore() {
e.preventDefault();
$.magnificPopup.close();
});
// Collapse.
$('.collapse').hide();
}
function initUserSetting() {
@ -698,6 +701,37 @@ function initProfile() {
});
}
function initTimeSwitch() {
// Time switch.
$(".time-since[title]").on("click", function () {
var $this = $(this);
var title = $this.attr("title");
var text = $this.text();
$this.text(title);
$this.attr("title", text);
});
}
function initDiff() {
$('.diff-detail-box>a').click(function () {
$($(this).data('target')).slideToggle(100);
})
var $counter = $('.diff-counter');
if ($counter.length < 1) {
return;
}
$counter.each(function (i, item) {
var $item = $(item);
var addLine = $item.find('span[data-line].add').data("line");
var delLine = $item.find('span[data-line].del').data("line");
var addPercent = parseFloat(addLine) / (parseFloat(addLine) + parseFloat(delLine)) * 100;
$item.find(".bar .add").css("width", addPercent + "%");
});
}
$(document).ready(function () {
Gogs.AppSubUrl = $('head').data('suburl') || '';
initCore();
@ -737,6 +771,10 @@ $(document).ready(function () {
if ($('#user-profile-page').length) {
initProfile();
}
if ($('#diff-page').length) {
initTimeSwitch();
initDiff();
}
$('#dashboard-sidebar-menu').tabs();
$('#pull-issue-preview').markdown_preview(".issue-add-comment");