public function addScripts($id, $params)
 {
     $this->addJQuery();
     $this->addScript('/plugins/content/sigplus/engines/boxplus/caption/js/' . $this->getScriptFilename());
     $this->addScript('/plugins/content/sigplus/engines/boxplus/lang/' . $this->getScriptFilename('boxplus.lang'));
     $engineservices = SIGPlusEngineServices::instance();
     if ($params->metadata) {
         $metadatabox = $engineservices->getMetadataEngine($params->lightbox);
         if ($metadatabox) {
             $metadatabox->addStyles();
             $metadatafun = $metadatabox->getMetadataFunction();
         }
     }
     $language = JFactory::getLanguage();
     list($lang, $country) = explode('-', $language->getTag());
     $script = '__jQuery__("#' . $id . '").boxplusCaptionGallery(__jQuery__.extend(' . $this->getCustomParameters($params) . ', { ' . 'position:' . ($params->imagecaptions != 'overlay' ? '"figure"' : '"overlay"') . ', ' . 'caption:function (image) { var c = __jQuery__("#" + image.attr("id") + "_caption"); return c.size() ? c.html() : image.attr("alt"); }, ' . 'download:' . ($params->download ? 'function (image) { var d = __jQuery__("#" + image.attr("id") + "_metadata a[rel=download]"); return d.size() ? d.attr("href") : false; }' : 'false') . ', ' . 'metadata:' . (isset($metadatafun) ? 'function (image) { var m = __jQuery__("#" + image.attr("id") + "_iptc"); return m.size() ? m : false; }' : 'false') . ', ' . 'dialog:' . (isset($metadatafun) ? $metadatafun : 'false') . ' })); ' . '__jQuery__.boxplusLanguage("' . $lang . '", "' . $country . '");';
     $this->addOnReadyScript($script);
 }
Example #2
0
 /**
  * Adds activation code to a (fully customized) gallery.
  */
 public function addGalleryEngines($customized = false)
 {
     if (!isset($this->imageservices)) {
         // global error, image services not available
         throw new SIGPlusInitializationException();
     }
     $engineservices = SIGPlusEngineServices::instance();
     if ($customized) {
         // hook anchors with image extensions to lightbox engine if any
         $engineservices->addStyles();
         $lightbox = $engineservices->getLightboxEngine($this->defparams->lightbox);
         // get selected lightbox engine if any, or use default
         if ($lightbox) {
             $lightbox->addStyles();
             $lightbox->addActivationScripts();
         }
     }
     $engineservices->addOnReadyEvent();
 }
Example #3
0
 /**
  * Appends a JavaScript snippet to the code to be run on the HTML DOM ready event.
  */
 protected function addOnReadyScript($script)
 {
     $instance = SIGPlusEngineServices::instance();
     $instance->addOnReadyScript($script);
 }