diff options
author | Joakim Reinert <mail@jreinert.com> | 2015-05-01 22:28:54 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-05-05 12:21:27 +0200 |
commit | da835670f796774d1f98c05dfdf7da1c7ba2655a (patch) | |
tree | 22922112e521779d76c7f2b2c418cee64a729e17 /data | |
parent | f7da6a0ee8c3b79deb8995e592a130a4a409dc70 (diff) |
Use global appConfig js variable instead of passing it down
Initialize it in header
Diffstat (limited to 'data')
-rw-r--r-- | data/js/application.js | 5 | ||||
-rw-r--r-- | data/js/lexer-input.js | 10 | ||||
-rw-r--r-- | data/js/main.js | 2 |
3 files changed, 8 insertions, 9 deletions
diff --git a/data/js/application.js b/data/js/application.js index 76ed5ae55..06a53854d 100644 --- a/data/js/application.js +++ b/data/js/application.js @@ -21,12 +21,11 @@ define( * Gets called for every request after page load * config contains app config attributes passed from php */ - onPageLoaded: function (config) { - config = config || {}; + onPageLoaded: function () { Util.highlightLineFromHash(); Util.setTabwidthFromLocalStorage(); TabwidthInput.initialize(); - LexerInput.initialize(config.lexers); + LexerInput.initialize(); ThumbnailView.initialize(); this.configureTooltips(); this.setupToggleSelectAllEvent(); diff --git a/data/js/lexer-input.js b/data/js/lexer-input.js index a4d3c7058..85c4a5432 100644 --- a/data/js/lexer-input.js +++ b/data/js/lexer-input.js @@ -11,10 +11,10 @@ define(['util', 'underscore', 'jquery-ui'], function (Util, _) { var baseUrl = $(event.target).data('base-url'); this.switchLexer(ui.item.value, baseUrl); }, - setupAutocomplete: function (lexers) { + setupAutocomplete: function () { var lexerSource = []; - for (var key in lexers) { - lexerSource.push({ label: lexers[key], value: key }); + for (var key in appConfig.lexers) { + lexerSource.push({ label: appConfig.lexers[key], value: key }); } $('.lexer-form input').autocomplete({ @@ -37,8 +37,8 @@ define(['util', 'underscore', 'jquery-ui'], function (Util, _) { } }; var LexerInput = { - initialize: function (lexers) { - PrivateFunctions.setupAutocomplete(lexers); + initialize: function () { + PrivateFunctions.setupAutocomplete(); PrivateFunctions.setupEvents(); } }; diff --git a/data/js/main.js b/data/js/main.js index 92c016d79..5710dcb68 100644 --- a/data/js/main.js +++ b/data/js/main.js @@ -22,7 +22,7 @@ requirejs.config({ require(['application', 'jquery'], function (App, $) { App.initialize(); $(document).ready(function () { - App.onPageLoaded(window.appConfig); + App.onPageLoaded(); }); }); })(); |