aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/comments/frontend/formattingonclick.js
blob: b94294c7274f2119c7b3052c97106533f9955f7b (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
// Attach click event to formatting revealer hyperlinks (formattingonclick.js)
HashOver.prototype.formattingOnclick = function (type, permalink)
{
	permalink = (permalink !== undefined) ? '-' + permalink : '';

	// Reference to this object
	var hashover = this;

	// Get formatting message elements
	var formattingID = type + '-formatting';
	var formatting = this.elements.get (formattingID + permalink, true);
	var formattingMessage = this.elements.get (formattingID + '-message' + permalink, true);

	// Attach click event to formatting revealer hyperlink
	formatting.onclick = function ()
	{
		if (hashover.classes.contains (formattingMessage, 'hashover-message-open')) {
			hashover.messages.close (formattingMessage);
			return false;
		}

		hashover.messages.open (formattingMessage);
		return false;
	}
};