Index: 0.12/inieditorpanel/htdocs/editor.js
===================================================================
--- 0.12/inieditorpanel/htdocs/editor.js	(revision 12844)
+++ 0.12/inieditorpanel/htdocs/editor.js	(working copy)
@@ -1,4 +1,3 @@
-var settings_stored_values = new Object();
 var settings_input_fields = new Object();
 
 function update_section_info(section_name, count_diff, modified_diff, defaults_diff) {
@@ -66,12 +65,14 @@
 
 $(document).ready(function(){
   settings_list = $('#settings_table'); // global var
-  section_counters = new Object();
-  section_names = new Array();
   cur_focused_field = settings_list.find('input[name="inieditor_cur_focused_field"]');
-  
-  load_data(section_counters, settings_stored_values);
 
+  $.each(section_names, function(idx, name) {
+    var info_elem = settings_list.find('td#section-title-' + name + ' .section-info');
+    $.extend(section_counters[name], {defaults_count: 0, modified_count: 0,
+                                      info_elem: info_elem});
+  });
+
   settings_list.find('input:checkbox[name=inieditor_default]').each(function() {
     var field_name = $(this).val();
     var name_split  = field_name.split('##');
@@ -173,7 +174,6 @@
   // Update section information.
   settings_list.find('td.section-title').each(function() {
     var section_name = $(this).attr('id').substr('section-title'.length + 1);
-    section_names.push(section_name);
     update_section_info(section_name, 0, 0, 0);
     
     if (section_count > 1) { // only make hidable when showing all sections
Index: 0.12/inieditorpanel/templates/admin_tracini.html
===================================================================
--- 0.12/inieditorpanel/templates/admin_tracini.html	(revision 12844)
+++ 0.12/inieditorpanel/templates/admin_tracini.html	(working copy)
@@ -8,11 +8,6 @@
   <xi:include href="admin.html" />
   <head>
     <title>Edit Trac Settings (trac.ini)</title>
-    <script type="text/javascript">
-    /* <![CDATA[ */
-      ${javascript}
-    /* ]]> */
-    </script>
   </head>
 
   <body>
Index: 0.12/inieditorpanel/templates/editor-data.js
===================================================================
--- 0.12/inieditorpanel/templates/editor-data.js	(revision 12844)
+++ 0.12/inieditorpanel/templates/editor-data.js	(working copy)
@@ -1,19 +0,0 @@
-var section_count = ${len(sections)};
-
-function load_data(cnt, stored) {
-  var info_elem;
-  var s;
-  
-{% for section_name, section in sorted([(key, value) for key, value in sections.items()], key=lambda section: section[0]) %}\
-
-  s = new Object();
-
-{% for option_name, option in sorted([(key, value) for key, value in modifiable_options[section_name].items() if (value.type != 'password')], key=lambda option: option[0]) %}\
-  s['${option_name}'] = '${option.stored_value.replace('\\\\', '\\\\\\\\').replace("'", "\\\\'")}';
-{% end %}
-
-  info_elem = settings_list.find('td#section-title-${section_name} .section-info');
-  cnt['${section_name}'] = { 'info_elem': info_elem, 'option_count': ${len(section)}, 'defaults_count': 0, 'modified_count': 0 };
-  stored['${section_name}'] = s;
-{% end %}
-}
Index: 0.12/inieditorpanel/web_ui.py
===================================================================
--- 0.12/inieditorpanel/web_ui.py	(revision 12844)
+++ 0.12/inieditorpanel/web_ui.py	(working copy)
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
 import re
 import copy
 
@@ -3,13 +5,11 @@
 from trac.core import *
 from trac.config import Option, ListOption, ExtensionOption, _TRUE_VALUES
-from trac.web.chrome import ITemplateProvider, add_stylesheet, add_script, add_notice, add_warning
+from trac.web.chrome import ITemplateProvider, add_stylesheet, add_script, \
+                            add_script_data, add_notice, add_warning
 from trac.admin.api import IAdminPanelProvider
 from trac.util.translation import _
 from trac.wiki.formatter import format_to_oneliner
 from trac.mimeview.api import Context
 
-from genshi.template import TemplateLoader
-from genshi.template.text import NewTextTemplate
-
 from inieditorpanel.api import *
 
@@ -352,14 +352,20 @@
              'hidden_options': hidden_options
            }
 
-    # Parse the JavaScript code
-    # NOTE: We can't use <xi:include> for this as Genshi escapes XML characters
-    #   in the JavaScript code leading invalid variable values (that contain
-    #   for example '>') in some cases.    
-    jsLoader = TemplateLoader(self.get_templates_dirs(), auto_reload=self.config.getbool('trac', 'auto_reload'))
-    jsTmpl = jsLoader.load('editor-data.js', cls=NewTextTemplate)
-    data['javascript'] = jsTmpl.generate(**data).render(encoding=None) # pass data dict as kwargs
-    
+    section_counters = {}
+    settings_stored_values = {}
+    for section_name, section in sections.iteritems():
+        section_counters[section_name] = {'option_count': len(section)}
+        settings_stored_values[section_name] = dict(
+            (name, option['stored_value'])
+            for name, option in modifiable_options[section_name].iteritems()
+            if option['type'] != 'password')
+
+    add_script_data(req, {'section_count': len(sections),
+                          'section_names': sorted(sections),
+                          'section_counters': section_counters,
+                          'settings_stored_values': settings_stored_values})
+
     add_stylesheet(req, 'inieditorpanel/main.css')
     add_script(req, 'inieditorpanel/editor.js')
     return 'admin_tracini.html', data
