aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/comments/frontend/getbackendqueries.js
blob: 811862bce04732fbc52c81d78eab5c3477220aab (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
// Get supported HashOver backend queries from options (getbackendqueries.js)
HashOverConstructor.getBackendQueries = function (options)
{
	// URL queries array
	var queries = [];

	// Check if options parameter is an object
	if (options && options.constructor === Object) {
		// If so, use URL and title if available
		var url = options.url || this.getURL (options.canonical);
		var title = options.title || this.getTitle ();

		// And add thread to request if told to
		if (options.thread !== undefined) {
			queries.push ('thread=' + options.thread);
		}
	} else {
		// If not, get the URL and title from the page
		var url = this.getURL ();
		var title = this.getTitle ();
	}

	// Default backend request POST data
	queries.push ('url=' + encodeURIComponent (url));
	queries.push ('title=' + encodeURIComponent (title));

	return queries;
};