Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r18212: LJSV-1382 (Inbox): fix conditional logic

Committer: ailyin
LJSV-1382 (Inbox): fix conditional logic
U   trunk/cgi-bin/weblib.pl
Modified: trunk/cgi-bin/weblib.pl
===================================================================
--- trunk/cgi-bin/weblib.pl	2011-02-04 05:07:35 UTC (rev 18211)
+++ trunk/cgi-bin/weblib.pl	2011-02-04 08:06:05 UTC (rev 18212)
@@ -1375,17 +1375,19 @@
     my $site_params = LJ::js_dumper(\%site);
 
     # include standard JS info
-    $ret .= qq {
-        <script type="text/javascript">
-            Site = window.Site || {};
-    };
-    $ret .= '        Site.ml_text = ' .  LJ::JSON->to_json(\%LJ::JSML) . ";\n" if(%LJ::JSML);
-    $ret .= qq {            (function(){
-                var p = $site_params, i;
-                for (i in p) Site[i] = p[i];
-            })();
-       </script>
-    } unless $only_needed;
+    unless ( $only_needed ) {
+        my $jsml_out = LJ::JSON->to_json(\%LJ::JSML);
+        $ret .= qq {
+            <script type="text/javascript">
+                Site = window.Site || {};
+                Site.ml_text = $jsml_out;
+                (function(){
+                    var p = $site_params, i;
+                    for (i in p) Site[i] = p[i];
+                })();
+           </script>
+        };
+    }
 
     my $now = time();
     my %list;   # type -> condition -> args -> [list of files];

Tags: andy, livejournal, pl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments