Index: trunk/inieditorpanel/htdocs/editor.js
===================================================================
--- trunk/inieditorpanel/htdocs/editor.js	(revision 12853)
+++ trunk/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) {
@@ -67,12 +66,15 @@
 
 $(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('##');
@@ -174,7 +176,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: trunk/inieditorpanel/templates/admin_tracini.html
===================================================================
--- trunk/inieditorpanel/templates/admin_tracini.html	(revision 12853)
+++ trunk/inieditorpanel/templates/admin_tracini.html	(working copy)
@@ -9,11 +9,6 @@
   <xi:include href="admin.html" />
   <head>
     <title>Edit Trac Settings (trac.ini)</title>
-    <script type="text/javascript">
-    /* <![CDATA[ */
-      ${javascript}
-    /* ]]> */
-    </script>
   </head>
 
   <body>
Index: trunk/inieditorpanel/templates/editor-data.js
===================================================================
--- trunk/inieditorpanel/templates/editor-data.js	(revision 12853)
+++ trunk/inieditorpanel/templates/editor-data.js	(working copy)
@@ -1,21 +0,0 @@
-var section_count = ${len(sections)};
-
-var info_format = '${javascript_quote(_("Modified: %(mod)d | Defaults: %(def)d | Options count: %(opt)d"))}';
-
-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['${javascript_quote(option_name)}'] = '${javascript_quote(option.stored_value)}';
-{% end %}
-
-  info_elem = settings_list.find('td#section-title-${section_name.replace(':','_')} .section-info');
-  cnt['${section_name.replace(':','_')}'] = { 'info_elem': info_elem, 'option_count': ${len(section)}, 'defaults_count': 0, 'modified_count': 0 };
-  stored['${section_name.replace(':','_')}'] = s;
-{% end %}
-}
Index: trunk/inieditorpanel/texts/othertexts.py
===================================================================
--- trunk/inieditorpanel/texts/othertexts.py	(revision 12853)
+++ trunk/inieditorpanel/texts/othertexts.py	(working copy)
@@ -10,8 +10,5 @@
 N_('hidden')
 N_('modifiable')
 
-# Javascript status
-N_("Modified: %(mod)d | Defaults: %(def)d | Options count: %(opt)d")
-
 # display field value when default
 N_('<default value>')
Index: trunk/inieditorpanel/web_ui.py
===================================================================
--- trunk/inieditorpanel/web_ui.py	(revision 12853)
+++ trunk/inieditorpanel/web_ui.py	(working copy)
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
 import re
 import copy
 
@@ -5,19 +7,15 @@
 
 from trac.core import *
 from trac.config import ConfigSection, 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.wiki.formatter import format_to_oneliner
 from trac.mimeview.api import Context
+from trac.util.translation import dgettext, domain_functions
 
-from genshi.template import TemplateLoader
-from genshi.template.text import NewTextTemplate
-
 from inieditorpanel.api import *
 
-from trac.util.text import javascript_quote
-from trac.util.translation import dgettext, domain_functions
-
 _, tag_, N_, add_domain, gettext = domain_functions(
     'inieditorpanel', 
     ('_', 'tag_', 'N_', 'add_domain', 'gettext'))
@@ -393,18 +391,25 @@
              'hidden_options': hidden_options
            }
 
-    data['_'] = _
-    data['gettext'] = gettext
-    data['javascript_quote'] = javascript_quote
+    section_counters = {}
+    settings_stored_values = {}
+    for section_name, section in sections.iteritems():
+        escaped = section_name.replace(':', '_')
+        section_counters[escaped] = {'option_count': len(section)}
+        settings_stored_values[escaped] = dict(
+            (name, option['stored_value'])
+            for name, option in modifiable_options[section_name].iteritems()
+            if option['type'] != 'password')
 
-    # 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
-    
+    add_script_data(req, {
+        'section_count': len(sections),
+        'section_names': sorted(section_counters),
+        'section_counters': section_counters,
+        'settings_stored_values': settings_stored_values,
+        'info_format': _("Modified: %(mod)d | Defaults: %(def)d | Options "
+                         "count: %(opt)d"),
+    })
+
     add_stylesheet(req, 'inieditorpanel/main.css')
     add_script(req, 'inieditorpanel/editor.js')
     return 'admin_tracini.html', data
