protected static function _addScripts($inline, $params = array(), &$config = array()) { $doc = JFactory::getDocument(); $height = isset($params['height']) && $params['height'] ? $params['height'] + 140 : '420'; $doc->addStyleSheet(self::$path . 'assets/css/cck_wysiwyg_editor.css'); if (!$inline) { if (empty($config['client'])) { if (!(isset($config['tmpl']) && $config['tmpl'] == 'ajax')) { $doc->addScript(JURI::root(true) . '/media/cck' . '/scripts/jquery-colorbox/js/jquery.colorbox-min.js'); } $doc->addStyleSheet(JURI::root(true) . '/media/cck' . '/scripts/jquery-colorbox/css/colorbox.css'); $js = ' $(".wysiwyg_editor_box").live("click", function(e) { e.preventDefault();' . ' $.fn.colorbox({href:$(this).attr(\'href\'), open:true, iframe:true, innerWidth:820, innerHeight:' . $height . ', scrolling:false, overlayClose:false, fixed:true, onLoad: function(){ $("#cboxClose").remove();}}); return false; });'; $doc->addScriptDeclaration('(function ($){' . $js . '})(jQuery);'); } elseif ($params['inherited'] == true) { JCck::loadModalBox(); $js = ' $(".wysiwyg_editor_box").live("click", function(e) { e.preventDefault();' . ' $.fn.colorbox({href:$(this).attr(\'href\'), open:true, iframe:true, innerWidth:820, innerHeight:' . $height . ', scrolling:false, overlayClose:false, fixed:true, onLoad: function(){ $("#cboxClose").remove();}}); return false; });'; $doc->addScriptDeclaration('(function ($){' . $js . '})(jQuery);'); } else { JCck::loadModalBox(); $js = ' jQuery(document).ready(function($){ $(".wysiwyg_editor_box").colorbox({iframe:true, innerWidth:820, innerHeight:' . $height . ', scrolling:false, overlayClose:false, fixed:true, onLoad: function(){$("#cboxClose").remove();}}); }); '; $doc->addScriptDeclaration($js); } } }
protected static function _addScripts($params, $options) { $doc = JFactory::getDocument(); $height = ''; $width = ''; if ($options['image_custom'] > 0) { $dim = array('w' => array(1 => 'width', 2 => 'innerWidth', 3 => 'maxWidth'), 'h' => array(1 => 'height', 2 => 'innerHeight', 3 => 'maxHeight')); $width = $dim['w'][$options['image_custom']] . ':' . $options['image_width']; $height = ', ' . $dim['h'][$options['image_custom']] . ':' . $options['image_height']; } $options = '{' . $width . $height . '}'; JCck::loadjQuery(); JCck::loadModalBox(); if ($params['id']) { $js = 'jQuery(document).ready(function($){ $("a[rel=\'colorBox' . $params['id'] . '\']").colorbox(' . $options . '); });'; $doc->addScriptDeclaration($js); } }
protected function _addScripts($id, $params = array()) { $doc = JFactory::getDocument(); if ($params['image_colorbox']) { JCck::loadjQuery(); JCck::loadModalBox(); $js = 'jQuery(document).ready(function($){ $("a[rel=\'colorBox' . $id . '\']").colorbox(); });'; $doc->addScriptDeclaration($js); } static $loaded = 0; if ($loaded) { return; } if ($params['custom_path']) { $loaded = 1; JCck::loadjQuery(); $doc->addStyleSheet(self::$path . 'assets/css/' . self::$type . '.css'); $doc->addScript(self::$path . 'assets/js/' . self::$type . '.js'); } }