TextTheme view removed
authorDarren <darren@darrenwhitlen.com>
Mon, 14 Apr 2014 12:56:13 +0000 (13:56 +0100)
committerDarren <darren@darrenwhitlen.com>
Mon, 14 Apr 2014 12:56:13 +0000 (13:56 +0100)
client/src/app.js
client/src/helpers/utils.js
client/src/models/application.js

index fdc2f59da5b5cf0d304ced47968ce1c9c4a0330b..39121b2f4cf84e6a83faf08c8b6b5dc8c8c0dff4 100644 (file)
@@ -110,19 +110,11 @@ _kiwi.global = {
 \r
     // Entry point to start the kiwi application\r
     init: function (opts, callback) {\r
-        var continueStart, locale, jobs, igniteTextTheme, text_theme;\r
+        var jobs, locale, localeLoaded, textThemeLoaded, text_theme;\r
         opts = opts || {};\r
 \r
         jobs = new JobManager();\r
-        jobs.onFinish(callback);\r
-\r
-        continueInit = function (locale, s, xhr) {\r
-            if (locale) {\r
-                _kiwi.global.i18n = new Jed(locale);\r
-            } else {\r
-                _kiwi.global.i18n = new Jed();\r
-            }\r
-\r
+        jobs.onFinish(function(locale, s, xhr) {\r
             _kiwi.app = new _kiwi.model.Application(opts);\r
 \r
             // Start the client up\r
@@ -131,15 +123,25 @@ _kiwi.global = {
             // Now everything has started up, load the plugin manager for third party plugins\r
             _kiwi.global.plugins = new _kiwi.model.PluginManager();\r
 \r
-            jobs.finishJob('load_locale');\r
-        };\r
+            callback();\r
+        });\r
 \r
-        igniteTextTheme = function(text_theme, s, xhr) {\r
-            _kiwi.global.text_theme = new _kiwi.view.TextTheme(text_theme);\r
+        textThemeLoaded = function(text_theme, s, xhr) {\r
+            opts.text_theme = text_theme;\r
 \r
             jobs.finishJob('load_text_theme');\r
         };\r
 \r
+        localeLoaded = function(locale, s, xhr) {\r
+            if (locale) {\r
+                _kiwi.global.i18n = new Jed(locale);\r
+            } else {\r
+                _kiwi.global.i18n = new Jed();\r
+            }\r
+\r
+            jobs.finishJob('load_locale');\r
+        };\r
+\r
         // Set up the settings datastore\r
         _kiwi.global.settings = _kiwi.model.DataStore.instance('kiwi.settings');\r
         _kiwi.global.settings.load();\r
@@ -150,17 +152,17 @@ _kiwi.global = {
         jobs.registerJob('load_locale');\r
         locale = _kiwi.global.settings.get('locale');\r
         if (!locale) {\r
-            $.getJSON(opts.base_path + '/assets/locales/magic.json', continueInit);\r
+            $.getJSON(opts.base_path + '/assets/locales/magic.json', localeLoaded);\r
         } else {\r
-            $.getJSON(opts.base_path + '/assets/locales/' + locale + '.json', continueInit);\r
+            $.getJSON(opts.base_path + '/assets/locales/' + locale + '.json', localeLoaded);\r
         }\r
 \r
         jobs.registerJob('load_text_theme');\r
         text_theme = opts.text_theme;\r
         if (!text_theme) {\r
-            $.getJSON(opts.base_path + '/assets/text_themes/default.json', igniteTextTheme);\r
+            $.getJSON(opts.base_path + '/assets/text_themes/default.json', textThemeLoaded);\r
         } else {\r
-            $.getJSON(opts.base_path + '/assets/text_themes/' + text_theme + '.json', igniteTextTheme);\r
+            $.getJSON(opts.base_path + '/assets/text_themes/' + text_theme + '.json', textThemeLoaded);\r
         }\r
     },\r
 \r
index e07c16b48d23d07349836cbb0c6f1225c2d9a89a..d83ca1fe8e2b6c001ce4a67cdcb85c1fbf3fccd9 100644 (file)
@@ -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']) {
index feb251ef25f9a9ddaa756aab94b00def7572f01d..d275953cc4730866f035fb24686335cc313b3329 100644 (file)
@@ -28,6 +28,7 @@
             this.server_settings = options.server_settings || {};\r
             this.translations = options.translations || {};\r
             this.themes = options.themes || [];\r
+            this.text_theme = options.text_theme || [];\r
 \r
             // Best guess at where the kiwi server is if not already specified\r
             this.kiwi_server = options.kiwi_server || this.detectKiwiServer();\r