more module updates
This commit is contained in:
@@ -32,15 +32,13 @@ The Colorbox module:
|
||||
|
||||
The Colorbox plugin:
|
||||
|
||||
* Supports images, image groups, slideshow, ajax, inline, and
|
||||
iframed content.
|
||||
* Appearance is controlled through CSS so users can restyle the box.
|
||||
* Preloads background images and can preload upcoming images in a
|
||||
photo group.
|
||||
* Generates W3C valid XHTML and adds no JS global variables and
|
||||
passes JSLint.
|
||||
* Tested in Firefox 2 & 3, Safari 3 & 4, Opera 9, Chrome,
|
||||
Internet Explorer 6, 7, 8.
|
||||
* Supports photos, grouping, slideshow, ajax, inline, and iframed content.
|
||||
* Appearance is controlled through CSS so it can be restyled.
|
||||
* Preloads upcoming images in a photo group.
|
||||
* Completely unobtrusive, options are set in the JS and require no
|
||||
changes to existing HTML.
|
||||
* Compatible with: jQuery 1.3.2+ in Firefox, Safari, Chrome, Opera,
|
||||
Internet Explorer 7+.
|
||||
* Released under the MIT License.
|
||||
|
||||
|
||||
|
@@ -6,9 +6,12 @@
|
||||
*
|
||||
* Available variables:
|
||||
* - $item: The complete item being inserted.
|
||||
* - $image_path: The URL to the image.
|
||||
* - $link_path: The URL to the image that Colorbox should open.
|
||||
* - $url: The URL to the image.
|
||||
* - $path: The URL to the image that Colorbox should open.
|
||||
* - $class: A set of classes assigned to this image (if any).
|
||||
* - $width: The width of the image (if known).
|
||||
* - $height: The height of the image (if known).
|
||||
* - $style_name: The Image style being used.
|
||||
* - $gallery_id: The ID of the Colorbox gallery.
|
||||
*
|
||||
* Note that ALT and Title fields should not be filled in here, instead they
|
||||
@@ -19,6 +22,9 @@
|
||||
* - __alt__: The ALT text, intended for use in the <img> tag.
|
||||
* - __title__: The Title text, intended for use in the <img> tag.
|
||||
* - __description__: A description of the image, sometimes used as a caption.
|
||||
* - __filename__: The file name.
|
||||
* - __[token]_or_filename__: Any of the above tokens if available, otherwise
|
||||
* use the file's name. i.e. __title_or_filename__.
|
||||
*/
|
||||
?>
|
||||
<a href="<?php print $link_path; ?>" title="__title__" class="colorbox colorbox-insert-image" rel="<?php print $gallery_id; ?>"><img typeof="foaf:Image" src="<?php print $image_path; ?>" alt="__alt__" title="__title__" class="<?php print $class; ?>" /></a>
|
||||
<a href="<?php print $path; ?>" title="__title__" class="colorbox colorbox-insert-image" rel="<?php print $gallery_id; ?>"><img src="<?php print $url; ?>" <?php if ($width && $height): ?>width="<?php print $width; ?>" height="<?php print $height; ?>" <?php endif; ?>alt="__alt__" title="__title__" class="<?php print $class; ?>" /></a>
|
||||
|
@@ -198,7 +198,7 @@ function colorbox_admin_settings() {
|
||||
$form['colorbox_custom_settings']['colorbox_scrolling'] = array(
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Scrollbars'),
|
||||
'#options' => array(0 => t('Off'), 1 => t('On')),
|
||||
'#options' => array(1 => t('On'), 0 => t('Off')),
|
||||
'#default_value' => variable_get('colorbox_scrolling', 1),
|
||||
'#description' => t('If false, Colorbox will hide scrollbars for overflowing content. This could be used on conjunction with the resize method for a smoother transition if you are appending content to an already open instance of Colorbox.'),
|
||||
);
|
||||
@@ -250,6 +250,25 @@ function colorbox_admin_settings() {
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
);
|
||||
$form['colorbox_advanced_settings']['colorbox_mobile_detect'] = array(
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Mobile detection'),
|
||||
'#options' => array(1 => t('On'), 0 => t('Off')),
|
||||
'#default_value' => variable_get('colorbox_mobile_detect', 1),
|
||||
'#description' => t('If on (default) Colorbox will not be active for devices with a the max width set below.'),
|
||||
);
|
||||
$form['colorbox_advanced_settings']['colorbox_mobile_device_width'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Device with'),
|
||||
'#default_value' => variable_get('colorbox_mobile_device_width', '480px'),
|
||||
'#size' => 30,
|
||||
'#description' => t('Set the mobile device max with. Default: 480px.'),
|
||||
'#states' => array(
|
||||
'visible' => array(
|
||||
':input[name="colorbox_mobile_detect"]' => array('value' => '1'),
|
||||
),
|
||||
),
|
||||
);
|
||||
$form['colorbox_advanced_settings']['colorbox_caption_trim'] = array(
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Caption shortening'),
|
||||
|
@@ -6,9 +6,9 @@ configure = admin/config/media/colorbox
|
||||
|
||||
files[] = views/colorbox_handler_field_colorbox.inc
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-08
|
||||
version = "7.x-2.4"
|
||||
; Information added by Drupal.org packaging script on 2014-09-12
|
||||
version = "7.x-2.8"
|
||||
core = "7.x"
|
||||
project = "colorbox"
|
||||
datestamp = "1365452412"
|
||||
datestamp = "1410514129"
|
||||
|
||||
|
@@ -14,13 +14,15 @@ function colorbox_requirements($phase) {
|
||||
if ($phase == 'runtime') {
|
||||
$t = get_t();
|
||||
$library = libraries_detect('colorbox');
|
||||
$error_type = isset($library['error']) ? drupal_ucfirst($library['error']) : '';
|
||||
$error_message = isset($library['error message']) ? $library['error message'] : '';
|
||||
|
||||
if (empty($library['installed'])) {
|
||||
$requirements['colorbox_plugin'] = array(
|
||||
'title' => $t('Colorbox plugin'),
|
||||
'value' => $t('At least @a', array('@a' => COLORBOX_MIN_PLUGIN_VERSION)),
|
||||
'value' => $t('@e: At least @a', array('@e' => $error_type, '@a' => COLORBOX_MIN_PLUGIN_VERSION)),
|
||||
'severity' => REQUIREMENT_ERROR,
|
||||
'description' => $t('You need to download the !colorbox, extract the archive and place the colorbox directory in the %path directory on your server.', array('!colorbox' => l($t('Colorbox plugin'), $library['download url']), '%path' => 'sites/all/libraries')),
|
||||
'description' => $t('!error You need to download the !colorbox, extract the archive and place the colorbox directory in the %path directory on your server.', array('!error' => $error_message, '!colorbox' => l($t('Colorbox plugin'), $library['download url']), '%path' => 'sites/all/libraries')),
|
||||
);
|
||||
}
|
||||
elseif (version_compare($library['version'], COLORBOX_MIN_PLUGIN_VERSION, '>=')) {
|
||||
@@ -47,7 +49,7 @@ function colorbox_requirements($phase) {
|
||||
* Implements hook_uninstall().
|
||||
*/
|
||||
function colorbox_uninstall() {
|
||||
db_query("DELETE FROM {variable} WHERE name LIKE 'colorbox_%'");
|
||||
db_delete('variable')->condition('name', db_like('colorbox_') . '%', 'LIKE')->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,9 +0,0 @@
|
||||
; $Id$
|
||||
|
||||
core = 7.x
|
||||
api = 2
|
||||
|
||||
libraries[colorbox][download][type] = "get"
|
||||
libraries[colorbox][download][url] = "http://colorpowered.com/colorbox/colorbox.zip"
|
||||
libraries[colorbox][directory_name] = "colorbox"
|
||||
libraries[colorbox][destination] = "libraries"
|
@@ -32,6 +32,7 @@ function colorbox_theme() {
|
||||
'widget' => NULL,
|
||||
),
|
||||
'template' => 'colorbox-insert-image',
|
||||
'pattern' => 'colorbox_insert_image__[a-z0-9_]+',
|
||||
'file' => 'colorbox.theme.inc',
|
||||
),
|
||||
|
||||
@@ -43,6 +44,7 @@ function colorbox_theme() {
|
||||
'node' => NULL, // Left for legacy support.
|
||||
'field' => array(),
|
||||
'display_settings' => array(),
|
||||
'delta' => null,
|
||||
),
|
||||
'file' => 'colorbox.theme.inc',
|
||||
),
|
||||
@@ -77,10 +79,10 @@ function colorbox_libraries_info() {
|
||||
$libraries['colorbox'] = array(
|
||||
'name' => 'Colorbox plugin',
|
||||
'vendor url' => 'http://www.jacklmoore.com/colorbox',
|
||||
'download url' => 'http://www.jacklmoore.com/colorbox',
|
||||
'download url' => 'https://github.com/jackmoore/colorbox/archive/1.x.zip',
|
||||
'version arguments' => array(
|
||||
'file' => 'jquery.colorbox-min.js',
|
||||
'pattern' => '@(?i:Colorbox) v([0-9\.a-z]+)@',
|
||||
'pattern' => '@(?i:Colorbox)\sv?([0-9\.a-z]+)@',
|
||||
'lines' => 5,
|
||||
),
|
||||
'files' => array(
|
||||
@@ -140,7 +142,7 @@ function _colorbox_active() {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Code from the block_list funtion in block.module.
|
||||
// Code from the block_list function in block.module.
|
||||
$path = drupal_get_path_alias($_GET['q']);
|
||||
$colorbox_pages = variable_get('colorbox_pages', "admin*\nimagebrowser*\nimg_assist*\nimce*\nnode/add/*\nnode/*/edit\nprint/*\nprintpdf/*\nsystem/ajax\nsystem/ajax/*");
|
||||
// Compare with the internal and path alias (if any).
|
||||
@@ -176,10 +178,10 @@ function _colorbox_doheader() {
|
||||
'slideshowSpeed' => variable_get('colorbox_slideshowspeed', 2500),
|
||||
'slideshowStart' => variable_get('colorbox_text_start', 'start slideshow'),
|
||||
'slideshowStop' => variable_get('colorbox_text_stop', 'stop slideshow'),
|
||||
'current' => variable_get('colorbox_text_current', '{current} of {total}'),
|
||||
'previous' => variable_get('colorbox_text_previous', '« Prev'),
|
||||
'next' => variable_get('colorbox_text_next', 'Next »'),
|
||||
'close' => variable_get('colorbox_text_close', 'Close'),
|
||||
'current' => strip_tags(variable_get('colorbox_text_current', '{current} of {total}')),
|
||||
'previous' => strip_tags(variable_get('colorbox_text_previous', '« Prev')),
|
||||
'next' => strip_tags(variable_get('colorbox_text_next', 'Next »')),
|
||||
'close' => strip_tags(variable_get('colorbox_text_close', 'Close')),
|
||||
'overlayClose' => variable_get('colorbox_overlayclose', 1) ? TRUE : FALSE,
|
||||
'maxWidth' => variable_get('colorbox_maxwidth', '98%'),
|
||||
'maxHeight' => variable_get('colorbox_maxheight', '98%'),
|
||||
@@ -187,6 +189,8 @@ function _colorbox_doheader() {
|
||||
'initialHeight' => variable_get('colorbox_initialheight', '250'),
|
||||
'fixed' => variable_get('colorbox_fixed', 1) ? TRUE : FALSE,
|
||||
'scrolling' => variable_get('colorbox_scrolling', 1) ? TRUE : FALSE,
|
||||
'mobiledetect' => variable_get('colorbox_mobile_detect', 1) ? TRUE : FALSE,
|
||||
'mobiledevicewidth' => variable_get('colorbox_mobile_device_width', '480px'),
|
||||
);
|
||||
}
|
||||
else {
|
||||
@@ -199,6 +203,8 @@ function _colorbox_doheader() {
|
||||
'maxWidth' => '98%',
|
||||
'maxHeight' => '98%',
|
||||
'fixed' => TRUE,
|
||||
'mobiledetect' => variable_get('colorbox_mobile_detect', 1) ? TRUE : FALSE,
|
||||
'mobiledevicewidth' => variable_get('colorbox_mobile_device_width', '480px'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -213,7 +219,9 @@ function _colorbox_doheader() {
|
||||
|
||||
// Add and initialise the Colorbox plugin.
|
||||
$variant = variable_get('colorbox_compression_type', 'minified');
|
||||
libraries_load('colorbox', $variant);
|
||||
if (module_exists('libraries')) {
|
||||
libraries_load('colorbox', $variant);
|
||||
}
|
||||
drupal_add_js($path . '/js/colorbox.js');
|
||||
|
||||
// Add JS and CSS based on selected style.
|
||||
@@ -251,6 +259,7 @@ function colorbox_field_formatter_info() {
|
||||
'field types' => array('image'),
|
||||
'settings' => array(
|
||||
'colorbox_node_style' => '',
|
||||
'colorbox_node_style_first' => '',
|
||||
'colorbox_image_style' => '',
|
||||
'colorbox_gallery' => 'post',
|
||||
'colorbox_gallery_custom' => '',
|
||||
@@ -280,6 +289,14 @@ function colorbox_field_formatter_settings_form($field, $instance, $view_mode, $
|
||||
'#options' => $image_styles_hide,
|
||||
'#description' => t('Image style to use in the content.'),
|
||||
);
|
||||
$element['colorbox_node_style_first'] = array(
|
||||
'#title' => t('Content image style for first image'),
|
||||
'#type' => 'select',
|
||||
'#default_value' => $settings['colorbox_node_style_first'],
|
||||
'#empty_option' => t('No special style.'),
|
||||
'#options' => $image_styles,
|
||||
'#description' => t('Image style to use in the content for the first image.'),
|
||||
);
|
||||
$element['colorbox_image_style'] = array(
|
||||
'#title' => t('Colorbox image style'),
|
||||
'#type' => 'select',
|
||||
@@ -306,15 +323,12 @@ function colorbox_field_formatter_settings_form($field, $instance, $view_mode, $
|
||||
);
|
||||
$element['colorbox_gallery_custom'] = array(
|
||||
'#title' => t('Custom gallery'),
|
||||
'#type' => 'machine_name',
|
||||
'#type' => 'textfield',
|
||||
'#maxlength' => 32,
|
||||
'#default_value' => $settings['colorbox_gallery_custom'],
|
||||
'#description' => t('All images on a page with the same gallery value (rel attribute) will be grouped together. It must only contain lowercase letters, numbers, and underscores.'),
|
||||
'#description' => t('All images on a page with the same gallery value (rel attribute) will be grouped together. It must only contain lowercase letters, numbers, hyphen and underscores.'),
|
||||
'#element_validate' => array('colorbox_gallery_custom_validate'),
|
||||
'#required' => FALSE,
|
||||
'#machine_name' => array(
|
||||
'exists' => 'colorbox_gallery_exists',
|
||||
'error' => t('The custom gallery field must only contain lowercase letters, numbers, and underscores.'),
|
||||
),
|
||||
'#states' => array(
|
||||
'visible' => array(
|
||||
':input[name$="[settings_edit_form][settings][colorbox_gallery]"]' => array('value' => 'custom'),
|
||||
@@ -335,7 +349,7 @@ function colorbox_field_formatter_settings_form($field, $instance, $view_mode, $
|
||||
'#type' => 'select',
|
||||
'#default_value' => $settings['colorbox_caption'],
|
||||
'#options' => $caption,
|
||||
'#description' => t('Automatic will use the first none empty value of the title, the alt text and the content title.'),
|
||||
'#description' => t('Automatic will use the first non-empty value of the title, the alt text and the content title.'),
|
||||
);
|
||||
$element['colorbox_caption_custom'] = array(
|
||||
'#title' => t('Custom caption'),
|
||||
@@ -380,6 +394,15 @@ function colorbox_field_formatter_settings_form($field, $instance, $view_mode, $
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate function for colorbox_gallery_custom.
|
||||
*/
|
||||
function colorbox_gallery_custom_validate($element, &$form_state) {
|
||||
if (!empty($element['#value']) && !preg_match('!^[a-z0-9_-]+$!', $element['#value'])) {
|
||||
form_error($element, t('%name must only contain lowercase letters, numbers, hyphen and underscores.', array('%name' => $element['#title'])));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_field_formatter_settings_summary().
|
||||
*/
|
||||
@@ -404,6 +427,10 @@ function colorbox_field_formatter_settings_summary($field, $instance, $view_mode
|
||||
$summary[] = t('Content image style: Original image');
|
||||
}
|
||||
|
||||
if (isset($image_styles[$settings['colorbox_node_style_first']])) {
|
||||
$summary[] = t('Content image style of first image: @style', array('@style' => $image_styles[$settings['colorbox_node_style_first']]));
|
||||
}
|
||||
|
||||
if (isset($image_styles[$settings['colorbox_image_style']])) {
|
||||
$summary[] = t('Colorbox image style: @style', array('@style' => $image_styles[$settings['colorbox_image_style']]));
|
||||
}
|
||||
@@ -455,6 +482,7 @@ function colorbox_field_formatter_view($entity_type, $entity, $field, $instance,
|
||||
'#node' => $entity, // Left for legacy support.
|
||||
'#field' => $field,
|
||||
'#display_settings' => $display['settings'],
|
||||
'#delta' => $delta,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -468,7 +496,8 @@ function colorbox_field_formatter_view($entity_type, $entity, $field, $instance,
|
||||
function colorbox_insert_styles() {
|
||||
$insert_styles = array();
|
||||
foreach (image_styles() as $key => $style) {
|
||||
$insert_styles['colorbox__' . $key] = array('label' => t('Colorbox @style', array('@style' => $style['name'])));
|
||||
$label = isset($style['label']) ? $style['label'] : $style['name'];
|
||||
$insert_styles['colorbox__' . $key] = array('label' => t('Colorbox @style', array('@style' => $label)));
|
||||
}
|
||||
|
||||
return $insert_styles;
|
||||
@@ -479,7 +508,7 @@ function colorbox_insert_styles() {
|
||||
*/
|
||||
function colorbox_insert_content($item, $style, $widget) {
|
||||
list($item['module_name'], $item['style_name']) = explode('__', $style['name'], 2);
|
||||
return theme('colorbox_insert_image', array('item' => $item, 'widget' => $widget));
|
||||
return theme(array('colorbox_insert_image__' . str_replace('-', '_', $item['style_name']), 'colorbox_insert_image'), array('item' => $item, 'widget' => $widget));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -25,16 +25,40 @@ function theme_colorbox_image_formatter($variables) {
|
||||
|
||||
$image = array(
|
||||
'path' => $item['uri'],
|
||||
'alt' => $item['alt'],
|
||||
'title' => $item['title'],
|
||||
'alt' => isset($item['alt']) ? $item['alt'] : '',
|
||||
'title' => isset($item['title']) ? $item['title'] : '',
|
||||
'style_name' => $settings['colorbox_node_style'],
|
||||
);
|
||||
|
||||
if ($variables['delta'] == 0 && !empty($settings['colorbox_node_style_first'])) {
|
||||
$image['style_name'] = $settings['colorbox_node_style_first'];
|
||||
}
|
||||
|
||||
if (isset($item['width']) && isset($item['height'])) {
|
||||
$image['width'] = $item['width'];
|
||||
$image['height'] = $item['height'];
|
||||
}
|
||||
|
||||
if (isset($item['attributes'])) {
|
||||
$image['attributes'] = $item['attributes'];
|
||||
}
|
||||
|
||||
// Allow image attributes to be overridden.
|
||||
if (isset($variables['item']['override']['attributes'])) {
|
||||
foreach (array('width', 'height', 'alt', 'title') as $key) {
|
||||
if (isset($variables['item']['override']['attributes'][$key])) {
|
||||
$image[$key] = $variables['item']['override']['attributes'][$key];
|
||||
unset($variables['item']['override']['attributes'][$key]);
|
||||
}
|
||||
}
|
||||
if (isset($image['attributes'])) {
|
||||
$image['attributes'] = $variables['item']['override']['attributes'] + $image['attributes'];
|
||||
}
|
||||
else {
|
||||
$image['attributes'] = $variables['item']['override']['attributes'];
|
||||
}
|
||||
}
|
||||
|
||||
$entity_title = entity_label($entity_type, $entity);
|
||||
|
||||
switch ($settings['colorbox_caption']) {
|
||||
@@ -135,45 +159,62 @@ function theme_colorbox_imagefield($variables) {
|
||||
$image = theme('image', $variables['image']);
|
||||
}
|
||||
|
||||
$options = array(
|
||||
$options = drupal_parse_url($variables['path']);
|
||||
$options += array(
|
||||
'html' => TRUE,
|
||||
'attributes' => array(
|
||||
'title' => $variables['title'],
|
||||
'class' => $class,
|
||||
'rel' => $variables['gid'],
|
||||
)
|
||||
),
|
||||
'language' => array('language' => NULL),
|
||||
);
|
||||
|
||||
return l($image, $variables['path'], $options);
|
||||
return l($image, $options['path'], $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preprocess variables for the colorbox-insert-image.tpl.php file.
|
||||
*/
|
||||
function template_preprocess_colorbox_insert_image(&$variables) {
|
||||
$class = array();
|
||||
$file = file_load($variables['item']['fid']);
|
||||
$item = $variables['item'];
|
||||
$variables['file'] = file_load($item['fid']);
|
||||
$variables['style_name'] = $item['style_name'];
|
||||
$variables['width'] = isset($item['width']) ? $item['width'] : NULL;
|
||||
$variables['height'] = isset($item['height']) ? $item['height'] : NULL;
|
||||
|
||||
// Determine dimensions of the image after the image style transformations.
|
||||
image_style_transform_dimensions($variables['style_name'], $variables);
|
||||
|
||||
$class = array();
|
||||
if (!empty($variables['widget']['settings']['insert_class'])) {
|
||||
$class = explode(' ', $variables['widget']['settings']['insert_class']);
|
||||
}
|
||||
$class[] = 'image-' . $variables['item']['style_name'];
|
||||
$class[] = 'image-' . $variables['style_name'];
|
||||
|
||||
foreach ($class as $key => $value) {
|
||||
$class[$key] = drupal_html_class($value);
|
||||
}
|
||||
|
||||
$variables['image_path'] = image_style_url($variables['item']['style_name'], $file->uri);
|
||||
$variables['class'] = implode(' ', $class);
|
||||
|
||||
$variables['uri'] = image_style_path($variables['style_name'], $variables['file']->uri);
|
||||
$absolute = isset($variables['widget']['settings']['insert_absolute']) ? $variables['widget']['settings']['insert_absolute'] : NULL;
|
||||
$variables['url'] = insert_create_url($variables['uri'], $absolute, variable_get('clean_url'));
|
||||
|
||||
// http://drupal.org/node/1923336
|
||||
if (function_exists('image_style_path_token')) {
|
||||
$token_query = array(IMAGE_DERIVATIVE_TOKEN => image_style_path_token($variables['style_name'], $variables['file']->uri));
|
||||
$variables['url'] .= (strpos($variables['url'], '?') !== FALSE ? '&' : '?') . drupal_http_build_query($token_query);
|
||||
}
|
||||
|
||||
if ($style_name = variable_get('colorbox_image_style', '')) {
|
||||
$variables['link_path'] = image_style_url($style_name, $file->uri);
|
||||
$variables['path'] = image_style_url($style_name, $variables['file']->uri);
|
||||
}
|
||||
else {
|
||||
$variables['link_path'] = file_create_url($file->uri);
|
||||
$variables['path'] = file_create_url($variables['file']->uri);
|
||||
}
|
||||
|
||||
$variables['class'] = implode(' ', $class);
|
||||
|
||||
$variables['gallery_id'] = '';
|
||||
switch (variable_get('colorbox_insert_gallery', 0)) {
|
||||
case 0:
|
||||
|
@@ -5,16 +5,23 @@ Drupal.behaviors.initColorbox = {
|
||||
if (!$.isFunction($.colorbox)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.colorbox.mobiledetect && window.matchMedia) {
|
||||
// Disable Colorbox for small screens.
|
||||
var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")");
|
||||
if (mq.matches) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$('.colorbox', context)
|
||||
.once('init-colorbox')
|
||||
.colorbox(settings.colorbox);
|
||||
|
||||
$(context).bind('cbox_complete', function () {
|
||||
Drupal.attachBehaviors('#cboxLoadedContent');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
{
|
||||
$(document).bind('cbox_complete', function () {
|
||||
Drupal.attachBehaviors('#cboxLoadedContent');
|
||||
});
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
Drupal.behaviors.initColorboxDefaultStyle = {
|
||||
attach: function (context, settings) {
|
||||
$(document).bind('cbox_complete', function () {
|
||||
$(context).bind('cbox_complete', function () {
|
||||
// Only run if there is a title.
|
||||
if ($('#cboxTitle:empty', context).length == false) {
|
||||
$('#cboxLoadedContent img', context).bind('mouseover', function () {
|
||||
|
@@ -126,7 +126,7 @@
|
||||
#cboxClose.cbox-close-plain {
|
||||
position: absolute;
|
||||
font-size: 20px;
|
||||
line-height: 18px;;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
Drupal.behaviors.initColorboxPlainStyle = {
|
||||
attach: function (context, settings) {
|
||||
$(document).bind('cbox_complete', function () {
|
||||
$(context).bind('cbox_complete', function () {
|
||||
// Make all the controls invisible.
|
||||
$('#cboxCurrent, #cboxSlideshow, #cboxPrevious, #cboxNext', context).addClass('element-invisible');
|
||||
// Replace "Close" with "×" and show.
|
||||
@@ -24,7 +24,7 @@ Drupal.behaviors.initColorboxPlainStyle = {
|
||||
}
|
||||
});
|
||||
});
|
||||
$(document).bind('cbox_closed', function () {
|
||||
$(context).bind('cbox_closed', function () {
|
||||
$('#cboxClose', context).removeClass('cbox-close-plain');
|
||||
});
|
||||
}
|
||||
|
@@ -151,8 +151,9 @@
|
||||
height: 38px;
|
||||
color: #313131;
|
||||
padding: 0 140px 0 15px;
|
||||
display: table-cell;
|
||||
display: table-cell !important;
|
||||
vertical-align: middle;
|
||||
float: none !important;
|
||||
}
|
||||
#cboxCurrent {
|
||||
position: absolute;
|
||||
|
@@ -2,15 +2,15 @@
|
||||
|
||||
Drupal.behaviors.initColorboxStockholmsyndromeStyle = {
|
||||
attach: function (context, settings) {
|
||||
$(document).bind('cbox_open', function () {
|
||||
$(context).bind('cbox_open', function () {
|
||||
// Hide close button initially.
|
||||
$('#cboxClose', context).css('opacity', 0);
|
||||
});
|
||||
$(document).bind('cbox_load', function () {
|
||||
$(context).bind('cbox_load', function () {
|
||||
// Hide close button. (It doesn't handle the load animation well.)
|
||||
$('#cboxClose', context).css('opacity', 0);
|
||||
});
|
||||
$(document).bind('cbox_complete', function () {
|
||||
$(context).bind('cbox_complete', function () {
|
||||
// Show close button with a delay.
|
||||
$('#cboxClose', context).fadeTo('fast', 0, function () {$(this).css('opacity', 1)});
|
||||
});
|
||||
|
@@ -109,7 +109,7 @@ If you would like to have the characters %5B and %5D please use the html entity
|
||||
$form['custom_gid'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Custom Colorbox gallery'),
|
||||
'#description' => t('Enable Colorbox gallery with a given string as gallery. Overrides the automatically generated gallery id above.'),
|
||||
'#description' => t('Enable Colorbox gallery with a given string as gallery. Overrides the automatically generated gallery id above. You may enter data from this view as per the "Replacement patterns" below.'),
|
||||
'#default_value' => $this->options['custom_gid'],
|
||||
'#weight' => -8,
|
||||
);
|
||||
@@ -162,12 +162,14 @@ If you would like to have the characters %5B and %5D please use the html entity
|
||||
$tokens = $this->get_render_tokens($this->options['alter']);
|
||||
$popup = filter_xss_admin($this->options['popup']);
|
||||
$caption = filter_xss_admin($this->options['caption']);
|
||||
$gallery = drupal_html_class($this->options['custom_gid']);
|
||||
$popup = strtr($popup, $tokens);
|
||||
$caption = strtr($caption, $tokens);
|
||||
$gallery = strtr($gallery, $tokens);
|
||||
|
||||
$width = $this->options['width'] ? $this->options['width'] : '';
|
||||
$height = $this->options['height'] ? $this->options['height'] : '';
|
||||
$gallery_id = !empty($this->options['custom_gid']) ? $this->options['custom_gid'] : ($this->options['gid'] ? 'gallery-' . $this->view->name : '');
|
||||
$gallery_id = !empty($gallery) ? $gallery : ($this->options['gid'] ? 'gallery-' . $this->view->name : '');
|
||||
$link_text = $tokens["[{$this->options['trigger_field']}]"];
|
||||
$link_options = array(
|
||||
'html' => TRUE,
|
||||
|
Reference in New Issue
Block a user