You are here

function _labjs_fix_inline in LABjs 7

Convert inline script.

It also fixes some exceptions.

Return value

boolean FALSE if LabJS should not be enabled, TRUE otherwise.

2 calls to _labjs_fix_inline()
labjs_advagg_modify_js_pre_render_alter in ./labjs.module
Implements hook_advagg_modify_js_pre_render_alter().
labjs_preprocess_html_tag in ./labjs.module
Implements hook_preprocess_html_tag().

File

./labjs.module, line 191
LABjs module

Code

function _labjs_fix_inline(&$value) {

  // Some JavaScripts do not support LABjs
  if (strpos($value, 'rpxnow.com') !== FALSE || strpos($value, 'fbcdn.net') !== FALSE) {
    return FALSE;
  }

  // Google Analytics compatibility
  $value = str_replace('var _gaq = _gaq || [];', 'if (typeof(_gaq)=="undefined") _gaq=[];', $value);

  // Piwik compatibility
  $value = str_replace('var _paq = _paq || [];', 'if (typeof(_paq)=="undefined") _paq=[];', $value);
  $value = "\$L = \$L.wait(function() {\n" . $value . "\n});";
  return TRUE;
}