From: Darren Date: Mon, 14 Apr 2014 12:56:13 +0000 (+0100) Subject: TextTheme view removed X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c3d988bc1d1fca76e6d1d8360a6a2e8c6b7da505;p=KiwiIRC.git TextTheme view removed --- diff --git a/client/src/app.js b/client/src/app.js index fdc2f59..39121b2 100644 --- a/client/src/app.js +++ b/client/src/app.js @@ -110,19 +110,11 @@ _kiwi.global = { // Entry point to start the kiwi application init: function (opts, callback) { - var continueStart, locale, jobs, igniteTextTheme, text_theme; + var jobs, locale, localeLoaded, textThemeLoaded, text_theme; opts = opts || {}; jobs = new JobManager(); - jobs.onFinish(callback); - - continueInit = function (locale, s, xhr) { - if (locale) { - _kiwi.global.i18n = new Jed(locale); - } else { - _kiwi.global.i18n = new Jed(); - } - + jobs.onFinish(function(locale, s, xhr) { _kiwi.app = new _kiwi.model.Application(opts); // Start the client up @@ -131,15 +123,25 @@ _kiwi.global = { // Now everything has started up, load the plugin manager for third party plugins _kiwi.global.plugins = new _kiwi.model.PluginManager(); - jobs.finishJob('load_locale'); - }; + callback(); + }); - igniteTextTheme = function(text_theme, s, xhr) { - _kiwi.global.text_theme = new _kiwi.view.TextTheme(text_theme); + textThemeLoaded = function(text_theme, s, xhr) { + opts.text_theme = text_theme; jobs.finishJob('load_text_theme'); }; + localeLoaded = function(locale, s, xhr) { + if (locale) { + _kiwi.global.i18n = new Jed(locale); + } else { + _kiwi.global.i18n = new Jed(); + } + + jobs.finishJob('load_locale'); + }; + // Set up the settings datastore _kiwi.global.settings = _kiwi.model.DataStore.instance('kiwi.settings'); _kiwi.global.settings.load(); @@ -150,17 +152,17 @@ _kiwi.global = { jobs.registerJob('load_locale'); locale = _kiwi.global.settings.get('locale'); if (!locale) { - $.getJSON(opts.base_path + '/assets/locales/magic.json', continueInit); + $.getJSON(opts.base_path + '/assets/locales/magic.json', localeLoaded); } else { - $.getJSON(opts.base_path + '/assets/locales/' + locale + '.json', continueInit); + $.getJSON(opts.base_path + '/assets/locales/' + locale + '.json', localeLoaded); } jobs.registerJob('load_text_theme'); text_theme = opts.text_theme; if (!text_theme) { - $.getJSON(opts.base_path + '/assets/text_themes/default.json', igniteTextTheme); + $.getJSON(opts.base_path + '/assets/text_themes/default.json', textThemeLoaded); } else { - $.getJSON(opts.base_path + '/assets/text_themes/' + text_theme + '.json', igniteTextTheme); + $.getJSON(opts.base_path + '/assets/text_themes/' + text_theme + '.json', textThemeLoaded); } }, diff --git a/client/src/helpers/utils.js b/client/src/helpers/utils.js index e07c16b..d83ca1f 100644 --- a/client/src/helpers/utils.js +++ b/client/src/helpers/utils.js @@ -529,7 +529,7 @@ function translateText(string_id, params) { function styleText(string_id, params) { var style, text; - style = formatToIrcMsg(_kiwi.global.text_theme.options[string_id]); + style = formatToIrcMsg(_kiwi.app.text_theme[string_id]); // Bring member info back to first level of params if (params['%M']) { diff --git a/client/src/models/application.js b/client/src/models/application.js index feb251e..d275953 100644 --- a/client/src/models/application.js +++ b/client/src/models/application.js @@ -28,6 +28,7 @@ this.server_settings = options.server_settings || {}; this.translations = options.translations || {}; this.themes = options.themes || []; + this.text_theme = options.text_theme || []; // Best guess at where the kiwi server is if not already specified this.kiwi_server = options.kiwi_server || this.detectKiwiServer();