Пример #1
0
 function initCarousel($id, $params)
 {
     AriCloudCarouselHelper::includeAssets($params);
     $width = intval($params->get('width', 300), 10);
     $height = intval($params->get('height'), 10);
     $width .= strpos($params->get('width'), '%') !== false ? '%' : 'px';
     $clientParams = AriCloudCarouselHelper::getClientParams($params);
     $doc =& JFactory::getDocument();
     $doc->addScriptDeclaration(sprintf(';(window["jQueryCloudCarousel"] || jQuery)(document).ready(function($) { cloudCarouselInit(window.jQueryCloudCarousel || $, "#%1$s", "%3$s", $.extend(%2$s, {"buttonLeft": $("#%1$s_wrapper .ari-cloud-carousel-left"), "buttonRight": $("#%1$s_wrapper .ari-cloud-carousel-right"), "titleBox": $("#%1$s_wrapper .ari-cloud-carousel-title"), "altBox": $("#%1$s_wrapper .ari-cloud-carousel-alt")}),%4$s); });', $id, $clientParams ? AriJSONHelper::encode($clientParams) : '{}', $width, (bool) $params->get('openOnlyActive', false) ? 'true' : 'false'));
     $styleDec = sprintf('#%1$s_wrapper,#%1$s{width:%2$s;height:%3$dpx;}', $id, $width, $height);
     if ($params->get('customstyle')) {
         $extraStyles = trim($params->get('customstyle'));
         $extraStyles = str_replace('{$id}', '#' . $id, $extraStyles);
         if (!empty($extraStyles)) {
             $styleDec .= $extraStyles;
         }
     }
     $bgImage = $params->get('bgImage');
     if ($bgImage) {
         $styleDec .= sprintf('#%1$s_wrapper{background:transparent url(%2$s) no-repeat center center;}', $id, AriUtils::isRemoteResource($bgImage) ? $bgImage : JURI::root(true) . '/' . $bgImage);
     }
     $doc->addStyleDeclaration($styleDec);
 }