//---------------------------------------------------- // Script author: brothercake //---------------------------------------------------- //### THIS IS THE ONLY SCRIPT YOU NEED TO EDIT ###// //global config object (universal scripting properties) var config = { 'image-path' : '/themes/site_themes/refocus/images/', //base path to images folder }; //function wrapper contains calls to initialise the various behaviors //without this, none of the other scripting will do anything var settings = function() { //global language object (for all generated language) var lang = { 'view-slide' : 'View Slide %n', //tooltip for rotator slide-marker dots 'current-slide' : 'Slide %n (now showing)', //tooltip for current slide-marker dot 'increment-slide' : 'View %inc Slide', //tooltip for rotator previous/next buttons 'next' : 'Next', //"Next" for %inc token above 'previous' : 'Previous' //"Previous" for %inc token above }; //initialise the behaviors class, passing the global config and lang objects Behaviors.init(config, lang); if(Behaviors.get('#banner-rotator-image') && Behaviors.get('#banner-rotator-info') && Behaviors.get('#banner-rotator-panel')) { //instantiate a new rotator instance for the main banner //specifying the slides information and meta-data object //(and saving this reference to pass to the mega-menu scripting) var banner_rotator = new Behaviors.Rotator({ 'image-id' : 'banner-rotator-image', //ID of image container (with link and image inside) 'info-id' : 'banner-rotator-info', //ID of info container (with heading, text and action button inside) 'panel-id' : 'banner-rotator-panel', //ID of control panel container (for appending created controls) 'transition-speed' : 1, //time taken for a complete transition from one slide to the next (seconds) 'transition-resolution' : 20, //animation resolution (iterations per fade; increase this value as you increase the speed, and vise versa) 'playback-speed' : 7, //auto playback speed (pause between transitions, seconds; 0 = no auto playback) 'show-controls' : true, //show the previous/next control buttons 'show-dots' : true, //show the slide-marker dots }); } if(Behaviors.get('#action-rotator-image') && Behaviors.get('#action-rotator-info') && Behaviors.get('#action-rotator-panel')) { //instantiate a new rotator instance for the act-now sidebar //specifying the slides information and meta-data object (no need to save the reference) new Behaviors.Rotator({ 'image-id' : 'action-rotator-image', 'info-id' : 'action-rotator-info', 'panel-id' : 'action-rotator-panel', 'transition-speed' : 0.5, 'transition-resolution' : 10, 'playback-speed' : 0, 'show-controls' : false, 'show-dots' : true }); } if(Behaviors.get('#footer-rotator-image') && Behaviors.get('#footer-rotator-info') && Behaviors.get('#footer-rotator-panel')) { //the slides information for the footer rotator is in default HTML, for no-script output //each group of four boxes is the text for one slide //so we have to extract that data (the boxes' html, not the box objects themselves) //then remove all but the first group from the page var boxcount = 0, slidecount = 0, slides = [], boxes = Behaviors.get('div', Behaviors.get('#footer-rotator-info'), { 'class' : 'comment' }); Behaviors.forevery(boxes, function(i, box) { if(box.className == 'comment') { var tmp = document.createElement('div'); tmp.appendChild(box.cloneNode(true)); if(boxcount == 0) { slides[slidecount] = { 'text' : tmp.innerHTML }; } else { slides[slidecount]['text'] += tmp.innerHTML; } if(slidecount > 0) {box.parentNode.removeChild(box);} if(++boxcount == 4) { slidecount ++; boxcount = 0; } } }); //then instantiate a new rotator instance for the footer //passing the extracted slides information, and meta-data object (no need to save the reference) new Behaviors.Rotator({ 'image-id' : 'footer-rotator-image', 'info-id' : 'footer-rotator-info', 'panel-id' : 'footer-rotator-panel', 'transition-speed' : 1, 'transition-resolution' : 20, 'playback-speed' : 0, 'show-controls' : false, 'show-dots' : true, 'slides' : slides }); } if(Behaviors.get('#tabs')) { //add the tabs behaviors Behaviors.addTabsBehaviors(); } //initialise the mega-menu, passing its config object //[fade] changed 'menu-open-pause' from 0.5 to 0.25 to make the menus open faster // and added 'menu-fade-speed', 'menu-fade-resolution' and 'universal-fade' parameters Behaviors.MegaMenu.init({ 'rotators' : ((typeof banner_rotator != 'undefined') ? [banner_rotator] : []), //OPTIONAL banner rotator references array (if defined) 'menu-open-pause' : 0.25, //pause before opening a menu from a mouse event (seconds) 'menu-close-pause' : 1, //pause before closing a menu from a mouse event (seconds) 'menu-fade-speed' : 0.2, //[fade] transition speed when opening and closing a menu (seconds) 'menu-fade-resolution' : 5, //[fade] transition resolution (number of iterations per fade) 'universal-fade' : true //[fade] apply the fade to all megamenus (true) or just the one in the navigation bar (false) }); //initialise the form utilities, passing its config object Behaviors.initFormUtilities({ 'inclusion-class' : 'dynamicValue' //inclusion class for default-value handling behaviors }); //initialise the rich-scroller scripting, passing its config object Behaviors.RichScroller.init({ 'increment' : 6, //scrolling increment (pixels) 'auto-scroll-delay' : 0.3, //delay before auto-scroll kicks-in (seconds) 'auto-scroll-speed' : 60, //base auto-scroll speed (increments per second) 'scrollbar-minheight' : 20 //minimum scrollbar height (pixels) }); //end initialise function wrapper };