Hacking Devel

By Markus Sandy at 06/26/2007 - 02:53
Tags:

I was testing the web service to display a video and noticing some extraneous JQuery code

<script type="text/javascript">
      $(document).ready(function() {
        $("body").append("");
      });
    </script>

This was causing javascript errors in routines that were designed to return media viewer embed code and I needed to get rid of it.

Turned out to be a result of using the devel module and others had reported this issue. Had nothing to do with use of JQuery module, which is on both nextgen and production/

This is just used on nextgen and so I decided to just hack the devel module for now. Hopefully this will get fixed in a later update, but I will document it here for now.

// mss: do not output extraneous scripts
$stemps = str_replace(array("\r", "\n", "<", ">", "&"),
                                         array('\r', '\n', '\x3c', '\x3e', '\x26'),
                                         addslashes($output));

if (strlen($stemps)) {

      // this makes sure all of the HTML is within the <body> even though this <script> is outside it
      print '<script type="text/javascript">
        $(document).ready(function() {
          $("body").append("'. $stemps.'");
        });
      </script>';
    }            
  }

Links:

Comments and discussion: