Merge branch 'master' into feature_ajax_comments

This commit is contained in:
Alexey Skobkin 2015-01-20 10:23:59 +03:00
commit e30b440956
2 changed files with 26 additions and 38 deletions

View File

@ -154,13 +154,31 @@ div#markItUpText-input {
} }
/* Шваброточки */ /** Индикация вложенности */
#comments .post .nesting {
height: 24px; #comments.nesting_level {
float: left; overflow: hidden;
} }
#comments .post:hover .nesting { #comments.nesting_level .info::before {
background-repeat: repeat-x; position: absolute;
top: 0;
right: 100%;
display: block;
width: 500px;
height: 24px;
content: '';
opacity: 0;
background-image: url('chrome-extension://__MSG_@@extension_id__/images/nesting-point.png'); background-image: url('chrome-extension://__MSG_@@extension_id__/images/nesting-point.png');
} background-repeat: repeat-x;
}
#comments.nesting_level .post:hover .info::before {
transition: opacity .2s ease-in;
opacity: 1;
}

View File

@ -651,7 +651,7 @@ $(document).ready(function() {
// Nesting level indicator // Nesting level indicator
if (options.is('option_other_comments_nesting_level')) { if (options.is('option_other_comments_nesting_level')) {
draw_nesting_level_indicator(); $('#comments').addClass('nesting_level');
} }
// Обновляем кол-во постов и непрочитанных комментариев // Обновляем кол-во постов и непрочитанных комментариев
@ -1412,36 +1412,6 @@ function hints_save_new_hint(username, new_hint) {
}); });
} }
/**
* Nesting level indicator
* Шваброшвабровские точки
*/
function draw_nesting_level_indicator() {
$('.comments').css({'margin-left': '0px'});
draw_nesting_level_indicator_level($('#comments > .comments'), 1);
}
function draw_nesting_level_indicator_level(obj, level) {
obj.find('> .post').each(function() {
var nesting = document.createElement('div');
$(nesting).addClass('nesting').css({
'width': (10 * level) + 'px'
});
this.insertBefore(nesting, $(this).find('.info')[0]);
$(this).find('> .post-content').css({
'padding-left': (10 * level) + 'px'
});
});
obj.each(function() {
var comments = $(this).find('> .comments');
if (comments.length > 0) {
draw_nesting_level_indicator_level(comments, level + 1);
}
});
}
/** /**
* Обновляем кол-во комментариев и непрочитанных новых постов в ленте * Обновляем кол-во комментариев и непрочитанных новых постов в ленте
*/ */