Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save waynegraham/3777871 to your computer and use it in GitHub Desktop.
Save waynegraham/3777871 to your computer and use it in GitHub Desktop.
Function to add Modernizr, Respond.js, and Selectivizr to Omeka
<?php
/**
* Adds and displays the following JavaScript assets:
*
* - Modernizr - http://modernizr.com/
* - Respond.js - https://github.com/scottjehl/Respond
* - Selectivizr - http://selectivizr.com/
*
* Be sure to put copies of each in your theme's 'javascripts' directory.
*/
function load_theme_javascripts() {
queue_js('modernizr.min');
$respondSrc = src('respond.min.js', 'javascripts');
$modernizrLoad = "Modernizr.load([{test: Modernizr.mq(), nope: " . "['$respondSrc']}]);";
queue_js_string($modernizrLoad);
// Append Selectivizr using an IE conditional, so only IE8 and earlier use it.
__v()->headScript()->appendFile(
src(
'selectivizr.min.js',
'javascripts'
),
'text/javascript',
array(
'conditional' => 'lt IE 9'
)
);
// display_js automatically adds jQuery for us, which is needed for Selectivizr.
display_js();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment