Author: ornicar2
Date: 2010-01-26 14:51:01 +0100 (Tue, 26 Jan 2010)
New Revision: 27192

Modified:
   plugins/diemPlugin/trunk/dmCorePlugin/web/js/dmCoreEditPlugins.js
   plugins/diemPlugin/trunk/dmFrontPlugin/web/js/dmFrontPageAddForm.js
Log:
[Diem]
- edition javascripts now use the new jQuery.parseJSON method

Modified: plugins/diemPlugin/trunk/dmCorePlugin/web/js/dmCoreEditPlugins.js
===================================================================
--- plugins/diemPlugin/trunk/dmCorePlugin/web/js/dmCoreEditPlugins.js   
2010-01-26 13:38:49 UTC (rev 27191)
+++ plugins/diemPlugin/trunk/dmCorePlugin/web/js/dmCoreEditPlugins.js   
2010-01-26 13:51:01 UTC (rev 27192)
@@ -63,19 +63,10 @@
     {
       if($encodedAssetsDiv = this.find('div.dm_encoded_assets').orNot())
       {
-        json = $encodedAssetsDiv.html();
+        data = jQuery.parseJSON($encodedAssetsDiv.html());
+
         $encodedAssetsDiv.remove();
 
-        // Try to use the native JSON parser first
-        if ( window.JSON && window.JSON.parse )
-        {
-          data = window.JSON.parse( json );
-        }
-        else
-        {
-          data = (new Function("return " + json))();
-        }
-
         for (i in data.css)
         {
           if (-1 == $.inArray(data.css[i], $.dm.loadedStylesheets))

Modified: plugins/diemPlugin/trunk/dmFrontPlugin/web/js/dmFrontPageAddForm.js
===================================================================
--- plugins/diemPlugin/trunk/dmFrontPlugin/web/js/dmFrontPageAddForm.js 
2010-01-26 13:38:49 UTC (rev 27191)
+++ plugins/diemPlugin/trunk/dmFrontPlugin/web/js/dmFrontPageAddForm.js 
2010-01-26 13:51:01 UTC (rev 27192)
@@ -22,18 +22,8 @@
       
       self.$slug = $('input#dm_page_front_new_form_slug', 
self.element).attr('disabled', self.autoSlug);
 
-      var json = $('div.parent_slugs', self.element).text();
+      self.parentSlugs = $.parseJSON($('div.parent_slugs', 
self.element).text());
       
-      // Try to use the native JSON parser first
-      if ( window.JSON && window.JSON.parse )
-      {
-        self.parentSlugs = window.JSON.parse( json );
-      }
-      else
-      {
-        self.parentSlugs = (new Function("return " + json))();
-      }
-      
       self.$form = $('form', self.element).dmAjaxForm({
         beforeSubmit: function(data)
         {

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to