public function __construct($context) { $this->_jtemplate = $context; parent::__construct(); JHtmlBootstrap::loadCss($includeMaincss = true, $this->_jtemplate->direction); JHtmlBootstrap::framework(); $this->_jparams = $this->_jtemplate->params ? $this->_jtemplate->params : JFactory::getApplication()->getTemplate(true)->params; $this->_google = new stdClass(); $this->setShowcase(); $this->setBackground(); $this->_mobile = Avatar::isHandleDevice(); $this->_responsive = $this->_jparams->get('active_responsive') ? $this->_jparams->get('active_responsive') : false; $this->_jquery = $this->_jparams->get('load_jquery') ? $this->_jparams->get('load_jquery') : false; $this->_optimize = $this->_jparams->get('optimize'); }
/** * Tests the framework method. * * @return void * * @since 3.1 */ public function testFramework() { // Initialise the Bootstrap JS framework JHtmlBootstrap::framework(); // Get the document instance $document = JFactory::getDocument(); $this->assertArrayHasKey('/media/jui/js/jquery.min.js', $document->_scripts, 'Verify that Bootstrap initializes jQuery as well'); $this->assertArrayHasKey('/media/jui/js/bootstrap.min.js', $document->_scripts, 'Verify that Bootstrap initializes Bootstrap'); }
/** * Method to load the Bootstrap JavaScript framework into the document head * * If debugging mode is on an uncompressed version of Bootstrap is included for easier debugging. * * @param mixed $debug Is debugging mode on? [optional] * * @return void * * @since 3.0 */ public static function framework($debug = null) { // Use Joomla version first if (JevJoomlaVersion::isCompatible("3.0")) { JHtmlBootstrap::framework($debug); return; } // Fall back to JEvents version JLoader::register('JevHtmlBootstrap', JEV_PATH . "libraries/bootstrap.php"); try { JevHtmlBootstrap::framework($debug); return; } catch (Exception $ex) { } // Finally use library version as last resort // Only load once if (!empty(static::$loaded[__METHOD__])) { return; } // Load jQuery JevHtmlJquery::framework(); // If no debugging value is set, use the configuration setting if ($debug === null) { $config = JFactory::getConfig(); $debug = (bool) $config->get('debug'); } JHtml::_('script', 'libraries/jevents/bootstrap/js/bootstrap.min.js', false, false, false, false, $debug); static::$loaded[__METHOD__] = true; return; }
<?php /** * @package Template.Schwaderhof * * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; $app = JFactory::getApplication(); $doc = JFactory::getDocument(); // Add JavaScript Frameworks JHtmlBootstrap::framework(); // Add Stylesheets $doc->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/template.css'); // Adjusting content width $left = $this->countModules('position-7'); $right = $this->countModules('position-8'); if ($left && $right) { $span = 'span6'; } elseif ($left && !$right || !$left && $right) { $span = 'span9'; } else { $span = 'span12'; } ?> <!DOCTYPE html> <html> <head> <jdoc:include type="head" /> </head> <body>
/** * Method to load the Bootstrap JavaScript & CSS framework into the document head * * If debugging mode is on an uncompressed version of Bootstrap is included for easier debugging. * * @param boolean $css Include CSS. * @param boolean $debug Is debugging mode on? [optional] * * @return AssetManager Return self to support chaining. */ public function bootstrap($css = false, $debug = null) { \JHtmlBootstrap::framework($debug); if ($css) { \JHtmlBootstrap::loadCss(); } return $this; }
/** * Method to load the Bootstrap JavaScript framework into the document head * * If debugging mode is on an uncompressed version of Bootstrap is included for easier debugging. * * @param mixed $debug Is debugging mode on? [optional] * * @return void * * @since 3.0 */ public static function framework($debug = null) { if (JevJoomlaVersion::isCompatible("3.0")) { JHtmlBootstrap::framework($debug); return; } // 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'); } /* if(!JHtml::_('script', 'jui/jquery.min.js', false, true, true, false, $debug)) { JHtml::_('script', 'libraries/jevents/bootstrap/js/jquery.min.js', false, true, false, false, $debug); } else { JHtml::_('script', 'jui/jquery.min.js', false, true, false, false, $debug); } */ // Make loading this conditional on config option ?? JFactory::getDocument()->addScript("//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"); //JHtml::_('script', 'com_jevents/jquery.min.js', false, true, false, false, $debug); // use bootstrap from CDN instead of our copy of it - problem though that target elements disappear when popover appears in Joomla 2.5 //JFactory::getDocument()->addScript("//maxcdn.bootstrapcdn.com/bootstrap/2.3.2/js/bootstrap.js"); JEVHelper::script("bootstrap.js", "com_jevents/", false, true); static::$loaded[__METHOD__] = true; return; }
/** * modal * * @param string $selector * * @return void */ public static function modal($selector = '.hasModal') { $asset = static::getAsset(); if (!static::inited(__METHOD__)) { \JHtmlBootstrap::framework(); $js = <<<JS var Windwalker; // Init modal jQuery(document).ready(function(\$) { \tvar modalBox = \$('<div class="modal fade hide" id="windwalker-iframe-modal"> \\ <div class="modal-dialog"> \\ <div class="modal-content"> \\ <div class="modal-body" style="max-height: 500px;"> \\ <iframe width="100%" style="min-height: 450px;" src="" frameborder="0"></iframe> \\ </div> \\ </div> \\ </div> \\ </div>'); \t\$('body').append(modalBox); \tWindwalker = Windwalker || (Windawlekr = {}); \tWindwalker.Modal = { \t\thide: function() { modalBox.modal('hide') }, \t\ttoggle: function() { modalBox.modal('toggle') }, \t\tshow: function() { modalBox.modal('show') }, \t\thandleUpdate: function() { modalBox.modal('handleUpdate') }, \t}; }); JS; $asset->internalJS($js); } if (!static::inited(__METHOD__, func_get_args())) { $js = <<<JS // Modal task jQuery(document).ready(function(\$) { \t\$('{$selector}').click(function(event) \t{ \t\tvar link = \$(this); \t\tvar modal = \$('#windwalker-iframe-modal'); \t\tvar href = link.attr('href'); \t\tvar iframe = modal.find('iframe'); \t\tiframe.attr('src', href); \t\tmodal.modal('show'); \t\tmodal.on('hide.bs.modal', function() { \t\t iframe.attr('src', ''); \t\t}) \t\tevent.stopPropagation(); \t\tevent.preventDefault(); \t}); }); JS; $asset->internalJS($js); } }
/** * registerScript * * @param \JDocument $template * * @return void */ protected static function registerScript(\JDocument $template) { \JHtmlBootstrap::framework(); }