aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/comments/frontend/uncollapsecommentslink.js
blob: 14c75c8bce9855886c298886243bf4b5d61cf857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Creates the "Show X Other Comments" button (uncollapsecommentslink.js)
HashOver.prototype.uncollapseCommentsLink = function ()
{
	// Check whether there are more than the collapse limit
	if (this.instance['total-count'] > this.setup['collapse-limit']) {
		// Create element for the comments
		this.instance['more-section'] = this.elements.create ('div', {
			className: 'hashover-more-section'
		});

		// If so, create "More Comments" hyperlink
		this.instance['more-link'] = this.elements.create ('a', {
			href: '#',
			className: 'hashover-more-link bg-blue-400 hover:bg-blue-500 no-underline'
			+ ' text-white font-bold py-2 px-4 shadow-md'
			+ ' hover:border-blue rounded inline-block mt-2',
			title: this.instance['more-link-text'],
			textContent: this.instance['more-link-text'],

			onclick: function () {
				return hashover.showMoreComments (this);
			}
		});

		// Add more button link to sort div
		this.instance['sort-section'].appendChild (this.instance['more-section']);

		// Add more button link to sort div
		this.instance['sort-section'].appendChild (this.instance['more-link']);

		// And consider comments collapsed
		this.instance['showing-more'] = false;
	} else {
		// If not, consider all comments shown
		this.instance['showing-more'] = true;
	}
};