public static function load($name)
 {
     switch ($name) {
         case 'jquery':
             // loaders / blockers
             Requirements::block(THIRDPARTY_DIR . "/jquery/jquery.js");
             Requirements::javascript(ABC_PATH . "/javascript/library/jQuery/jquery-1.10.2.min.js");
             LeftAndMainHelper::require_unblock(THIRDPARTY_DIR . "/jquery/jquery.js");
             LeftAndMainHelper::require_block(ABC_PATH . "/javascript/library/jQuery/jquery-1.10.2.min.js");
             LeftAndMain::require_javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
             break;
         case 'jquery-mobile':
             // dependencies
             self::load('jquery');
             // loaders / blockers
             Requirements::javascript(ABC_PATH . '/javascript/library/jQuery/mobile/jquery.mobile-1.3.2.min.js');
             LeftAndMainHelper::require_block(ABC_PATH . '/javascript/library/jQuery/mobile/jquery.mobile-1.3.2.min.js');
             break;
         case 'lean-modal':
             // dependencies
             self::load('jquery');
             // loaders / blockers
             Requirements::javascript(ABC_PATH . "/javascript/library/jQuery/lean-modal/jquery.lean-modal.min.js");
             Requirements::css(ABC_PATH . "/javascript/library/jQuery/lean-modal/jquery.lean-modal.css");
             LeftAndMainHelper::require_block(ABC_PATH . "/javascript/library/jQuery/lean-modal/jquery.lean-modal.min.js");
             LeftAndMainHelper::require_block(ABC_PATH . "/javascript/library/jQuery/lean-modal/jquery.lean-modal.css");
             break;
         case 'avgrund':
             // dependencies
             self::load('jquery');
             // loaders / blockers
             Requirements::javascript(ABC_PATH . "/javascript/library/jQuery/avgrund/jquery.avgrund.js");
             Requirements::css(ABC_PATH . "/javascript/library/jQuery/avgrund/avgrund.css");
             LeftAndMainHelper::require_block(ABC_PATH . "/javascript/library/jQuery/avgrund/jquery.avgrund.js");
             LeftAndMainHelper::require_block(ABC_PATH . "/javascript/library/jQuery/avgrund/argvund.css");
             break;
         case 'bootstrap':
             // dependencies
             self::load('jquery');
             // loaders / blockers
             Requirements::javascript(ABC_PATH . '/lib/bootstrap/css/bootstrap.min.css');
             LeftAndMainHelper::require_block(ABC_PATH . '/lib/bootstrap/js/bootstrap.min.js');
             break;
         case 'slidatron':
             // dependencies
             self::load('jquery');
             // loaders / blockers
             Requirements::javascript(ABC_PATH . '/javascript/library/jQuery/event.drag/jquery.event.drag.js');
             Requirements::javascript(ABC_PATH . '/javascript/library/jQuery/event.drag/jquery.event.drag.live.js');
             Requirements::javascript(ABC_PATH . '/javascript/library/jquery.drag.touch.js');
             Requirements::javascript(ABC_PATH . '/javascript/library/jQuery/slidatron/jquery.slidatron.js');
             // Requirements::css(ABC_PATH.'/javascript/library/jQuery/slidatron/slidatron.css');
             LeftAndMainHelper::require_block(ABC_PATH . '/javascript/library/jQuery/event.drag/jquery.event.drag.js');
             LeftAndMainHelper::require_block(ABC_PATH . '/javascript/library/jQuery/event.drag/jquery.event.drag.live.js');
             LeftAndMainHelper::require_block(ABC_PATH . '/javascript/library/jquery.drag.touch.js');
             LeftAndMainHelper::require_block(ABC_PATH . '/javascript/library/jQuery/slidatron/jquery.slidatron.js');
             break;
         case 'nivo-slider':
             // dependencies
             self::load('jquery');
             // loaders / blockers
             Requirements::javascript(ABC_PATH . '/javascript/library/jQuery/nivo-slider/jquery.nivo.slider.pack.js');
             Requirements::css(ABC_PATH . '/javascript/library/jQuery/nivo-slider/nivo-slider.css');
             Requirements::css(ABC_PATH . '/javascript/library/jQuery/nivo-slider/themes/default/default.css');
             LeftAndMainHelper::require_block(ABC_PATH . '/javascript/library/jQuery/nivo-slider/jquery.nivo.slider.pack.js');
             LeftAndMainHelper::require_block(ABC_PATH . '/javascript/library/jQuery/nivo-slider/nivo-slider.css');
             LeftAndMainHelper::require_block(ABC_PATH . '/javascript/library/jQuery/nivo-slider/themes/default/default.css');
             break;
         default:
             throw new Exception('Invalid module requested; currently available modules are: jquery, jquery-mobile, bootstrap, avgrund, slidatron, nivo-slider');
             break;
     }
 }
Ejemplo n.º 2
0
Requirements::set_write_js_to_body(true);
Requirements::set_combined_files_enabled(true);
// HTML5 Shims
// -----------
$shimRequirements = array('thirdparty/selectivizr/index.js', 'thirdparty/respond/dest/respond.min.js', 'thirdparty/modernizr/modernizr.js');
Requirements::combine_files('lte-ie8-shims.js', $shimRequirements);
Requirements::process_combined_files();
// forces ss to generate the file regardless of blocking
// CSS
// ---
$cssRequirements = array('themes/project/css/main.css', 'themes/project/css/typography.css');
Requirements::combine_files('application.css', $cssRequirements);
// Primary JS
// ----------
$jsRequirements = array('thirdparty/jquery/dist/jquery.min.js', 'project/javascript/main.js', 'project/javascript/forms.js');
Requirements::combine_files('application.js', $jsRequirements);
// Asset loading
// -------------
// block jquery
// block the combined shims + component files so we can lead them manually
RequirementsHelper::require_block(array_merge(array('assets/_combinedfiles/lte-ie8-shims.js', 'framework/thirdparty/jquery/jquery.js'), $shimRequirements));
// dump this into a conditional
Requirements::insertHeadTags('
    <!--[if (gte IE 6)&(lte IE 8)]>
        <script src="/assets/_combinedfiles/lte-ie8-shims.js"></script>
    <![endif]-->
');
// block all front end requirements from the cms
LeftAndMainHelper::require_block(array_merge(array('assets/_combinedfiles/application.css', 'assets/_combinedfiles/application.js', 'assets/_combinedfiles/lte-ie8-shims.js'), $cssRequirements, $jsRequirements, $shimRequirements));
// let the cms load its preferred version of jquery
LeftAndMainHelper::require_unblock(array('framework/thirdparty/jquery/jquery.js'));