function javascript_libraries_add_inline in JavaScript Libraries Manager 7
Add script loader inline to attach a script to markup that will be cached.
Parameters
$url: URL of the script to be loaded.
Return value
string Inline javascript to load the script.
1 call to javascript_libraries_add_inline()
File
- ./
javascript_libraries.module, line 405 - Toggle the inclusion of Drupal system libraries. Upload and reference custom libraries as well.
Code
function javascript_libraries_add_inline($url) {
$script = <<<ENDSCRIPT
<script type="text/javascript">
jQuery(document).ready(function () {
Drupal.settings.javascript_libraries = Drupal.settings.javascript_libraries || {};
if (!Drupal.settings.javascript_libraries["{<span class="php-variable">$url</span>}"]) {
jQuery(document).ready(function() { jQuery.getScript("{<span class="php-variable">$url</span>}"); });
Drupal.settings.javascript_libraries["{<span class="php-variable">$url</span>}"] = true;
}
});
</script>
ENDSCRIPT;
return $script;
}