Commit c194acd1 authored by frjo's avatar frjo
Browse files

Porting over the latst addiotion from the 6-dev version. Allow adjusting...

Porting over the latst addiotion from the 6-dev version. Allow adjusting settings programatically etc.
parent 9545c18b
......@@ -14,10 +14,6 @@ function colorbox_admin_settings() {
$colorbox_path = variable_get('colorbox_path', COLORBOX_PATH);
if (!is_dir($colorbox_path)) {
drupal_set_message(t('You need to download the !colorbox and extract the entire contents of the archive into the %path folder of your server.', array('!colorbox' => l(t('Colorbox plugin'), 'http://colorpowered.com/colorbox/'), '%path' => 'sites/all/libraries')), 'error');
}
if (module_exists('image')) {
$form['colorbox_imagefield'] = array(
'#type' => 'fieldset',
......
......@@ -168,18 +168,6 @@ function _colorbox_doheader() {
return; // Don't add the JavaScript and CSS on specified paths.
}
$path = drupal_get_path('module', 'colorbox');
$style = variable_get('colorbox_style', 'default');
switch ($style) {
case 'default':
drupal_add_css($path . '/styles/default/colorbox_default_style.css');
break;
case 'none':
break;
default:
drupal_add_css($style . '/colorbox.css');
}
// Insert options and translated strings as javascript settings.
if (variable_get('colorbox_custom_settings_activate', 0)) {
$js_settings = array(
......@@ -219,6 +207,27 @@ function _colorbox_doheader() {
'maxHeight' => '100%',
);
}
$path = drupal_get_path('module', 'colorbox');
$style = variable_get('colorbox_style', 'default');
// Give other modules the possibility to override Colorbox settings and
// style.
$data = &$js_settings;
$data['__drupal_alter_by_ref'] = array(&$style);
drupal_alter('colorbox_settings', $data);
// Add CSS based on selected style.
switch ($style) {
case 'none':
break;
case 'default':
drupal_add_css($path .'/styles/default/colorbox_default_style.css');
break;
default:
drupal_add_css($style .'/colorbox.css');
}
drupal_add_js(array('colorbox' => $js_settings), array('type' => 'setting', 'scope' => JS_DEFAULT));
if (module_exists('image') && variable_get('colorbox_auto_image_nodes', 0)) {
......
......@@ -72,7 +72,7 @@ function colorbox_drush_help($section) {
*
*/
function drush_colorbox_plugin() {
if (!drush_shell_exec('type -P unzip')) {
if (!drush_shell_exec('type unzip')) {
return drush_set_error(dt('Missing dependency: unzip. Install it before using this command.'));
}
......
......@@ -3,23 +3,10 @@
Drupal.behaviors.initColorbox = {
attach: function (context, settings) {
$('a, area, input', context).filter('.colorbox:not(.initColorbox-processed)').addClass('initColorbox-processed').colorbox({
transition:settings.colorbox.transition,
speed:settings.colorbox.speed,
opacity:settings.colorbox.opacity,
slideshow:settings.colorbox.slideshow,
slideshowSpeed:settings.colorbox.slideshowSpeed,
slideshowAuto:settings.colorbox.slideshowAuto,
slideshowStart:settings.colorbox.slideshowStart,
slideshowStop:settings.colorbox.slideshowStop,
current:settings.colorbox.current,
previous:settings.colorbox.previous,
next:settings.colorbox.next,
close:settings.colorbox.close,
overlayClose:settings.colorbox.overlayClose,
maxWidth:settings.colorbox.maxWidth,
maxHeight:settings.colorbox.maxHeight
});
$('a, area, input', context)
.filter('.colorbox:not(.initColorbox-processed)')
.addClass('initColorbox-processed')
.colorbox(settings.colorbox);
}
};
......
......@@ -27,6 +27,9 @@ Drupal.behaviors.initColorboxInline = {
innerHeight:function(){
return $.urlParam('height', $(this).attr('href'));
},
title:function(){
return $.urlParam('title', $(this).attr('href'));
},
iframe:function(){
return $.urlParam('iframe', $(this).attr('href'));
},
......
......@@ -147,7 +147,7 @@ class colorbox_handler_field_colorbox extends views_handler_field {
$i++;
$link_tag = l($link_text, '', array('html' => TRUE, 'fragment' => 'colorbox-inline-' . $i, 'query' => 'width=' . $width . '&height=' . $height . '&inline=true', 'attributes' => array('title' => $caption, 'class' => 'colorbox-inline', 'rel' => $gallery_id)));
$link_tag = l($link_text, '', array('html' => TRUE, 'fragment' => 'colorbox-inline-' . $i, 'query' => 'width=' . $width . '&height=' . $height . '&title='. $caption . '&inline=true', 'attributes' => array('class' => 'colorbox-inline', 'rel' => $gallery_id)));
// The outside div is there to hide all of the divs because if the specific Colorbox
// div is hidden it won't show up as a Colorbox.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment