//---------------------------------------------------- // Site: Amnesty International Australia // 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 'cache-list' : [ //OPTIONAL array of images to be pre-cached //"email signup" menu close button 'back-email-close.gif', //rotator buttons '../../../../themes/site_themes/refocus/images/button-take-action.png', '../../../../themes/site_themes/refocus/images/button-donate-med.png', '../../../../themes/site_themes/refocus/images/button-read-more.png', //banner rotator images '../../../../images/uploads/about/nauru_carousel.jpg', '../../../../images/uploads/splash/Cleveland-kids-detention-QLD.jpg', '../../../../images/uploads/about/homepagesplash-hands.jpg', '../../../../images/uploads/about/indosplash.jpg', //act-now rotator images ] }; //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 'slides' : [ { 'src' : '../../../../images/uploads/about/nauru_carousel.jpg', 'alt' : 'Refugee children in Nauru take part in a protest in March 2015. © Private', 'href' : 'http://www.amnesty.org.au/action/action/42240/', 'button-src' : '../../../../themes/site_themes/refocus/images/button-take-action.png', 'button-alt' : 'Take Action', 'heading' : "Demand an end to the secret abuse in Nauru", 'text' : "The government is going to great lengths to inflict suffering on people seeking asylum and to hide this abuse from the eyes of the world." }, { 'src' : '../../../../images/uploads/splash/Cleveland-kids-detention-QLD.jpg', 'alt' : 'CCTV footage of a dog intimidating a teenage girl at Cleveland youth detention centre.', 'href' : 'http://www.amnesty.org.au/action/action/42195/', 'button-src' : '../../../../themes/site_themes/refocus/images/button-take-action.png', 'button-alt' : 'Take Action', 'heading' : "Stop the torture of kids in youth detention", 'text' : "Join our call on the Prime Minister to address the shocking conditions in youth detention centres like Don Dale in the NT." }, { 'src' : '../../../../images/uploads/about/homepagesplash-hands.jpg', 'alt' : 'Hands. © Wayne Quilliam', 'href' : 'http://www.amnesty.org.au/news/comments/42411/', 'button-src' : '../../../../themes/site_themes/refocus/images/button-take-action.png', 'button-alt' : 'Take Action', 'heading' : "New report on QLD youth justice", 'text' : "“Heads held high”: Keeping Queensland kids out of detention, strong in culture and community." }, { 'src' : '../../../../images/uploads/about/indosplash.jpg', 'alt' : '© Amnesty International', 'href' : 'http://www.amnesty.org.au/action/action/41770/', 'button-src' : '../../../../themes/site_themes/refocus/images/button-take-action.png', 'button-alt' : 'Take Action', 'heading' : "Act now: Stop imminent executions in Indonesia", 'text' : "Three death row prisoners are at imminent risk of facing the firing squad. Act now to stop the executions before it’s too late." } ] }); } 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, 'slides' : [ ] }); } 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 };