You are here

function sharerich_page_build in Sharerich 7.3

Same name and namespace in other branches
  1. 7 sharerich.module \sharerich_page_build()
  2. 7.2 sharerich.module \sharerich_page_build()

Implements hook_page_build().

File

./sharerich.module, line 508

Code

function sharerich_page_build() {
  if (path_is_admin(current_path())) {
    return;
  }

  // Backwards compatibility to jQuery.live.
  $js = <<<JS
(function(\$) {
  typeof \$ && typeof \$.fn.on !== "function" && \$.fn.extend({
    on: function(event, callback, fallback) {
      switch (typeof callback) {
        case "function": return this.live(event, callback);
        case "string"  : return \$(callback).live(event, fallback);
      }
    }
  });
}(jQuery));
JS;
  drupal_add_js($js, array(
    'type' => 'inline',
    'scope' => 'header',
  ));
  if (!variable_get('sharerich_skip_js', FALSE)) {

    // Load the library via the libraries module.
    libraries_load('rrssb', variable_get('sharerich_library_variant', 'minified'));
  }
  else {
    if ($library = libraries_detect('rrssb')) {
      foreach ($library['files']['css'] as $path => $value) {
        drupal_add_css($library['library path'] . '/' . $path);
      }
    }
  }

  // Add the module css.
  drupal_add_css(drupal_get_path('module', 'sharerich') . '/css/sharerich.css');
}