summaryrefslogtreecommitdiffstats
path: root/data/js/application.js
blob: 3118f96bb3479b7f96d8cc1091b91c5cfdf23cea (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
(function () {
'use strict';
define(
	[
		'require',
		'util',
		'lexer-input',
		'vendor'
	],
	function (require, Util, LexerInput) {
		require(['script']);
		var App = {
			 // Gets called for every request (before page load)
			initialize: function () {
				this.setupLineHighlight();
			},

			/*
			 * Gets called for every request after page load
			 * config contains app config attributes passed from php
			 */
			onPageLoaded: function (config) {
				Util.highlightLineFromHash();
				LexerInput.initialize(config.lexers);
			},

			setupLineHighlight: function () {
				$(window).on('hashchange', Util.highlightLineFromHash);
			},

		};

		return App;
	}
);
})();