mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-08 23:39:46 +01:00
expand.js: format
This commit is contained in:
parent
289c137b2d
commit
47d2a38b80
13
js/expand.js
13
js/expand.js
@ -10,7 +10,6 @@
|
|||||||
* Usage:
|
* Usage:
|
||||||
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
||||||
* $config['additional_javascript'][] = 'js/expand.js';
|
* $config['additional_javascript'][] = 'js/expand.js';
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
@ -21,7 +20,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
let doExpand = function() {
|
let doExpand = function() {
|
||||||
$(this)
|
$(this)
|
||||||
.html($(this).text().replace(_("Click reply to view."), '<a href="javascript:void(0)">'+_("Click to expand")+'</a>.'))
|
.html($(this).text().replace(_("Click reply to view."), '<a href="javascript:void(0)">' + _("Click to expand") + '</a>.'))
|
||||||
.find('a').click(window.expandFun = function() {
|
.find('a').click(window.expandFun = function() {
|
||||||
let thread = $(this).parents('[id^="thread_"]');
|
let thread = $(this).parents('[id^="thread_"]');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -46,15 +45,15 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
thread.find("span.omitted").css('display', 'none');
|
thread.find('span.omitted').css('display', 'none');
|
||||||
|
|
||||||
$('<span class="omitted hide-expanded"><a href="javascript:void(0)">' + _('Hide expanded replies') + '</a>.</span>')
|
$('<span class="omitted hide-expanded"><a href="javascript:void(0)">' + _('Hide expanded replies') + '</a>.</span>')
|
||||||
.insertAfter(thread.find('.op div.body, .op span.omitted').last())
|
.insertAfter(thread.find('.op div.body, .op span.omitted').last())
|
||||||
.click(function() {
|
.click(function() {
|
||||||
thread.find('.expanded').remove();
|
thread.find('.expanded').remove();
|
||||||
let parent = $(this).parent();
|
let parent = $(this).parent();
|
||||||
parent.find(".omitted:not(.hide-expanded)").css('display', '');
|
parent.find('.omitted:not(.hide-expanded)').css('display', '');
|
||||||
parent.find(".hide-expanded").remove();
|
parent.find('.hide-expanded').remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -63,8 +62,8 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
$('div.post.op span.omitted').each(doExpand);
|
$('div.post.op span.omitted').each(doExpand);
|
||||||
|
|
||||||
$(document).on("new_post", function(e, post) {
|
$(document).on('new_post', function(e, post) {
|
||||||
if (!$(post).hasClass("reply")) {
|
if (!$(post).hasClass('reply')) {
|
||||||
$(post).find('div.post.op span.omitted').each(doExpand);
|
$(post).find('div.post.op span.omitted').each(doExpand);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user