View source
<?php
define('RESPONDJS_DOWNLOAD_URI', 'https://raw.githubusercontent.com/scottjehl/Respond/master/dest/respond.min.js');
define('RESPONDJS_DOWNLOAD_LOCATION', 'sites/all/libraries/respondjs');
define('RESPONDJS_SCOPE_DEFAULT', 'header');
define('RESPONDJS_QUIET_DEFAULT', NULL);
function respondjs_menu() {
$items = array();
$items['admin/config/media/respondjs'] = array(
'title' => 'Respond.js',
'description' => 'Configure respond.js settings',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'respondjs_admin',
),
'access arguments' => array(
'administer respondjs',
),
'file' => 'respondjs.admin.inc',
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
function respondjs_permission() {
return array(
'administer respondjs' => array(
'title' => t('Administer respond.js'),
),
);
}
function respondjs_page_build() {
drupal_add_js(respondjs_get_library_file(), array(
'type' => 'file',
'scope' => variable_get('respondjs_scope', RESPONDJS_SCOPE_DEFAULT),
'group' => JS_LIBRARY,
'every_page' => TRUE,
'weight' => -999,
'preprocess' => 0,
));
}
function respondjs_library() {
$libraries['respondjs'] = array(
'title' => 'Respond.js',
'website' => 'https://github.com/scottjehl/Respond',
'version' => '',
'js' => array(
respondjs_get_library_file() => array(),
),
);
return $libraries;
}
function respondjs_get_library_path() {
$default_path = drupal_get_path('module', 'respondjs') . '/lib';
if (function_exists('libraries_get_path') && file_exists(libraries_get_path('respondjs'))) {
$path = libraries_get_path('respondjs');
}
else {
if (file_exists($default_path)) {
$path = $default_path;
}
else {
$path = NULL;
}
}
return $path;
}
function respondjs_get_library_file() {
return respondjs_get_library_path() . '/respond.min.js';
}