You are here

function jquerymobile_add in jQuery Mobile module 7

Add the library to the page

File

./jquerymobile.module, line 27
Provides the jQuery Mobile library to modules and themes that request it.

Code

function jquerymobile_add() {
  $loaded_files =& drupal_static(__FUNCTION__);
  if (!$loaded_files) {
    $jquerymobile_path = JQUERYMOBILE_PATH;
    $current_version = variable_get('jquerymobile_current_version', '1.0a3');
    $compression = variable_get('jquerymobile_compression_type', '');

    // this happens first; we need the option to override jqm default settings
    drupal_add_js(drupal_get_path('module', 'jquerymobile') . '/js/jquerymobile_settings.js', array(
      'group' => JS_LIBRARY,
    ));
    drupal_add_js($jquerymobile_path . '/jquery.mobile-' . $current_version . (!empty($compression) ? "." . $compression : '') . ".js", array(
      'group' => JS_LIBRARY,
    ));
    drupal_add_css($jquerymobile_path . '/jquery.mobile-' . $current_version . (!empty($compression) ? "." . $compression : '') . ".css", array(
      'group' => CSS_DEFAULT,
    ));

    // mark files as added
    jquerymobile_is_added(TRUE);
  }
}