/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { RHelperAsset::load('tracks.css'); $mainframe = JFactory::getApplication(); $params = $mainframe->getParams(); $ordering = $params->def('subround_order', 0); $ordering = $ordering ? 'DESC' : 'ASC'; $projectround_id = JRequest::getVar('id', 0, '', 'int'); $model = $this->getModel(); $subroundresults = $model->getSubrounds($projectround_id, 0, $ordering); $round = $model->getRound($projectround_id); $project = $model->getRoundProject($projectround_id); $projectparams = $model->getParams($project->id); $breadcrumbs = $mainframe->getPathWay(); $breadcrumbs->addItem($round->name, TrackslibHelperRoute::getRoundResultRoute($projectround_id)); $document = JFactory::getDocument(); $document->setTitle($round->name . ' - ' . $project->name); //print_r($subroundresults);exit; // $this->assignRef('points_attrib', $points_attrib); $this->assignRef('results', $subroundresults); $this->assignRef('round', $round); $this->assignRef('project', $project); $this->assignRef('projectparams', $projectparams); $this->assignRef('params', $params); parent::display($tpl); }
protected function displayForm($tpl) { RHelperAsset::load('tracks.css'); $user = JFactory::getUser(); $model = $this->getModel(); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->user = $user; $this->canEdit = $user->get('id') && ($user->authorise('core.manage', 'com_tracks') || $user->get('id') == $this->item->admin_id); if (!$user->id || !$this->canEdit) { JFactory::getApplication()->redirect('index.php', 'not allowed !'); } $attribs['class'] = "pic"; if ($this->item->picture) { $this->item->picture = JHTML::image(JURI::root() . $this->item->picture, $this->item->name, $attribs); } else { $this->item->picture = JHTML::image(JURI::root() . 'media/com_tracks/images/misc/tnnophoto.jpg', $this->item->name, $attribs); } if ($this->item->picture_small) { $this->item->picture_small = JHTML::image(JURI::root() . $this->item->picture_small, $this->item->name, $attribs); } else { $this->item->picture_small = JHTML::image(JURI::root() . 'media/com_tracks/images/misc/tnnophoto.jpg', $this->item->name, $attribs); } if ($this->item->vehicle_picture) { $this->item->vehicle_picture = JHTML::image(JURI::root() . $this->item->vehicle_picture, $this->item->vehicle_picture, $attribs); } else { $this->item->vehicle_picture = JHTML::image(JURI::root() . 'media/com_tracks/images/misc/tnnophoto.jpg', '', $attribs); } $this->title = $this->item->id ? JText::_('COM_TRACKS_PAGETITLE_EDIT_TEAM') : JText::_('COM_TRACKS_PAGETITLE_CREATE_TEAM'); // Display the template parent::display($tpl); }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { RHelperAsset::load('tracks.css'); $model = $this->getModel(); $projects = $model->getProjects(); $this->assignRef('projects', $projects); parent::display($tpl); }
/** * Load the jQuery framework * * @return void */ public static function holder() { // Only load once if (!empty(static::$loaded[__METHOD__])) { return; } RHelperAsset::load('lib/holder.js', self::EXTENSION); static::$loaded[__METHOD__] = true; return; }
/** * Load the Chart framework * * @return void */ public static function framework() { // Only load once if (!empty(static::$loaded[__METHOD__])) { return; } JHtmlRjquery::framework(); RHelperAsset::load('lib/chart/Chart.min.js', self::EXTENSION); static::$loaded[__METHOD__] = true; return; }
/** * Load the main Searchtools libraries * * @return void * * @since 3.2 */ public static function main() { // Only load once if (!empty(static::$loaded[__METHOD__])) { return; } // Depends on jQuery UI JHtml::_('rjquery.ui', array('core', 'sortable')); RHelperAsset::load('lib/sortablelist.min.js', self::EXTENSION); RHelperAsset::load('lib/sortablelist.min.css', self::EXTENSION); static::$loaded[__METHOD__] = true; return; }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { RHelperAsset::load('tracks.css'); $mainframe = JFactory::getApplication(); $model = $this->getModel(); $rows = $model->getData(); $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_TRACKS_All_Teams')); $breadcrumbs = $mainframe->getPathWay(); $breadcrumbs->addItem(JText::_('COM_TRACKS_All_Teams'), TrackslibHelperRoute::getTeamsRoute()); $this->assignRef('rows', $rows); parent::display($tpl); }
/** * Display the edit page * * @param string $tpl The template file to use * * @return string */ public function display($tpl = null) { $user = JFactory::getUser(); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->canConfig = false; if ($user->authorise('core.admin', 'com_tracks')) { $this->canConfig = true; } RHelperAsset::load('participantteam.js'); // Display the template parent::display($tpl); }
/** * Load the main Searchtools libraries * * @param mixed $debug Is debugging mode on? [optional] * * @return void * * @since 3.2 */ public static function main($debug = null) { // Only load once if (empty(static::$loaded[__METHOD__])) { // Requires jQuery but allows to skip its loading if ($loadJquery = !isset($options['loadJquery']) || $options['loadJquery'] != 0) { RHtml::_('rjquery.framework'); } // Load the jQuery plugin && CSS RHelperAsset::load('jquery.searchtools.css', static::EXTENSION); RHelperAsset::load('jquery.searchtools.min.js', static::EXTENSION); static::$loaded[__METHOD__] = true; } return; }
/** * Load the main Searchtools libraries * * @param mixed $debug Is debugging mode on? [optional] * * @return void * * @since 3.2 */ public static function main($debug = null) { // Only load once if (!empty(static::$loaded[__METHOD__])) { return; } // If no debugging value is set, use the configuration setting if ($debug === null) { $config = JFactory::getConfig(); $debug = (bool) $config->get('debug'); } // Load the jQuery plugin && CSS RHelperAsset::load('jquery.searchtools.css', static::EXTENSION); RHelperAsset::load('jquery.searchtools.js', static::EXTENSION); static::$loaded[__METHOD__] = true; return; }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { RHelperAsset::load('tracks.css'); $mainframe = JFactory::getApplication(); $projectId = JFactory::getApplication()->input->getInt('p', 0); $model = $this->getModel(); $results = $model->getResults($projectId); $project = $model->getProject($projectId); $params = $model->getParams(); $document = JFactory::getDocument(); $document->setTitle($project->name); $breadcrumbs = $mainframe->getPathWay(); $breadcrumbs->addItem($project->name, TrackslibHelperRoute::getProjectRoute($project->id)); $this->assignRef('results', $results); $this->assignRef('project', $project); $this->assignRef('params', $params); parent::display($tpl); }
/** * Method to load the Sortable script and make table sortable * * @param string $tableId DOM id of the table * @param string $formId DOM id of the form * @param string $sortDir Sort direction * @param string $saveOrderingUrl Save ordering url, ajax-load after an item dropped * @param boolean $proceedSaveOrderButton Set whether a save order button is displayed * @param boolean $nestedList Set whether the list is a nested list * * @return void */ public static function sortable($tableId, $formId, $sortDir = 'asc', $saveOrderingUrl, $proceedSaveOrderButton = true, $nestedList = false) { // Only load once if (isset(self::$loaded[__METHOD__])) { return; } // Depends on jQuery UI JHtml::_('rjquery.ui', array('core', 'sortable')); RHelperAsset::load('lib/sortablelist.js', self::EXTENSION); RHelperAsset::load('lib/sortablelist.css', self::EXTENSION); // Attach sortable to document JFactory::getDocument()->addScriptDeclaration("\n\t\t\t(function (\$){\n\t\t\t\t\$(document).ready(function (){\n\t\t\t\t\tvar sortableList = new \$.JSortableList('#" . $tableId . " tbody','" . $formId . "','" . $sortDir . "' , '" . $saveOrderingUrl . "','','" . $nestedList . "');\n\t\t\t\t});\n\t\t\t})(jQuery);\n\t\t\t"); if ($proceedSaveOrderButton) { self::_proceedSaveOrderButton(); } // Set static array self::$loaded[__METHOD__] = true; return; }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { RHelperAsset::load('tracks.css'); $mainframe = JFactory::getApplication(); $project_id = $mainframe->input->getInt('p', 0); $params = $mainframe->getParams(); $model = $this->getModel(); $individuals = $model->getIndividuals($project_id); $project = $model->getProject($project_id); $projectparams = $model->getParams($project_id); $breadcrumbs = $mainframe->getPathWay(); $breadcrumbs->addItem($project->name . ' ' . JText::_('COM_TRACKS_Participants'), TrackslibHelperRoute::getParticipantsRoute($project_id)); $document = JFactory::getDocument(); $document->setTitle($project->name . ' ' . JText::_('COM_TRACKS_Participants')); $this->assignRef('params', $params); $this->assignRef('project', $project); $this->assignRef('projectparams', $projectparams); $this->assignRef('individuals', $individuals); parent::display($tpl); }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { RHelperAsset::load('tracks.css'); $mainframe = JFactory::getApplication(); $params = $mainframe->getParams(); $round_id = $mainframe->input->getInt('id', 0); $model = $this->getModel(); $round = $model->getRound($round_id); $breadcrumbs = $mainframe->getPathWay(); $breadcrumbs->addItem($round->name, 'index.php?view=round&r=' . $round_id); $document = JFactory::getDocument(); $document->setTitle($round->name); // parse description with content plugins $round->description = JHTML::_('content.prepare', $round->description); $picture = TrackslibHelperImage::modalimage($round->picture, $round->name, 150); $this->assignRef('round', $round); $this->assignRef('params', $params); $this->assignRef('picture', $picture); parent::display($tpl); }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { RHelperAsset::load('tracks.css'); $mainframe = JFactory::getApplication(); $project_id = $mainframe->input->getInt('p', 0); $model = $this->getModel(); $rankings = $model->getRankings($project_id); $project = $model->getProject($project_id); $params = $model->getParams($project_id); $viewparams = $mainframe->getParams('com_tracks'); $params->merge($viewparams); $breadcrumbs = $mainframe->getPathWay(); $breadcrumbs->addItem($project->name . ' ' . JText::_('COM_TRACKS_Rankings'), TrackslibHelperRoute::getRankingRoute($project_id)); $document = JFactory::getDocument(); $document->setTitle($project->name . ' ' . JText::_('COM_TRACKS_Rankings')); $this->assignRef('params', $params); $this->assignRef('project', $project); $this->assignRef('rankings', $rankings); parent::display($tpl); }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { RHelperAsset::load('tracks.css'); $mainframe = JFactory::getApplication(); if ($this->getLayout() == 'edit') { $this->displayForm($tpl); return; } $user = JFactory::getUser(); $params = $mainframe->getParams('com_tracks'); $document = JFactory::getDocument(); $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('tracks'); JPluginHelper::importPlugin('content'); $data = $this->get('Item'); $attribs['class'] = "pic"; if ($data->picture != '') { $data->picture = JHTML::image(JURI::root() . $data->picture, $data->first_name . ' ' . $data->last_name, $attribs); } else { $data->picture = JHTML::image(JURI::root() . 'media/com_tracks/images/misc/tnnophoto.jpg', $data->first_name . ' ' . $data->last_name, $attribs); } if ($data->picture_small != '') { $data->picture_small = JHTML::image(JURI::root() . $data->picture_small, $data->first_name . ' ' . $data->last_name, $attribs); } else { $data->picture_small = JHTML::image(JURI::root() . 'media/com_tracks/images/misc/tnnophoto.jpg', $data->first_name . ' ' . $data->last_name, $attribs); } $raceResults = $this->sortResultsByProject($this->get('RaceResults')); $show_edit_link = $user->id && $user->id == $data->user_id || $user->authorise('core.manage', 'com_tracks'); $breadcrumbs = $mainframe->getPathWay(); $breadcrumbs->addItem($data->first_name . ' ' . $data->last_name, TrackslibHelperRoute::getEditIndividualRoute($data->id)); $document->setTitle($data->first_name . ' ' . $data->last_name); // Allow content plugins $data->description = JHTML::_('content.prepare', $data->description); $this->assignRef('data', $data); $this->assignRef('show_edit_link', $show_edit_link); $this->assignRef('results', $raceResults); $this->assignRef('params', $params); $this->assignRef('dispatcher', $dispatcher); parent::display($tpl); }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { RHelperAsset::load('tracks.css'); $mainframe = JFactory::getApplication(); $project_id = $mainframe->input->getInt('p', 0); $data = $this->get('data'); $rounds = $this->get('rounds'); $project = $this->get('project'); $params = $this->get('Params'); $params->merge(JComponentHelper::getParams('com_tracks')); $title = JText::sprintf('COM_TRACKS_view_project_results', $project->name); $breadcrumbs = $mainframe->getPathWay(); $breadcrumbs->addItem($title, TrackslibHelperRoute::getProjectResultRoute($project_id)); $document = JFactory::getDocument(); $document->setTitle($title); $this->assignRef('params', $params); $this->assignRef('project', $project); $this->assignRef('rows', $data); $this->assignRef('rounds', $rounds); $this->assign('title', $title); parent::display($tpl); }
<?php /** * @package redMIGRATOR.Backend * @subpackage Controller * * @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE * * redMIGRATOR is based on JUpgradePRO made by Matias Aguirre */ // No direct access. defined('_JEXEC') or die; RHelperAsset::load('lib/font-awesome/css/font-awesome.min.css', 'redcore'); // Get the version $version = "v{$this->version}"; // get params $params = $this->params; // get document to add scripts $document = JFactory::getDocument(); $document->addScript('components/com_redmigrator/js/dwProgressBar.js'); $document->addScript("components/com_redmigrator/js/migrate.js"); $document->addScript('components/com_redmigrator/js/requestmultiple.js'); $document->addStyleSheet("components/com_redmigrator/css/redmigrator.css"); ?> <script type="text/javascript"> window.addEvent('domready', function() { /* Init redmigrator */ var redMigrator = new redmigrator({
$view = $data['view']; if (!$view instanceof RView) { throw new InvalidArgumentException(sprintf('Invalid view %s specified for the component layout', get_class($view))); } $toolbar = $view->getToolbar(); // Get the view template. $tpl = $data['tpl']; // Get the view render. return $view->loadTemplate($tpl); } $templateComponent = 'component' === $input->get('tmpl'); $input->set('tmpl', 'component'); $input->set('redcore', true); JHtml::_('rbootstrap.responsive'); RHelperAsset::load('component.js', 'redcore'); RHelperAsset::load('component.css', 'redcore'); // For Joomla! 2.5 we will add bootstrap alert messages if (version_compare(JVERSION, '3.0', '<') && JFactory::getApplication()->isAdmin()) { // Require the message renderer as it doesn't respect the naming convention. $messageRendererPath = JPATH_LIBRARIES . '/redcore/joomla/document/renderer/message.php'; if (file_exists($messageRendererPath)) { require_once $messageRendererPath; } } // Do we have to display the sidebar ? $displaySidebar = false; if (isset($data['sidebar_display'])) { $displaySidebar = (bool) $data['sidebar_display']; } $sidebarLayout = ''; // The sidebar layout name.
/** * Load the jQuery UI library * * @return void * * @since 1.0 */ public static function ui() { // Only load once if (!empty(static::$loaded[__METHOD__])) { return; } self::framework(); RHelperAsset::load('lib/jquery-ui/jquery-ui.min.js', self::EXTENSION); // Include datepicker translations $langTag = JFactory::getLanguage()->getTag(); $langTagParts = explode('-', $langTag); $mainLang = reset($langTagParts); RHelperAsset::load('lib/jquery-ui/i18n/jquery.ui.datepicker-' . $langTag . '.js', self::EXTENSION); RHelperAsset::load('lib/jquery-ui/i18n/jquery.ui.datepicker-' . $mainLang . '.js', self::EXTENSION); // CSS RHelperAsset::load('lib/jquery-ui/jquery-ui.custom.min.css', self::EXTENSION); static::$loaded[__METHOD__] = true; return; }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { if ($this->showProjectSwitch) { $this->projectSwitch = $this->get('ProjectSwitchForm'); } RHelperAsset::load('tracksbackend.css', 'com_tracks'); return parent::display($tpl); }
/** * @package Dummy.Backend * @subpackage Template * * @copyright Copyright (C) 2008 - 2015 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; $doc = JFactory::getDocument(); $jsLibrary = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places'; // If this library not load, load it if (!array_key_exists($jsLibrary, $doc->_scripts)) { $doc->addScript($jsLibrary); } RHelperAsset::load('googlemaps/markerwithlabel.min.js', 'com_dummy'); RHelperAsset::load('googlemaps/infobubble.min.js', 'com_dummy'); JHtml::_('behavior.keepalive'); JHtml::_('rdropdown.init'); JHtml::_('rbootstrap.tooltip'); JHtml::_('rjquery.chosen', 'select'); JHtml::_('rholder.image', '50x50'); $saveOrderLink = 'index.php?option=com_dummy&task=objects.saveOrderAjax&tmpl=component'; $listOrder = $this->state->get('list.ordering'); $listDirn = $this->state->get('list.direction'); $ordering = $listOrder == 'i.ordering'; $saveOrder = $listOrder == 'i.ordering' && strtolower($listDirn) == 'asc'; $search = $this->state->get('filter.search'); $user = JFactory::getUser(); $userId = $user->id; if ($saveOrder && $this->canEditState) { JHTML::_('rsortablelist.sortable', 'table-items', 'adminForm', strtolower($listDirn), $saveOrderLink, false, true);
* * @copyright Copyright (C) 2008 - 2015 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; $app = JFactory::getApplication(); $input = JFactory::getApplication()->input; JLoader::import('joomla.html.parameter'); $option = $input->getCmd('option'); $view = $input->getCmd('view'); // Register component prefix JLoader::registerPrefix('Dummy', __DIR__); // Register library prefix JLoader::registerPrefix('Dummy', JPATH_LIBRARIES . '/dummy'); // Loading helper JLoader::import('joomla.html.pagination'); JLoader::import('dummy', JPATH_COMPONENT . '/helpers'); JLoader::import('route', JPATH_COMPONENT . '/helpers'); // Load RedCORE bootstrap CSS RHelperAsset::load('dummy.min.css', 'com_dummy'); $controller = $input->getCmd('view'); // Set the controller page if (!file_exists(JPATH_COMPONENT . '/controllers/' . $controller . '.php')) { $controller = 'demo'; $input->set('view', 'demo'); } require_once JPATH_COMPONENT . '/controllers/' . $controller . '.php'; // Execute the controller $controller = JControllerLegacy::getInstance('dummy'); $controller->execute($input->getCmd('task')); $controller->redirect();
/** * Load the bootstrap-checkbox. * * @return void */ public static function checkbox() { static::framework(); RHelperAsset::load('lib/bootstrap-checkbox/css/bootstrap-checkbox.min.css', static::EXTENSION); RHelperAsset::load('lib/bootstrap-checkbox.min.js', static::EXTENSION); }
$toolbar = $view->getToolbar(); // Get the view template. $tpl = $data['tpl']; // Get the view render. return $view->loadTemplate($tpl); } $templateComponent = 'component' === $input->get('tmpl'); $input->set('tmpl', 'component'); $input->set('redcore', true); // Load bootstrap + fontawesome RHtmlMedia::loadFrameworkCss(); RHtmlMedia::loadFrameworkJs(); RHelperAsset::load('component.min.js', 'redcore'); // Load a custom CSS option for this component if exists if ($comOption = $input->get('option', null)) { RHelperAsset::load($comOption . '.css', $comOption); } // For Joomla! 2.5 we will add bootstrap alert messages if (version_compare(JVERSION, '3.0', '<') && JFactory::getApplication()->isAdmin()) { // Require the message renderer as it doesn't respect the naming convention. $messageRendererPath = JPATH_LIBRARIES . '/redcore/joomla/document/renderer/message.php'; if (file_exists($messageRendererPath)) { require_once $messageRendererPath; } } // Do we have to display the sidebar ? $displaySidebar = false; if (isset($data['sidebar_display'])) { $displaySidebar = (bool) $data['sidebar_display']; } $sidebarLayout = '';
/** * Load the entire bootstrap framework * * @param mixed $debug Is debugging mode on? [optional] * * @return void */ public static function main($debug = null) { JHtml::_('rjquery.framework'); RHelperAsset::load('redgrid.min.js', static::EXTENSION); }
/** * Load font-awesome * * @return void */ public static function fontawesome() { // Include Bootstrap framework static::framework(); RHelperAsset::load('lib/font-awesome/css/font-awesome.min.css', static::EXTENSION); }
<?php /** * @package Redcore * @subpackage Layouts * * @copyright Copyright (C) 2012 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later, see LICENSE. */ defined('JPATH_REDCORE') or die; $data = $displayData; // Add jquery UI js. JHtml::_('rjquery.datepicker'); $doc = JFactory::getDocument(); $script = "\n(function(\$){\n\t\$(document).ready(function () {\n\t\t\$('" . $data->cssId . "').datepicker(" . $data->datepickerOptions . ");\n\t\t// We will remove all the default images links with a font-awesome icon\n\t\t\$('img[src=\"rdatepicker-calendar.gif\"]').replaceWith('<i class=\"icon-calendar icon-2x\"></i>');\n\t});\n})(jQuery);\n"; $doc->addScriptDeclaration($script); // Load the common css RHelperAsset::load('rdatepicker.css', 'redcore'); echo $data->fieldHtml;
/** * Loads proper media framework library * * @param string $defaultFramework Set as default framework * * @return void */ public static function loadFrameworkJs($defaultFramework = '') { JHtml::_('rjquery.framework'); if (!empty($defaultFramework)) { self::setFramework($defaultFramework); } $isAdmin = JFactory::getApplication()->isAdmin(); if ($isAdmin || !$isAdmin && RBootstrap::$loadFrontendCSS) { if (self::getFramework() == 'bootstrap2') { RHelperAsset::load('lib/bootstrap.min.js', 'redcore'); } elseif (self::getFramework() == 'bootstrap3') { RHelperAsset::load('lib/bootstrap3/bootstrap.min.js', 'redcore'); } elseif (self::getFramework() == 'foundation5') { } } }
/** * Load the LazyLoad library * https://github.com/tuupola/jquery_lazyload * * @param string $selector CSS Selector of image for apply LazyLoad * @param array $options Optional array with options * * @return void */ public static function lazyload($selector = 'img.lazy', $options = null) { // Only load once if (isset(static::$loaded[__METHOD__][$selector])) { return; } self::framework(); RHelperAsset::load('lib/lazyload/jquery.lazyload.min.js', self::EXTENSION); // Generate options with default values $options = static::options2Jregistry($options); JFactory::getDocument()->addScriptDeclaration("\n\t\t\t(function(\$){\n\t\t\t\t\$(document).ready(function () {\n\t\t\t\t\t\$('" . $selector . "').each(function(index){\n\t\t\t\t\t\tif ((\$(this).attr('data-original') == undefined) || (\$(this).attr('data-original') == ''))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\$(this).attr('data-original', \$(this).attr('src'));\n\t\t\t\t\t\t\t\$(this).removeAttr('src');\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\t\$('" . $selector . "').lazyload(\n\t\t\t\t\t\t" . $options . "\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t})(jQuery);\n\t\t"); static::$loaded[__METHOD__][$selector] = true; return; }