summaryrefslogtreecommitdiff
path: root/http/src/js/pages.help.js
blob: d63ebd632f9e20d465a800c35ac4568562e78105 (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
38
39
40
41
42
43
44
45
46
47
48
49
epgd.pages.help = {
	$con: null,
	render: function () {
		$('#menu_help').addClass("menu-active");
		if (!this.$con) this.load();
		epgd.$con.html(this.$con);
		this.init();
	},
	getButton: function(id, useAnchor){
		return (useAnchor ? '<a' : '<button') + ' id="bh_' + id + '" class="help iAsButton i-help" role="button">' + epgd.tr.menu.help + '</' + ( useAnchor ? 'a>' : 'button>');
	},
	getIcon: function (id) {
	    return '<a id="bh_' + id + '" class="help iAsIcon i-help" />';
	},
	initButtons: function ($con) {
		if (!$con)
			$con = epgd.$con;
		$con.tooltip({
		    items: ".help",
		    //position: { at: "left top" },
		    //position: { my: "left top" },
			tooltipClass: 'quickInfo',
			content: function () {
				return epgd.pages.help.getQuickInfo(this.id.slice(3));
			},
			open: function (ev, ui) {
			    $(ui.tooltip).position({
			        of: ev.toElement,
			        my: "left top"
			    });
			    ev.preventDefault();
			}
		});
	},
	getQuickInfo: function (id) {
		var h= epgd.pages.help;
		if (!h.$con) h.load();
		return h.$con.find('#h_' + id).html() || epgd.tr.pages.help.noHelp;
	},
	load: function () {
		var me = this;
		epgd.ajax({
		    url: epgd.tr.pages.help.url, async: false, dataType: "html", contentType: "text/plain; charset=utf-8"
		}, function (data) {
		    me.$con = $($(data).filter('#help')[0]);
		    $(data).filter('#help_js').appendTo(document.body);
		});
	}
};