1 2/* Merged Plone Javascript file 3 * This file is dynamically assembled from separate parts. 4 * Some of these parts have 3rd party licenses or copyright information attached 5 * Such information is valid for that section, 6 * not for the entire composite file 7 * originating files are separated by - filename.js - 8 */ 9 10/* - ++resource++collective.polls/js/collective.poll.js - */ 11// https://unespar.edu.br/portal_javascripts/++resource++collective.polls/js/collective.poll.js?original=1 12!function($){"use strict";var DrawPoll=function(element,options){this.init(element)};DrawPoll.prototype={constructor:DrawPoll,init:function(poll){this.poll=$(poll);this.ajax_submit();this.content_handler=this.get_handler();if(this.content_handler[0]!==undefined){this.type=this.get_type();this.data=this.get_data();this.extra_conf={'width':undefined};switch(this.type){case 'portlet':this.setup_portlet(this.data.type);break;default:this.setup_default(this.data.type)}this.draw(this.data,this.content_handler,this.extra_conf)}},draw:function(data,content_handler,extra_conf){content_handler.polls({width:extra_conf.width,type:data.type,data:data.result_data})},get_data:function(poll){var poll=poll!==undefined?poll:this.poll,raw_results=poll.find('.poll-results'),result={},result_data=[];raw_results.find('li').each(function(i){var li=$(this),data={};data['label']=li.find('.option_description').text();data['data']=li.find('.option_result').text()*1;result_data[i]=data});result['type']=this.get_graph_type(poll);result['result_data']=result_data;raw_results.hide();return result},get_handler:function(poll){var poll=poll!==undefined?poll:this.poll,handler=poll.find('[class*=pollresultholder]');return handler},get_type:function(handler){var handler=handler!==undefined?handler:this.content_handler,re=/\w+(?=pollresultholder)/,match=handler.attr('class').match(re),type=match?match[0]:match;if(type===undefined){type='default'}return type},get_graph_type:function(poll){var poll=poll!==undefined?poll:this.poll,re=/\w+(?=-poll)/,match=poll.attr('class').match(re),type=match?match[0]:match;return type},setup_portlet:function(type){if(type=='pie'){this.content_handler.height(150)}},setup_default:function(type){var width=350;switch(type){case 'pie':this.content_handler.height(200);this.content_handler.width(width);break;case 'bar':width=300;this.content_handler.width(width);break}this.extra_conf['width']=width},ajax_submit:function(){this.poll.submit(function(event){var t=$(this);var p=t.parents('.votePortlet');var url=t.attr('action');var data=t.serialize()+'&ajax_load=True&poll.submit=True';$('.poll-spinner',p).show();t.css({'visibility':'hidden'});$.ajax({url:url,data:data,type:'POST',success:function(html){var manager='' 13if(p[0]!==undefined){manager=p.attr('data-manager')}if(!manager){window.location=window.location}else{var base=p.attr('data-url');if(!base){base='.'}$.ajax({url:base+'/@@poll_portlet_render',data:{'column':manager},success:function(data){p.replaceWith(data);$('.poll-data').drawpoll();$('.spinner',p).hide()}})}}});return false})}};$.fn.drawpoll=function(option){return this.each(function(){var t=$(this),data=t.data('drawpoll'),options=typeof option=='object'&&option;if(!data)t.data('drawpoll',(data=new DrawPoll(this,options)));if(typeof option=='string')data[option]()})};$.fn.drawpoll.Constructor=DrawPoll;$(function(){$('.poll-data, .votePortlet form').drawpoll()})}(window.jQuery); 14 15/* - ++resource++brasil.gov.tiles/jquery.cycle2.js - */ 16/*! 17* jQuery Cycle2; version: 2.1.1 build: 20140128 18* http://jquery.malsup.com/cycle2/ 19* Copyright (c) 2014 M. Alsup; Dual licensed: MIT/GPL 20*/ 21 22/* Cycle2 core engine */ 23;(function($) { 24"use strict"; 25 26var version = '2.1.1'; 27 28$.fn.cycle = function( options ) { 29 // fix mistakes with the ready state 30 var o; 31 if ( this.length === 0 && !$.isReady ) { 32 o = { s: this.selector, c: this.context }; 33 $.fn.cycle.log('requeuing slideshow (dom not ready)'); 34 $(function() { 35 $( o.s, o.c ).cycle(options); 36 }); 37 return this; 38 } 39 40 return this.each(function() { 41 var data, opts, shortName, val; 42 var container = $(this); 43 var log = $.fn.cycle.log; 44 45 if ( container.data('cycle.opts') ) 46 return; // already initialized 47 48 if ( container.data('cycle-log') === false || 49 ( options && options.log === false ) || 50 ( opts && opts.log === false) ) { 51 log = $.noop; 52 } 53 54 log('--c2 init--'); 55 data = container.data(); 56 for (var p in data) { 57 // allow props to be accessed sans 'cycle' prefix and log the overrides 58 if (data.hasOwnProperty(p) && /^cycle[A-Z]+/.test(p) ) { 59 val = data[p]; 60 shortName = p.match(/^cycle(.*)/)[1].replace(/^[A-Z]/, lowerCase); 61 log(shortName+':', val, '('+typeof val +')'); 62 data[shortName] = val; 63 } 64 } 65 66 opts = $.extend( {}, $.fn.cycle.defaults, data, options || {}); 67 68 opts.timeoutId = 0; 69 opts.paused = opts.paused || false; // #57 70 opts.container = container; 71 opts._maxZ = opts.maxZ; 72
73 opts.API = $.extend ( { _container: container }, $.fn.cycle.API ); 74 opts.API.log = log; 75 opts.API.trigger = function( eventName, args ) { 76 opts.container.trigger( eventName, args ); 77 return opts.API; 78 }; 79 80 container.data( 'cycle.opts', opts ); 81 container.data( 'cycle.API', opts.API ); 82 83 // opportunity for plugins to modify opts and API 84 opts.API.trigger('cycle-bootstrap', [ opts, opts.API ]); 85 86 opts.API.addInitialSlides(); 87 opts.API.preInitSlideshow(); 88 89 if ( opts.slides.length ) 90 opts.API.initSlideshow(); 91 }); 92}; 93 94$.fn.cycle.API = { 95 opts: function() { 96 return this._container.data( 'cycle.opts' ); 97 }, 98 addInitialSlides: function() { 99 var opts = this.opts(); 100 var slides = opts.slides; 101 opts.slideCount = 0; 102 opts.slides = $(); // empty set 103 104 // add slides that already exist 105 slides = slides.jquery ? slides : opts.container.find( slides ); 106 107 if ( opts.random ) { 108 slides.sort(function() {return Math.random() - 0.5;}); 109 } 110 111 opts.API.add( slides ); 112 }, 113 114 preInitSlideshow: function() { 115 var opts = this.opts(); 116 opts.API.trigger('cycle-pre-initialize', [ opts ]); 117 var tx = $.fn.cycle.transitions[opts.fx]; 118 if (tx && $.isFunction(tx.preInit)) 119 tx.preInit( opts ); 120 opts._preInitialized = true; 121 }, 122 123 postInitSlideshow: function() { 124 var opts = this.opts(); 125 opts.API.trigger('cycle-post-initialize', [ opts ]); 126 var tx = $.fn.cycle.transitions[opts.fx]; 127 if (tx && $.isFunction(tx.postInit)) 128 tx.postInit( opts ); 129 }, 130 131 initSlideshow: function() { 132 var opts = this.opts(); 133 var pauseObj = opts.container; 134 var slideOpts; 135 opts.API.calcFirstSlide(); 136 137 if ( opts.container.css('position') == 'static' ) 138 opts.container.css('position', 'relative'); 139 140 $(opts.slides[opts.currSlide]).css({ 141 opacity: 1, 142 display: 'block', 143 visibility: 'visible' 144 }); 145 opts.API.stackSlides( opts.slides[opts.currSlide], opts.slides[opts.nextSlide], !opts.reverse ); 146 147 if ( opts.pauseOnHover ) { 148 // allow pauseOnHover to specify an element 149 if ( opts.pauseOnHover !== true ) 150 pauseObj = $( opts.pauseOnHover ); 151 152 pauseObj.hover( 153 function(){ opts.API.pause( true ); }, 154 function(){ opts.API.resume( true ); } 155 ); 156 } 157 158 // stage initial transition 159 if ( opts.timeout ) { 160 slideOpts = opts.API.getSlideOpts( opts.currSlide ); 161 opts.API.queueTransition( slideOpts, slideOpts.timeout + opts.delay ); 162 } 163 164 opts._initialized = true; 165 opts.API.updateView( true ); 166 opts.API.trigger('cycle-initialized', [ opts ]); 167 opts.API.postInitSlideshow(); 168 }, 169 170 pause: function( hover ) { 171 var opts = this.opts(), 172 slideOpts = opts.API.getSlideOpts(), 173 alreadyPaused = opts.hoverPaused || opts.paused; 174 175 if ( hover ) 176 opts.hoverPaused = true; 177 else 178 opts.paused = true; 179 180 if ( ! alreadyPaused ) { 181 opts.container.addClass('cycle-paused'); 182 opts.API.trigger('cycle-paused', [ opts ]).log('cycle-paused'); 183 184 if ( slideOpts.timeout ) { 185 clearTimeout( opts.timeoutId ); 186 opts.timeoutId = 0; 187 188 // determine how much time is left for the current slide 189 opts._remainingTimeout -= ( $.now() - opts._lastQueue ); 190 if ( opts._remainingTimeout < 0 || isNaN(opts._remainingTimeout) ) 191 opts._remainingTimeout = undefined; 192 } 193 } 194 }, 195 196 resume: function( hover ) { 197 var opts = this.opts(), 198 alreadyResumed = !opts.hoverPaused && !opts.paused, 199 remaining; 200 201 if ( hover ) 202 opts.hoverPaused = false; 203 else 204 opts.paused = false;
205 206 207 if ( ! alreadyResumed ) { 208 opts.container.removeClass('cycle-paused'); 209 // #gh-230; if an animation is in progress then don't queue a new transition; it will 210 // happen naturally 211 if ( opts.slides.filter(':animated').length === 0 ) 212 opts.API.queueTransition( opts.API.getSlideOpts(), opts._remainingTimeout ); 213 opts.API.trigger('cycle-resumed', [ opts, opts._remainingTimeout ] ).log('cycle-resumed'); 214 } 215 }, 216 217 add: function( slides, prepend ) { 218 var opts = this.opts(); 219 var oldSlideCount = opts.slideCount; 220 var startSlideshow = false; 221 var len; 222 223 if ( $.type(slides) == 'string') 224 slides = $.trim( slides ); 225 226 $( slides ).each(function(i) { 227 var slideOpts; 228 var slide = $(this); 229 230 if ( prepend ) 231 opts.container.prepend( slide ); 232 else 233 opts.container.append( slide ); 234 235 opts.slideCount++; 236 slideOpts = opts.API.buildSlideOpts( slide ); 237 238 if ( prepend ) 239 opts.slides = $( slide ).add( opts.slides ); 240 else 241 opts.slides = opts.slides.add( slide ); 242 243 opts.API.initSlide( slideOpts, slide, --opts._maxZ ); 244 245 slide.data('cycle.opts', slideOpts); 246 opts.API.trigger('cycle-slide-added', [ opts, slideOpts, slide ]); 247 }); 248 249 opts.API.updateView( true ); 250 251 startSlideshow = opts._preInitialized && (oldSlideCount < 2 && opts.slideCount >= 1); 252 if ( startSlideshow ) { 253 if ( !opts._initialized ) 254 opts.API.initSlideshow(); 255 else if ( opts.timeout ) { 256 len = opts.slides.length; 257 opts.nextSlide = opts.reverse ? len - 1 : 1; 258 if ( !opts.timeoutId ) { 259 opts.API.queueTransition( opts ); 260 } 261 } 262 } 263 }, 264 265 calcFirstSlide: function() { 266 var opts = this.opts(); 267 var firstSlideIndex; 268 firstSlideIndex = parseInt( opts.startingSlide || 0, 10 ); 269 if (firstSlideIndex >= opts.slides.length || firstSlideIndex < 0) 270 firstSlideIndex = 0; 271 272 opts.currSlide = firstSlideIndex; 273 if ( opts.reverse ) { 274 opts.nextSlide = firstSlideIndex - 1; 275 if (opts.nextSlide < 0) 276 opts.nextSlide = opts.slides.length - 1; 277 } 278 else { 279 opts.nextSlide = firstSlideIndex + 1; 280 if (opts.nextSlide == opts.slides.length) 281 opts.nextSlide = 0; 282 } 283 }, 284 285 calcNextSlide: function() { 286 var opts = this.opts(); 287 var roll; 288 if ( opts.reverse ) { 289 roll = (opts.nextSlide - 1) < 0; 290 opts.nextSlide = roll ? opts.slideCount - 1 : opts.nextSlide-1; 291 opts.currSlide = roll ? 0 : opts.nextSlide+1; 292 } 293 else { 294 roll = (opts.nextSlide + 1) == opts.slides.length; 295 opts.nextSlide = roll ? 0 : opts.nextSlide+1; 296 opts.currSlide = roll ? opts.slides.length-1 : opts.nextSlide-1; 297 } 298 }, 299 300 calcTx: function( slideOpts, manual ) { 301 var opts = slideOpts; 302 var tx; 303 if ( manual && opts.manualFx ) 304 tx = $.fn.cycle.transitions[opts.manualFx]; 305 if ( !tx ) 306 tx = $.fn.cycle.transitions[opts.fx]; 307 308 if (!tx) { 309 tx = $.fn.cycle.transitions.fade; 310 opts.API.log('Transition "' + opts.fx + '" not found. Using fade.'); 311 } 312 return tx; 313 }, 314 315 prepareTx: function( manual, fwd ) { 316 var opts = this.opts(); 317 var after, curr, next, slideOpts, tx; 318 319 if ( opts.slideCount < 2 ) { 320 opts.timeoutId = 0; 321 return; 322 } 323 if ( manual && ( !opts.busy || opts.manualTrump ) ) { 324 opts.API.stopTransition(); 325 opts.busy = false; 326 clearTimeout(opts.timeoutId); 327 opts.timeoutId = 0; 328 } 329 if ( opts.busy ) 330 return; 331 if ( opts.timeoutId === 0 && !manual ) 332 return; 333 334 curr = opts.slides[opts.currSlide]; 335 next = opts.slides[opts.nextSlide];
336 slideOpts = opts.API.getSlideOpts( opts.nextSlide ); 337 tx = opts.API.calcTx( slideOpts, manual ); 338 339 opts._tx = tx; 340 341 if ( manual && slideOpts.manualSpeed !== undefined ) 342 slideOpts.speed = slideOpts.manualSpeed; 343 344 // if ( opts.nextSlide === opts.currSlide ) 345 // opts.API.calcNextSlide(); 346 347 // ensure that: 348 // 1. advancing to a different slide 349 // 2. this is either a manual event (prev/next, pager, cmd) or 350 // a timer event and slideshow is not paused 351 if ( opts.nextSlide != opts.currSlide && 352 (manual || (!opts.paused && !opts.hoverPaused && opts.timeout) )) { // #62 353 354 opts.API.trigger('cycle-before', [ slideOpts, curr, next, fwd ]); 355 if ( tx.before ) 356 tx.before( slideOpts, curr, next, fwd ); 357 358 after = function() { 359 opts.busy = false; 360 // #76; bail if slideshow has been destroyed 361 if (! opts.container.data( 'cycle.opts' ) ) 362 return; 363 364 if (tx.after) 365 tx.after( slideOpts, curr, next, fwd ); 366 opts.API.trigger('cycle-after', [ slideOpts, curr, next, fwd ]); 367 opts.API.queueTransition( slideOpts); 368 opts.API.updateView( true ); 369 }; 370 371 opts.busy = true; 372 if (tx.transition) 373 tx.transition(slideOpts, curr, next, fwd, after); 374 else 375 opts.API.doTransition( slideOpts, curr, next, fwd, after); 376 377 opts.API.calcNextSlide(); 378 opts.API.updateView(); 379 } else { 380 opts.API.queueTransition( slideOpts ); 381 } 382 }, 383 384 // perform the actual animation 385 doTransition: function( slideOpts, currEl, nextEl, fwd, callback) { 386 var opts = slideOpts; 387 var curr = $(currEl), next = $(nextEl); 388 var fn = function() { 389 // make sure animIn has something so that callback doesn't trigger immediately 390 next.animate(opts.animIn || { opacity: 1}, opts.speed, opts.easeIn || opts.easing, callback); 391 }; 392 393 next.css(opts.cssBefore || {}); 394 curr.animate(opts.animOut || {}, opts.speed, opts.easeOut || opts.easing, function() { 395 curr.css(opts.cssAfter || {}); 396 if (!opts.sync) { 397 fn(); 398 } 399 }); 400 if (opts.sync) { 401 fn(); 402 } 403 }, 404 405 queueTransition: function( slideOpts, specificTimeout ) { 406 var opts = this.opts(); 407 var timeout = specificTimeout !== undefined ? specificTimeout : slideOpts.timeout; 408 if (opts.nextSlide === 0 && --opts.loop === 0) { 409 opts.API.log('terminating; loop=0'); 410 opts.timeout = 0; 411 if ( timeout ) { 412 setTimeout(function() { 413 opts.API.trigger('cycle-finished', [ opts ]); 414 }, timeout); 415 } 416 else { 417 opts.API.trigger('cycle-finished', [ opts ]); 418 } 419 // reset nextSlide 420 opts.nextSlide = opts.currSlide; 421 return; 422 } 423 if ( timeout ) { 424 opts._lastQueue = $.now(); 425 if ( specificTimeout === undefined ) 426 opts._remainingTimeout = slideOpts.timeout; 427 428 if ( !opts.paused && ! opts.hoverPaused ) { 429 opts.timeoutId = setTimeout(function() { 430 opts.API.prepareTx( false, !opts.reverse ); 431 }, timeout ); 432 } 433 } 434 }, 435 436 stopTransition: function() { 437 var opts = this.opts(); 438 if ( opts.slides.filter(':animated').length ) { 439 opts.slides.stop(false, true); 440 opts.API.trigger('cycle-transition-stopped', [ opts ]); 441 } 442 443 if ( opts._tx && opts._tx.stopTransition ) 444 opts._tx.stopTransition( opts ); 445 }, 446 447 // advance slide forward or back 448 advanceSlide: function( val ) { 449 var opts = this.opts(); 450 clearTimeout(opts.timeoutId); 451 opts.timeoutId = 0; 452 opts.nextSlide = opts.currSlide + val; 453 454 if (opts.nextSlide < 0) 455 opts.nextSlide = opts.slides.length - 1; 456 else if (opts.nextSlide >= opts.slides.length) 457 opts.nextSlide = 0; 458 459 opts.API.prepareTx( true, val >= 0 ); 460 return false;
461 }, 462 463 buildSlideOpts: function( slide ) { 464 var opts = this.opts(); 465 var val, shortName; 466 var slideOpts = slide.data() || {}; 467 for (var p in slideOpts) { 468 // allow props to be accessed sans 'cycle' prefix and log the overrides 469 if (slideOpts.hasOwnProperty(p) && /^cycle[A-Z]+/.test(p) ) { 470 val = slideOpts[p]; 471 shortName = p.match(/^cycle(.*)/)[1].replace(/^[A-Z]/, lowerCase); 472 opts.API.log('['+(opts.slideCount-1)+']', shortName+':', val, '('+typeof val +')'); 473 slideOpts[shortName] = val; 474 } 475 } 476 477 slideOpts = $.extend( {}, $.fn.cycle.defaults, opts, slideOpts ); 478 slideOpts.slideNum = opts.slideCount; 479 480 try { 481 // these props should always be read from the master state object 482 delete slideOpts.API; 483 delete slideOpts.slideCount; 484 delete slideOpts.currSlide; 485 delete slideOpts.nextSlide; 486 delete slideOpts.slides; 487 } catch(e) { 488 // no op 489 } 490 return slideOpts; 491 }, 492 493 getSlideOpts: function( index ) { 494 var opts = this.opts(); 495 if ( index === undefined ) 496 index = opts.currSlide; 497 498 var slide = opts.slides[index]; 499 var slideOpts = $(slide).data('cycle.opts'); 500 return $.extend( {}, opts, slideOpts ); 501 }, 502 503 initSlide: function( slideOpts, slide, suggestedZindex ) { 504 var opts = this.opts(); 505 slide.css( slideOpts.slideCss || {} ); 506 if ( suggestedZindex > 0 ) 507 slide.css( 'zIndex', suggestedZindex ); 508 509 // ensure that speed settings are sane 510 if ( isNaN( slideOpts.speed ) ) 511 slideOpts.speed = $.fx.speeds[slideOpts.speed] || $.fx.speeds._default; 512 if ( !slideOpts.sync ) 513 slideOpts.speed = slideOpts.speed / 2; 514 515 slide.addClass( opts.slideClass ); 516 }, 517 518 updateView: function( isAfter, isDuring, forceEvent ) { 519 var opts = this.opts(); 520 if ( !opts._initialized ) 521 return; 522 var slideOpts = opts.API.getSlideOpts(); 523 var currSlide = opts.slides[ opts.currSlide ]; 524 525 if ( ! isAfter && isDuring !== true ) { 526 opts.API.trigger('cycle-update-view-before', [ opts, slideOpts, currSlide ]); 527 if ( opts.updateView < 0 ) 528 return; 529 } 530 531 if ( opts.slideActiveClass ) { 532 opts.slides.removeClass( opts.slideActiveClass ) 533 .eq( opts.currSlide ).addClass( opts.slideActiveClass ); 534 } 535 536 if ( isAfter && opts.hideNonActive ) 537 opts.slides.filter( ':not(.' + opts.slideActiveClass + ')' ).css('visibility', 'hidden'); 538 539 if ( opts.updateView === 0 ) { 540 setTimeout(function() { 541 opts.API.trigger('cycle-update-view', [ opts, slideOpts, currSlide, isAfter ]); 542 }, slideOpts.speed / (opts.sync ? 2 : 1) ); 543 } 544 545 if ( opts.updateView !== 0 ) 546 opts.API.trigger('cycle-update-view', [ opts, slideOpts, currSlide, isAfter ]); 547 548 if ( isAfter ) 549 opts.API.trigger('cycle-update-view-after', [ opts, slideOpts, currSlide ]); 550 }, 551 552 getComponent: function( name ) { 553 var opts = this.opts(); 554 var selector = opts[name]; 555 if (typeof selector === 'string') { 556 // if selector is a child, sibling combinator, adjancent selector then use find, otherwise query full dom 557 return (/^\s*[\>|\+|~]/).test( selector ) ? opts.container.find( selector ) : $( selector ); 558 } 559 if (selector.jquery) 560 return selector; 561 562 return $(selector); 563 }, 564 565 stackSlides: function( curr, next, fwd ) { 566 var opts = this.opts(); 567 if ( !curr ) { 568 curr = opts.slides[opts.currSlide]; 569 next = opts.slides[opts.nextSlide]; 570 fwd = !opts.reverse; 571 } 572 573 // reset the zIndex for the common case: 574 // curr slide on top, next slide beneath, and the rest in order to be shown 575 $(curr).css('zIndex', opts.maxZ); 576 577 var i; 578 var z = opts.maxZ - 2; 579 var len = opts.slideCount; 580 if (fwd) { 581 for ( i = opts.currSlide + 1; i < len; i++ ) 582 $( opts.slides[i] ).css( 'zIndex', z-- ); 583 for ( i = 0; i < opts.currSlide; i++ ) 584 $( opts.slides[i] ).css( 'zIndex', z-- ); 585 } 586 else { 587 for ( i = opts.currSlide - 1; i >= 0; i-- ) 588 $( opts.slides[i] ).css( 'zIndex', z-- ); 589 for ( i = len - 1; i > opts.currSlide; i-- ) 590 $( opts.slides[i] ).css( 'zIndex', z-- ); 591 } 592 593 $(next).css('zIndex', opts.maxZ - 1); 594 }, 595 596 getSlideIndex: function( el ) { 597 return this.opts().slides.index( el ); 598 } 599 600}; // API 601 602// default logger 603$.fn.cycle.log = function log() { 604 /*global console:true */ 605 //if (window.console && console.log) 606 // console.log('[cycle2] ' + Array.prototype.join.call(arguments, ' ') ); 607}; 608 609$.fn.cycle.version = function() { return 'Cycle2: ' + version; }; 610 611// helper functions 612 613function lowerCase(s) { 614 return (s || '').toLowerCase(); 615} 616 617// expose transition object 618$.fn.cycle.transitions = { 619 custom: { 620 }, 621 none: { 622 before: function( opts, curr, next, fwd ) { 623 opts.API.stackSlides( next, curr, fwd ); 624 opts.cssBefore = { opacity: 1, visibility: 'visible', display: 'block' }; 625 } 626 }, 627 fade: { 628 before: function( opts, curr, next, fwd ) {
629 var css = opts.API.getSlideOpts( opts.nextSlide ).slideCss || {}; 630 opts.API.stackSlides( curr, next, fwd ); 631 opts.cssBefore = $.extend(css, { opacity: 0, visibility: 'visible', display: 'block' }); 632 opts.animIn = { opacity: 1 }; 633 opts.animOut = { opacity: 0 }; 634 } 635 }, 636 fadeout: { 637 before: function( opts , curr, next, fwd ) { 638 var css = opts.API.getSlideOpts( opts.nextSlide ).slideCss || {}; 639 opts.API.stackSlides( curr, next, fwd ); 640 opts.cssBefore = $.extend(css, { opacity: 1, visibility: 'visible', display: 'block' }); 641 opts.animOut = { opacity: 0 }; 642 } 643 }, 644 scrollHorz: { 645 before: function( opts, curr, next, fwd ) { 646 opts.API.stackSlides( curr, next, fwd ); 647 var w = opts.container.css('overflow','hidden').width(); 648 opts.cssBefore = { left: fwd ? w : - w, top: 0, opacity: 1, visibility: 'visible', display: 'block' }; 649 opts.cssAfter = { zIndex: opts._maxZ - 2, left: 0 }; 650 opts.animIn = { left: 0 }; 651 opts.animOut = { left: fwd ? -w : w }; 652 } 653 } 654}; 655 656// @see: http://jquery.malsup.com/cycle2/api 657$.fn.cycle.defaults = { 658 allowWrap: true, 659 autoSelector: '.cycle-slideshow[data-cycle-auto-init!=false]', 660 delay: 0, 661 easing: null, 662 fx: 'fade', 663 hideNonActive: true, 664 loop: 0, 665 manualFx: undefined, 666 manualSpeed: undefined, 667 manualTrump: true, 668 maxZ: 100, 669 pauseOnHover: false, 670 reverse: false, 671 slideActiveClass: 'cycle-slide-active', 672 slideClass: 'cycle-slide', 673 slideCss: { position: 'absolute', top: 0, left: 0 }, 674 slides: '> img', 675 speed: 500, 676 startingSlide: 0, 677 sync: true, 678 timeout: 4000, 679 updateView: 0 680}; 681 682// automatically find and run slideshows 683$(document).ready(function() { 684 $( $.fn.cycle.defaults.autoSelector ).cycle(); 685}); 686 687})(jQuery); 688 689/*! Cycle2 autoheight plugin; Copyright (c) M.Alsup, 2012; version: 20130913 */ 690(function($) { 691"use strict"; 692 693$.extend($.fn.cycle.defaults, { 694 autoHeight: 0, // setting this option to false disables autoHeight logic 695 autoHeightSpeed: 250, 696 autoHeightEasing: null 697}); 698 699$(document).on( 'cycle-initialized', function( e, opts ) { 700 var autoHeight = opts.autoHeight; 701 var t = $.type( autoHeight ); 702 var resizeThrottle = null; 703 var ratio; 704 705 if ( t !== 'string' && t !== 'number' ) 706 return; 707 708 // bind events 709 opts.container.on( 'cycle-slide-added cycle-slide-removed', initAutoHeight ); 710 opts.container.on( 'cycle-destroyed', onDestroy ); 711 712 if ( autoHeight == 'container' ) { 713 opts.container.on( 'cycle-before', onBefore ); 714 } 715 else if ( t === 'string' && /\d+\:\d+/.test( autoHeight ) ) { 716 // use ratio 717 ratio = autoHeight.match(/(\d+)\:(\d+)/); 718 ratio = ratio[1] / ratio[2]; 719 opts._autoHeightRatio = ratio; 720 } 721 722 // if autoHeight is a number then we don't need to recalculate the sentinel 723 // index on resize 724 if ( t !== 'number' ) { 725 // bind unique resize handler per slideshow (so it can be 'off-ed' in onDestroy) 726 opts._autoHeightOnResize = function () { 727 clearTimeout( resizeThrottle ); 728 resizeThrottle = setTimeout( onResize, 50 ); 729 }; 730 731 $(window).on( 'resize orientationchange', opts._autoHeightOnResize ); 732 } 733 734 setTimeout( onResize, 30 ); 735 736 function onResize() { 737 initAutoHeight( e, opts ); 738 } 739}); 740 741function initAutoHeight( e, opts ) { 742 var clone, height, sentinelIndex; 743 var autoHeight = opts.autoHeight; 744 745 if ( autoHeight == 'container' ) { 746 height = $( opts.slides[ opts.currSlide ] ).outerHeight(); 747 opts.container.height( height ); 748 } 749 else if ( opts._autoHeightRatio ) { 750 opts.container.height( opts.container.width() / opts._autoHeightRatio ); 751 } 752 else if ( autoHeight === 'calc' || ( $.type( autoHeight ) == 'number' && autoHeight >= 0 ) ) { 753 if ( autoHeight === 'calc' ) 754 sentinelIndex = calcSentinelIndex( e, opts ); 755 else if ( autoHeight >= opts.slides.length ) 756 sentinelIndex = 0; 757 else 758 sentinelIndex = autoHeight; 759 760 // only recreate sentinel if index is different 761 if ( sentinelIndex == opts._sentinelIndex ) 762 return; 763 764 opts._sentinelIndex = sentinelIndex; 765 if ( opts._sentinel ) 766 opts._sentinel.remove(); 767 768 // clone existing slide as sentinel 769 clone = $( opts.slides[ sentinelIndex ].cloneNode(true) ); 770 771 // #50; remove special attributes from cloned content
772 clone.removeAttr( 'id name rel' ).find( '[id],[name],[rel]' ).removeAttr( 'id name rel' ); 773 774 clone.css({ 775 position: 'static', 776 visibility: 'hidden', 777 display: 'block' 778 }).prependTo( opts.container ).addClass('cycle-sentinel cycle-slide').removeClass('cycle-slide-active'); 779 clone.find( '*' ).css( 'visibility', 'hidden' ); 780 781 opts._sentinel = clone; 782 } 783} 784 785function calcSentinelIndex( e, opts ) { 786 var index = 0, max = -1; 787 788 // calculate tallest slide index 789 opts.slides.each(function(i) { 790 var h = $(this).height(); 791 if ( h > max ) { 792 max = h; 793 index = i; 794 } 795 }); 796 return index; 797} 798 799function onBefore( e, opts, outgoing, incoming, forward ) { 800 var h = $(incoming).outerHeight(); 801 opts.container.animate( { height: h }, opts.autoHeightSpeed, opts.autoHeightEasing ); 802} 803 804function onDestroy( e, opts ) { 805 if ( opts._autoHeightOnResize ) { 806 $(window).off( 'resize orientationchange', opts._autoHeightOnResize ); 807 opts._autoHeightOnResize = null; 808 } 809 opts.container.off( 'cycle-slide-added cycle-slide-removed', initAutoHeight ); 810 opts.container.off( 'cycle-destroyed', onDestroy ); 811 opts.container.off( 'cycle-before', onBefore ); 812 813 if ( opts._sentinel ) { 814 opts._sentinel.remove(); 815 opts._sentinel = null; 816 } 817} 818 819})(jQuery); 820 821/*! caption plugin for Cycle2; version: 20130306 */ 822(function($) { 823"use strict"; 824 825$.extend($.fn.cycle.defaults, { 826 caption: '> .cycle-caption', 827 captionTemplate: '{{slideNum}} / {{slideCount}}', 828 overlay: '> .cycle-overlay', 829 overlayTemplate: '<div>{{title}}</div><div>{{desc}}</div>', 830 captionModule: 'caption' 831}); 832 833$(document).on( 'cycle-update-view', function( e, opts, slideOpts, currSlide ) { 834 if ( opts.captionModule !== 'caption' ) 835 return; 836 var el; 837 $.each(['caption','overlay'], function() { 838 var name = this; 839 var template = slideOpts[name+'Template']; 840 var el = opts.API.getComponent( name ); 841 if( el.length && template ) { 842 el.html( opts.API.tmpl( template, slideOpts, opts, currSlide ) ); 843 el.show(); 844 } 845 else { 846 el.hide(); 847 } 848 }); 849}); 850 851$(document).on( 'cycle-destroyed', function( e, opts ) { 852 var el; 853 $.each(['caption','overlay'], function() { 854 var name = this, template = opts[name+'Template']; 855 if ( opts[name] && template ) { 856 el = opts.API.getComponent( 'caption' ); 857 el.empty(); 858 } 859 }); 860}); 861 862})(jQuery); 863 864/*! command plugin for Cycle2; version: 20130707 */ 865(function($) { 866"use strict"; 867 868var c2 = $.fn.cycle; 869 870$.fn.cycle = function( options ) { 871 var cmd, cmdFn, opts; 872 var args = $.makeArray( arguments ); 873 874 if ( $.type( options ) == 'number' ) { 875 return this.cycle( 'goto', options ); 876 } 877 878 if ( $.type( options ) == 'string' ) { 879 return this.each(function() { 880 var cmdArgs; 881 cmd = options; 882 opts = $(this).data('cycle.opts'); 883 884 if ( opts === undefined ) { 885 c2.log('slideshow must be initialized before sending commands; "' + cmd + '" ignored'); 886 return; 887 } 888 else { 889 cmd = cmd == 'goto' ? 'jump' : cmd; // issue #3; change 'goto' to 'jump' internally 890 cmdFn = opts.API[ cmd ]; 891 if ( $.isFunction( cmdFn )) { 892 cmdArgs = $.makeArray( args ); 893 cmdArgs.shift(); 894 return cmdFn.apply( opts.API, cmdArgs ); 895 } 896 else { 897 c2.log( 'unknown command: ', cmd ); 898 } 899 } 900 }); 901 } 902 else { 903 return c2.apply( this, arguments ); 904 } 905}; 906 907// copy props 908$.extend( $.fn.cycle, c2 ); 909 910$.extend( c2.API, { 911 next: function() { 912 var opts = this.opts(); 913 if ( opts.busy && ! opts.manualTrump ) 914 return; 915 916 var count = opts.reverse ? -1 : 1; 917 if ( opts.allowWrap === false && ( opts.currSlide + count ) >= opts.slideCount ) 918 return; 919 920 opts.API.advanceSlide( count );
921 opts.API.trigger('cycle-next', [ opts ]).log('cycle-next'); 922 }, 923 924 prev: function() { 925 var opts = this.opts(); 926 if ( opts.busy && ! opts.manualTrump ) 927 return; 928 var count = opts.reverse ? 1 : -1; 929 if ( opts.allowWrap === false && ( opts.currSlide + count ) < 0 ) 930 return; 931 932 opts.API.advanceSlide( count ); 933 opts.API.trigger('cycle-prev', [ opts ]).log('cycle-prev'); 934 }, 935 936 destroy: function() { 937 this.stop(); //#204 938 939 var opts = this.opts(); 940 var clean = $.isFunction( $._data ) ? $._data : $.noop; // hack for #184 and #201 941 clearTimeout(opts.timeoutId); 942 opts.timeoutId = 0; 943 opts.API.stop(); 944 opts.API.trigger( 'cycle-destroyed', [ opts ] ).log('cycle-destroyed'); 945 opts.container.removeData(); 946 clean( opts.container[0], 'parsedAttrs', false ); 947 948 // #75; remove inline styles 949 if ( ! opts.retainStylesOnDestroy ) { 950 opts.container.removeAttr( 'style' ); 951 opts.slides.removeAttr( 'style' ); 952 opts.slides.removeClass( opts.slideActiveClass ); 953 } 954 opts.slides.each(function() { 955 $(this).removeData(); 956 clean( this, 'parsedAttrs', false ); 957 }); 958 }, 959 960 jump: function( index ) { 961 // go to the requested slide 962 var fwd; 963 var opts = this.opts(); 964 if ( opts.busy && ! opts.manualTrump ) 965 return; 966 var num = parseInt( index, 10 ); 967 if (isNaN(num) || num < 0 || num >= opts.slides.length) { 968 opts.API.log('goto: invalid slide index: ' + num); 969 return; 970 } 971 if (num == opts.currSlide) { 972 opts.API.log('goto: skipping, already on slide', num); 973 return; 974 } 975 opts.nextSlide = num; 976 clearTimeout(opts.timeoutId); 977 opts.timeoutId = 0; 978 opts.API.log('goto: ', num, ' (zero-index)'); 979 fwd = opts.currSlide < opts.nextSlide; 980 opts.API.prepareTx( true, fwd ); 981 }, 982 983 stop: function() { 984 var opts = this.opts(); 985 var pauseObj = opts.container; 986 clearTimeout(opts.timeoutId); 987 opts.timeoutId = 0; 988 opts.API.stopTransition(); 989 if ( opts.pauseOnHover ) { 990 if ( opts.pauseOnHover !== true ) 991 pauseObj = $( opts.pauseOnHover ); 992 pauseObj.off('mouseenter mouseleave'); 993 } 994 opts.API.trigger('cycle-stopped', [ opts ]).log('cycle-stopped'); 995 }, 996 997 reinit: function() { 998 var opts = this.opts(); 999 opts.API.destroy(); 1000 opts.container.cycle(); 1001 }, 1002 1003 remove: function( index ) { 1004 var opts = this.opts(); 1005 var slide, slideToRemove, slides = [], slideNum = 1; 1006 for ( var i=0; i < opts.slides.length; i++ ) { 1007 slide = opts.slides[i]; 1008 if ( i == index ) { 1009 slideToRemove = slide; 1010 } 1011 else { 1012 slides.push( slide ); 1013 $( slide ).data('cycle.opts').slideNum = slideNum; 1014 slideNum++; 1015 } 1016 } 1017 if ( slideToRemove ) { 1018 opts.slides = $( slides ); 1019 opts.slideCount--; 1020 $( slideToRemove ).remove(); 1021 if (index == opts.currSlide) 1022 opts.API.advanceSlide( 1 ); 1023 else if ( index < opts.currSlide ) 1024 opts.currSlide--; 1025 else 1026 opts.currSlide++; 1027 1028 opts.API.trigger('cycle-slide-removed', [ opts, index, slideToRemove ]).log('cycle-slide-removed'); 1029 opts.API.updateView(); 1030 } 1031 } 1032 1033}); 1034 1035// listen for clicks on elements with data-cycle-cmd attribute 1036$(document).on('click.cycle', '[data-cycle-cmd]', function(e) { 1037 // issue cycle command 1038 e.preventDefault(); 1039 var el = $(this); 1040 var command = el.data('cycle-cmd'); 1041 var context = el.data('cycle-context') || '.cycle-slideshow'; 1042 $(context).cycle(command, el.data('cycle-arg')); 1043}); 1044 1045 1046})(jQuery); 1047 1048/*! hash plugin for Cycle2; version: 20130905 */ 1049(function($) { 1050"use strict"; 1051 1052$(document).on( 'cycle-pre-initialize', function( e, opts ) { 1053 onHashChange( opts, true ); 1054 1055 opts._onHashChange = function() { 1056 onHashChange( opts, false ); 1057 }; 1058
1059 $( window ).on( 'hashchange', opts._onHashChange); 1060}); 1061 1062$(document).on( 'cycle-update-view', function( e, opts, slideOpts ) { 1063 if ( slideOpts.hash && ( '#' + slideOpts.hash ) != window.location.hash ) { 1064 opts._hashFence = true; 1065 window.location.hash = slideOpts.hash; 1066 } 1067}); 1068 1069$(document).on( 'cycle-destroyed', function( e, opts) { 1070 if ( opts._onHashChange ) { 1071 $( window ).off( 'hashchange', opts._onHashChange ); 1072 } 1073}); 1074 1075function onHashChange( opts, setStartingSlide ) { 1076 var hash; 1077 if ( opts._hashFence ) { 1078 opts._hashFence = false; 1079 return; 1080 } 1081 1082 hash = window.location.hash.substring(1); 1083 1084 opts.slides.each(function(i) { 1085 if ( $(this).data( 'cycle-hash' ) == hash ) { 1086 if ( setStartingSlide === true ) { 1087 opts.startingSlide = i; 1088 } 1089 else { 1090 var fwd = opts.currSlide < i; 1091 opts.nextSlide = i; 1092 opts.API.prepareTx( true, fwd ); 1093 } 1094 return false; 1095 } 1096 }); 1097} 1098 1099})(jQuery); 1100 1101/*! loader plugin for Cycle2; version: 20131121 */ 1102(function($) { 1103"use strict"; 1104 1105$.extend($.fn.cycle.defaults, { 1106 loader: false 1107}); 1108 1109$(document).on( 'cycle-bootstrap', function( e, opts ) { 1110 var addFn; 1111 1112 if ( !opts.loader ) 1113 return; 1114 1115 // override API.add for this slideshow 1116 addFn = opts.API.add; 1117 opts.API.add = add; 1118 1119 function add( slides, prepend ) { 1120 var slideArr = []; 1121 if ( $.type( slides ) == 'string' ) 1122 slides = $.trim( slides ); 1123 else if ( $.type( slides) === 'array' ) { 1124 for (var i=0; i < slides.length; i++ ) 1125 slides[i] = $(slides[i])[0]; 1126 } 1127 1128 slides = $( slides ); 1129 var slideCount = slides.length; 1130 1131 if ( ! slideCount ) 1132 return; 1133 1134 slides.css('visibility','hidden').appendTo('body').each(function(i) { // appendTo fixes #56 1135 var count = 0; 1136 var slide = $(this); 1137 var images = slide.is('img') ? slide : slide.find('img'); 1138 slide.data('index', i); 1139 // allow some images to be marked as unimportant (and filter out images w/o src value) 1140 images = images.filter(':not(.cycle-loader-ignore)').filter(':not([src=""])'); 1141 if ( ! images.length ) { 1142 --slideCount; 1143 slideArr.push( slide ); 1144 return; 1145 } 1146 1147 count = images.length; 1148 images.each(function() { 1149 // add images that are already loaded 1150 if ( this.complete ) { 1151 imageLoaded(); 1152 } 1153 else { 1154 $(this).load(function() { 1155 imageLoaded(); 1156 }).on("error", function() { 1157 if ( --count === 0 ) { 1158 // ignore this slide 1159 opts.API.log('slide skipped; img not loaded:', this.src); 1160 if ( --slideCount === 0 && opts.loader == 'wait') { 1161 addFn.apply( opts.API, [ slideArr, prepend ] ); 1162 } 1163 } 1164 }); 1165 } 1166 }); 1167 1168 function imageLoaded() { 1169 if ( --count === 0 ) { 1170 --slideCount; 1171 addSlide( slide ); 1172 } 1173 } 1174 }); 1175 1176 if ( slideCount ) 1177 opts.container.addClass('cycle-loading'); 1178 1179 1180 function addSlide( slide ) { 1181 var curr; 1182 if ( opts.loader == 'wait' ) { 1183 slideArr.push( slide ); 1184 if ( slideCount === 0 ) { 1185 // #59; sort slides into original markup order 1186 slideArr.sort( sorter ); 1187 addFn.apply( opts.API, [ slideArr, prepend ] ); 1188 opts.container.removeClass('cycle-loading'); 1189 } 1190 } 1191 else { 1192 curr = $(opts.slides[opts.currSlide]); 1193 addFn.apply( opts.API, [ slide, prepend ] ); 1194 curr.show(); 1195 opts.container.removeClass('cycle-loading'); 1196 } 1197 } 1198 1199 function sorter(a, b) { 1200 return a.data('index') - b.data('index'); 1201 } 1202 } 1203}); 1204 1205})(jQuery); 1206 1207/*! pager plugin for Cycle2; version: 20130525 */ 1208(function($) { 1209"use strict"; 1210 1211$.extend($.fn.cycle.defaults, { 1212 pager: '> .cycle-pager', 1213 pagerActiveClass: 'cycle-pager-active', 1214 pagerEvent: 'click.cycle', 1215 pagerTemplate: '<span>•</span>' 1216}); 1217 1218$(document).on( 'cycle-bootstrap', function( e, opts, API ) { 1219 // add method to API 1220 API.buildPagerLink = buildPagerLink; 1221}); 1222 1223$(document).on( 'cycle-slide-added', function( e, opts, slideOpts, slideAdded ) { 1224 if ( opts.pager ) { 1225 opts.API.buildPagerLink ( opts, slideOpts, slideAdded ); 1226 opts.API.page = page; 1227 } 1228}); 1229 1230$(document).on( 'cycle-slide-removed', function( e, opts, index, slideRemoved ) { 1231 if ( opts.pager ) { 1232 var pagers = opts.API.getComponent( 'pager' ); 1233 pagers.each(function() { 1234 var pager = $(this); 1235 $( pager.children()[index] ).remove(); 1236 }); 1237 } 1238}); 1239 1240$(document).on( 'cycle-update-view', function( e, opts, slideOpts ) { 1241 var pagers; 1242 1243 if ( opts.pager ) { 1244 pagers = opts.API.getComponent( 'pager' ); 1245 pagers.each(function() { 1246 $(this).children().removeClass( opts.pagerActiveClass )
1247 .eq( opts.currSlide ).addClass( opts.pagerActiveClass ); 1248 }); 1249 } 1250}); 1251 1252$(document).on( 'cycle-destroyed', function( e, opts ) { 1253 var pager = opts.API.getComponent( 'pager' ); 1254 1255 if ( pager ) { 1256 pager.children().off( opts.pagerEvent ); // #202 1257 if ( opts.pagerTemplate ) 1258 pager.empty(); 1259 } 1260}); 1261 1262function buildPagerLink( opts, slideOpts, slide ) { 1263 var pagerLink; 1264 var pagers = opts.API.getComponent( 'pager' ); 1265 pagers.each(function() { 1266 var pager = $(this); 1267 if ( slideOpts.pagerTemplate ) { 1268 var markup = opts.API.tmpl( slideOpts.pagerTemplate, slideOpts, opts, slide[0] ); 1269 pagerLink = $( markup ).appendTo( pager ); 1270 } 1271 else { 1272 pagerLink = pager.children().eq( opts.slideCount - 1 ); 1273 } 1274 pagerLink.on( opts.pagerEvent, function(e) { 1275 e.preventDefault(); 1276 opts.API.page( pager, e.currentTarget); 1277 }); 1278 }); 1279} 1280 1281function page( pager, target ) { 1282 /*jshint validthis:true */ 1283 var opts = this.opts(); 1284 if ( opts.busy && ! opts.manualTrump ) 1285 return; 1286 1287 var index = pager.children().index( target ); 1288 var nextSlide = index; 1289 var fwd = opts.currSlide < nextSlide; 1290 if (opts.currSlide == nextSlide) { 1291 return; // no op, clicked pager for the currently displayed slide 1292 } 1293 opts.nextSlide = nextSlide; 1294 opts.API.prepareTx( true, fwd ); 1295 opts.API.trigger('cycle-pager-activated', [opts, pager, target ]); 1296} 1297 1298})(jQuery); 1299 1300 1301/*! prevnext plugin for Cycle2; version: 20130709 */ 1302(function($) { 1303"use strict"; 1304 1305$.extend($.fn.cycle.defaults, { 1306 next: '> .cycle-next', 1307 nextEvent: 'click.cycle', 1308 disabledClass: 'disabled', 1309 prev: '> .cycle-prev', 1310 prevEvent: 'click.cycle', 1311 swipe: false 1312}); 1313 1314$(document).on( 'cycle-initialized', function( e, opts ) { 1315 opts.API.getComponent( 'next' ).on( opts.nextEvent, function(e) { 1316 e.preventDefault(); 1317 opts.API.next(); 1318 }); 1319 1320 opts.API.getComponent( 'prev' ).on( opts.prevEvent, function(e) { 1321 e.preventDefault(); 1322 opts.API.prev(); 1323 }); 1324 1325 if ( opts.swipe ) { 1326 var nextEvent = opts.swipeVert ? 'swipeUp.cycle' : 'swipeLeft.cycle swipeleft.cycle'; 1327 var prevEvent = opts.swipeVert ? 'swipeDown.cycle' : 'swipeRight.cycle swiperight.cycle'; 1328 opts.container.on( nextEvent, function(e) { 1329 opts.API.next(); 1330 }); 1331 opts.container.on( prevEvent, function() { 1332 opts.API.prev(); 1333 }); 1334 } 1335}); 1336 1337$(document).on( 'cycle-update-view', function( e, opts, slideOpts, currSlide ) { 1338 if ( opts.allowWrap ) 1339 return; 1340 1341 var cls = opts.disabledClass; 1342 var next = opts.API.getComponent( 'next' ); 1343 var prev = opts.API.getComponent( 'prev' ); 1344 var prevBoundry = opts._prevBoundry || 0; 1345 var nextBoundry = (opts._nextBoundry !== undefined)?opts._nextBoundry:opts.slideCount - 1; 1346 1347 if ( opts.currSlide == nextBoundry ) 1348 next.addClass( cls ).prop( 'disabled', true ); 1349 else 1350 next.removeClass( cls ).prop( 'disabled', false ); 1351 1352 if ( opts.currSlide === prevBoundry ) 1353 prev.addClass( cls ).prop( 'disabled', true ); 1354 else 1355 prev.removeClass( cls ).prop( 'disabled', false ); 1356}); 1357 1358 1359$(document).on( 'cycle-destroyed', function( e, opts ) { 1360 opts.API.getComponent( 'prev' ).off( opts.nextEvent ); 1361 opts.API.getComponent( 'next' ).off( opts.prevEvent ); 1362 opts.container.off( 'swipeleft.cycle swiperight.cycle swipeLeft.cycle swipeRight.cycle swipeUp.cycle swipeDown.cycle' ); 1363}); 1364 1365})(jQuery); 1366 1367/*! progressive loader plugin for Cycle2; version: 20130315 */ 1368(function($) { 1369"use strict"; 1370 1371$.extend($.fn.cycle.defaults, { 1372 progressive: false 1373}); 1374 1375$(document).on( 'cycle-pre-initialize', function( e, opts ) { 1376 if ( !opts.progressive ) 1377 return; 1378 1379 var API = opts.API; 1380 var nextFn = API.next; 1381 var prevFn = API.prev; 1382 var prepareTxFn = API.prepareTx; 1383 var type = $.type( opts.progressive ); 1384 var slides, scriptEl; 1385 1386 if ( type == 'array' ) { 1387 slides = opts.progressive; 1388 } 1389 else if ($.isFunction( opts.progressive ) ) { 1390 slides = opts.progressive( opts ); 1391 } 1392 else if ( type == 'string' ) { 1393 scriptEl = $( opts.progressive ); 1394 slides = $.trim( scriptEl.html() ); 1395 if ( !slides ) 1396 return; 1397 // is it json array? 1398 if ( /^(\[)/.test( slides ) ) { 1399 try { 1400 slides = $.parseJSON( slides ); 1401 } 1402 catch(err) { 1403 API.log( 'error parsing progressive slides', err ); 1404 return; 1405 } 1406 } 1407 else { 1408 // plain text, split on delimeter 1409 slides = slides.split( new RegExp( scriptEl.data('cycle-split') || '\n') ); 1410 1411 // #95; look for empty slide 1412 if ( ! slides[ slides.length - 1 ] ) 1413 slides.pop(); 1414 } 1415 } 1416 1417 1418 1419 if ( prepareTxFn ) { 1420 API.prepareTx = function( manual, fwd ) { 1421 var index, slide; 1422 1423 if ( manual || slides.length === 0 ) { 1424 prepareTxFn.apply( opts.API, [ manual, fwd ] ); 1425 return; 1426 } 1427 1428 if ( fwd && opts.currSlide == ( opts.slideCount-1) ) { 1429 slide = slides[ 0 ]; 1430 slides = slides.slice( 1 ); 1431 opts.container.one('cycle-slide-added', function(e, opts ) { 1432 setTimeout(function() { 1433 opts.API.advanceSlide( 1 ); 1434 },50); 1435 }); 1436 opts.API.add( slide ); 1437 } 1438 else if ( !fwd && opts.currSlide === 0 ) { 1439 index = slides.length-1; 1440 slide = slides[ index ]; 1441 slides = slides.slice( 0, index ); 1442 opts.container.one('cycle-slide-added', function(e, opts ) { 1443 setTimeout(function() { 1444 opts.currSlide = 1; 1445 opts.API.advanceSlide( -1 ); 1446 },50); 1447 }); 1448 opts.API.add( slide, true ); 1449 } 1450 else { 1451 prepareTxFn.apply( opts.API, [ manual, fwd ] ); 1452 } 1453 }; 1454 } 1455 1456 if ( nextFn ) { 1457 API.next = function() { 1458 var opts = this.opts(); 1459 if ( slides.length && opts.currSlide == ( opts.slideCount - 1 ) ) { 1460 var slide = slides[ 0 ]; 1461 slides = slides.slice( 1 ); 1462 opts.container.one('cycle-slide-added', function(e, opts ) { 1463 nextFn.apply( opts.API ); 1464 opts.container.removeClass('cycle-loading'); 1465 }); 1466 opts.container.addClass('cycle-loading'); 1467 opts.API.add( slide ); 1468 } 1469 else { 1470 nextFn.apply( opts.API ); 1471 } 1472 }; 1473 } 1474 1475 if ( prevFn ) { 1476 API.prev = function() { 1477 var opts = this.opts(); 1478 if ( slides.length && opts.currSlide === 0 ) { 1479 var index = slides.length-1; 1480 var slide = slides[ index ]; 1481 slides = slides.slice( 0, index ); 1482 opts.container.one('cycle-slide-added', function(e, opts ) { 1483 opts.currSlide = 1; 1484 opts.API.advanceSlide( -1 ); 1485 opts.container.removeClass('cycle-loading'); 1486 }); 1487 opts.container.addClass('cycle-loading'); 1488 opts.API.add( slide, true ); 1489 } 1490 else { 1491 prevFn.apply( opts.API ); 1492 } 1493 }; 1494 } 1495}); 1496 1497})(jQuery); 1498 1499/*! tmpl plugin for Cycle2; version: 20121227 */ 1500(function($) { 1501"use strict"; 1502 1503$.extend($.fn.cycle.defaults, { 1504 tmplRegex: '{{((.)?.*?)}}' 1505}); 1506 1507$.extend($.fn.cycle.API, { 1508 tmpl: function( str, opts /*, ... */) { 1509 var regex = new RegExp( opts.tmplRegex || $.fn.cycle.defaults.tmplRegex, 'g' ); 1510 var args = $.makeArray( arguments ); 1511 args.shift(); 1512 return str.replace(regex, function(_, str) { 1513 var i, j, obj, prop, names = str.split('.'); 1514 for (i=0; i < args.length; i++) { 1515 obj = args[i]; 1516 if ( ! obj ) 1517 continue; 1518 if (names.length > 1) { 1519 prop = obj; 1520 for (j=0; j < names.length; j++) { 1521 obj = prop; 1522 prop = prop[ names[j] ] || str; 1523 } 1524 } else { 1525 prop = obj[str]; 1526 } 1527 1528 if ($.isFunction(prop)) 1529 return prop.apply(obj, args); 1530 if (prop !== undefined && prop !== null && prop != str) 1531 return prop; 1532 } 1533 return str; 1534 }); 1535 } 1536}); 1537 1538})(jQuery); 1539 1540 1541/* - ++resource++brasil.gov.tiles/jquery.cycle2.carousel.js - */ 1542/*! carousel transition plugin for Cycle2; version: 20130528 */ 1543(function($) { 1544"use strict"; 1545 1546$( document ).on('cycle-bootstrap', function( e, opts, API ) { 1547 if ( opts.fx !== 'carousel' ) 1548 return; 1549
1550 API.getSlideIndex = function( el ) { 1551 var slides = this.opts()._carouselWrap.children(); 1552 var i = slides.index( el ); 1553 return i % slides.length; 1554 }; 1555 1556 // override default 'next' function 1557 API.next = function() { 1558 var count = opts.reverse ? -1 : 1; 1559 if ( opts.allowWrap === false && ( opts.currSlide + count ) > opts.slideCount - opts.carouselVisible ) 1560 return; 1561 opts.API.advanceSlide( count ); 1562 opts.API.trigger('cycle-next', [ opts ]).log('cycle-next'); 1563 }; 1564 1565}); 1566 1567 1568$.fn.cycle.transitions.carousel = { 1569 // transition API impl 1570 preInit: function( opts ) { 1571 opts.hideNonActive = false; 1572 1573 opts.container.on('cycle-destroyed', $.proxy(this.onDestroy, opts.API)); 1574 // override default API implementation 1575 opts.API.stopTransition = this.stopTransition; 1576 1577 // issue #10 1578 for (var i=0; i < opts.startingSlide; i++) { 1579 opts.container.append( opts.slides[0] ); 1580 } 1581 }, 1582 1583 // transition API impl 1584 postInit: function( opts ) { 1585 var i, j, slide, pagerCutoffIndex, wrap; 1586 var vert = opts.carouselVertical; 1587 if (opts.carouselVisible && opts.carouselVisible > opts.slideCount) 1588 opts.carouselVisible = opts.slideCount - 1; 1589 var visCount = opts.carouselVisible || opts.slides.length; 1590 var slideCSS = { display: vert ? 'block' : 'inline-block', position: 'static' }; 1591 1592 // required styles 1593 opts.container.css({ position: 'relative', overflow: 'hidden' }); 1594 opts.slides.css( slideCSS ); 1595 1596 opts._currSlide = opts.currSlide; 1597 1598 // wrap slides in a div; this div is what is animated 1599 wrap = $('<div class="cycle-carousel-wrap"></div>') 1600 .prependTo( opts.container ) 1601 .css({ margin: 0, padding: 0, top: 0, left: 0, position: 'absolute' }) 1602 .append( opts.slides ); 1603 1604 opts._carouselWrap = wrap; 1605 1606 if ( !vert ) 1607 wrap.css('white-space', 'nowrap'); 1608 1609 if ( opts.allowWrap !== false ) { 1610 // prepend and append extra slides so we don't see any empty space when we 1611 // near the end of the carousel. for fluid containers, add even more clones 1612 // so there is plenty to fill the screen 1613 // @todo: optimzie this based on slide sizes 1614 1615 for ( j=0; j < (opts.carouselVisible === undefined ? 2 : 1); j++ ) { 1616 for ( i=0; i < opts.slideCount; i++ ) { 1617 wrap.append( opts.slides[i].cloneNode(true) ); 1618 } 1619 i = opts.slideCount; 1620 while ( i-- ) { // #160, #209 1621 wrap.prepend( opts.slides[i].cloneNode(true) ); 1622 } 1623 } 1624 1625 wrap.find('.cycle-slide-active').removeClass('cycle-slide-active'); 1626 opts.slides.eq(opts.startingSlide).addClass('cycle-slide-active'); 1627 } 1628 1629 if ( opts.pager && opts.allowWrap === false ) { 1630 // hide "extra" pagers 1631 pagerCutoffIndex = opts.slideCount - visCount; 1632 $( opts.pager ).children().filter( ':gt('+pagerCutoffIndex+')' ).hide(); 1633 } 1634 1635 opts._nextBoundry = opts.slideCount - opts.carouselVisible; 1636 1637 this.prepareDimensions( opts ); 1638 }, 1639 1640 prepareDimensions: function( opts ) { 1641 var dim, offset, pagerCutoffIndex, tmp; 1642 var vert = opts.carouselVertical; 1643 var visCount = opts.carouselVisible || opts.slides.length; 1644 1645 if ( opts.carouselFluid && opts.carouselVisible ) { 1646 if ( ! opts._carouselResizeThrottle ) { 1647 // fluid container AND fluid slides; slides need to be resized to fit container 1648 this.fluidSlides( opts ); 1649 } 1650 } 1651 else if ( opts.carouselVisible && opts.carouselSlideDimension ) { 1652 dim = visCount * opts.carouselSlideDimension; 1653 opts.container[ vert ? 'height' : 'width' ]( dim ); 1654 } 1655 else if ( opts.carouselVisible ) { 1656 dim = visCount * $(opts.slides[0])[vert ? 'outerHeight' : 'outerWidth'](true); 1657 opts.container[ vert ? 'height' : 'width' ]( dim ); 1658 } 1659 // else { 1660 // // fluid; don't size the container 1661 // } 1662
1663 offset = ( opts.carouselOffset || 0 ); 1664 if ( opts.allowWrap !== false ) { 1665 if ( opts.carouselSlideDimension ) { 1666 offset -= ( (opts.slideCount + opts.currSlide) * opts.carouselSlideDimension ); 1667 } 1668 else { 1669 // calculate offset based on actual slide dimensions 1670 tmp = opts._carouselWrap.children(); 1671 for (var j=0; j < (opts.slideCount + opts.currSlide); j++) { 1672 offset -= $(tmp[j])[vert?'outerHeight':'outerWidth'](true); 1673 } 1674 } 1675 } 1676 1677 opts._carouselWrap.css( vert ? 'top' : 'left', offset ); 1678 }, 1679 1680 fluidSlides: function( opts ) { 1681 var timeout; 1682 var slide = opts.slides.eq(0); 1683 var adjustment = slide.outerWidth() - slide.width(); 1684 var prepareDimensions = this.prepareDimensions; 1685 1686 // throttle resize event 1687 $(window).on( 'resize', resizeThrottle); 1688 1689 opts._carouselResizeThrottle = resizeThrottle; 1690 onResize(); 1691 1692 function resizeThrottle() { 1693 clearTimeout( timeout ); 1694 timeout = setTimeout( onResize, 20 ); 1695 } 1696 1697 function onResize() { 1698 opts._carouselWrap.stop( false, true ); 1699 var slideWidth = opts.container.width() / opts.carouselVisible; 1700 slideWidth = Math.ceil( slideWidth - adjustment ); 1701 opts._carouselWrap.children().width( slideWidth ); 1702 if ( opts._sentinel ) 1703 opts._sentinel.width( slideWidth ); 1704 prepareDimensions( opts ); 1705 } 1706 }, 1707 1708 // transition API impl 1709 transition: function( opts, curr, next, fwd, callback ) { 1710 var moveBy, props = {}; 1711 var hops = opts.nextSlide - opts.currSlide; 1712 var vert = opts.carouselVertical; 1713 var speed = opts.speed; 1714 1715 // handle all the edge cases for wrapping & non-wrapping 1716 if ( opts.allowWrap === false ) { 1717 fwd = hops > 0; 1718 var currSlide = opts._currSlide; 1719 var maxCurr = opts.slideCount - opts.carouselVisible; 1720 if ( hops > 0 && opts.nextSlide > maxCurr && currSlide == maxCurr ) { 1721 hops = 0; 1722 } 1723 else if ( hops > 0 && opts.nextSlide > maxCurr ) { 1724 hops = opts.nextSlide - currSlide - (opts.nextSlide - maxCurr); 1725 } 1726 else if ( hops < 0 && opts.currSlide > maxCurr && opts.nextSlide > maxCurr ) { 1727 hops = 0; 1728 } 1729 else if ( hops < 0 && opts.currSlide > maxCurr ) { 1730 hops += opts.currSlide - maxCurr; 1731 } 1732 else 1733 currSlide = opts.currSlide; 1734 1735 moveBy = this.getScroll( opts, vert, currSlide, hops ); 1736 opts.API.opts()._currSlide = opts.nextSlide > maxCurr ? maxCurr : opts.nextSlide; 1737 } 1738 else { 1739 if ( fwd && opts.nextSlide === 0 ) { 1740 // moving from last slide to first 1741 moveBy = this.getDim( opts, opts.currSlide, vert ); 1742 callback = this.genCallback( opts, fwd, vert, callback ); 1743 } 1744 else if ( !fwd && opts.nextSlide == opts.slideCount - 1 ) { 1745 // moving from first slide to last 1746 moveBy = this.getDim( opts, opts.currSlide, vert ); 1747 callback = this.genCallback( opts, fwd, vert, callback ); 1748 } 1749 else { 1750 moveBy = this.getScroll( opts, vert, opts.currSlide, hops ); 1751 } 1752 } 1753 1754 props[ vert ? 'top' : 'left' ] = fwd ? ( "-=" + moveBy ) : ( "+=" + moveBy ); 1755 1756 // throttleSpeed means to scroll slides at a constant rate, rather than 1757 // a constant speed 1758 if ( opts.throttleSpeed ) 1759 speed = (moveBy / $(opts.slides[0])[vert ? 'height' : 'width']() ) * opts.speed; 1760 1761 opts._carouselWrap.animate( props, speed, opts.easing, callback ); 1762 }, 1763 1764 getDim: function( opts, index, vert ) { 1765 var slide = $( opts.slides[index] ); 1766 return slide[ vert ? 'outerHeight' : 'outerWidth'](true); 1767 }, 1768 1769 getScroll: function( opts, vert, currSlide, hops ) { 1770 var i, moveBy = 0; 1771 1772 if (hops > 0) { 1773 for (i=currSlide; i < currSlide+hops; i++) 1774 moveBy += this.getDim( opts, i, vert); 1775 } 1776 else { 1777 for (i=currSlide; i > currSlide+hops; i--) 1778 moveBy += this.getDim( opts, i, vert); 1779 } 1780 return moveBy; 1781 }, 1782 1783 genCallback: function( opts, fwd, vert, callback ) { 1784 // returns callback fn that resets the left/top wrap position to the "real" slides 1785 return function() { 1786 var pos = $(opts.slides[opts.nextSlide]).position(); 1787 var offset = 0 - pos[vert?'top':'left'] + (opts.carouselOff
1787set || 0); 1788 opts._carouselWrap.css( opts.carouselVertical ? 'top' : 'left', offset ); 1789 callback(); 1790 }; 1791 }, 1792 1793 // core API override 1794 stopTransition: function() { 1795 var opts = this.opts(); 1796 opts.slides.stop( false, true ); 1797 opts._carouselWrap.stop( false, true ); 1798 }, 1799 1800 // core API supplement 1801 onDestroy: function( e ) { 1802 var opts = this.opts(); 1803 if ( opts._carouselResizeThrottle ) 1804 $( window ).off( 'resize', opts._carouselResizeThrottle ); 1805 opts.slides.prependTo( opts.container ); 1806 opts._carouselWrap.remove(); 1807 } 1808}; 1809 1810})(jQuery); 1811 1812 1813/* - ++resource++brasil.gov.tiles/tiles.js - */ 1814/* 1815 Comentario 1816*/ 1817$(function() { 1818 var root = typeof exports !== "undefined" && exports !== null ? exports : this; 1819 1820 //video gallery 1821 if ($('.videogallery-tile')[0] !== undefined) { 1822 var videoResponsiveResize; 1823 1824 root.VideoResponsiveResize = function () { 1825 var _Singleton, _base; 1826 _Singleton = (function () { 1827 function _Singleton() {} 1828 1829 _Singleton.prototype.qtd_coluna_anterior = ''; 1830 _Singleton.prototype.scrollbar = false; 1831 1832 _Singleton.prototype.resize = function () { 1833 var qtd_coluna_atual; 1834 1835 qtd_coluna_atual = 1; 1836 1837 if ($(window).width() > 480) { 1838 qtd_coluna_atual = 2; 1839 } 1840 1841 // 3 columns, 460 + 30 padding 1842 if ($(window).width() > 960) { 1843 qtd_coluna_atual = 3; 1844 } 1845 1846 if (this.qtd_coluna_anterior !== qtd_coluna_atual) { 1847 this.qtd_coluna_anterior = qtd_coluna_atual; 1848 1849 $('.videogallery-tile').each(function(){ 1850 $(this).removeClass('gallery-2-columns'); 1851 $(this).removeClass('gallery-3-columns'); 1852 1853 if (qtd_coluna_atual === 2) { 1854 $(this).addClass('gallery-2-columns'); 1855 } else if (qtd_coluna_atual === 3) { // Desktop 1856 $(this).addClass('gallery-3-columns'); 1857 } 1858 1859 //resize video onload 1860 var video_width = $('.player-holder iframe').width(); 1861 $('.player-holder iframe').height(video_width/1.3333); 1862 1863 //video loading logic 1864 var video_gallery = $(this); 1865 var gallery_link = video_gallery.find('.gallery-element').find('.gallery-element-link'); 1866 gallery_link.click(function(e){ 1867 e.preventDefault(); 1868 1869 var player = $(this).data('player-dom'); 1870 var metadata = $(this).siblings('.gallery-element-metadata'); 1871 1872 video_gallery.find('.selected').removeClass('selected'); 1873 $(this).parents('.gallery-element').addClass('selected'); 1874 1875 var player_slot = video_gallery.find('.player-holder'); 1876 player_slot.find('.player-video').html(player); 1877 player_slot.find('.title').html(metadata.find('.title').html()); 1878 player_slot.find('.description').html(metadata.find('.description').html()); 1879 1880 //resize video onload 1881 var video_width = $('.player-holder iframe').width(); 1882 $('.player-holder iframe').height(video_width/1.3333); 1883 }); 1884 }); 1885 } 1886 }; 1887 1888 return _Singleton; 1889 })(); 1890 1891 1892 if ((_base = root.VideoResponsiveResize).instance == null) { 1893 _base.instance = new _Singleton(); 1894 }
1895 return root.VideoResponsiveResize.instance; 1896 }; 1897 1898 var resize = function () { 1899 videoResponsiveResize = new root.VideoResponsiveResize(); 1900 videoResponsiveResize.resize(); 1901 } 1902 1903 $(window).resize(function () { 1904 resize(); 1905 }); 1906 1907 resize(); 1908 } 1909 1910 if ($('.mediacarousel-tile')[0] !== undefined) { 1911 var carouselResponsiveResize; 1912 1913 root.CarouselResponsiveResize = function () { 1914 var _Singleton, _base; 1915 _Singleton = (function () { 1916 function _Singleton() {} 1917 1918 _Singleton.prototype.qtd_coluna_anterior = ''; 1919 _Singleton.prototype.scrollbar = false; 1920 1921 _Singleton.prototype.resize = function () { 1922 var qtd_coluna_atual; 1923 1924 qtd_coluna_atual = 1; 1925 1926 if ($(window).width() > 480) { 1927 qtd_coluna_atual = 2; 1928 } 1929 1930 // 3 columns, 460 + 30 padding 1931 if ($(window).width() > 960) { 1932 qtd_coluna_atual = 3; 1933 } 1934 1935 if (this.qtd_coluna_anterior !== qtd_coluna_atual) { 1936 this.qtd_coluna_anterior = qtd_coluna_atual; 1937 var _i, _len; 1938 var gallerias = Galleria.get(); 1939 1940 for (_i = 0, _len = gallerias.length; _i < _len; _i++) { 1941 var g = gallerias[_i]; 1942 if (g) { 1943 var mediacarousel = '#' + g._target.id; 1944 g.resize({ 1945 width: g._stageWidth, 1946 height: g._stageWidth*3/4 1947 }); 1948 $(mediacarousel).css({ 1949 height: g._stageWidth*3/4 1950 }); 1951 1952 var bottomThumbs = $('.galleria-thumbnails-container', mediacarousel).offset().top + 1953 $('.galleria-thumbnails-container', mediacarousel).height(); 1954 var bottomContainer = $(mediacarousel).offset().top + 1955 $(mediacarousel).height(); 1956 var heightContainer = $(mediacarousel).height() + 1957 (bottomThumbs - 1958 bottomContainer) + 1959 ($(mediacarousel+' + .mediacarousel-footer-container a').text === '' ? 39: 18) + 1960 8; 1961 $(mediacarousel).css({ 1962 height: heightContainer 1963 }); 1964 var tile = $(mediacarousel).parent().parent(); 1965 $('.loading-mask', tile).css({ 1966 height: tile.height() + 15 1967 }); 1968 } 1969 } 1970 } 1971 }; 1972 1973 return _Singleton; 1974 })(); 1975 1976 1977 if ((_base = root.CarouselResponsiveResize).instance == null) { 1978 _base.instance = new _Singleton(); 1979 } 1980 return root.CarouselResponsiveResize.instance; 1981 }; 1982 1983 var resize = function () { 1984 carouselResponsiveResize = new root.CarouselResponsiveResize(); 1985 carouselResponsiveResize.resize(); 1986 } 1987 1988 $(window).resize(function () { 1989 resize(); 1990 }); 1991 1992 resize(); 1993 } 1994 1995 function AudioPlayer(audio_element, conf) { 1996 var self = this, 1997 cssSelectorAncestor = conf.cssSelectorAncestor, 1998 ae = audio_element; 1999 2000 $.extend(self, { 2001 init: function(){ 2002 var audio_url = self.get_audio_url(); 2003 var media = self.get_media(audio_url); 2004 2005 ae.jPlayer({ 2006 ready: function () { 2007 $(this).jPlayer("setMedia", media.media_urls); 2008 }, 2009 swfPath: "/++resource++brasil.gov.tiles", 2010 supplied: media.supplied, 2011 cssSelectorAncestor: cssSelectorAncestor, 2012 solution:"html,flash", 2013 wmode: "window", 2014 preload: "none" 2015 }); 2016 }, 2017 2018 /** 2019 * Construct the setMedia list of option and the supplied list 2020 **/ 2021 get_media: function(urls){ 2022 var media = {'media_urls':{}, 'supplied':''}; 2023 var media_type, url, _i, _len; 2024 2025 urls = urls.split(';'); 2026 for (_i = 0, _len = urls.length; _i < _len; _i++) { 2027 url = urls[_i]; 2028 media_type = self.get_media_type(url); 2029 if (media_type){ 2030 media['media_urls'][media_type] = url; 2031 if (media['supplied']) { 2032 media['supplied'] += ', '; 2033 } 2034 media['supplied'] += media_type; 2035 2036 } 2037 } 2038 2039 return media; 2040 }, 2041 2042 /** 2043 * Get the audio url from the configuration or the data attribute in the 2044 * main element 2045 **/ 2046 get_audio_url: function(){ 2047 var url = conf.audio_url? conf.audio_url : ae.data('audio-url'); 2048 return url; 2049 }, 2050 2051 /** 2052 * Function to gleam the media type from the URL 2053 * 2054 **/ 2055 get_media_type: function(url) { 2056 var mediaType = false;
2057 if(/\.mp3$/i.test(url)) { 2058 mediaType = 'mp3'; 2059 } else if(/\.mp4$/i.test(url) || /\.m4v$/i.test(url)) { 2060 mediaType = 'm4v'; 2061 } else if(/\.m4a$/i.test(url)) { 2062 mediaType = 'm4a'; 2063 } else if(/\.ogg$/i.test(url) || /\.oga$/i.test(url)) { 2064 mediaType = 'oga'; 2065 } else if(/\.ogv$/i.test(url)) { 2066 mediaType = 'ogv'; 2067 } else if(/\.webm$/i.test(url)) { 2068 mediaType = 'webmv'; 2069 } 2070 return mediaType; 2071 }, 2072 2073 /** 2074 * Method to update the media element reproduced in the player 2075 * requires just a media url 2076 **/ 2077 update_player: function(new_url) { 2078 //clear all media (even if is running) 2079 //ae.jPlayer("clearMedia"); 2080 conf.audio_url = new_url; 2081 2082 var audio_url = self.get_audio_url(); 2083 var media = self.get_media(audio_url); 2084 2085 ae.jPlayer( "clearMedia" ); 2086 ae.jPlayer("option", 'swfPath', '/++resource++brasil.gov.tiles'); 2087 2088 ae.jPlayer("option", "supplied", media.supplied); 2089 ae.jPlayer("setMedia", media.media_urls); 2090 2091 } 2092 }); 2093 self.init(); 2094 } 2095 2096 $.fn.audio_player = function(options) { 2097 2098 // already instanced, return the data object 2099 var el = this.data("audio_player"); 2100 if (el) { return el; } 2101 2102 2103 var default_settings = this.data('audio_player-settings'); 2104 var settings = ''; 2105 //default settings 2106 if (default_settings) { 2107 settings = default_settings; 2108 } else { 2109 settings = { 2110 'cssSelectorAncestor': '#jp_container_1', 2111 } 2112 } 2113 2114 if (options) { 2115 $.extend(settings, options); 2116 } 2117 2118 return this.each(function() { 2119 el = new AudioPlayer($(this), settings); 2120 $(this).data("audio_player", el); 2121 }); 2122 2123 }; 2124 2125 function AudioGallery(gallery) { 2126 var self = this, 2127 gallery_obj = gallery, 2128 player = gallery_obj.find('.jp-jplayer'), 2129 ancestor = '#' + gallery_obj.find('.jp-audio').attr('id'); 2130 2131 $.extend(self, { 2132 init: function(){ 2133 self.bind_events(); 2134 player.audio_player({'cssSelectorAncestor':ancestor}); 2135 }, 2136 2137 bind_events: function() { 2138 var links = gallery_obj.find('.audiogallery-item'); 2139 links.click(function(e){ 2140 e.preventDefault(); 2141 self.update($(this).attr('href')); 2142 links.parent('li').removeClass('selected'); 2143 $(this).parent('li').addClass('selected'); 2144 gallery_obj.find('.audiogallery-item-title').html($(this).html()); 2145 }); 2146 }, 2147 2148 update: function(url) { 2149 var p = player.audio_player({'cssSelectorAncestor':ancestor}); 2150 p.update_player(url); 2151 } 2152 }); 2153 self.init(); 2154 } 2155 2156 $.fn.audiogallery = function() { 2157 2158 // already instanced, return the data object 2159 var el = this.data("audiogallery"); 2160 if (el) { return el; } 2161 2162 2163 var default_settings = this.data('audiogallery-settings'); 2164 2165 return this.each(function() { 2166 el = new AudioGallery($(this)); 2167 $(this).data("audiogallery", el); 2168 }); 2169 2170 }; 2171 2172 function MediaCarousel(mediacarousel) { 2173 var self = this, 2174 galleria_id = mediacarousel.attr('id'); 2175 2176 $.extend(self, { 2177 init: function(){ 2178 Galleria.loadTheme(window.location.href.trim('/') + '/++resource++brasil.gov.tiles/galleria.classic.min.js'); 2179 2180 Galleria.configure({ 2181 _toggleInfo: false, // Set this to false if you want the caption to show always
2182 debug : false, // Set this to false to prevent debug messages 2183 imageCrop : false, // Defines how Galleria will crop the image 2184 wait : true, // Defines if and how Galleria should wait until it can be displayed using user interaction 2185 responsive : false // This option sets thew Gallery in responsive mode 2186 }); 2187 2188 Galleria.on('image', function(e) { 2189 var mediacarousel = '#'+this._target.id; 2190 2191 // Sometimes (I don't know why) Galleria fails, so I need to check if it worked and remove duplicates 2192 if (($('.galleria-layer>.rights', mediacarousel).length > 0) && 2193 ($('.galleria-info-text>.rights[data-index='+e.index+']', mediacarousel).length > 0)) { 2194 $('.galleria-info-text>.rights[data-index='+e.index+']', mediacarousel).remove(); 2195 } 2196 2197 // Move the layer element to the right place 2198 if ($('.galleria-layer>.rights', mediacarousel).length > 0) { 2199 $('.galleria-info-text', mediacarousel).append($('.galleria-layer>.rights', mediacarousel)); 2200 } 2201 2202 // Sometimes (I don't know why) Galleria fails, so I need to check if it worked and hide duplicates 2203 if ($('.galleria-info-text>.rights[data-index='+e.index+']', mediacarousel).length > 0) { 2204 $('.rights', mediacarousel).each(function(){ 2205 $(this).css('display', 'none'); 2206 }); 2207 $('.galleria-info-text>.rights[data-index='+e.index+']', mediacarousel).css('display', 'block'); 2208 } 2209 2210 $('.galleria-thumbnails-container', mediacarousel).insertAfter($('.galleria-info', mediacarousel)); 2211 var bottomThumbs = $('.galleria-thumbnails-container', mediacarousel).offset().top + 2212 $('.galleria-thumbnails-container', mediacarousel).height(); 2213 var bottomContainer = $(mediacarousel).offset().top + 2214 $(mediacarousel).height(); 2215 var heightContainer = $(mediacarousel).height() + 2216 (bottomThumbs - 2217 bottomContainer) + 2218 ($(mediacarousel+' + .mediacarousel-footer-container a').text === '' ? 39: 18) + 2219 8; 2220 2221 if (!$(mediacarousel).hasClass('image')){ 2222 $(mediacarousel).addClass('image'); 2223 $(mediacarousel).animate({ 2224 height: heightContainer 2225 }); 2226 $('.galleria-thumbnails-container, .galleria-info').animate({ 2227 opacity: 1 2228 }, function () { 2229 var tile = $(mediacarousel).parent().parent(); 2230 $('.loading-mask', tile).css({ 2231 height: tile.height() + 15 2232 }); 2233 }); 2234 } 2235 }); 2236 Galleria.on('loadfinish', function(e) { 2237 var mediacarousel = '#'+this._target.id; 2238 $('.galleria-thumbnails-container', mediacarousel).insertAfter($('.galleria-info', mediacarousel)); 2239 var bottomThumbs = $('.galleria-thumbnails-container', mediacarousel).offset().top + 2240 $('.galleria-thumbnails-container', mediacarousel).height(); 2241 var bottomContainer = $(mediacarousel).offset().top + 2242 $(mediacarousel).height(); 2243 var heightContainer = $(mediacarousel).height() + 2244 (bottomThumbs - 2245 bottomContainer) +
2246 ($(mediacarousel+' + .mediacarousel-footer-container a').text === '' ? 39: 18) + 2247 8; 2248 2249 var tile = $(mediacarousel).parent().parent(), 2250 thumbGaleria = $('.galleria-thumbnails-list', tile), 2251 navGaleriaNext = $('.galleria-thumb-nav-right', tile); 2252 if (navGaleriaNext.hasClass('disabled')) { 2253 thumbGaleria.css({ 'margin-right': 10 }); 2254 } else { 2255 thumbGaleria.css({ 'margin-right': 40 }); 2256 } 2257 if ($(mediacarousel).hasClass('image')) { 2258 $(mediacarousel).css({ 2259 height: heightContainer 2260 }); 2261 var tile = $(mediacarousel).parent().parent(); 2262 $('.loading-mask', tile).css({ 2263 height: tile.height() + 15 2264 }); 2265 } 2266 }); 2267 Galleria.run('#'+galleria_id); 2268 2269 Galleria.ready(function() { 2270 var galleriaContainer = $('#'+this._target.id), 2271 tile = $(galleriaContainer).parent().parent(); 2272 if (!galleriaContainer.hasClass('ready')) { 2273 galleriaContainer.addClass('ready'); 2274 var galleriaContainerWidth = galleriaContainer.width(), 2275 galleriaContainerHeight = (galleriaContainerWidth*3)/4; 2276 this.resize({ 2277 width: galleriaContainerWidth, 2278 height: galleriaContainerHeight 2279 }); 2280 } 2281 $('.galleria-thumb-nav-left, .galleria-thumb-nav-right, .galleria-thumbnails .galleria-image img', tile).on('click', function() { 2282 var thumbGaleria = $('.galleria-thumbnails-list', tile), 2283 navGaleriaNext = $('.galleria-thumb-nav-right', tile); 2284 if (navGaleriaNext.hasClass('disabled')) { 2285 thumbGaleria.css({ 'margin-right': 10 }); 2286 } else { 2287 thumbGaleria.css({ 'margin-right': 40 }); 2288 } 2289 }); 2290 }); 2291 }, 2292 }); 2293 self.init(); 2294 } 2295 $.fn.mediacarousel = function() { 2296 2297 // already instanced, return the data object 2298 var el = this.data("mediacarousel"); 2299 if (el) { return el; } 2300 2301 var default_settings = this.data('mediacarousel-settings'); 2302 2303 return this.each(function() { 2304 el = new MediaCarousel($(this)); 2305 $(this).data("mediacarousel", el); 2306 2307 }); 2308 }; 2309 $(document).on( 2310 'submit', 2311 'form[action*=edit-tile\\/mediacarousel]', 2312 function(){ 2313 setTimeout(function() { 2314 location.reload(); 2315 }, 400); 2316 } 2317 ); 2318 2319 // Tile Galeria de Albuns 2320 var albuns = { 2321 // View de álbum carrossel (carrossel de imagens do álbum) 2322 carrossel: function () { 2323 if (!root.cycle2_loaded) { 2324 root.cycle2_loaded = true; 2325 2326 var obj = this; 2327 $('.cycle-slideshow').on('cycle-next cycle-prev', function (e, opts) { 2328 var $galeria = $(this).parent().parent(); 2329 var $slideshows = $('.cycle-slideshow', $galeria); 2330 $slideshows.not(this).cycle('goto', opts.currSlide); 2331 obj.layoutAdjustment($galeria, opts.currSlide); 2332 }); 2333 2334 // Aplicando o mesmo controle de navegacao para os thumbs e galerias 2335 $('.cycle-carrossel .thumb-itens').click(function (e){ 2336 e.preventDefault(); 2337 var $thumbs = $(this).parent().parent(); 2338 var $galeria = $thumbs.parent().parent(); 2339 var $slideshows = $('.cycle-slideshow', $galeria); 2340 var index = $thumbs.data('cycle.API').getSlideIndex(this); 2341 $slideshows.cycle('goto', index); 2342 obj.layoutAdjustment($galeria, index); 2343 }); 2344 2345 // Adicionando navegação por teclado 2346 $(document.documentElement).keyup(function (event) { 2347 if (event.keyCode == 37) { 2348 $('.cycle-prev').trigger('click'); 2349 } else if (event.keyCode == 39) { 2350 $('.cycle-next').trigger('click'); 2351 } 2352 }); 2353 2354 $('.cycle-slideshow').each(function(){ 2355 var $galeria = $(this).parent().parent(); 2356 obj.layoutAdjustment($galeria, 0); 2357 }); 2358 } 2359 }, 2360 2361 layoutAdjustment: function($galeria, index){ 2362 var aElem = $(".cycle-player .cycle-slide", $galeria), 2363 elem, 2364 novaaltura, 2365 alturaimagem, 2366 larguracarosel; 2367 2368 // Pula primeiro elemento 2369 index = index + 1; 2370 elem = aElem[index], 2371 novaaltura = $(elem).height(); 2372 alturaimagem = $('.cycle-sentinel img', $galeria).height(); 2373 larguracarosel = ($('.carousel', $galeria).width() - 2374 (36 * 2)); 2375 2376 $('.cycle-sentinel', $galeria).height(novaaltura); 2377 $('.cycle-hover', $galeria).height(alturaimagem); 2378 $('.cycle-carrossel', $galeria).width(larguracarosel); 2379 } 2380 }; 2381 $(window).load(function(){ 2382 albuns.carrossel(); 2383 }); 2384}); 2385 2386 2387/* - ++resource++brasil.gov.tiles/jquery.jplayer.min.js - */ 2388/* 2389 * jPlayer Plugin for jQuery JavaScript Library 2390 * http://www.jplayer.org 2391 * 2392 * Copyright (c) 2009 - 2013 Happyworm Ltd 2393 * Dual licensed under the MIT and GPL licenses. 2394 * - http://www.opensource.org/licenses/mit-license.php 2395 * - http://www.gnu.org/copyleft/gpl.html 2396 * 2397 * Author: Mark J Panaghiston 2398 * Version: 2.3.0 2399 * Date: 20th April 2013 2400 */ 2401(function(b,f){"function"===typeof define&&define.amd?define(["jquery"],f):f(b.jQuery)})(this,function(b,f){b.fn.jPlayer=function(a){var c="string"===typeof a,d=Array.prototype.slice.call(arguments,1
2401),e=this;a=!c&&d.length?b.extend.apply(null,[!0,a].concat(d)):a;if(c&&"_"===a.charAt(0))return e;c?this.each(function(){var c=b.data(this,"jPlayer"),h=c&&b.isFunction(c[a])?c[a].apply(c,d):c;if(h!==c&&h!==f)return e=h,!1}):this.each(function(){var c=b.data(this,"jPlayer");c?c.option(a||{}):b.data(this, 2402"jPlayer",new b.jPlayer(a,this))});return e};b.jPlayer=function(a,c){if(arguments.length){this.element=b(c);this.options=b.extend(!0,{},this.options,a);var d=this;this.element.bind("remove.jPlayer",function(){d.destroy()});this._init()}};b.jPlayer.emulateMethods="load play pause";b.jPlayer.emulateStatus="src readyState networkState currentTime duration paused ended playbackRate";b.jPlayer.emulateOptions="muted volume";b.jPlayer.reservedEvent="ready flashreset resize repeat error warning";b.jPlayer.event= 2403{};b.each("ready flashreset resize repeat click error warning loadstart progress suspend abort emptied stalled play pause loadedmetadata loadeddata waiting playing canplay canplaythrough seeking seeked timeupdate ended ratechange durationchange volumechange".split(" "),function(){b.jPlayer.event[this]="jPlayer_"+this});b.jPlayer.htmlEvent="loadstart abort emptied stalled loadedmetadata loadeddata canplay canplaythrough ratechange".split(" ");b.jPlayer.pause=function(){b.each(b.jPlayer.prototype.instances, 2404function(a,c){c.data("jPlayer").status.srcSet&&c.jPlayer("pause")})};b.jPlayer.timeFormat={showHour:!1,showMin:!0,showSec:!0,padHour:!1,padMin:!0,padSec:!0,sepHour:":",sepMin:":",sepSec:""};var l=function(){this.init()};l.prototype={init:function(){this.options={timeFormat:b.jPlayer.timeFormat}},time:function(a){var c=new Date(1E3*(a&&"number"===typeof a?a:0)),b=c.getUTCHours();a=this.options.timeFormat.showHour?c.getUTCMinutes():c.getUTCMinutes()+60*b;c=this.options.timeFormat.showMin?c.getUTCSeconds(): 2405c.getUTCSeconds()+60*a;b=this.options.timeFormat.padHour&&10>b?"0"+b:b;a=this.options.timeFormat.padMin&&10>a?"0"+a:a;c=this.options.timeFormat.padSec&&10>c?"0"+c:c;b=""+(this.options.timeFormat.showHour?b+this.options.timeFormat.sepHour:"");b+=this.options.timeFormat.showMin?a+this.options.timeFormat.sepMin:"";return b+=this.options.timeFormat.showSec?c+this.options.timeFormat.sepSec:""}};var m=new l;b.jPlayer.convertTime=function(a){return m.time(a)};b.jPlayer.uaBrowser=function(a){a=a.toLowerCase(); 2406var b=/(opera)(?:.*version)?[ \/]([\w.]+)/,d=/(msie) ([\w.]+)/,e=/(mozilla)(?:.*? rv:([\w.]+))?/;a=/(webkit)[ \/]([\w.]+)/.exec(a)||b.exec(a)||d.exec(a)||0>a.indexOf("compatible")&&e.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}};b.jPlayer.uaPlatform=function(a){var b=a.toLowerCase(),d=/(android)/,e=/(mobile)/;a=/(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/.exec(b)||[];b=/(ipad|playbook)/.exec(b)||!e.exec(b)&&d.exec(b)||[];a[1]&&(a[1]=a[1].replace(/\s/g,"_"));return{platform:a[1]|| 2407"",tablet:b[1]||""}};b.jPlayer.browser={};b.jPlayer.platform={};var j=b.jPlayer.uaBrowser(navigator.userAgent);j.browser&&(b.jPlayer.browser[j.browser]=!0,b.jPlayer.browser.version=j.version);j=b.jPlayer.uaPlatform(navigator.userAgent);j.platform&&(b.jPlayer.platform[j.platform]=!0,b.jPlayer.platform.mobile=!j.tablet,b.jPlayer.platform.tablet=!!j.tablet);b.jPlayer.getDocMode=function(){var a;b.jPlayer.browser.msie&&(document.documentMode?a=document.documentMode:(a=5,document.compatMode&&"CSS1Compat"=== 2408document.compatMode&&(a=7)));return a};b.jPlayer.browser.documentMode=b.jPlayer.getDocMode();b.jPlayer.nativeFeatures={init:function(){var a=document,b=a.createElement("video"),d={w3c:"fullscreenEnabled fullscreenElement requestFullscreen exitFullscreen fullscreenchange fullscreenerror".split(" "),moz:"mozFullScreenEnabled mozFullScreenElement mozRequestFullScreen mozCancelFullScreen mozfullscreenchange mozfullscreenerror".split(" "),webkit:" webkitCurrentFullScreenElement webkitRequestFullScreen webkitCancelFullScreen webkitfullscreenchange ".split(" "), 2409webkitVideo:"webkitSupportsFullscreen webkitDisplayingFullscreen webkitEnterFullscreen webkitExitFullscreen ".split(" ")},e=["w3c","moz","webkit","webkitVideo"],g,h;this.fullscreen=b={support:{w3c:!!a[d.w3c[0]],moz:!!a[d.moz[0]],webkit:"function"===typeof a[d.webkit[3]],webkitVideo:"function"===typeof b[d.webkitVideo[2]]},used:{}};g=0;for(h=e.length;g<h;g++){var f=e[g];if(b.support[f]){b.spec=f;b.used[f]=!0;break}}if(b.spec){var k=d[b.spec];b.api={fullscreenEnabled:!0,fullscreenElement:function(b){b= 2410b?b:a;return b[k[1]]},requestFullscreen:function(a){return a[k[2]]()},exitFullscreen:function(b){b=b?b:a;return b[k[3]]()}};b.event={fullscreenchange:k[4],fullscreenerror:k[5]}}else b.api={fullscreenEnabled:!1,fullscreenElement:function(){return null},requestFullscreen:function(){},exitFullscreen:function(){}},b.event={}}};b.jPlayer.nativeFeatures.init();b.jPlayer.focus=null;b.jPlayer.keyIgnoreElementNames="INPUT TEXTAREA";var n=function(a){var c=b.jPlayer.focus,d;c&&(b.each(b.jPlayer.keyIgnoreElementNames.split(/\s+/g), 2411function(b,c){if(a.target.nodeName.toUpperCase()===c.toUpperCase())return d=!0,!1}),d||b.each(c.options.keyBindings,function(d,g){if(g&&a.which===g.key&&b.isFunction(g.fn))return a.preventDefault(),g.fn(c),!1}))};
2411b.jPlayer.keys=function(a){b(document.documentElement).unbind("keydown.jPlayer");a&&b(document.documentElement).bind("keydown.jPlayer",n)};b.jPlayer.keys(!0);b.jPlayer.prototype={count:0,version:{script:"2.3.0",needFlash:"2.3.0",flash:"unknown"},options:{swfPath:"js",solution:"html, flash", 2412supplied:"mp3",preload:"metadata",volume:0.8,muted:!1,wmode:"opaque",backgroundColor:"#000000",cssSelectorAncestor:"#jp_container_1",cssSelector:{videoPlay:".jp-video-play",play:".jp-play",pause:".jp-pause",stop:".jp-stop",seekBar:".jp-seek-bar",playBar:".jp-play-bar",mute:".jp-mute",unmute:".jp-unmute",volumeBar:".jp-volume-bar",volumeBarValue:".jp-volume-bar-value",volumeMax:".jp-volume-max",currentTime:".jp-current-time",duration:".jp-duration",fullScreen:".jp-full-screen",restoreScreen:".jp-restore-screen", 2413repeat:".jp-repeat",repeatOff:".jp-repeat-off",gui:".jp-gui",noSolution:".jp-no-solution"},smoothPlayBar:!1,fullScreen:!1,fullWindow:!1,autohide:{restored:!1,full:!0,fadeIn:200,fadeOut:600,hold:1E3},loop:!1,repeat:function(a){a.jPlayer.options.loop?b(this).unbind(".jPlayerRepeat").bind(b.jPlayer.event.ended+".jPlayer.jPlayerRepeat",function(){b(this).jPlayer("play")}):b(this).unbind(".jPlayerRepeat")},nativeVideoControls:{},noFullWindow:{msie:/msie [0-6]\./,ipad:/ipad.*?os [0-4]\./,iphone:/iphone/, 2414ipod:/ipod/,android_pad:/android [0-3]\.(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,iemobile:/iemobile/,webos:/webos/},noVolume:{ipad:/ipad/,iphone:/iphone/,ipod:/ipod/,android_pad:/android(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,iemobile:/iemobile/,webos:/webos/,playbook:/playbook/},timeFormat:{},keyEnabled:!1,audioFullScreen:!1,keyBindings:{play:{key:32,fn:function(a){a.status.paused?a.play(): 2415a.pause()}},fullScreen:{key:13,fn:function(a){(a.status.video||a.options.audioFullScreen)&&a._setOption("fullScreen",!a.options.fullScreen)}},muted:{key:8,fn:function(a){a._muted(!a.options.muted)}},volumeUp:{key:38,fn:function(a){a.volume(a.options.volume+0.1)}},volumeDown:{key:40,fn:function(a){a.volume(a.options.volume-0.1)}}},verticalVolume:!1,idPrefix:"jp",noConflict:"jQuery",emulateHtml:!1,errorAlerts:!1,warningAlerts:!1},optionsAudio:{size:{width:"0px",height:"0px",cssClass:""},sizeFull:{width:"0px", 2416height:"0px",cssClass:""}},optionsVideo:{size:{width:"480px",height:"270px",cssClass:"jp-video-270p"},sizeFull:{width:"100%",height:"100%",cssClass:"jp-video-full"}},instances:{},status:{src:"",media:{},paused:!0,format:{},formatType:"",waitForPlay:!0,waitForLoad:!0,srcSet:!1,video:!1,seekPercent:0,currentPercentRelative:0,currentPercentAbsolute:0,currentTime:0,duration:0,videoWidth:0,videoHeight:0,readyState:0,networkState:0,playbackRate:1,ended:0},internal:{ready:!1},solution:{html:!0,flash:!0}, 2417format:{mp3:{codec:'audio/mpeg; codecs="mp3"',flashCanPlay:!0,media:"audio"},m4a:{codec:'audio/mp4; codecs="mp4a.40.2"',flashCanPlay:!0,media:"audio"},oga:{codec:'audio/ogg; codecs="vorbis"',flashCanPlay:!1,media:"audio"},wav:{codec:'audio/wav; codecs="1"',flashCanPlay:!1,media:"audio"},webma:{codec:'audio/webm; codecs="vorbis"',flashCanPlay:!1,media:"audio"},fla:{codec:"audio/x-flv",flashCanPlay:!0,media:"audio"},rtmpa:{codec:'audio/rtmp; codecs="rtmp"',flashCanPlay:!0,media:"audio"},m4v:{codec:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"', 2418flashCanPlay:!0,media:"video"},ogv:{codec:'video/ogg; codecs="theora, vorbis"',flashCanPlay:!1,media:"video"},webmv:{codec:'video/webm; codecs="vorbis, vp8"',flashCanPlay:!1,media:"video"},flv:{codec:"video/x-flv",flashCanPlay:!0,media:"video"},rtmpv:{codec:'video/rtmp; codecs="rtmp"',flashCanPlay:!0,media:"video"}},_init:function(){var a=this;this.element.empty();this.status=b.extend({},this.status);this.internal=b.extend({},this.internal);this.options.timeFormat=b.extend({},b.jPlayer.timeFormat, 2419this.options.timeFormat);this.internal.cmdsIgnored=b.jPlayer.platform.ipad||b.jPlayer.platform.iphone||b.jPlayer.platform.ipod;this.internal.domNode=this.element.get(0);
2419this.options.keyEnabled&&!b.jPlayer.focus&&(b.jPlayer.focus=this);this.formats=[];this.solutions=[];this.require={};this.htmlElement={};this.html={};this.html.audio={};this.html.video={};this.flash={};this.css={};this.css.cs={};this.css.jq={};this.ancestorJq=[];this.options.volume=this._limitValue(this.options.volume,0,1);b.each(this.options.supplied.toLowerCase().split(","), 2420function(c,d){var e=d.replace(/^\s+|\s+$/g,"");if(a.format[e]){var f=!1;b.each(a.formats,function(a,b){if(e===b)return f=!0,!1});f||a.formats.push(e)}});b.each(this.options.solution.toLowerCase().split(","),function(c,d){var e=d.replace(/^\s+|\s+$/g,"");if(a.solution[e]){var f=!1;b.each(a.solutions,function(a,b){if(e===b)return f=!0,!1});f||a.solutions.push(e)}});this.internal.instance="jp_"+this.count;this.instances[this.internal.instance]=this.element;this.element.attr("id")||this.element.attr("id", 2421this.options.idPrefix+"_jplayer_"+this.count);this.internal.self=b.extend({},{id:this.element.attr("id"),jq:this.element});this.internal.audio=b.extend({},{id:this.options.idPrefix+"_audio_"+this.count,jq:f});this.internal.video=b.extend({},{id:this.options.idPrefix+"_video_"+this.count,jq:f});this.internal.flash=b.extend({},{id:this.options.idPrefix+"_flash_"+this.count,jq:f,swf:this.options.swfPath+(".swf"!==this.options.swfPath.toLowerCase().slice(-4)?(this.options.swfPath&&"/"!==this.options.swfPath.slice(-1)? 2422"/":"")+"Jplayer.swf":"")});this.internal.poster=b.extend({},{id:this.options.idPrefix+"_poster_"+this.count,jq:f});b.each(b.jPlayer.event,function(b,c){a.options[b]!==f&&(a.element.bind(c+".jPlayer",a.options[b]),a.options[b]=f)});this.require.audio=!1;this.require.video=!1;b.each(this.formats,function(b,c){a.require[a.format[c].media]=!0});this.options=this.require.video?b.extend(!0,{},this.optionsVideo,this.options):b.extend(!0,{},this.optionsAudio,this.options);this._setSize();this.status.nativeVideoControls= 2423this._uaBlocklist(this.options.nativeVideoControls);this.status.noFullWindow=this._uaBlocklist(this.options.noFullWindow);this.status.noVolume=this._uaBlocklist(this.options.noVolume);b.jPlayer.nativeFeatures.fullscreen.api.fullscreenEnabled&&this._fullscreenAddEventListeners();this._restrictNativeVideoControls();this.htmlElement.poster=document.createElement("img");this.htmlElement.poster.id=this.internal.poster.id;this.htmlElement.poster.onload=function(){(!a.status.video||a.status.waitForPlay)&& 2424a.internal.poster.jq.show()};this.element.append(this.htmlElement.poster);this.internal.poster.jq=b("#"+this.internal.poster.id);this.internal.poster.jq.css({width:this.status.width,height:this.status.height});this.internal.poster.jq.hide();this.internal.poster.jq.bind("click.jPlayer",function(){a._trigger(b.jPlayer.event.click)});this.html.audio.available=!1;this.require.audio&&(this.htmlElement.audio=document.createElement("audio"),this.htmlElement.audio.id=this.internal.audio.id,this.html.audio.available= 2425!!this.htmlElement.audio.canPlayType&&this._testCanPlayType(this.htmlElement.audio));this.html.video.available=!1;this.require.video&&(this.htmlElement.video=document.createElement("video"),this.htmlElement.video.id=this.internal.video.id,this.html.video.available=!!this.htmlElement.video.canPlayType&&this._testCanPlayType(this.htmlElement.video));this.flash.available=this._checkForFlash(10.1);this.html.canPlay={};this.flash.canPlay={};b.each(this.formats,function(b,c){a.html.canPlay[c]=a.html[a.format[c].media].available&& 2426""!==a.htmlElement[a.format[c].media].canPlayType(a.format[c].codec);a.flash.canPlay[c]=a.format[c].flashCanPlay&&a.flash.available});this.html.desired=!1;this.flash.desired=!1;b.each(this.solutions,function(c,d){if(0===c)a[d].desired=!0;else{var e=!1,f=!1;b.each(a.formats,function(b,c){a[a.solutions[0]].canPlay[c]&&("video"===a.format[c].media?f=!0:e=!0)});a[d].desired=a.require.audio&&!e||a.require.video&&!f}});this.html.support={};this.flash.support={};b.each(this.formats,function(b,c){a.html.support[c]= 2427a.html.canPlay[c]&&a.html.desired;a.flash.support[c]=a.flash.canPlay[c]&&a.flash.desired});this.html.used=!1;this.flash.used=!1;b.each(this.solutions,function(c,d){b.each(a.formats,function(b,c){if(a[d].support[c])return a[d].used=!0,!1})});this._resetActive();this._resetGate();this._cssSelectorAncestor(this.options.cssSelectorAncestor);!this.html.used&&!this.flash.used?(this._error({type:b.jPlayer.error.NO_SOLUTION,context:"{solution:'"+this.options.solution+"', supplied:'"+this.options.supplied+ 2428"'}",message:b.jPlayer.errorMsg.NO_SOLUTION,hint:b.jPlayer.errorHint.NO_SOLUTION}),this.css.jq.noSolution.length&&this.css.jq.noSolution.show()):this.css.jq.noSolution.length&&this.css.jq.noSolution.hide();if(this.flash.used){var c,d="jQuery="+encodeURI(this.options.noConflict)+"&id="+encodeURI(this.internal.self.id)+"&vol="+this.options.volume+"&muted="+this.options.muted;if(b.jPlayer.browser.msie&&(9>Number(b.jPlayer.browser.version)||9>b.jPlayer.browser.documentMode)){d=['<param name="movie" value="'+ 2429this.internal.flash.swf+'" />','<param name="FlashVars" value="'+d+'" />','<param name="allowScriptAccess" value="always" />','<param name="bgcolor" value="'+this.options.backgroundColor+'" />','<param name="wmode" value="'+this.options.wmode+'" />'];c=document.createElement('<object id="'+this.internal.flash.id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0" tabindex="-1"></object>');for(var e=0;e<d.length;e++)c.appendChild(document.createElement(d[e]))}else e=function(a, 2430b,c){var d=document.createElement("param");d.setAttribute("name",b);d.setAttribute("value",c);a.appendChild(d)},c=document.createElement("object"),c.setAttribute("id",this.internal.flash.id),c.setAttribute("data",this.internal.flash.swf),c.setAttribute("type","application/x-shockwave-flash"),c.setAttribute("width","1"),c.setAttribute("height","1"),c.setAttribute("tabindex","-1"),e(c,"flashvars",d),e(c,"allowscriptaccess","always"),e(c,"bgcolor",this.options.backgroundColor),e(c,"wmode",this.options.wmode); 2431this.element.append(c);this.internal.flash.jq=b(c)}this.html.used&&(this.html.audio.available&&(this._addHtmlEventListeners(this.htmlElement.audio,this.html.audio),this.element.append(this.htmlElement.audio),this.internal.audio.jq=b("#"+this.internal.audio.id)),this.html.video.available&&(this._addHtmlEventListeners(this.htmlElement.video,this.html.video),this.element.append(this.htmlElement.video),this.internal.video.jq=b("#"+this.internal.video.id),this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width, 2432height:this.status.height}):this.internal.video.jq.css({width:"0px",height:"0px"}),this.internal.video.jq.bind("click.jPlayer",function(){a._trigger(b.jPlayer.event.click)})));this.options.emulateHtml&&this._emulateHtmlBridge();this.html.used&&!this.flash.used&&setTimeout(function(){a.internal.ready=!0;a.version.flash="n/a";a._trigger(b.jPlayer.event.repeat);a._trigger(b.jPlayer.event.ready)},100);this._updateNativeVideoControls();this._updateInterface();this._updateButtons(!1);this._updateAutohide(); 2433this._updateVolume(this.options.volume);this._updateMute(this.options.muted);this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide();b.jPlayer.prototype.count++},destroy:function(){this.clearMedia();this._removeUiClass();this.css.jq.currentTime.length&&this.css.jq.currentTime.text("");this.css.jq.duration.length&&this.css.jq.duration.text("");b.each(this.css.jq,function(a,b){b.length&&b.unbind(".jPlayer")});this.internal.poster.jq.unbind(".jPlayer");this.internal.video.jq&&this.internal.video.jq.unbind(".jPlayer"); 2434this._fullscreenRemoveEventListeners();
2434this===b.jPlayer.focus&&(b.jPlayer.focus=null);this.options.emulateHtml&&this._destroyHtmlBridge();this.element.removeData("jPlayer");this.element.unbind(".jPlayer");this.element.empty();delete this.instances[this.internal.instance]},enable:function(){},disable:function(){},_testCanPlayType:function(a){try{return a.canPlayType(this.format.mp3.codec),!0}catch(b){return!1}},_uaBlocklist:function(a){var c=navigator.userAgent.toLowerCase(),d=!1;b.each(a,function(a, 2435b){if(b&&b.test(c))return d=!0,!1});return d},_restrictNativeVideoControls:function(){this.require.audio&&this.status.nativeVideoControls&&(this.status.nativeVideoControls=!1,this.status.noFullWindow=!0)},_updateNativeVideoControls:function(){this.html.video.available&&this.html.used&&(this.htmlElement.video.controls=this.status.nativeVideoControls,this._updateAutohide(),this.status.nativeVideoControls&&this.require.video?(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width, 2436height:this.status.height})):this.status.waitForPlay&&this.status.video&&(this.internal.poster.jq.show(),this.internal.video.jq.css({width:"0px",height:"0px"})))},_addHtmlEventListeners:function(a,c){var d=this;a.preload=this.options.preload;a.muted=this.options.muted;a.volume=this.options.volume;a.addEventListener("progress",function(){c.gate&&(d.internal.cmdsIgnored&&0<this.readyState&&(d.internal.cmdsIgnored=!1),d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.progress))},!1); 2437a.addEventListener("timeupdate",function(){c.gate&&(d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.timeupdate))},!1);a.addEventListener("durationchange",function(){c.gate&&(d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.durationchange))},!1);a.addEventListener("play",function(){c.gate&&(d._updateButtons(!0),d._html_checkWaitForPlay(),d._trigger(b.jPlayer.event.play))},!1);a.addEventListener("playing",function(){c.gate&&(d._updateButtons(!0),d._seeked(),d._trigger(b.jPlayer.event.playing))}, 2438!1);a.addEventListener("pause",function(){c.gate&&(d._updateButtons(!1),d._trigger(b.jPlayer.event.pause))},!1);a.addEventListener("waiting",function(){c.gate&&(d._seeking(),d._trigger(b.jPlayer.event.waiting))},!1);a.addEventListener("seeking",function(){c.gate&&(d._seeking(),d._trigger(b.jPlayer.event.seeking))},!1);a.addEventListener("seeked",function(){c.gate&&(d._seeked(),d._trigger(b.jPlayer.event.seeked))},!1);a.addEventListener("volumechange",function(){c.gate&&(d.options.volume=a.volume, 2439d.options.muted=a.muted,d._updateMute(),d._updateVolume(),d._trigger(b.jPlayer.event.volumechange))},!1);a.addEventListener("suspend",function(){c.gate&&(d._seeked(),d._trigger(b.jPlayer.event.suspend))},!1);a.addEventListener("ended",function(){c.gate&&(b.jPlayer.browser.webkit||(d.htmlElement.media.currentTime=0),d.htmlElement.media.pause(),d._updateButtons(!1),d._getHtmlStatus(a,!0),d._updateInterface(),d._trigger(b.jPlayer.event.ended))},!1);a.addEventListener("error",function(){c.gate&&(d._updateButtons(!1), 2440d._seeked(),d.status.srcSet&&(clearTimeout(d.internal.htmlDlyCmdId),d.status.waitForLoad=!0,d.status.waitForPlay=!0,d.status.video&&!d.status.nativeVideoControls&&d.internal.video.jq.css({width:"0px",height:"0px"}),d._validString(d.status.media.poster)&&!d.status.nativeVideoControls&&d.internal.poster.jq.show(),d.css.jq.videoPlay.length&&d.css.jq.videoPlay.show(),d._error({type:b.jPlayer.error.URL,context:d.status.src,message:b.jPlayer.errorMsg.URL,hint:b.jPlayer.errorHint.URL})))},!1);b.each(b.jPlayer.htmlEvent, 2441function(e,g){a.addEventListener(this,function(){c.gate&&d._trigger(b.jPlayer.event[g])},!1)})},_getHtmlStatus:function(a,b){var d=0,e=0,g=0,f=0;isFinite(a.duration)&&(this.status.duration=a.duration);d=a.currentTime;e=0<this.status.duration?100*d/this.status.duration:0;"object"===typeof a.seekable&&0<a.seekable.length?(g=0<this.status.duration?100*a.seekable.end(a.seekable.length-1)/this.status.duration:100,f=0<this.status.duration?100*a.currentTime/a.seekable.end(a.seekable.length-1):0):(g=100, 2442f=e);b&&(e=f=d=0);this.status.seekPercent=g;this.status.currentPercentRelative=f;this.status.currentPercentAbsolute=e;this.status.currentTime=d;this.status.videoWidth=a.videoWidth;this.status.videoHeight=a.videoHeight;this.status.readyState=a.readyState;this.status.networkState=a.networkState;this.status.playbackRate=a.playbackRate;this.status.ended=a.ended},_resetStatus:function(){this.status=b.extend({},this.status,b.jPlayer.prototype.status)},_trigger:function(a,c,d){a=b.Event(a);a.jPlayer={}; 2443a.jPlayer.version=b.extend({},this.version);a.jPlayer.options=b.extend(!0,{},this.options);a.jPlayer.status=b.extend(!0,{},this.status);a.jPlayer.html=b.extend(!0,{},this.html);a.jPlayer.flash=b.extend(!0,{},this.flash);c&&(a.jPlayer.error=b.extend({},c));d&&(a.jPlayer.warning=b.extend({},d));this.element.trigger(a)},jPlayerFlashEvent:function(a,c){if(a===b.jPlayer.event.ready)if(this.internal.ready){if(this.flash.gate){if(this.status.srcSet){var d=this.status.currentTime,e=this.status.paused;this.setMedia(this.status.media); 24440<d&&(e?this.pause(d):this.play(d))}this._trigger(b.jPlayer.event.flashreset)}}else this.internal.ready=!0,this.internal.flash.jq.css({width:"0px",height:"0px"}),this.version.flash=c.version,this.version.needFlash!==this.version.flash&&this._error({type:b.jPlayer.error.VERSION,context:this.version.flash,message:b.jPlayer.errorMsg.VERSION+this.version.flash,hint:b.jPlayer.errorHint.VERSION}),this._trigger(b.jPlayer.event.repeat),this._trigger(a);if(this.flash.gate)switch(a){case b.jPlayer.event.progress:this._getFlashStatus(c); 2445this._updateInterface();this._trigger(a);break;case b.jPlayer.event.timeupdate:this._getFlashStatus(c);this._updateInterface();this._trigger(a);break;case b.jPlayer.event.play:this._seeked();this._updateButtons(!0);this._trigger(a);break;case b.jPlayer.event.pause:this._updateButtons(!1);this._trigger(a);break;case b.jPlayer.event.ended:this._updateButtons(!1);this._trigger(a);break;case b.jPlayer.event.click:this._trigger(a);break;case b.jPlayer.event.error:this.status.waitForLoad=!0;this.status.waitForPlay= 2446!0;this.status.video&&this.internal.flash.jq.css({width:"0px",height:"0px"});
2446this._validString(this.status.media.poster)&&this.internal.poster.jq.show();this.css.jq.videoPlay.length&&this.status.video&&this.css.jq.videoPlay.show();this.status.video?this._flash_setVideo(this.status.media):this._flash_setAudio(this.status.media);this._updateButtons(!1);this._error({type:b.jPlayer.error.URL,context:c.src,message:b.jPlayer.errorMsg.URL,hint:b.jPlayer.errorHint.URL});break;case b.jPlayer.event.seeking:this._seeking(); 2447this._trigger(a);break;case b.jPlayer.event.seeked:this._seeked();this._trigger(a);break;case b.jPlayer.event.ready:break;default:this._trigger(a)}return!1},_getFlashStatus:function(a){this.status.seekPercent=a.seekPercent;this.status.currentPercentRelative=a.currentPercentRelative;this.status.currentPercentAbsolute=a.currentPercentAbsolute;this.status.currentTime=a.currentTime;this.status.duration=a.duration;this.status.videoWidth=a.videoWidth;this.status.videoHeight=a.videoHeight;this.status.readyState= 24484;this.status.networkState=0;this.status.playbackRate=1;this.status.ended=!1},_updateButtons:function(a){a!==f&&(this.status.paused=!a,this.css.jq.play.length&&this.css.jq.pause.length&&(a?(this.css.jq.play.hide(),this.css.jq.pause.show()):(this.css.jq.play.show(),this.css.jq.pause.hide())));this.css.jq.restoreScreen.length&&this.css.jq.fullScreen.length&&(this.status.noFullWindow?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.hide()):this.options.fullWindow?(this.css.jq.fullScreen.hide(), 2449this.css.jq.restoreScreen.show()):(this.css.jq.fullScreen.show(),this.css.jq.restoreScreen.hide()));this.css.jq.repeat.length&&this.css.jq.repeatOff.length&&(this.options.loop?(this.css.jq.repeat.hide(),this.css.jq.repeatOff.show()):(this.css.jq.repeat.show(),this.css.jq.repeatOff.hide()))},_updateInterface:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.width(this.status.seekPercent+"%");this.css.jq.playBar.length&&(this.options.smoothPlayBar?this.css.jq.playBar.stop().animate({width:this.status.currentPercentAbsolute+ 2450"%"},250,"linear"):this.css.jq.playBar.width(this.status.currentPercentRelative+"%"));this.css.jq.currentTime.length&&this.css.jq.currentTime.text(this._convertTime(this.status.currentTime));this.css.jq.duration.length&&this.css.jq.duration.text(this._convertTime(this.status.duration))},_convertTime:l.prototype.time,_seeking:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.addClass("jp-seeking-bg")},_seeked:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.removeClass("jp-seeking-bg")}, 2451_resetGate:function(){this.html.audio.gate=!1;this.html.video.gate=!1;this.flash.gate=!1},_resetActive:function(){this.html.active=!1;this.flash.active=!1},setMedia:function(a){var c=this,d=!1,e=this.status.media.poster!==a.poster;this._resetMedia();this._resetGate();this._resetActive();b.each(this.formats,function(e,f){var j="video"===c.format[f].media;b.each(c.solutions,function(b,e){if(c[e].support[f]&&c._validString(a[f])){var g="html"===e;j?(g?(c.html.video.gate=!0,c._html_setVideo(a),c.html.active= 2452!0):(c.flash.gate=!0,c._flash_setVideo(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.show(),c.status.video=!0):(g?(c.html.audio.gate=!0,c._html_setAudio(a),c.html.active=!0):(c.flash.gate=!0,c._flash_setAudio(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.hide(),c.status.video=!1);d=!0;return!1}});if(d)return!1});if(d){if((!this.status.nativeVideoControls||!this.html.video.gate)&&this._validString(a.poster))e?this.htmlElement.poster.src=a.poster:this.internal.poster.jq.show(); 2453this.status.srcSet=!0;this.status.media=b.extend({},a);this._updateButtons(!1);this._updateInterface()}else this._error({type:b.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SUPPORT,hint:b.jPlayer.errorHint.NO_SUPPORT})},_resetMedia:function(){this._resetStatus();this._updateButtons(!1);this._updateInterface();this._seeked();this.internal.poster.jq.hide();clearTimeout(this.internal.htmlDlyCmdId);this.html.active?this._html_resetMedia():this.flash.active&& 2454this._flash_resetMedia()},clearMedia:function(){this._resetMedia();this.html.active?this._html_clearMedia():this.flash.active&&this._flash_clearMedia();this._resetGate();this._resetActive()},load:function(){this.status.srcSet?this.html.active?this._html_load():this.flash.active&&this._flash_load():this._urlNotSetError("load")},focus:function(){this.options.keyEnabled&&(b.jPlayer.focus=this)},play:function(a){a="number"===typeof a?a:NaN;this.status.srcSet?(this.focus(),this.html.active?this._html_play(a): 2455this.flash.active&&this._flash_play(a)):this._urlNotSetError("play")},videoPlay:function(){this.play()},pause:function(a){a="number"===typeof a?a:NaN;this.status.srcSet?this.html.active?this._html_pause(a):this.flash.active&&this._flash_pause(a):this._urlNotSetError("pause")},pauseOthers:function(){var a=this;b.each(this.instances,function(b,d){a.element!==d&&d.data("jPlayer").status.srcSet&&d.jPlayer("pause")})},stop:function(){this.status.srcSet?this.html.active?this._html_pause(0):this.flash.active&& 2456this._flash_pause(0):this._urlNotSetError("stop")},playHead:function(a){a=this._limitValue(a,0,100);
2456this.status.srcSet?this.html.active?this._html_playHead(a):this.flash.active&&this._flash_playHead(a):this._urlNotSetError("playHead")},_muted:function(a){this.options.muted=a;this.html.used&&this._html_mute(a);this.flash.used&&this._flash_mute(a);!this.html.video.gate&&!this.html.audio.gate&&(this._updateMute(a),this._updateVolume(this.options.volume),this._trigger(b.jPlayer.event.volumechange))}, 2457mute:function(a){a=a===f?!0:!!a;this._muted(a)},unmute:function(a){a=a===f?!0:!!a;this._muted(!a)},_updateMute:function(a){a===f&&(a=this.options.muted);this.css.jq.mute.length&&this.css.jq.unmute.length&&(this.status.noVolume?(this.css.jq.mute.hide(),this.css.jq.unmute.hide()):a?(this.css.jq.mute.hide(),this.css.jq.unmute.show()):(this.css.jq.mute.show(),this.css.jq.unmute.hide()))},volume:function(a){a=this._limitValue(a,0,1);this.options.volume=a;this.html.used&&this._html_volume(a);this.flash.used&& 2458this._flash_volume(a);!this.html.video.gate&&!this.html.audio.gate&&(this._updateVolume(a),this._trigger(b.jPlayer.event.volumechange))},volumeBar:function(a){if(this.css.jq.volumeBar.length){var b=this.css.jq.volumeBar.offset(),d=a.pageX-b.left,e=this.css.jq.volumeBar.width();a=this.css.jq.volumeBar.height()-a.pageY+b.top;b=this.css.jq.volumeBar.height();this.options.verticalVolume?this.volume(a/b):this.volume(d/e)}this.options.muted&&this._muted(!1)},volumeBarValue:function(a){this.volumeBar(a)}, 2459_updateVolume:function(a){a===f&&(a=this.options.volume);a=this.options.muted?0:a;this.status.noVolume?(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.hide(),this.css.jq.volumeBarValue.length&&this.css.jq.volumeBarValue.hide(),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.hide()):(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.show(),this.css.jq.volumeBarValue.length&&(this.css.jq.volumeBarValue.show(),this.css.jq.volumeBarValue[this.options.verticalVolume?"height":"width"](100*a+ 2460"%")),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.show())},volumeMax:function(){this.volume(1);this.options.muted&&this._muted(!1)},_cssSelectorAncestor:function(a){var c=this;this.options.cssSelectorAncestor=a;this._removeUiClass();this.ancestorJq=a?b(a):[];a&&1!==this.ancestorJq.length&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.ancestorJq.length+" found for cssSelectorAncestor.",hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT}); 2461this._addUiClass();b.each(this.options.cssSelector,function(a,b){c._cssSelector(a,b)})},_cssSelector:function(a,c){var d=this;"string"===typeof c?b.jPlayer.prototype.options.cssSelector[a]?(this.css.jq[a]&&this.css.jq[a].length&&this.css.jq[a].unbind(".jPlayer"),this.options.cssSelector[a]=c,this.css.cs[a]=this.options.cssSelectorAncestor+" "+c,this.css.jq[a]=c?b(this.css.cs[a]):[],this.css.jq[a].length&&this.css.jq[a].bind("click.jPlayer",function(c){c.preventDefault();d[a](c);b(this).blur()}),c&& 24621!==this.css.jq[a].length&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[a],message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[a].length+" found for "+a+" method.",hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT})):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_METHOD,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:b.jPlayer.warningHint.CSS_SELECTOR_METHOD}):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_STRING,context:c,message:b.jPlayer.warningMsg.CSS_SELECTOR_STRING, 2463hint:b.jPlayer.warningHint.CSS_SELECTOR_STRING})},seekBar:function(a){if(this.css.jq.seekBar){var b=this.css.jq.seekBar.offset();a=a.pageX-b.left;b=this.css.jq.seekBar.width();this.playHead(100*a/b)}},playBar:function(a){this.seekBar(a)},repeat:function(){this._loop(!0)},repeatOff:function(){this._loop(!1)},_loop:function(a){this.options.loop!==a&&(this.options.loop=a,this._updateButtons(),this._trigger(b.jPlayer.event.repeat))},currentTime:function(){},duration:function(){},gui:function(){},noSolution:function(){}, 2464option:function(a,c){var d=a;if(0===arguments.length)return b.extend(!0,{},this.options);if("string"===typeof a){var e=a.split(".");if(c===f){for(var d=b.extend(!0,{},this.options),g=0;g<e.length;g++)if(d[e[g]]!==f)d=d[e[g]];else return this._warning({type:b.jPlayer.warning.OPTION_KEY,context:a,message:b.jPlayer.warningMsg.OPTION_KEY,hint:b.jPlayer.warningHint.OPTION_KEY}),f;return d}for(var g=d={},h=0;h<e.length;h++)h<e.length-1?(g[e[h]]={},g=g[e[h]]):g[e[h]]=c}this._setOptions(d);return this},_setOptions:function(a){var c= 2465this;b.each(a,function(a,b){c._setOption(a,b)});return this},_setOption:function(a,c){var d=this;switch(a){case "volume":this.volume(c);break;case "muted":this._muted(c);break;case "cssSelectorAncestor":this._cssSelectorAncestor(c);break;case "cssSelector":b.each(c,function(a,b){d._cssSelector(a,b)});break;case "fullScreen":if(this.options[a]!==c){var e=b.jPlayer.nativeFeatures.fullscreen.used.webkitVideo;if(!e||e&&!this.status.waitForPlay)e||(this.options[a]=c),c?this._requestFullscreen():this._exitFullscreen(), 2466e||this._setOption("fullWindow",c)}break;case "fullWindow":this.options[a]!==c&&(this._removeUiClass(),this.options[a]=c,this._refreshSize());break;case "size":!this.options.fullWindow&&this.options[a].cssClass!==c.cssClass&&this._removeUiClass();this.options[a]=b.extend({},this.options[a],c);this._refreshSize();break;case "sizeFull":this.options.fullWindow&&this.options[a].cssClass!==c.cssClass&&this._removeUiClass();this.options[a]=b.extend({},this.options[a],c);this._refreshSize();break;case "autohide":this.options[a]= 2467b.extend({},this.options[a],c);this._updateAutohide();break;case "loop":this._loop(c);break;case "nativeVideoControls":this.options[a]=b.extend({},this.options[a],c);this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this._restrictNativeVideoControls();this._updateNativeVideoControls();break;case "noFullWindow":this.options[a]=b.extend({},this.options[a],c);this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this.status.noFullWindow= 2468this._uaBlocklist(this.options.noFullWindow);this._restrictNativeVideoControls();this._updateButtons();break;case "noVolume":this.options[a]=b.extend({},this.options[a],c);this.status.noVolume=this._uaBlocklist(this.options.noVolume);this._updateVolume();this._updateMute();break;case "emulateHtml":this.options[a]!==c&&((this.options[a]=c)?this._emulateHtmlBridge():this._destroyHtmlBridge());break;case "timeFormat":this.options[a]=b.extend({},this.options[a],c);break;case "keyEnabled":this.options[a]= 2469c;
2469!c&&this===b.jPlayer.focus&&(b.jPlayer.focus=null);break;case "keyBindings":this.options[a]=b.extend(!0,{},this.options[a],c);break;case "audioFullScreen":this.options[a]=c}return this},_refreshSize:function(){this._setSize();this._addUiClass();this._updateSize();this._updateButtons();this._updateAutohide();this._trigger(b.jPlayer.event.resize)},_setSize:function(){this.options.fullWindow?(this.status.width=this.options.sizeFull.width,this.status.height=this.options.sizeFull.height,this.status.cssClass= 2470this.options.sizeFull.cssClass):(this.status.width=this.options.size.width,this.status.height=this.options.size.height,this.status.cssClass=this.options.size.cssClass);this.element.css({width:this.status.width,height:this.status.height})},_addUiClass:function(){this.ancestorJq.length&&this.ancestorJq.addClass(this.status.cssClass)},_removeUiClass:function(){this.ancestorJq.length&&this.ancestorJq.removeClass(this.status.cssClass)},_updateSize:function(){this.internal.poster.jq.css({width:this.status.width, 2471height:this.status.height});!this.status.waitForPlay&&this.html.active&&this.status.video||this.html.video.available&&this.html.used&&this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width,height:this.status.height}):!this.status.waitForPlay&&(this.flash.active&&this.status.video)&&this.internal.flash.jq.css({width:this.status.width,height:this.status.height})},_updateAutohide:function(){var a=this,b=function(){a.css.jq.gui.fadeIn(a.options.autohide.fadeIn,function(){clearTimeout(a.internal.autohideId); 2472a.internal.autohideId=setTimeout(function(){a.css.jq.gui.fadeOut(a.options.autohide.fadeOut)},a.options.autohide.hold)})};this.css.jq.gui.length&&(this.css.jq.gui.stop(!0,!0),clearTimeout(this.internal.autohideId),this.element.unbind(".jPlayerAutohide"),this.css.jq.gui.unbind(".jPlayerAutohide"),this.status.nativeVideoControls?this.css.jq.gui.hide():this.options.fullWindow&&this.options.autohide.full||!this.options.fullWindow&&this.options.autohide.restored?(this.element.bind("mousemove.jPlayer.jPlayerAutohide", 2473b),this.css.jq.gui.bind("mousemove.jPlayer.jPlayerAutohide",b),this.css.jq.gui.hide()):this.css.jq.gui.show())},fullScreen:function(){this._setOption("fullScreen",!0)},restoreScreen:function(){this._setOption("fullScreen",!1)},_fullscreenAddEventListeners:function(){var a=this,c=b.jPlayer.nativeFeatures.fullscreen;c.api.fullscreenEnabled&&c.event.fullscreenchange&&("function"!==typeof this.internal.fullscreenchangeHandler&&(this.internal.fullscreenchangeHandler=function(){a._fullscreenchange()}), 2474document.addEventListener(c.event.fullscreenchange,this.internal.fullscreenchangeHandler,!1))},_fullscreenRemoveEventListeners:function(){var a=b.jPlayer.nativeFeatures.fullscreen;this.internal.fullscreenchangeHandler&&document.addEventListener(a.event.fullscreenchange,this.internal.fullscreenchangeHandler,!1)},_fullscreenchange:function(){this.options.fullScreen&&!b.jPlayer.nativeFeatures.fullscreen.api.fullscreenElement()&&this._setOption("fullScreen",!1)},_requestFullscreen:function(){var a=this.ancestorJq.length? 2475this.ancestorJq[0]:this.element[0],c=b.jPlayer.nativeFeatures.fullscreen;c.used.webkitVideo&&(a=this.htmlElement.video);c.api.fullscreenEnabled&&c.api.requestFullscreen(a)},_exitFullscreen:function(){var a=b.jPlayer.nativeFeatures.fullscreen,c;a.used.webkitVideo&&(c=this.htmlElement.video);a.api.fullscreenEnabled&&a.api.exitFullscreen(c)},_html_initMedia:function(a){var c=b(this.htmlElement.media).empty();b.each(a.track||[],function(a,b){var g=document.createElement("track");g.setAttribute("kind", 2476b.kind?b.kind:"");g.setAttribute("src",b.src?b.src:"");g.setAttribute("srclang",b.srclang?b.srclang:"");g.setAttribute("label",b.label?b.label:"");b.def&&g.setAttribute("default",b.def);c.append(g)});this.htmlElement.media.src=this.status.src;"none"!==this.options.preload&&this._html_load();this._trigger(b.jPlayer.event.timeupdate)},_html_setFormat:function(a){var c=this;b.each(this.formats,function(b,e){if(c.html.support[e]&&a[e])return c.status.src=a[e],c.status.format[e]=!0,c.status.formatType= 2477e,!1})},_html_setAudio:function(a){this._html_setFormat(a);this.htmlElement.media=this.htmlElement.audio;this._html_initMedia(a)},_html_setVideo:function(a){this._html_setFormat(a);this.status.nativeVideoControls&&(this.htmlElement.video.poster=this._val
2477idString(a.poster)?a.poster:"");this.htmlElement.media=this.htmlElement.video;this._html_initMedia(a)},_html_resetMedia:function(){this.htmlElement.media&&(this.htmlElement.media.id===this.internal.video.id&&!this.status.nativeVideoControls&&this.internal.video.jq.css({width:"0px", 2478height:"0px"}),this.htmlElement.media.pause())},_html_clearMedia:function(){this.htmlElement.media&&(this.htmlElement.media.src="about:blank",this.htmlElement.media.load())},_html_load:function(){this.status.waitForLoad&&(this.status.waitForLoad=!1,this.htmlElement.media.load());clearTimeout(this.internal.htmlDlyCmdId)},_html_play:function(a){var b=this,d=this.htmlElement.media;this._html_load();if(isNaN(a))d.play();else{this.internal.cmdsIgnored&&d.play();try{if(!d.seekable||"object"===typeof d.seekable&& 24790<d.seekable.length)d.currentTime=a,d.play();else throw 1;}catch(e){this.internal.htmlDlyCmdId=setTimeout(function(){b.play(a)},250);return}}this._html_checkWaitForPlay()},_html_pause:function(a){var b=this,d=this.htmlElement.media;0<a?this._html_load():clearTimeout(this.internal.htmlDlyCmdId);d.pause();
2479if(!isNaN(a))try{if(!d.seekable||"object"===typeof d.seekable&&0<d.seekable.length)d.currentTime=a;else throw 1;}catch(e){this.internal.htmlDlyCmdId=setTimeout(function(){b.pause(a)},250);return}0< 2480a&&this._html_checkWaitForPlay()},_html_playHead:function(a){var b=this,d=this.htmlElement.media;this._html_load();try{if("object"===typeof d.seekable&&0<d.seekable.length)d.currentTime=a*d.seekable.end(d.seekable.length-1)/100;else if(0<d.duration&&!isNaN(d.duration))d.currentTime=a*d.duration/100;else throw"e";}catch(e){this.internal.htmlDlyCmdId=setTimeout(function(){b.playHead(a)},250);return}this.status.waitForLoad||this._html_checkWaitForPlay()},_html_checkWaitForPlay:function(){this.status.waitForPlay&& 2481(this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height})))},_html_volume:function(a){this.html.audio.available&&(this.htmlElement.audio.volume=a);this.html.video.available&&(this.htmlElement.video.volume=a)},_html_mute:function(a){this.html.audio.available&&(this.htmlElement.audio.muted=a);this.html.video.available&&(this.htmlElement.video.muted= 2482a)},_flash_setAudio:function(a){var c=this;try{b.each(this.formats,function(b,d){if(c.flash.support[d]&&a[d]){switch(d){case "m4a":case "fla":c._getMovie().fl_setAudio_m4a(a[d]);break;case "mp3":c._getMovie().fl_setAudio_mp3(a[d]);break;case "rtmpa":c._getMovie().fl_setAudio_rtmp(a[d])}c.status.src=a[d];c.status.format[d]=!0;c.status.formatType=d;return!1}}),"auto"===this.options.preload&&(this._flash_load(),this.status.waitForLoad=!1)}catch(d){this._flashError(d)}},_flash_setVideo:function(a){var c= 2483this;try{b.each(this.formats,function(b,d){if(c.flash.support[d]&&a[d]){switch(d){case "m4v":case "flv":c._getMovie().fl_setVideo_m4v(a[d]);break;case "rtmpv":c._getMovie().fl_setVideo_rtmp(a[d])}c.status.src=a[d];c.status.format[d]=!0;c.status.formatType=d;return!1}}),"auto"===this.options.preload&&(this._flash_load(),this.status.waitForLoad=!1)}catch(d){this._flashError(d)}},_flash_resetMedia:function(){this.internal.flash.jq.css({width:"0px",height:"0px"});this._flash_pause(NaN)},_flash_clearMedia:function(){try{this._getMovie().fl_clearMedia()}catch(a){this._flashError(a)}}, 2484_flash_load:function(){try{this._getMovie().fl_load()}catch(a){this._flashError(a)}this.status.waitForLoad=!1},_flash_play:function(a){try{this._getMovie().fl_play(a)}catch(b){this._flashError(b)}this.status.waitForLoad=!1;this._flash_checkWaitForPlay()},_flash_pause:function(a){try{this._getMovie().fl_pause(a)}catch(b){this._flashError(b)}0<a&&(this.status.waitForLoad=!1,this._flash_checkWaitForPlay())},_flash_playHead:function(a){try{this._getMovie().fl_play_head(a)}catch(b){this._flashError(b)}this.status.waitForLoad|| 2485this._flash_checkWaitForPlay()},_flash_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.flash.jq.css({width:this.status.width,height:this.status.height})))},_flash_volume:function(a){try{this._getMovie().fl_volume(a)}catch(b){this._flashError(b)}},_flash_mute:function(a){try{this._getMovie().fl_mute(a)}catch(b){this._flashError(b)}},_getMovie:function(){return document[this.internal.flash.id]}, 2486_getFlashPluginVersion:function(){var a=0,b;if(window.ActiveXObject)try{if(b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")){var d=b.GetVariable("$version");d&&(d=d.split(" ")[1].split(","),a=parseInt(d[0],10)+"."+parseInt(d[1],10))}}catch(e){}else navigator.plugins&&0<navigator.mimeTypes.length&&(b=navigator.plugins["Shockwave Flash"])&&(a=navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,"$1"));return 1*a},_checkForFlash:function(a){var b=!1;this._getFlashPluginVersion()>= 2487a&&(b=!0);return b},_validString:function(a){return a&&"string"===typeof a},_limitValue:function(a,b,d){return a<b?b:a>d?d:a},_urlNotSetError:function(a){this._error({type:b.jPlayer.error.URL_NOT_SET,context:a,message:b.jPlayer.errorMsg.URL_NOT_SET,hint:b.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(a){var c;c=this.internal.ready?"FLASH_DISABLED":"FLASH";this._error({type:b.jPlayer.error[c],context:this.internal.flash.swf,message:b.jPlayer.errorMsg[c]+a.message,hint:b.jPlayer.errorHint[c]}); 2488this.internal.flash.jq.css({width:"1px",height:"1px"})},_error:function(a){this._trigger(b.jPlayer.event.error,a);this.options.errorAlerts&&this._alert("Error!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_warning:function(a){this._trigger(b.jPlayer.event.warning,f,a);this.options.warningAlerts&&this._alert("Warning!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_alert:function(a){alert("jPlayer "+this.version.script+ 2489" : id='"+this.internal.self.id+"' : "+a)},_emulateHtmlBridge:function(){var a=this;b.each(b.jPlayer.emulateMethods.split(/\s+/g),function(b,d){a.internal.domNode[d]=function(b){a[d](b)}});b.each(b.jPlayer.event,function(c,d){var e=!0;b.each(b.jPlayer.reservedEvent.split(/\s+/g),function(a,b){if(b===c)return e=!1});e&&a.element.bind(d+".jPlayer.jPlayerHtml",function(){a._emulateHtmlUpdate();var b=document.createEvent("Event");
2489b.initEvent(c,!1,!0);a.internal.domNode.dispatchEvent(b)})})},_emulateHtmlUpdate:function(){var a= 2490this;b.each(b.jPlayer.emulateStatus.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.status[d]});b.each(b.jPlayer.emulateOptions.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.options[d]})},_destroyHtmlBridge:function(){var a=this;this.element.unbind(".jPlayerHtml");b.each((b.jPlayer.emulateMethods+" "+b.jPlayer.emulateStatus+" "+b.jPlayer.emulateOptions).split(/\s+/g),function(b,d){delete a.internal.domNode[d]})}};b.jPlayer.error={FLASH:"e_flash",FLASH_DISABLED:"e_flash_disabled",NO_SOLUTION:"e_no_solution", 2491NO_SUPPORT:"e_no_support",URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"};b.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",FLASH_DISABLED:"jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ",NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.", 2492URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",VERSION:"jPlayer "+b.jPlayer.prototype.version.script+" needs Jplayer.swf version "+b.jPlayer.prototype.version.needFlash+" but found "};
2492b.jPlayer.errorHint={FLASH:"Check your swfPath option and that Jplayer.swf is there.",FLASH_DISABLED:"Check that you have not display:none; the jPlayer entity or any ancestor.",NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.", 2493URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."};b.jPlayer.warning={CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"};b.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of css selectors found did not equal one: ",CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.", 2494OPTION_KEY:"The option requested in jPlayer('option') is undefined."};b.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.