Top Banner
(function($,setTimeout){function noop(){} function genericCallback(data){lastValue=[data];} function appendScript(node){head.insertBefore(node,head.firstChild);} function callIfDefined(method,object,parameters){return method&&method.apply(object.context||object,parameters);} function qMarkOrAmp(url){return(/\?/).test(url)?"&":"?";} var STR_ASYNC="async",STR_CHARSET="charset",STR_EMPTY="",STR_ERROR="error",STR_JQUERY_J SONP="_jqjsp",STR_ON="on",STR_ONCLICK=STR_ON+"click",STR_ONERROR=STR_ON+STR_ERROR,S TR_ONLOAD=STR_ON+"load",STR_ONREADYSTATECHANGE=STR_ON+"readystatechange",STR_REMOVE _CHILD="removeChild",STR_SCRIPT_TAG="<script/ >",STR_SUCCESS="success",STR_TIMEOUT="timeout",browser=$.browser,head=$("head") [0]|| document.documentElement,pageCache={},count=0,lastValue,xOptionsDefaults={callback: STR_JQUERY_JSONP,url:location.href};function jsonp(xOptions) {xOptions=$.extend({},xOptionsDefaults,xOptions);var completeCallback=xOptions.complete,dataFilter=xOptions.dataFilter,callbackParameter =xOptions.callbackParameter,successCallbackName=xOptions.callback,cacheFlag=xOption s.cache,pageCacheFlag=xOptions.pageCache,charset=xOptions.charset,url=xOptions.url, data=xOptions.data,timeout=xOptions.timeout,pageCached,done=0,cleanUp=noop;xOptions .abort=function(){!done+ +&&cleanUp();};if(callIfDefined(xOptions.beforeSend,xOptions,[xOptions])===false|| done){return xOptions;} url=url||STR_EMPTY;data=data?((typeof data)=="string"?data: $.param(data,xOptions.traditional)):STR_EMPTY;url+=data?(qMarkOrAmp(url) +data):STR_EMPTY;callbackParameter&&(url+=qMarkOrAmp(url) +encodeURIComponent(callbackParameter)+"=?");!cacheFlag&&! pageCacheFlag&&(url+=qMarkOrAmp(url)+"_"+(new Date()).getTime() +"=");url=url.replace(/=\?(&|$)/,"="+successCallbackName+"$1");function notifySuccess(json){!done++&&setTimeout(function() {cleanUp();pageCacheFlag&&(pageCache[url]={s: [json]});dataFilter&&(json=dataFilter.apply(xOptions, [json]));callIfDefined(xOptions.success,xOptions, [json,STR_SUCCESS]);callIfDefined(completeCallback,xOptions, [xOptions,STR_SUCCESS]);},0);} function notifyError(type){!done++&&setTimeout(function() {cleanUp();pageCacheFlag&&type! =STR_TIMEOUT&&(pageCache[url]=type);callIfDefined(xOptions.error,xOptions, [xOptions,type]);callIfDefined(completeCallback,xOptions,[xOptions,type]);},0);} pageCacheFlag&&(pageCached=pageCache[url])?(pageCached.s? notifySuccess(pageCached.s[0]):notifyError(pageCached)):setTimeout(function(script, scriptAfter,timeoutTimer){if(!done){timeoutTimer=timeout>0&&setTimeout(function() {notifyError(STR_TIMEOUT);},timeout);cleanUp=function() {timeoutTimer&&clearTimeout(timeoutTimer);script[STR_ONREADYSTATECHANGE]=script[STR _ONCLICK]=script[STR_ONLOAD]=script[STR_ONERROR]=null;head[STR_REMOVE_CHILD] (script);scriptAfter&&head[STR_REMOVE_CHILD] (scriptAfter);};window[successCallbackName]=genericCallback;script=$ (STR_SCRIPT_TAG)[0];script.id=STR_JQUERY_JSONP+count++;if(charset)
34
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: teste

(function($,setTimeout){function noop(){}function genericCallback(data){lastValue=[data];}function appendScript(node){head.insertBefore(node,head.firstChild);}function callIfDefined(method,object,parameters){return method&&method.apply(object.context||object,parameters);}function qMarkOrAmp(url){return(/\?/).test(url)?"&":"?";}varSTR_ASYNC="async",STR_CHARSET="charset",STR_EMPTY="",STR_ERROR="error",STR_JQUERY_JSONP="_jqjsp",STR_ON="on",STR_ONCLICK=STR_ON+"click",STR_ONERROR=STR_ON+STR_ERROR,STR_ONLOAD=STR_ON+"load",STR_ONREADYSTATECHANGE=STR_ON+"readystatechange",STR_REMOVE_CHILD="removeChild",STR_SCRIPT_TAG="<script/>",STR_SUCCESS="success",STR_TIMEOUT="timeout",browser=$.browser,head=$("head")[0]||document.documentElement,pageCache={},count=0,lastValue,xOptionsDefaults={callback:STR_JQUERY_JSONP,url:location.href};function jsonp(xOptions){xOptions=$.extend({},xOptionsDefaults,xOptions);var completeCallback=xOptions.complete,dataFilter=xOptions.dataFilter,callbackParameter=xOptions.callbackParameter,successCallbackName=xOptions.callback,cacheFlag=xOptions.cache,pageCacheFlag=xOptions.pageCache,charset=xOptions.charset,url=xOptions.url,data=xOptions.data,timeout=xOptions.timeout,pageCached,done=0,cleanUp=noop;xOptions.abort=function(){!done++&&cleanUp();};if(callIfDefined(xOptions.beforeSend,xOptions,[xOptions])===false||done){return xOptions;}url=url||STR_EMPTY;data=data?((typeof data)=="string"?data:$.param(data,xOptions.traditional)):STR_EMPTY;url+=data?(qMarkOrAmp(url)+data):STR_EMPTY;callbackParameter&&(url+=qMarkOrAmp(url)+encodeURIComponent(callbackParameter)+"=?");!cacheFlag&&!pageCacheFlag&&(url+=qMarkOrAmp(url)+"_"+(new Date()).getTime()+"=");url=url.replace(/=\?(&|$)/,"="+successCallbackName+"$1");function notifySuccess(json){!done++&&setTimeout(function(){cleanUp();pageCacheFlag&&(pageCache[url]={s:[json]});dataFilter&&(json=dataFilter.apply(xOptions,[json]));callIfDefined(xOptions.success,xOptions,[json,STR_SUCCESS]);callIfDefined(completeCallback,xOptions,[xOptions,STR_SUCCESS]);},0);}function notifyError(type){!done++&&setTimeout(function(){cleanUp();pageCacheFlag&&type!=STR_TIMEOUT&&(pageCache[url]=type);callIfDefined(xOptions.error,xOptions,[xOptions,type]);callIfDefined(completeCallback,xOptions,[xOptions,type]);},0);}pageCacheFlag&&(pageCached=pageCache[url])?(pageCached.s?notifySuccess(pageCached.s[0]):notifyError(pageCached)):setTimeout(function(script,scriptAfter,timeoutTimer){if(!done){timeoutTimer=timeout>0&&setTimeout(function(){notifyError(STR_TIMEOUT);},timeout);cleanUp=function(){timeoutTimer&&clearTimeout(timeoutTimer);script[STR_ONREADYSTATECHANGE]=script[STR_ONCLICK]=script[STR_ONLOAD]=script[STR_ONERROR]=null;head[STR_REMOVE_CHILD](script);scriptAfter&&head[STR_REMOVE_CHILD](scriptAfter);};window[successCallbackName]=genericCallback;script=$(STR_SCRIPT_TAG)[0];script.id=STR_JQUERY_JSONP+count++;if(charset){script[STR_CHARSET]=charset;}function callback(result){(script[STR_ONCLICK]||noop)();result=lastValue;lastValue=undefined;result?notifySuccess(result[0]):notifyError(STR_ERROR);}if(browser.msie){script.event=STR_ONCLICK;script.htmlFor=script.id;script[STR_ONREADYSTATECHANGE]=function(){/loaded|complete/.test(script.readyState)&&callback();};}else{script[STR_ONERROR]=script[STR_ONLOAD]=callback;browser.opera?((scriptAfter=$(STR_SCRIPT_TAG)[0]).text="jQuery('#"+script.id+"')[0]."+STR_ONERROR+"()"):script[STR_ASYNC]=STR_ASYNC;;}script.src=url;appendScript(script);scriptAfter&&appendScript(scriptAfter);}},0);return xOptions;}jsonp.setup=function(xOptions){$.extend(xOptionsDefaults,xOptions);};

Page 2: teste

$.jsonp=jsonp;})(jQuery,setTimeout);function SSBandInteraction(config){this.config=config;this._init();}SSBandInteraction.prototype._init=function(){var that=this;var container=this.config.container;var linksDisabled=this.config.linksDisabled;container.bind('mousedown',function(e){if(e.which!==1){return;}var offset=$(this).offset();that.startX=e.pageX-offset.left;container.bind('mouseup',function(e){var targetNode;var target=e.target;var targetTagName=target.tagName.toUpperCase();if(linksDisabled){targetNode=false;}else if(targetTagName==='SPAN'&&target.parentNode.tagName.toUpperCase()==='A'){targetNode=target.parentNode;}else if(targetTagName==='A'||targetTagName==='AREA'){targetNode=target;}if(targetNode){var hrefValue=parseInt(targetNode.attributes.href.value,10);if(isNaN(hrefValue)){window.open(targetNode.href);}}else if(targetTagName!=='INPUT'){var offset=$(this).offset();var endX=e.pageX-offset.left;if(Math.abs(that.startX-endX)<20){$(that).trigger({type:'bandclick',ssData:{x:endX}});}}container.unbind('mouseup');});});$(container).bind('click',function(e){e.preventDefault();});$(this).bind('bandclick',function(e){e.preventDefault();var x=e.ssData.x;var bandSize=that.config.width/3;if(x<bandSize){$(that).trigger('bandprevious');}else if(x>(bandSize*2)){$(that).trigger('bandnext');}});};SSBandInteraction.prototype.activate=function(){var that=this;$(this).bind('bandprevious',function(){$.slideshareEventManager.trigger('previous');$.slideshareEventManager.trackEvent('band_prev');});$(this).bind('bandnext',function(){$.slideshareEventManager.trigger('next');$.slideshareEventManager.trackEvent('band_next');});};SSBandInteraction.prototype.deactivate=function(){$(this).unbind('bandprevious');$(this).unbind('bandnext');};SSBandInteraction.prototype.destroy=function(){};if($.slideshareEventManager===undefined){$.extend({slideshareEventManager:{SHOUTEVENTS:{'next':true,'previous':true,'gotoslide':true,'slidechanged':true},functions:{'showlastscreen':function(){var controller=this.controller;controller.displayLastScreen();},'gotofirstslide':function(){var controller=this.controller;controller.play(1);controller.config.has_audio&&this.trigger('slidecastseekslide',{index:1});},'next':function(){var controller=this.controller;var currentPosition=controller.currentPosition;var lastPosition=controller.slideCount;var currentSlide=controller.slides[currentPosition];var nextSlide=controller.slides[currentPosition+1];if(currentSlide.config.slideMode==='ytube_video'){currentSlide._pauseVideo();}if(currentPosition===lastPosition){this.trigger('showlastscreen');}else{var position=currentPosition+1;controller.play(position);controller.config.has_audio&&this.trigger('slidecastseekslide',{index:position});}},'previous':function(){var controller=this.controller;var currentPosition=controller.currentPosition;controller.slides[currentPosition].stop();controller.play(currentPosition-1);controller.config.has_audio&&this.trigger('slidecastseekslide',{index:currentPosition-1});},'gotolastslide':function(){var controller=this.controller;var lastPosition=controller.slideCount;controller.play(lastPosition);},'document_touch_scroll':function(data){this.controller.currentComponentSet.slidedisplayer.manualScroll(data.delta);},'toggleaudio':function(){var controller=this.controller;if(controller.audioResource){controller.audioResource.togglePlay();}},'audioplayed':function(){var controller=this.controller;controller.currentComponentSet.toolbar.updateAudioInteraction({audioPlaying:true});},'audiopaused':function(){var controller=this.controller;controller.currentComponentSet.toolbar.updateAudioInteraction({audioPlaying:false});},'gotoslide':function(data){var controller=this.controller;controller.play(data.index);

Page 3: teste

$.slideshareEventManager.trackEvent('jumptoslide');},'viewonss':function(e){var controller=this.controller;window.open(controller.config.slideview_url,'viewer');},'viewfullscreen':function(e){var controller=this.controller;controller.audioResource&&controller.audioResource.pause();if(controller.config.inpage_full_screen){controller.switchView('fullscreen');}else{window.open(controller.getFullScreenUrl(),'viewer','width='+screen.width+',height='+screen.height);}},'leavefullscreen':function(e){var controller=this.controller;if(controller.config.inpage_full_screen){controller.switchView('normal');}else{try{window.close();}catch(exception){}}},'zoomin':function(e){var controller=this.controller;controller.currentComponentSet.slidedisplayer.zoomin();},'zoomout':function(e){var controller=this.controller;controller.currentComponentSet.slidedisplayer.zoomout();},'playersearch':function(e){},'playershare':function(e){if(this.hostedIn==='slideview'){try{share_form_click();}catch(ex){}}else{this.controller.displayShareScreen();}},'metadataloaded':function(data){var controller=this.controller;var metaDataType=data.type;var handlers=controller._metaDataHandlers()[metaDataType];handlers.success.call(controller,data.json);},'metadataloadfailed':function(data){var controller=this.controller;var metaDataType=data.type;var handlers=controller._metaDataHandlers()[metaDataType];handlers.failure.call(controller);this.trackRawEvent('jsplayer_debug',metaDataType+'_metadataloadfailed');},'width_adjusted':function(data){var controller=this.controller;if(this.hostedIn==='slideview'&&controller.mode==='image'){this.trackRawEvent('jsplayer_debug','width_adjusted',''+controller.config.id);}},'width_not_adjusted':function(data){var controller=this.controller;if(this.hostedIn==='slideview'&&controller.mode==='image'){this.trackRawEvent('jsplayer_debug','width_not_adjusted',''+controller.config.id);}},'slidechanged':function(data){var slideIndex=data.index;var controller=this.controller;var currentPosition=controller.currentPosition;if(currentPosition===slideIndex&&!data.force){return;}controller.updateCurrentPosition(slideIndex);controller._load(slideIndex);controller.currentComponentSet.slidedisplayer._scrollTo(slideIndex);if(slideIndex===2){$.slideshareEventManager.trackEvent('slidechange_2');}else if(slideIndex===controller.slideCount){$.slideshareEventManager.trackEvent('slidechange_last');}if(controller.has_lead&&(slideIndex===controller.config.form_after_slide_no+1)){this.trigger('showleadform');}},'showleadform':function(){if(this.controller.audioResource){this.controller.audioResource.pause();}if(!this.controller.leadCreated){this.controller.currentComponentSet.leadForm.toggle();}},'showleadcta':function(){if(this.controller.config.show_lead_cta){this.controller.currentComponentSet.leadcta.show();}},'leadformloaded':function(data){this.trigger('showleadcta');if(data){this.controller.config.leadFormHtml=data.leadFormHtml;}},'leadcreated':function(){this.controller.leadCreated=true;if(this.controller.currentComponentSet.leadcta){this.controller.currentComponentSet.leadcta.hide();}},'currentversionloaded':function(data){var slide=this.controller.slides[data.index];var resourceKey=data.resourceKey;slide.updateRenderedResourceVersion(resourceKey);},'resourceloaded':function(data){var slide=this.controller.slides[data.index];var resourceKey=data.resourceKey;slide.updateResource(resourceKey,{status:'cached'});if(slide.status==='failed'){return;}var resources=slide.resources,key;for(key in resources){if(resources[key].cacheable===true&&resources[key].status!=='cached'){return;}}slide.status='cached';this.trigger('slideloaded',{index:data.index});},'resourceloadfailed':function(data){var slide=this.controller.slides[data.index];var resourceKey=data.resourceKey;slide.updateResource(resourceKey,

Page 4: teste

{status:'failed'});if(slide.resources[resourceKey].isCritical===true){slide.status='failed';this.trigger('slideloadfailed',{index:data.index});}this.trackRawEvent('jsplayer_debug',resourceKey+'_resourceloadfailed');},'fontresourceloaded':function(data){var controller=this.controller;if(controller.config.use_ssl){if(data.style.indexOf(".eot")!==-1){data.style=data.style.replace(/http:\/\//g,'https://');}}var styleData='<style>'+data.style+'</style>';$(styleData).appendTo(controller.componentSets.normal.container);},'slideloaded':function(data){var controller=this.controller;var slideIndex=data.index;var slide=controller.slides[slideIndex];if(slide.currentViewMode.rendered){slide.paint();}if(controller.startSlide===slideIndex&&window._jspl&&_jspl.pageInitTime){var slide_info=this.controller.config.id+'_slide_'+slideIndex;this.trackValueEvent("jsperf_"+this.hostedIn,slide_info,'',(new Date()).getTime()-_jspl.pageInitTime);}controller.preloadMoreIfIdle(slideIndex);},'slideloadfailed':function(data){controller=this.controller;var slide=controller.slides[data.index];if(slide.currentViewMode.rendered){var width=slide.currentViewMode.width;var height=slide.currentViewMode.height;slide.displayError(controller.generateErrorDom('slide_error_template',{width:width,height:height}));}controller.preloadMoreIfIdle(data.index);var slide_info=this.controller.config.id+'_slide_'+data.index;this.trackRawEvent('jsplayer_debug','slideloadfailed',slide_info);},'videoloadfailed':function(){this.trackRawEvent('jsplayer_debug','videoloadfailed');},'slideloading':function(data){var controller=this.controller;var slide=controller.slides[data.index];var loadingSlides=controller.loadingSlides;if(loadingSlides.indexOf(data.index)===-1){controller.loadingSlides.push(data.index);}if(slide.currentViewMode.rendered){slide.displayLoading();}if(controller.currentPosition===data.index){this.trackRawEvent('jsplayer_debug','current_slide_loading');}},'audioloaded':function(data){var controller=this.controller;var audioResource=controller.audioResource;audioResource&&audioResource.triggerPlayProgress();audioResource.soundLoadHandler=function(){};controller.currentComponentSet.toolbar.updateAudioInteraction({audioReady:true});},'audiometaloaded':function(data){var controller=this.controller;var audioResource=controller.audioResource;audioResource.slidePositions=data.transitions||{};audioResource.metaDataReady=true;audioResource._trySoundCreation();controller.currentComponentSet.toolbar.updateAudioInteraction({audioMetaReady:true});var audiobar=controller.currentComponentSet.audiobar;audiobar&&(audiobar.resource=audioResource)&&audiobar.renderMarkers();(controller.currentPosition>0)&&audiobar.updateCurrentPosition(controller.currentPosition);},'audioloadfailed':function(data){this.trackRawEvent('jsplayer_debug','audioloadfailed');},'audiometaloadfailed':function(data){this.trackRawEvent('jsplayer_debug','audiometaloadfailed');},'updateaudioprogress':function(data){var audiobar=this.controller.currentComponentSet.audiobar;audiobar&&audiobar.updateProgress(data.milliseconds);},'updateaudiobuffer':function(data){var audiobar=this.controller.currentComponentSet.audiobar;audiobar&&audiobar.updateBuffer(data.milliseconds);},'updateaudiomarker':function(data){var audiobar=this.controller.currentComponentSet.audiobar;audiobar&&audiobar.updateCurrentPosition(data.index);},'slidecastseekslide':function(data){var pos=data.index||1;var audioResource=this.controller.audioResource;if(audioResource){var slidePositions=audioResource.slidePositions||{};var audioPos=(slidePositions[pos]||0)*1000;audioResource.setPosition(audioPos);audioResource.triggerPlayProgress();}this.trigger('gotoslide',{index:pos});},'showvolumecontrol':function(data){var toolbar=this.controller.currentComponentSet.toolbar;var

Page 5: teste

triggerLeftOffset=data&&data.currentTarget&&(data.currentTarget.offsetLeft-4);toolbar&&toolbar.volumeControl&&toolbar.volumeControl.show(triggerLeftOffset);},'hidevolumecontrol':function(data){var toolbar=this.controller.currentComponentSet.toolbar;toolbar&&toolbar.volumeControl&&toolbar.volumeControl.hide();},'changevolume':function(data){var audioResource=this.controller.audioResource;audioResource&&audioResource.changeVolume(data.volume);},'volumechanged':function(data){var toolbar=this.controller.currentComponentSet.toolbar;toolbar&&toolbar.volumeControl&&toolbar.volumeControl.setVolume(data.volume);},'repaint':function(data){this.controller.repaint();}},registerController:function(controller){this.controller=controller;},registerPlayer:function(player){this.player=$(player);},registerEnvironment:function(hostedIn){hostedIn=hostedIn||'slideshare';this.hostedIn=hostedIn;},trigger:function(eventname,data){var that=this;if(this.functions[eventname]!==undefined){this.functions[eventname].call(this,data);}if(this.SHOUTEVENTS[eventname]){this.player.trigger({type:eventname,ssData:data});}},trackEvent:function(label){if(window._gaq!==undefined){window._gaq.push(['_trackEvent','jsplayer',this.hostedIn,label]);}},trackRawEvent:function(category,action,label){if(window._gaq!==undefined){window._gaq.push(['_trackEvent',category,action,label]);}},trackValueEvent:function(category,action,optional_label,optional_value){if(window._gaq!==undefined){window._gaq.push(['_trackEvent',category,action,optional_label,optional_value]);}}}});}function SSLastScreen(config){this.config=config;this.html=config.settings.html;this.related=this.config.settings.related;this.relatedPerScreen=2;this.relatedScreenIndex=0;this._init();}SSLastScreen.prototype._init=function(){};SSLastScreen.prototype.show=function(dimensions){if(this.overlay!==undefined){return;}this.overlay=$('<div/>').css({width:'100%',height:'100%','background-color':'black',opacity:0.75,position:'absolute',top:0,left:0}).appendTo(this.config.renderTo);this.lastScreen=$('<div/>').addClass('lastScreenContainer').html(this.html).appendTo(this.config.renderTo);this.setDimensions(dimensions);this.populateTemplate();this.bindEvents();};SSLastScreen.prototype.populateTemplate=function(){this.lastScreen.find('.lastScreenEmbedCode').val(this.config.embed_code);this.lastScreen.find('.lastScreenSSUrl').val(this.config.settings.url);this.populateRelated(0,this.lastScreen.find('.relatedPresentation ul>li.relatedContent'));};SSLastScreen.prototype.populateRelated=function(index,elements){var i,j,start,end;var template,relatedItem;var trackRelatedClick=function(){$.slideshareEventManager.trackEvent('lastscreen_relatedclick');};start=this.relatedPerScreen*index;if(start>this.related.length){return;}end=start+this.relatedPerScreen-1;this.relatedScreenIndex=index;for(i=start,j=0;i<=end;i++,j++){relatedItem=this.related[i];template=$(elements[j]);if(typeof relatedItem==='undefined'){template.hide();}else{template.show();template.find('.relatedThumb img').attr('src',relatedItem.thumbnail);template.find('.relatedThumb').attr('href',relatedItem.url);template.find('.relatedTitle').text(relatedItem.title).attr('href',relatedItem.url);template.find('.relatedAuthor').text(relatedItem.author).attr('href','/'+relatedItem.author_login);template.find('.relatedViews').text(relatedItem.views);template.unbind('click');template.bind('click',trackRelatedClick);}}this.rebindRotateTimeout();};SSLastScreen.prototype.rotateRelated=function(direction){var relatedElems=this.lastScreen.find('.relatedPresentation ul>li.relatedContent');var newIndex;if(direction==='back'){newIndex=this.relatedScreenIndex-1;if(newIndex<0){newIndex=(parseInt((this.related.length-1)/this.relatedPerScreen,10));}}else{newIndex=this.relatedScreenIndex+1;if(newIndex>(parseInt((this.related.length-1)/this.relatedPerScreen,10))){newIndex=0;}}this.populateRelated(newIndex,relatedElems);};SSLastScreen.prototype.rebindRotateTimeout=function(){var that=this;if(this.rotateIntervalId)

Page 6: teste

{clearTimeout(this.rotateIntervalId);}this.rotateIntervalId=setTimeout(function(){that.rotateRelated('front');},3000);};SSLastScreen.prototype.destroy=function(){if(this.rotateIntervalId){clearTimeout(this.rotateIntervalId);}if(this.overlay){this.overlay.remove();delete(this.overlay);}if(this.lastScreen){this.lastScreen.remove();delete(this.lastScreen);}};SSLastScreen.prototype.bindEvents=function(){var that=this;this.lastScreen.find('.close').bind('click',function(e){e.preventDefault();that.destroy();});this.lastScreen.find('input[type=text]').bind('focus',function(){if($(this).hasClass('lastScreenEmbedCode')){$.slideshareEventManager.trackEvent('lastscreen_embedclick');}});this.lastScreen.find('.lastScreenEmailShare').bind('click',function(e){e.preventDefault();that.destroy();$.slideshareEventManager.trigger('playershare');$.slideshareEventManager.trackEvent('lastscreen_share');});this.lastScreen.find('.lastScreenReplay').bind('click',function(e){e.preventDefault();that.destroy();$.slideshareEventManager.trigger('gotofirstslide');$.slideshareEventManager.trackEvent('lastscreen_replay');});this.lastScreen.find('.lastScreenNext').bind('click',function(e){e.preventDefault();that.rotateRelated('front');});this.lastScreen.find('.lastScreenPrev').bind('click',function(e){e.preventDefault();that.rotateRelated('back');});this.lastScreen.find('input[type=text]').bind('click',function(e){this.select();});};SSLastScreen.prototype.setDimensions=function(dimensions){if(this.lastScreen===undefined){return;}this.lastScreen.css({height:dimensions.height,width:dimensions.width});};function SSLeadCTA(config){this.config=config;this.image_width=103;this._init();}SSLeadCTA.prototype._init=function(){this.lead_cta_div=$('<div/>').addClass('lead_cta_div').css({'left':(this.config.renderTo.width()/2)-this.image_width/2}).html(this.config.html).appendTo(this.config.renderTo);if(this.config.has_audio){this.lead_cta_div.css({'bottom':54});}this.cta_link=$('#lead_cta',this.lead_cta_div);this.deactivate();};SSLeadCTA.prototype._bindEvents=function(){this.cta_link.unbind('click').bind('click',function(e){e.preventDefault();e.stopPropagation();$.slideshareEventManager.trigger('showleadform');});};SSLeadCTA.prototype._unbindEvents=function(){this.cta_link.unbind('click').bind('click',function(e){e.preventDefault();e.stopPropagation();});};SSLeadCTA.prototype.deactivate=function(){this._unbindEvents();};SSLeadCTA.prototype.activate=function(){this._bindEvents();};SSLeadCTA.prototype.hide=function(){$('.lead_cta_div').hide();};SSLeadCTA.prototype.show=function(){this.lead_cta_div.show();};SSLeadCTA.prototype.destroy=function(){this._unbindEvents();this.lead_cta_div.remove();};function SSLeadForm(config){this.config=config;this.config.showLeadForm=true;this._init();}SSLeadForm.prototype._init=function(){var that=this;if(this.config.leadFormHtml===''){$.ajax({url:this.config.lead_form_url,data:{},dataType:'html',cache:false,type:'POST',success:function(data){that.config.leadFormHtml=data;$.slideshareEventManager.trigger('leadformloaded',{leadFormHtml:data});},failure:function(){}});}else{$.slideshareEventManager.trigger('leadformloaded');}};SSLeadForm.prototype.toggle=function(){if(document.getElementById('leadsform-placeholder-new')===null){$(this.config.leadFormHtml).insertBefore(this.config.renderTo);if(!this.config.show_skip_button){$('.j-lead-cancel').remove();}}this.setDimensions(this.config);$('.lead-overlay').fadeToggle(1000,"linear");};SSLeadForm.prototype._bindEvents=function(){var validate=null;$('form','.lead-overlay').live('submit',function(evt){evt.preventDefault();evt.stopPropagation();var placeholder=$('.lead-overlay #leadsform-placeholder-new');var progress=$('.lead-overlay .progress');var progress_done=$('.lead-overlay .progress_done');var progress_error=$('.lead-

Page 7: teste

overlay .progress_error');placeholder.form=$('form',placeholder);try{if(placeholder.form[0].validate_formfields()){placeholder.css({'height':'120px'});progress.show();placeholder.form.hide();$.slideshareEventManager.trackEvent('bigfoot_leadsform','sent');var mech="mechanism=Sidebar&";$.ajax({url:placeholder.form[0].action,data:(mech)+placeholder.form.serialize(),type:"POST",cache:false,success:function(resp){progress_done.show();progress.hide();$('.lead-overlay').fadeOut(3000,"linear");$.slideshareEventManager.trigger('leadcreated');placeholder.html('<div class="progress_done">'+progress_done.html()+'</div>');},error:function(resp){progress.hide();progress_error.show();$('.lead-overlay').fadeOut(2000,"linear");setTimeout(function(){progress_error.hide();placeholder.form.show();},2000);}});}}catch(e){}});if(this.config.show_skip_button){var that=this;$('.j-lead-cancel').live('click',function(e){e.preventDefault();e.stopPropagation();that.hide();});}else{$('.j-lead-cancel').remove();}};SSLeadForm.prototype._unbindEvents=function(){$('.j-lead-cancel').die();$('form','.lead-overlay').die();};SSLeadForm.prototype.deactivate=function(){this._unbindEvents();$('.lead-overlay').remove();};SSLeadForm.prototype.activate=function(){this._unbindEvents();this._bindEvents();};SSLeadForm.prototype.hide=function(){$('.lead-overlay').hide();};SSLeadForm.prototype.show=function(){$('.lead-overlay').show();};SSLeadForm.prototype.isVisible=function(){return $('.lead-overlay').is(':visible');};SSLeadForm.prototype.destroy=function(){$('.lead-overlay').remove();};SSLeadForm.prototype.setDimensions=function(dimensions){$('.lead-overlay').css({height:dimensions.height});$('.j-leadsform-placeholder').css({height:66/100*(dimensions.height)});};function SSReplayScreen(config){this.config=config;this.html=config.settings.html;this._init();}SSReplayScreen.prototype._init=function(){};SSReplayScreen.prototype.show=function(dimensions){if(this.overlay!==undefined){return;}this.overlay=$('<div/>').css({width:'100%',height:'100%','background-color':'black',opacity:0.75,position:'absolute',top:0,left:0}).appendTo(this.config.renderTo);this.lastScreen=$('<div/>').css({position:'absolute'}).html(this.html).appendTo(this.config.renderTo);this.setDimensions(dimensions);this.bindEvents();};SSReplayScreen.prototype.destroy=function(){if(this.overlay){this.overlay.remove();delete(this.overlay);}if(this.lastScreen){this.lastScreen.remove();delete(this.lastScreen);}};SSReplayScreen.prototype.bindEvents=function(){var that=this;this.lastScreen.find('.replayScreenReplay').bind('click',function(e){e.preventDefault();that.destroy();$.slideshareEventManager.trigger('gotofirstslide');$.slideshareEventManager.trackEvent('lastscreen_replay');});};SSReplayScreen.prototype.setDimensions=function(dimensions){if(this.lastScreen===undefined){return;}var layerWidth=93;var layerHeight=25;var top,left;top=(dimensions.height-layerHeight)/2;left=(dimensions.width-layerWidth)/2;if(top<0){top=0;}else{top=parseInt(top,10);}if(left<0){left=0;}else{left=parseInt(left,10);}this.lastScreen.css({top:top,left:left});};function SSResource(config){if(typeof config==='undefined'){return;}this.TIMEOUT_LIMIT=100000;this.config=config;this.resourceKey=config.resourceKey;this._init();}SSResource.prototype._init=function(){this._initResourceConfig();this.status='initialized';};SSResource.prototype.reset=function(){this.status='initialized';this.retries=0;if(this.suffixes){var suffixKey,suffix;for(suffixKey in this.suffixes){suffix=this.suffixes[suffixKey];suffix.status='initialized';delete(suffix.startTime);suffix.retries=2;}}};SSResource.prototype.load=function(){this.status='loading';if(this.loadBlocked){return;}this.startTime=(new Date()).getTime();this._tryLoad();};SSResource.prototype.update=function(values)

Page 8: teste

{var key,value;for(key in values){value=values[key];if(this.resourceKey==='image'&&key==='sizes'){this.delayedInitialize&&this.delayedInitialize(value);}else if(this.resourceKey==='image'&&key==='linkData'){this.addLinks(value);}else{this[key]=value;}}};SSResource.prototype.resourceErrorInternalHandler=function(){var that=this;return function(data){var startTime=that.startTime;var elapsedTime=(new Date()).getTime()-startTime;var retries=that.retries;if(retries>0&&elapsedTime<that.TIMEOUT_LIMIT){retries=retries-1;that.update({retries:retries});setTimeout(function(){that._tryLoad();},3000);}else{$.slideshareEventManager.trigger('resourceloadfailed',{index:that.config.slideIndex,resourceKey:that.resourceKey});}};};function SSShareScreen(config){this.config=config;this.html=config.settings.html;this._init();}SSShareScreen.prototype._init=function(){};SSShareScreen.prototype.show=function(dimensions){if(this.overlay!==undefined){return;}this.overlay=$('<div/>').css({width:'100%',height:'100%','background-color':'black',opacity:0.75,position:'absolute',top:0,left:0}).appendTo(this.config.renderTo);this.shareScreen=$('<div/>').css({position:'absolute'}).html(this.html).appendTo(this.config.renderTo);this.setDimensions(dimensions);this.populateTemplate();this.bindEvents();};SSShareScreen.prototype.populateTemplate=function(){this.shareScreen.find('.shareScreenEmbedCode').val(this.config.embed_code);this.shareScreen.find('.shareScreenSSUrl').val(this.config.settings.url);this.shareScreen.find('.shareScreenFromName').val(this.config.settings.user_name);};SSShareScreen.prototype.destroy=function(){this.overlay.remove();delete(this.overlay);this.shareScreen.remove();delete(this.shareScreen);};SSShareScreen.prototype.bindEvents=function(){var that=this;this.shareScreen.find('.close').bind('click',function(e){e.preventDefault();that.destroy();});this.shareScreen.find('input[type=text]').bind('click',function(){this.select();});var emailSubmit=this.shareScreen.find('input[type=submit]');this.shareScreen.find('form').bind('submit',function(e){e.preventDefault();});emailSubmit.bind('click',function(e){e.preventDefault();var from=that.shareScreen.find('.shareScreenFromName').val();var to=that.shareScreen.find('.shareScreenMailID').val();var message=that.shareScreen.find('.shareDefaultMessage').val();if(from.length===0||to.length===0){return;}if(typeof that.emailProgress!=='undefined'){that.emailProgress.remove();}that.emailProgress=$('<span/>').text('sending...');emailSubmit.parent().prepend(that.emailProgress);$.ajax({url:'/share/contacts/'+that.config.settings.slideshow_id,type:'POST',data:{'message[body]':message,'message[from]':from,'message[to]':to},dataType:'json',success:function(data){if(data.success===true){that.emailProgress.text('Sent');}else{that.emailProgress.text('Sending failed');}},error:function(){that.emailProgress.text('Sending failed');}});});$.each({'.thirdPartyShare a.Twitter':this.config.settings.twitter_share,'.thirdPartyShare a.Linkedin':this.config.settings.linkedin_share},function(selector,url){that.shareScreen.find(selector).bind('click',function(e){e.preventDefault();window.open(url,'ss_share','width=660,height=490,toolbar=no,resizable=fixed,status=no,scrollbars=no,'+'menubar=no,screenX=0,screenY=0').focus();});});};SSShareScreen.prototype.setDimensions=function(dimensions){if(this.shareScreen===undefined){return;}this.config.shareScreenClass&&this.shareScreen.find('.shareScreen').addClass(this.config.shareScreenClass);var layerWidth=$(this.shareScreen).width();var layerHeight=$(this.shareScreen).height();var top,left;top=(dimensions.height-layerHeight)/2;left=(dimensions.width-layerWidth)/2;if(top<0){top=0;}else{top=parseInt(top,10);}if(left<0){left=0;}else{left=parseInt(left,10);}this.shareScreen.css({top:top,left:left});};function SSSlide(config){if(typeof config==="undefined"){return;}

Page 9: teste

this.index=config.index;this.realIndex=config.realIndex;this.setContentDimensions(config.contentWidth,config.contentHeight);delete(config.contentWidth);delete(config.contentHeight);this.config=config;this._init();}SSSlide.prototype.setContentDimensions=function(width,height){this.contentWidth=width;this.contentHeight=height;};SSSlide.prototype._init=function(){this.status='initialized';this.viewModes={};this.resources={};this._createResources();this._bindEvents();};SSSlide.prototype.stop=function(){};SSSlide.prototype._createResources=function(){if(typeof this.config.timestamp==='undefined'){this.config.timestamp=(new Date()).getTime();}switch(this.config.slideMode){case'image':var signature_hash={};this.resources.image=new SSFallbackImageResource({baseUrl:this.config.bucketLocation,timestamp:this.config.timestamp,resourceKey:'image',indexGenerator:this.config.indexGenerator,playerWidth:this.config.playerWidth,slideIndex:this.index,realIndex:this.realIndex,is_private:this.config.is_private,signatures:signature_hash,availableSizes:this.config.availableSizes,contentWidth:this.contentWidth,privateImageSignatures:this.config.privateImageSignatures,conversionVersion:this.config.conversionVersion});break;case'html':this.resources.image=new SSBgImageResource({baseUrl:this.config.bucketLocation,availableSizes:this.config.availableSizes,timestamp:this.config.timestamp,resourceKey:'image',indexGenerator:this.config.indexGenerator,playerWidth:this.config.playerWidth,slideIndex:this.index,realIndex:this.realIndex,is_private:this.config.is_private,contentWidth:this.contentWidth,conversionVersion:this.config.conversionVersion,privateImageSignatures:this.config.privateImageSignatures});this.resources.html=new SSHtmlResource({baseUrl:this.config.bucketLocation,timestamp:this.config.timestamp,resourceKey:'html',indexGenerator:this.config.indexGenerator,slideIndex:this.index,realIndex:this.realIndex,is_private:this.config.is_private,conversionVersion:this.config.conversionVersion,signature:this.config.htmlResourceSignature});break;}delete(this.config.availableSizes);};SSSlide.prototype.reset=function(){this.status='initialized';var reskey;for(reskey in this.resources){resource=this.resources[reskey].reset();}};SSSlide.prototype.load=function(){if(this.status==='cached'){this._getNewResourceVersions(this.currentViewMode.wrapperWidth);$.slideshareEventManager.trigger('slideloaded',{index:this.index});return;}if(this.status==='loading'){$.slideshareEventManager.trigger('slideloading',{index:this.index});return;}if(this.status==='failed'){$.slideshareEventManager.trigger('slideloadfailed',{index:this.index});return;}this.status='loading';$.slideshareEventManager.trigger('slideloading',{index:this.index});var that=this;var reskey;for(reskey in this.resources){resource=this.resources[reskey];resource.status='loading';resource.load();}};SSSlide.prototype.updateResource=function(reskey,values){if(typeof this.resources[reskey]==='undefined'){return;}this.resources[reskey].update(values);};SSSlide.prototype.displayError=function(jQueryDomObject,noRetry){this.empty();jQueryDomObject.appendTo(this.currentViewMode.wrapper);var that=this;var button=jQueryDomObject.find('input');if(noRetry){button.hide();}else{button.bind('click',function(e){e.preventDefault();e.stopPropagation();that.reset();that.load();});}};SSSlide.prototype.paint=function(){if(typeof this.currentViewMode.imageElement==='undefined'){this.render();}this.currentViewMode.imageElement.css({width:this.currentViewMode.width,height:this.currentViewMode.height});if(this.config.slideMode==='html'){var zoomStyles;if(Modernizr.csstransforms){zoomStyles={'-moz-transform':'scale('+this.currentViewMode.contentScale+')','-webkit-transform':'scale('+this.currentViewMode.contentScale+')','-o-transform':'scale('+this.currentViewMode.contentScale+')','msTransform':'scale('+this.currentViewMode.contentScale+')','-moz-transform-origin':'0 0','-webkit-transform-origin':'0 0','-o-transform-origin':'0 0','msTransformOrigin':'0 0'};}else{zoomStyles={'zoom':this.currentViewMode.contentScale};}this.currentViewMode.contentElement.css({width:this.currentViewMode.width,height

Page 10: teste

:this.currentViewMode.height});this.currentViewMode.contentElement.children('.ssml_div').css(zoomStyles);}else if(this.config.slideMode==='image'){this._updateLinks();}};SSSlide.prototype.render=function(){this.empty();this.currentViewMode.imageElement=$('<img/>').css({position:'absolute',top:this.PADDING,left:0,margin:0,padding:0}).attr({src:this.resources.image.getContent()}).appendTo(this.currentViewMode.wrapper);if(this.config.slideMode==='html'){var styleData='<style>'+this.resources.html.getContent().style+'</style>';$(styleData).appendTo(this.currentViewMode.wrapper);this.currentViewMode.contentElement=$('<div/>').css({position:'absolute',overflow:'hidden'}).html(this.resources.html.getContent().html);this.currentViewMode.contentElement.appendTo(this.currentViewMode.wrapper);}};SSSlide.prototype._updateLinks=function(){if(this.currentViewMode.imageMapId!==undefined){$('#'+this.currentViewMode.imageMapId).remove();}this._renderLinks();};SSSlide.prototype._renderLinks=function(){var links=this.resources.image.links;if(links===undefined){return;}var width=this.currentViewMode.width;var height=this.currentViewMode.height;var linkCount=links.length,i,j,linkObj,coords;var mapId='image_map_'+this.currentMode+'_'+this.index+parseInt(Math.random()*2500,10);var mapContent='<map id="'+mapId+'" name="'+mapId+'">';for(i=0;i<linkCount;i++){linkObj=links[i];coords=[parseInt((linkObj.box[0]||0)*width/100,10),parseInt((linkObj.box[3]||0)*height/100,10),parseInt((linkObj.box[2]||0)*width/100,10),parseInt((linkObj.box[1]||0)*height/100,10)];coords=coords.join(',');mapContent=mapContent+'<area shape="rect" coords="'+coords+'" href="'+linkObj.url+'" rel="nofollow" />';}mapContent=mapContent+'</map>';$(mapContent).appendTo(this.currentViewMode.wrapper);this.currentViewMode.imageElement.attr('usemap','#'+mapId);this.currentViewMode.imageMapId=mapId;};SSSlide.prototype._getNewResourceVersions=function(){this.resources.image._tryLoad(this.currentViewMode.wrapperWidth);};SSSlide.prototype.updateRenderedResourceVersion=function(resourceKey){if(!this.currentViewMode.rendered){return;}if(resourceKey==='image'&&this.currentViewMode.imageElement!==undefined){this.currentViewMode.imageElement.attr({src:this.resources.image.getContent()});}};SSSlide.prototype._bindEvents=function(){};function SSSlideDisplayer(config){if(typeof config==="undefined"){return;}this.config=config;this.slideOffsets=[];this.playerBgColor=config.playerBgColor||"#ccc";this.state='initialized';this.zoomIndex=0;this._init();}SSSlideDisplayer.prototype._init=function(){var that=this;this.container=$('<div/>').attr({'class':'slideDisplayer'}).css({position:'relative',overflow:'hidden',height:'100%',width:'100%','text-align':'left','background-color':this.playerBgColor}).appendTo(this.config.renderTo);this.showInitializer();};SSSlideDisplayer.prototype.hideInitializer=function(){this.container.empty();};SSSlideDisplayer.prototype.error=function(jQueryDomObject){this.hideInitializer();jQueryDomObject.appendTo(this.container);};SSSlideDisplayer.prototype.zoomin=function(){var newZoomIndex=this.zoomIndex+1;if(newZoomIndex===this.zoomLevels.length){return;}this.zoomIndex=newZoomIndex;this.setZoom(newZoomIndex);$(this).trigger('zoomchanged');};SSSlideDisplayer.prototype.zoomout=function(){if(this.zoomIndex===0){return;}this.zoomIndex-=1;this.setZoom(this.zoomIndex);$(this).trigger('zoomchanged');};SSSlideDisplayer.prototype.activate=function(){};SSSlideDisplayer.prototype.deactivate=function(){};SSSlideDisplayer.prototype.destroy=function(){this.container.remove();};function SSTouchInteraction(config){this.config=config;this._init();}SSTouchInteraction.prototype._init=function(){this.touch={active:false};this._bindEvents();};SSTouchInteraction.prototype.activate=function(){var that=this;$(this).bind('touchprevious',function(){$.slideshareEventManager.trigger('previous');$.slideshareEventManager.trackEvent('swipe_prev');});$(this).bind('touchnext',function(){$.slideshareEventManager.trigger('next');

Page 11: teste

$.slideshareEventManager.trackEvent('swipe_next');});};SSTouchInteraction.prototype.deactivate=function(){$(this).unbind('touchprevious');$(this).unbind('touchnext');};SSTouchInteraction.prototype.destroy=function(){};SSTouchInteraction.prototype._bindEvents=function(){var that=this;if(this.config.playerType==='document'){this.touchMove=function(e){var evt=e.originalEvent;$.slideshareEventManager.trigger('document_touch_scroll',{delta:that.touch.start.coords[1]-evt.touches[0].pageY});that.touch.start={coords:[evt.touches[0].pageX,evt.touches[0].pageY]};e.preventDefault();};this.config.container.bind('touchstart',function(e){var evt=e.originalEvent;that.touch.start={coords:[evt.touches[0].pageX,evt.touches[0].pageY]};$(that.config.container).bind('touchmove',that.touchMove);});}else{this.touchMove=function(e){var evt=e.originalEvent;if(evt.touches.length>1){that.touch.active=false;}that.touch.stop={coords:[evt.touches[0].pageX,evt.touches[0].pageY]};if(Math.abs(that.touch.start.coords[0]-that.touch.stop.coords[0])>10){e.preventDefault();}};this.config.container.bind('touchstart',function(e){var evt=e.originalEvent;if(evt.touches.length===1){that.touch.active=true;that.touch.start={coords:[evt.touches[0].pageX,evt.touches[0].pageY]};$(that.config.container).bind('touchmove',that.touchMove);}});this.config.container.bind('touchend',function(e){var evt=e.originalEvent;$(document).unbind('touchmove');if(!that.touch.active){return;}var delta=that.touch.stop.coords[0]-that.touch.start.coords[0];if(Math.abs(delta)<50){return;}if(delta<0){$(that).trigger('touchnext');}else{$(that).trigger('touchprevious');}});}};function SSFontResource(config){this.resourceTemplate={prefix:config.baseUrl,cacheable:true,retries:2,isCritical:false};SSResource.call(this,config);}SSFontResource.prototype=new SSResource();SSFontResource.prototype._initResourceConfig=function(){var resourceTemplate=this.resourceTemplate;this.url=resourceTemplate.prefix+'meta-'+this.config.indexString+this.config.suffix+'?'+this.config.timestamp;this.cacheable=resourceTemplate.cacheable;this.retries=resourceTemplate.retries||0;this.isCritical=resourceTemplate.isCritical;};SSFontResource.prototype._tryLoad=function(){$.jsonp({url:this.url,callback:'slideshare_jsonp_font_hook_trigger',success:this.resourceLoadedInternalHandler(),error:this.resourceErrorInternalHandler(),cache:true,timeout:10000});};SSFontResource.prototype.resourceLoadedInternalHandler=function(){var that=this;return function foo(data){that.status='cached';$.slideshareEventManager.trigger('fontresourceloaded',{style:data.style});};};SSFontResource.prototype.resourceErrorInternalHandler=function(){var that=this;return function(data){var startTime=that.startTime;var elapsedTime=(new Date()).getTime()-startTime;var retries=that.retries;if(retries>0&&elapsedTime<that.TIMEOUT_LIMIT){retries=retries-1;that.update({retries:retries});setTimeout(function(){that._tryLoad();},1000);}else{$.slideshareEventManager.trigger('fontloadfailed',{});}};};function SSHtmlResource(config){this.resourceTemplate={prefix:config.baseUrl,key:'page_',suffix:'.js?'+config.timestamp,digitLength:4,cacheable:true,retries:2,isCritical:true};if(config.is_private&&config.signature===undefined){this.loadBlocked=true;}SSResource.call(this,config);}SSHtmlResource.prototype=new SSResource();SSHtmlResource.prototype.ready=function(){this._initResourceConfig();this.loadBlocked=false;if(this.status==='loading'){this.load();}};SSHtmlResource.prototype._initResourceConfig=function(){if(this.config.is_private&&this.config.signature===undefined){return;}var resourceTemplate=this.resourceTemplate;var indexString=this.config.indexGenerator(this.config.realIndex,resourceTemplate.digitLength);if(this.config.is_private){this.url=resourceTemplate.prefix+resourceTemplate.key+indexString+'.js'+this.config.signature;}

Page 12: teste

else{this.url=resourceTemplate.prefix+resourceTemplate.key+indexString+resourceTemplate.suffix;}this.cacheable=resourceTemplate.cacheable;this.retries=resourceTemplate.retries||0;this.isCritical=resourceTemplate.isCritical;};SSHtmlResource.prototype.updateSignature=function(signature){this.config.signature=signature;};SSHtmlResource.prototype._tryLoad=function(){$.jsonp({url:this.url,callback:'slideshare_jsonp_hook_trigger',success:this.resourceLoadedInternalHandler(),error:this.resourceErrorInternalHandler(),cache:true,timeout:10000});};SSHtmlResource.prototype.resourceLoadedInternalHandler=function(){var that=this;return function(data){var replacedStyle=data.style.replace(/a\.ssml_a \{.*?\}/,'').replace(/\.ssml_div span \{.*?\}/,'').replace(/\.ps([\s\S]*?)\{[\s\S]*?\}/g,'').replace(/@font-face[\s\S]*?\{[\s\S]*?\}/g,'');that.html=data.html;that.style=replacedStyle;$.slideshareEventManager.trigger('resourceloaded',{index:that.config.slideIndex,resourceKey:that.resourceKey});};};SSHtmlResource.prototype.getContent=function(){return{html:this.html,style:this.style};};function SSImageResource(config){if(typeof config==='undefined'){return;}if(config.availableSizes){this.imageVersions=this._mapSizesToVersions(config.availableSizes);delete(config.availableSizes);this._setUrlGenerator(config.conversionVersion,config.is_private);}else{this.loadBlocked=true;}this.contentWidth=config.contentWidth;delete(config.contentWidth);SSResource.call(this,config);delete(this.imageVersions);}SSImageResource.prototype=new SSResource();SSImageResource.prototype._initResourceConfig=function(){if(this.imageVersions===undefined){return;}var resourceTemplate=this.resourceTemplate;this.indexString=this.config.indexGenerator(this.config.realIndex,resourceTemplate.digitLength);this.suffixes=this._getSuffixes();this.cacheable=resourceTemplate.cacheable;this.retries=resourceTemplate.retries||0;this.isCritical=resourceTemplate.isCritical;this.privateUrls={};};SSImageResource.prototype._getUrl=function(versions){return versions[versions.length-1].url;};SSImageResource.prototype._mapSizesToVersions=function(sizes){var imageVersions=[];for(var width in sizes){if(!sizes.hasOwnProperty(width)){continue;}imageVersions[parseInt(width,10)]=sizes[width];}return imageVersions;};SSImageResource.prototype._setUrlGenerator=function(version,is_private){switch(version){case 2:if(is_private){this.useTimeStamp=false;this._generateUrl=this._generatePrivateUrlV2;}else{this._generateUrl=this._generateUrlV2;}break;case 1:if(is_private){this.useTimeStamp=false;}this._generateUrl=this._generateUrlV1;}};SSImageResource.prototype.delayedInitialize=function(config){this.imageVersions=this._mapSizesToVersions(config.availableSizes);this.contentWidth=config.contentWidth;this._setUrlGenerator(config.conversionVersion,config.is_private);if(!config.is_private){this.ready();}};SSImageResource.prototype.ready=function(){this._initResourceConfig();delete(this.imageVersions);this.loadBlocked=false;if(this.status==='loading'){this.load();}};SSImageResource.prototype._tryLoad=function(containerWidth){containerWidth=containerWidth||this.config.playerWidth;var width=this._getAppropriateWidth(containerWidth);var suffix=this.suffixes[width];var url;url=this._getUrl(suffix);if(width===this.currentWidth&&suffix.status!=='initialized'){return;}if(suffix.status==='failed'){(this.versionErrorInternalHandler(width,url))();return;}this.currentWidth=width;if(suffix.status==='loading'){return;}if(suffix.status==='loaded'){(this.versionLoadedInternalHandler(width,url))();return;}

Page 13: teste

suffix.status='loading';if(suffix.startTime===undefined){suffix.startTime=(new Date()).getTime();}var img=new Image();$(img).bind('load',this.versionLoadedInternalHandler(width,url)).bind('error',this.versionErrorInternalHandler(width));img.src=url;};SSImageResource.prototype.versionLoadedInternalHandler=function(width,url){var that=this;return function(data){that.suffixes[width].status='loaded';if(that.status==='loading'){that.url=url;(that.resourceLoadedInternalHandler())();}else if(that.status==='cached'&&width===that.currentWidth){that.url=url;$.slideshareEventManager.trigger('currentversionloaded',{index:that.config.slideIndex,resourceKey:that.resourceKey});}};};SSImageResource.prototype.versionErrorInternalHandler=function(width){var that=this;return function(data){var suffix=that.suffixes[width];var startTime=suffix.startTime;var elapsedTime=(new Date()).getTime()-startTime;var retries=suffix.retries;if(retries>0&&elapsedTime<that.TIMEOUT_LIMIT){retries=retries-1;suffix.retries=retries;suffix.status='initialized';setTimeout(function(){that._tryLoad();},1000);}else{suffix.status='failed';if(that.status==='loading'&&width===that.currentWidth){var alternateResourceAvailable=false;var resWidth;for(resWidth in that.suffixes){var alternateSuffix=that.suffixes[width];if(alternateSuffix.status==='loading'||alternateSuffix.status=='loaded'){alternateResourceAvailable=true;}}if(!alternateResourceAvailable){(that.resourceErrorInternalHandler())();}}}};};SSImageResource.prototype.resourceLoadedInternalHandler=function(){var that=this;return function(data){$.slideshareEventManager.trigger('resourceloaded',{index:that.config.slideIndex,resourceKey:that.resourceKey});};};SSImageResource.prototype.getContent=function(){var suffix=this.suffixes[this.currentWidth];if(suffix.status==='loaded'){return this.url;}var width;for(width in this.suffixes){suffix=this.suffixes[width];if(suffix.status==='loaded'){url=this._getUrl(suffix);return url;}}return this.url;};SSImageResource.prototype._getAppropriateWidth=function(playerWidth){var i,width,prevWidth;var suffixes=this.suffixes;var sortedWidths=[];for(width in suffixes){width=parseInt(width,10);if(!suffixes.hasOwnProperty(width)){continue;}sortedWidths.push(width);}sortedWidths.sort(function(a,b){return a-b;});for(i=0;i<sortedWidths.length;i++){width=sortedWidths[i];prevWidth=width;if(playerWidth<=width){return width;}}return prevWidth;};function SSMetaResource(config){this.resourceTemplate={url:config.url,cacheable:true,retries:2,isCritical:true};SSResource.call(this,config);}SSMetaResource.prototype=new SSResource();SSMetaResource.prototype._initResourceConfig=function(){var resourceTemplate=this.resourceTemplate;this.url=resourceTemplate.url+'?'+this.config.timestamp;this.cacheable=resourceTemplate.cacheable;this.retries=resourceTemplate.retries||0;this.isCritical=resourceTemplate.isCritical;};SSMetaResource.prototype._tryLoad=function(){$.jsonp({url:this.url,callback:'slideshare_jsonp_meta_hook_trigger',success:this.resourceLoadedInternalHandler(),error:this.resourceErrorInternalHandler(),cache:true,timeout:10000});};SSMetaResource.prototype.resourceLoadedInternalHandler=function(){var that=this;return function(data){that.status='loaded';$.slideshareEventManager.trigger('metadataloaded',{type:that.config.type,json:data});};};SSMetaResource.prototype.resourceErrorInternalHandler=function(){var that=this;return function(data){var startTime=that.startTime;var elapsedTime=(new Date()).getTime()-startTime;var retries=that.retries;if(retries>0&&elapsedTime<that.TIMEOUT_LIMIT){retries=retries-1;that.update({retries:retries});setTimeout(function(){that._tryLoad();},1000);}else{$.slideshareEventManager.trigger('metadataloadfailed',{type:that.config.type});}};};function SSBgImageResource(config){this.resourceTemplate={prefix:config.baseUrl,digitLength:3,cacheable:true,retri

Page 14: teste

es:0,isCritical:true};this.useTimeStamp=true;var imageVersions=config.availableSizes;this.imageVersions=[];for(var width in imageVersions){this.imageVersions[parseInt(width,10)]=imageVersions[width];}switch(config.conversionVersion){case 2:if(config.is_private){this.useTimeStamp=false;this._generateUrl=this._generatePrivateUrlV2;}else{this._generateUrl=this._generateUrlV2;}break;case 1:this._generateUrl=this._generateUrlV1;if(config.is_private){this.useTimeStamp=false;}}SSImageResource.call(this,config);}SSBgImageResource.prototype=new SSImageResource();SSBgImageResource.prototype._generateUrlV2=function(index,size,quality){return this.config.baseUrl+'images/'+parseInt(quality,10)+'/slide-'+index+'-'+size+'.jpg?'+this.config.timestamp;};SSBgImageResource.prototype._generateUrlV1=function(index,size,extension){if(this.useTimeStamp){return this.config.baseUrl+'output'+index+(size===this.contentWidth?'':('-'+size))+'.'+extension+'?'+this.config.timestamp;}else{return this.config.baseUrl+'output'+index+(size===this.contentWidth?'':('-'+size))+'.'+extension+this.config.privateImageSignatures[size][75].url;}};SSBgImageResource.prototype._generatePrivateUrlV2=function(index,size,quality){return this.config.baseUrl+'images%2F'+parseInt(quality,10)+'%2Fslide-'+index+'-'+size+'.jpg'+this.config.privateImageSignatures[size][quality].url;};SSBgImageResource.prototype._getSuffixes=function(){var suffixes={};var imageVersions=this.imageVersions;var urlSuffix=this.config.timestamp;var i,width,qualities_or_extensions,versionLen,quality,suffix;for(width in imageVersions){if(!imageVersions.hasOwnProperty(width)){continue;}width=parseInt(width,10);qualities_or_extensions=imageVersions[width];suffixes[width]=[];versionLen=qualities_or_extensions.length;for(i=0;i<versionLen;i++){quality=parseInt(qualities_or_extensions[i],10);suffix={url:this._generateUrl(this.indexString,width,qualities_or_extensions[i]),status:'initialized',retries:2};suffixes[width][(isNaN(quality)?75:quality)]=suffix;}}return suffixes;};function SSFallbackImageResource(config){this.resourceTemplate={prefix:config.baseUrl,digitLength:1,cacheable:true,retries:0,isCritical:true};this.useTimeStamp=true;SSImageResource.call(this,config);}SSFallbackImageResource.prototype=new SSImageResource();SSFallbackImageResource.prototype._generateUrlV2=function(index,size,quality){return this.config.baseUrl+'/'+quality+'/slide-'+index+'-'+size+'.jpg?'+this.config.timestamp;};SSFallbackImageResource.prototype._generateUrlV1=function(index,size,quality){if(this.useTimeStamp){return this.config.baseUrl+'-slide-'+index+(size===this.contentWidth?'':('-'+size))+'.jpg?'+this.config.timestamp;}else{return this.config.baseUrl+'-slide-'+index+(size===this.contentWidth?'':('-'+size))+'.jpg'+this.config.privateImageSignatures[size][75].url;}};SSFallbackImageResource.prototype._generatePrivateUrlV2=function(index,size,quality){return this.config.baseUrl+'%2F'+quality+'%2Fslide-'+index+'-'+size+'.jpg'+this.config.privateImageSignatures[size][quality].url;};SSFallbackImageResource.prototype._getSuffixes=function(){var suffixes=[];var imageVersions=this.imageVersions;var i,width,suffix,qualities,quality,qualityLen;for(width in imageVersions){if(!imageVersions.hasOwnProperty(width)){continue;}width=parseInt(width,10);qualities=imageVersions[width];suffixes[width]=[];qualityLen=qualities.length;for(i=0;i<qualityLen;i++){quality=parseInt(qualities[i],10);suffix={url:this._generateUrl(this.indexString,width,quality),status:'initialized',retries:2};suffixes[width][quality]=suffix;}}return suffixes;};SSFallbackImageResource.prototype.addLinks=function(values){this.links=values.links||[];};SSFallbackImageResource.prototype.addSignature=function(signatures)

Page 15: teste

{this.config.privateImageSignatures=signatures;};function SSDocumentDisplayer(config){SSSlideDisplayer.call(this,config);this.zoomLevels=[1,1.2,1.5,1.75,2,2.5,3,4];this.prerenderedSlides=[];}SSDocumentDisplayer.prototype=new SSSlideDisplayer();SSDocumentDisplayer.prototype._bindEvents=function(){var that=this;var i,slide;var container=this.container;var linksDisabled=this.config.linksDisabled;container.unbind('scroll');container.bind('scroll',function(e){var currentSlide=that.detectCurrentSlide();$.slideshareEventManager.trigger('slidechanged',{index:currentSlide});});container.unbind('click');container.bind('click',function(e){var target=e.target;var targetTagName=target.tagName.toUpperCase();var targetNode;if(linksDisabled){targetNode=false;}else if(targetTagName==='SPAN'&&target.parentNode.tagName.toUpperCase()==='A'){targetNode=target.parentNode;}else if(targetTagName==='A'||targetTagName==='AREA'){targetNode=target;}if(targetNode){var hrefValue=parseInt(targetNode.attributes.href.value,10);if(isNaN(hrefValue)){window.open(targetNode.href);}}});$(container).bind('click',function(e){e.preventDefault();});};SSDocumentDisplayer.prototype._scrollTo=function(index){if(this.slides){var topOffset=this.slides[index].currentViewMode.container.position().top;this.container.scrollTop(topOffset);}};SSDocumentDisplayer.prototype.start=function(config){var i,slide;var slideContainers=[];if(this.slides===undefined){this.slides=config.slides;this.state='playing';this.hideInitializer();this.slidesContainer=$('<div/>').attr({'class':'slidesContainer'}).css({position:'relative','background-color':this.playerBgColor}).appendTo(this.container);for(i=1;i<=this.config.slideCount;i++){slideContainers[i]=$('<div/>').appendTo(this.slidesContainer);}}for(i=1;i<=this.config.slideCount;i++){slide=this.slides[i];slide.setContainer({mode:config.mode,bgColor:this.playerBgColor,container:slideContainers[i]});}this.setZoom(0);};SSDocumentDisplayer.prototype.showInitializer=function(){$('<div/>').css({width:this.container.width()-10,height:this.container.height()-20,padding:5,margin:0,top:0,left:0,'background-color':'#fff'}).html('Loading...').appendTo(this.container);};SSDocumentDisplayer.prototype.detectCurrentSlide=function(){var that=this;var viewHeight=this.height;var viewEdge1=this.container.scrollTop();var currentSlide=(function(){var i;for(i=1;i<that.config.slideCount;i++){var slideEdge1=that.slideOffsets[i];var slideEdge2=that.slideOffsets[i+1];if(viewEdge1>=slideEdge1&&viewEdge1<slideEdge2){return i;}}return that.config.slideCount;})();return currentSlide;};SSDocumentDisplayer.prototype.setZoom=function(index){this.zoomIndex=index;var currentZoom=this.zoomLevels[this.zoomIndex];if(currentZoom===1){this.container.css({'overflow-y':'scroll','overflow-x':'hidden'});this.slidesContainer.width('100%');this.width=this.slidesContainer.width();}else{this.container.css({'overflow-y':'scroll','overflow-x':'scroll'});var zoomWidth=this.config.width*currentZoom;this.slidesContainer.width(zoomWidth);this.width=zoomWidth;}};SSDocumentDisplayer.prototype.getZoomDimensions=function(){var currentZoom=this.zoomLevels[this.zoomIndex];return{width:this.config.width*currentZoom,height:this.config.height*currentZoom,displayerWidth:this.width};};SSDocumentDisplayer.prototype.setDimensions=function(dimensions){var that=this;if(typeof dimensions==='object'){this.config.width=dimensions.width;this.config.height=dimensions.height;}var partialUpdate=dimensions&&dimensions.partial;if(!partialUpdate&&this.state==='playing'){this.setZoom(this.zoomIndex);}var zoomDimensions=this.getZoomDimensions();var zoomWidth=zoomDimensions.width;var zoomHeight=zoomDimensions.height;var slidesContainerWidth=zoomDimensions.displayerWidth;this.container.css({height:this.config.height,width:this.config.width});if(!

Page 16: teste

partialUpdate&&this.state==='playing'){this.panelHeight=0;var i,slide,offset;offset=0;for(i=1;i<=this.config.slideCount;i++){slide=this.slides[i];slide.setDimensions({parentWidth:slidesContainerWidth,parentHeight:zoomHeight});this.slideOffsets[i]=offset;offset+=slide.wrapperOffset();}this.height=offset;}};SSDocumentDisplayer.prototype.setPrerenderedSlides=function(config){var i;for(i=config.start;i<=config.end;i++){if($.inArray(i,this.prerenderedSlides)===-1){this.prerenderedSlides.push(i);}}};SSDocumentDisplayer.prototype.manualScroll=function(delta){this.container&&this.container.scrollTop(this.container.scrollTop()+delta);};function SSDocumentSlide(config){SSSlide.call(this,config);this.PADDING=5;}SSDocumentSlide.prototype=new SSSlide();SSDocumentSlide.prototype.wrapperOffset=function(){return this.currentViewMode.wrapperHeight;};SSDocumentSlide.prototype.empty=function(){this.currentViewMode.wrapper.empty();};SSDocumentSlide.prototype.displayLoading=function(){this.empty();$('<div/>').css({width:this.currentViewMode.width,height:this.currentViewMode.height-10,padding:5,top:0,left:0,'background-color':'#fff'}).html('Loading...').appendTo(this.currentViewMode.wrapper);};SSDocumentSlide.prototype.setDimensions=function(dimensions){var viewWidth=dimensions.parentWidth;var viewHeight=dimensions.parentHeight-(this.PADDING*2);var viewAspect=viewWidth/viewHeight;var origwidth,origheight,contentAspect;if(this.contentWidth===undefined||this.contentHeight===undefined){origwidth=viewWidth;origheight=viewWidth*1.33;contentAspect=origwidth/origheight;}else{origwidth=this.contentWidth;origheight=this.contentHeight;contentAspect=origwidth/origheight;}var scale,contentScale,fontscale,width,height;var top,left;contentScale=viewWidth/origwidth;fontscale=contentScale*16;width=viewWidth;scale=viewAspect/contentAspect;top=this.PADDING;height=scale*viewHeight;width=parseInt(width,10);height=parseInt(height,10);this.currentViewMode.container.css({width:width+(this.PADDING*2),height:height+(this.PADDING*2)});this.currentViewMode.wrapper.css({width:width,height:height,position:'absolute','background-color':this.currentViewMode.bgColor,padding:this.PADDING+'px 0'});this.currentViewMode.wrapperWidth=width;this.currentViewMode.wrapperHeight=height;this.currentViewMode.top=top;this.currentViewMode.left=0;this.currentViewMode.contentScale=contentScale;this.currentViewMode.fontscale=fontscale;this.currentViewMode.width=width;this.currentViewMode.height=height;};SSDocumentSlide.prototype.hide=function(){if(!this.currentViewMode.rendered){return;}this.empty();delete(this.currentViewMode.contentElement);delete(this.currentViewMode.imageElement);this.currentViewMode.rendered=false;};SSDocumentSlide.prototype.show=function(force){if(this.currentViewMode.rendered&&!force){return;}this.currentViewMode.rendered=true;this.load();};SSDocumentSlide.prototype.play=function(){$.slideshareEventManager.trigger('slidechanged',{index:this.index});this.show();};SSDocumentSlide.prototype.setContainer=function(config){var mode=config.mode;if(this.viewModes[mode]===undefined){this.viewModes[mode]={'rendered':false,'bgColor':config.bgColor||'#ccc','container':config.container,'wrapper':$('<div/>').appendTo(config.container)};this.viewModes[mode].container.css({position:'relative'});}this.currentViewMode=this.viewModes[mode];this.currentMode=config.mode;};function SSToolbar(config){this.config=config;this.GA_EVENTS={'previous':'toolbar_prev','next':'toolbar_next','viewonss':'toolbar_viewonss','zoomin':'toolbar_zoomin','zoomout':'toolbar_zoomout','viewfullscreen':'toolbar_fullscreen','leavefullscreen':'toolbar_leavefullscreen'};this._init();this._ELEMENTS=this.getElements();this._ELEMENT_PRIORITIES={1:['nav'],5:['viewOnSS'],2:['fullScreen','leaveFullScreen'],3:['share'],4:['goToSlide'],6:['zoomButtons']};this._ELEMENT_VISIBILITY={'share':!this.config.disableShare,'fullScreen':!this.config.isFullScreen,'leaveFullScreen':this.config.isFullScreen,'viewOnSS':t

Page 17: teste

his.config.enableViewSS,'zoomButtons':(this.config.playerType=='document'),'nav':true,'goToSlide':true};this._ELEMENT_SECTION={'nav':'one','share':'two','fullScreen':'two','leaveFullScreen':'two','goToSlide':'two','viewOnSS':'one','zoomButtons':'two'};var viewOnSSbuttonWidth={'small':29,'normal':88};if(this.config.playerType=='document'){this._ELEMENT_WIDTHS={'nav':30,'share':72,'fullScreen':24,'leaveFullScreen':24,'goToSlide':57,'viewOnSS':viewOnSSbuttonWidth[this.config.toolbarClass],'zoomButtons':56};this._ELEMENT_SECTION.share='one';}else{this._ELEMENT_WIDTHS={'nav':57,'share':35,'fullScreen':24,'leaveFullScreen':24,'goToSlide':57,'viewOnSS':viewOnSSbuttonWidth[this.config.toolbarClass]};}this.config.toolbarPadding=6;}SSToolbar.prototype._init=function(){var container=this.container=$('<div/>').attr({'class':'toolbar'}).css({height:this.config.height}).html(this.config.html).appendTo(this.config.renderTo);this.config.toolbarClass=this._getToolbarClass();this.container.addClass(this.config.toolbarClass);if(this.config.disableShare){container.find('.btnShare').hide();}if(this.config.enableViewSS){container.find('.btnViewOnSS').show();}if(this.config.isFullScreen){container.find('.btnFullScreen').hide();container.find('.btnLeaveFullScreen').show();}if(this.config.hasAudio){this.volumeControl=new SSVolumeControl({container:container.find('.jspl_volume_control'),renderTo:container,trigger:container.find('.btnVolume')});this.audioActive=true;}var that=this;container.find('.goToSlideLabel>span').html('/'+this.config.totalSlideCount);this.deactivate();};SSToolbar.prototype._getToolbarClass=function(){var toolbarClass="";if(this.config.width<400){toolbarClass="small";}else{toolbarClass="normal";}return toolbarClass;};SSToolbar.prototype.getElements=function(){var container=this.container;var elementCodes={'nav':'.nav','share':'.btnShare','fullScreen':'.btnFullScreen','leaveFullScreen':'.btnLeaveFullScreen','viewOnSS':'.btnViewOnSS','goToSlide':'.goToSlideLabel','zoomButtons':'.docActions'};var elements={};$.each(elementCodes,function(code,selector){elements[code]=container.find(selector);});return elements;};SSToolbar.prototype.deactivate=function(){var buttons='.btnFirst, .btnPrevious, .btnNext, .btnLast, .btnSS, .btnViewOnSS, .btnFullScreen, '+'.btnZoomOut, .btnZoomIn, .btnFind, .btnShare';this.container.find(buttons).unbind('click');this._unbindButtonHandler(buttons);this.container.find('.goToSlideLabel>input[type=text]').attr('disabled',true);this.active=false;this.config.hasAudio&&this.updateAudioInteraction();};SSToolbar.prototype.activate=function(){var that=this;var container=this.container;var buttons='.btnFirst, .btnPrevious, .btnNext, .btnLast, .btnSS, .btnViewOnSS, .btnFullScreen, '+'.btnZoomOut, .btnZoomIn, .btnFind, .btnShare';this._bindButtonHandler(buttons,{'.btnViewOnSS':'viewonss','.btnFirst':'gotofirstslide','.btnSS':'viewonss','.btnPrevious':'previous','.btnNext':'next','.btnLast':'gotolastslide','.btnFullScreen':'viewfullscreen','.btnLeaveFullScreen':'leavefullscreen','.btnZoomOut':'zoomout','.btnZoomIn':'zoomin','.btnFind':'playersearch','.btnShare':'playershare'});var gotoslideInput=this.container.find('.goToSlideLabel>input[type=text]');gotoslideInput.attr('disabled',false);gotoslideInput.bind('keyup',function(e){e.stopPropagation();if(e.keyCode===13){var input=$(e.target);var val=input.val();if(isNaN(val)){return;}else{var slidenumber=parseInt(val,10);$.slideshareEventManager.trigger('gotoslide',{index:slidenumber});}}});gotoslideInput.bind('focus',function(e){$(e.target).select();});this.active=true;this.config.hasAudio&&this.updateAudioInteraction();};SSToolbar.prototype.updateAudioInteraction=function(values){var key;for(key in values){this[key]=values[key];}if(this.active&&this.audioReady&&this.audioMetaReady){!this.audioActive&&this._activateAudio();this._updateAudioDisplay();}else{this.au

Page 18: teste

dioActive&&this._deactivateAudio();}};SSToolbar.prototype._activateAudio=function(){this.container.find('.btnAudio,.btnVolume').removeClass('disabled');this._bindButtonHandler('.btnAudio,.btnVolume',{'.btnAudio':'toggleaudio','.btnVolume':'showvolumecontrol'});this.audioActive=true;};SSToolbar.prototype._deactivateAudio=function(){this.container.find('.btnAudio,.btnVolume').addClass('disabled');this._unbindButtonHandler('.btnAudio,.btnVolume');this.audioActive=false;};SSToolbar.prototype._updateAudioDisplay=function(playing){if(this.audioPlaying){this.container.find('.btnAudio').removeClass('btnAudioPlay').addClass('btnAudioPause').attr('title','Pause');}else{this.container.find('.btnAudio').removeClass('btnAudioPause').addClass('btnAudioPlay').attr('title','Play');}};SSToolbar.prototype._bindButtonHandler=function(resetButtons,config){var container=this.container;var that=this;this.container.find(resetButtons).unbind();$.each(config,function(selector,eventname){container.find(selector).bind('click',function(e){$.slideshareEventManager.trigger(eventname,e);e.preventDefault();e.stopPropagation();var gaEvent=that.GA_EVENTS[eventname];if(gaEvent){$.slideshareEventManager.trackEvent(gaEvent);}});});};SSToolbar.prototype._unbindButtonHandler=function(buttons){this.container.find(buttons).unbind();this.container.find(buttons).bind('click',function(e){e.preventDefault();e.stopPropagation();});};SSToolbar.prototype.setDimensions=function(dimensions){var that=this;var firstElementWidth=that._ELEMENT_WIDTHS[that._ELEMENT_PRIORITIES[1][0]];var sectionWidth=(dimensions.width/2)-that.config.toolbarPadding-firstElementWidth;var availableWidth={'one':sectionWidth,'two':sectionWidth};var priorityLength=this._ELEMENT_PRIORITIES.length;var priorityElement,priorityElementLength;var elementCode,elementWidth,elementVisibility,elementShowable;$.each(this._ELEMENT_PRIORITIES,function(priority,priorityElement){priorityElementLength=priorityElement.length;for(var j=0;j<priorityElementLength;j++){elementCode=priorityElement[j];var section=that._ELEMENT_SECTION[elementCode];elementWidth=that._ELEMENT_WIDTHS[elementCode];elementShowable=(that._ELEMENT_VISIBILITY[elementCode]&&availableWidth[section]>elementWidth);if(priority==1||elementShowable){that._ELEMENTS[elementCode].show();if(priority!=1){availableWidth[section]-=elementWidth;}}else{that._ELEMENTS[elementCode].hide();}}});};SSToolbar.prototype.updateCurrentPosition=function(position){this.container.find('.goToSlideLabel>input[type=text]').val(position);};SSToolbar.prototype.destroy=function(){this.container.remove();};function SSPlayerController(config){this.config=config;this.realSlideCount=this.config.slide_count;this.slideCount=this.realSlideCount;if(this.config.has_video){this.slideCount+=this.config.video_slides_count;}delete(this.config.slide_count);this.mode=this.config.mode;delete(this.config.mode);this.currentPosition=0;this.loadingSlides=[];this.loadedSlides=[];this.slideModes={};this.availableBgSizes={};this.availableFallbackSizes={};if(this.config.has_lead){this.has_lead=true;this.leadCreated=false;if(this.config.form_after_slide_no===this.slideCount){this.config.form_after_slide_no=this.slideCount-1;}}this.PRELOAD_PRE_LIMIT=2;this.PRELOAD_POST_LIMIT=5;this.FONT_BATCH_COUNT=10;this.DEFAULT_ERROR_SCORE=0;this.AUTOVERIFICATION_ERROR_THRESHOLD=0.001;this.AUTOVERIFICATION_THRESHOLDS={'bad v1.0':0.001,'bad v1.1':0.0001,'bad v2.0':0.0001};this.MAX_PERCENTAGE_FAILING={'bad v1.0':100,'bad v1.1':20,'bad v2.0':20};this.TOOLBAR_HEIGHT=30;this.TOOLBAR_PADDING=8;this.AUDIOBAR_HEIGHT=16;this.initialized=false;this.PRERENDER_COUNT=1;this._init();this.startSlide=parseInt(this.config.page||1,10);this.play(this.startSlide);}SSPlayerController.prototype._init=function(){var that=this;$.slideshareEventManager.registerController(this);$.slideshareEventManager.registerEnvironment(this.config.hosted_in);this.cachedDomElements={};this.componentSets={};this._createComponentSet('normal');this._bindEvents();this.exitFullScreenHandler=this.exitFullScreenHandlerFactory();if(this

Page 19: teste

.mode!=='video'){this._initMetadata();this._loadMetadata();this.config.has_audio&&!this.config.touch&&this._loadAudioMetadata();}else{this._loadVideoMeta();}$.slideshareEventManager.trackEvent('player_initialized');$.slideshareEventManager.trackEvent(this.mode+'_mode');};SSPlayerController.prototype._loadVideoMeta=function(){if(this.config.is_private){this._getHtmlSignatures();}this.initialized=true;};SSPlayerController.prototype._initMetadata=function(){if(this.mode==='html'){if(this.config.is_private){this._getHtmlSignatures();}this._initFontResources();this._initHtmlMetadata();this.config.image_ready&&this._initImageMetadata(true);}else if(this.mode==='image'){this._initImageMetadata();}else{if(window._gaq){_gaq.push(['_trackEvent','jsplayer','invalidplayermode',this.config.id]);}throw"Unknown player mode";}};SSPlayerController.prototype._loadMetadata=function(){if(this.mode==='html'){this.metaResource.load();this.config.image_ready&&this.imageMetaResource.load();}else if(this.mode==='image'){this.imageMetaResource.load();}else{throw"Unknown player mode";}};SSPlayerController.prototype._initHtmlMetadata=function(signature){this.metaResource=new SSMetaResource({url:this.config.bucket_location+'meta.js',timestamp:this.config.timestamp,type:'html',is_private:this.config.is_private,signature:signature});};SSPlayerController.prototype._initImageMetadata=function(isFallback,signature){this.imageMetaResource=new SSMetaResource({url:this.config.image_bucket_location+'.js',timestamp:this.config.timestamp,type:isFallback?'imagefallback':'imageprimary'});};SSPlayerController.prototype._initFontResources=function(signatures,fontBatchCount){if(fontBatchCount){fontBatchNum=Math.ceil(this.slideCount/fontBatchCount);}else{fontBatchNum=Math.ceil(this.slideCount/this.FONT_BATCH_COUNT);}var urlSuffix;if($.browser.msie){urlSuffix=this.config.html_eotfont_url_suffix;}else{urlSuffix=this.config.html_ttffont_url_suffix;}var i;this.fontResources=[];for(i=1;i<=fontBatchNum;i++){this.fontResources[i]=new SSFontResource({baseUrl:this.config.bucket_location,indexString:this._getIndexString(i,0),timestamp:this.config.timestamp,suffix:urlSuffix});}};SSPlayerController.prototype._loadAudioMetadata=function(){this.audioResource=new SSAudioResource({url:this.config.audio_bucket_location+'.js',timestamp:this.config.audio_timestamp,slideCount:this.slideCount,audioDuration:this.config.audio_duration,audioUrl:this.config.audio_url,flashRoot:this.config.sound_manager_flash_component_root,assetId:this.config.sound_manager_asset_id});this.audioResource.load();};SSPlayerController.prototype.getImagePrivateSignatures=function(imageSizes,mode){var that=this;(function(mode){$.ajax({url:that.config.images_signature_request_route,data:{id:that.config.id,key:that.config.secret_key,mode:mode,images_sizes:imageSizes,version:that.conversionVersion,password_hash:that.config.password_hash,slidetracking_hash:that.config.slidetracking_hash},dataType:'json',cache:false,type:'POST',success:function(data){if(mode==='html'){that.privateImageSignatures=data;}else if(mode==='image'){that.privateFallBackImageSignatures=data;}if(mode==='html'||mode==='image'){that.postInitialize();}else{if(that.slidesCreated){var imageCount=that.slideModes.image.length;var slide,slideIndex;for(i=0;i<imageCount;i++){slideIndex=that.slideModes.image[i];slide=that.slides[that.realIndexToIndex[slideIndex]];slide.resources.image.addSignature(data[slideIndex]);slide.resources.image.ready();}}else{that.privateFallBackImageSignatures=data;}}}});})(mode);};SSPlayerController.prototype._getHtmlSignatures=function(){var policyUrl=this.config.signature_request_route;var that=this;$.ajax({url:policyUrl,data:{id:this.config.id,key:this.config.secret_key},dataType:'json',cache:false,type:'POST',success:function(data){var dataLength=data.length;var

Page 20: teste

dataObj;if(dataLength!==0){for(var i=0;i<dataLength;i++){dataObj=data[i];that.htmlResourceSignatures=data[i].info;}for(i=0;i<that.slideCount;i++){if(that.slides&&that.slides[i]){slide=that.slides[i];slide.resources.html.updateSignature(that.htmlResourceSignatures[i].url);slide.resources.html.ready();}}}},failure:function(){$.slideshareEventManager.trigger('metadataloadfailed',{type:that.config.type});}});};SSPlayerController.prototype._metaDataHandlers=function(){var criticalFailureHandler=function(){var height,width;var slidedisplayer=this.currentComponentSet.slidedisplayer;height=slidedisplayer.container.height();width=slidedisplayer.container.width();slidedisplayer.error(this.generateErrorDom('meta_error_template',{width:width,height:height}));};return{html:{success:function(data){this.conversionVersion=parseInt(data.version||1,10);this.slideSizes=data.sizes||{};var availableSizes={};switch(this.conversionVersion){case 2:availableSizes=data.available_sizes||{};break;case 1:var imageFormats=data.image_formats;var i,slideFormats,slideSizes,width,fullSize;var slideCount=this.realSlideCount;for(i=1;i<=slideCount;i++){slideFormats=imageFormats[i]||{};slideSizes={};for(width in slideFormats){slideSizes[width]=[slideFormats[width]];}slideSizes[400]=['jpg'];try{fullSize=this.slideSizes[i].width;}catch(ex){fullSize=slideSizes.length-1+100;}slideSizes[fullSize]=['png'];availableSizes[i]=slideSizes;}}this.availableBgSizes=availableSizes;var errorScores=data.error_scores||{};this.algo=errorScores.algo||'bad v1.0';this.errorScores=errorScores.webkit||{};var commonStyle="\n.ssml_div span {line-height:normal;} "+"\n.ssml_div div {line-height:normal;}\n.ssml_div{font-size:16px;}";if(this.config.disable_links){commonStyle=commonStyle+"\n.ssml_div a{cursor:default;}";}var defaultPresentationStyle="a.ssml_a {text-decoration:none;color:inherit;vertical-align:top;} "+"\n.ssml_div span {position:absolute; white-space:pre; vertical-align:top;} "+"\n.ssml_div div {position:absolute;}";var finalResetStyleTag='<style>'+(data.global_styles_css||defaultPresentationStyle)+commonStyle+'</style>';$(finalResetStyleTag).appendTo(this.currentComponentSet.container);if(data.pages_per_fontfile){this.FONT_BATCH_COUNT=data.pages_per_fontfile;this._initFontResources();}if(this.config.is_private){this.getImagePrivateSignatures(this.availableBgSizes,"html");}else{this.postInitialize();}},failure:criticalFailureHandler},imagefallback:{success:function(data){if(this.config.disable_links){data.links={};}if(this.slidesCreated){this.fallbackMetaHandler(data);}else{this.fallbackMetaData=data;}},failure:function(){var imageCount=this.slideModes.image.length;var i,width,height,slideIndex,slide;for(i=0;i<imageCount;i++){slideIndex=this.slideModes.image[i];slide=this.slides[slideIndex];width=slide.currentViewMode.width;height=slide.currentViewMode.height;slide.displayError(this.generateErrorDom('slide_error_template',{width:width,height:height}),true);}}},imageprimary:{success:function(data){this.conversionVersion=parseInt(data.version||1,10);this.slideSizes=data.sizes||{};if(this.config.disable_links){data.links={};}this.slideLinks=data.links||{};var slideCount=this.realSlideCount;var i,slideAvailableSizes,dimensions;switch(this.conversionVersion){case 2:this.availableFallbackSizes=data.available_sizes;break;case 1:this.availableFallbackSizes={};for(i=1;i<=slideCount;i++){slideAvailableSizes={320:[75],768:[75]};dimensions=this.slideSizes[i]||{};if(dimensions.width){slideAvailableSizes[dimensions.width]=[75];}this.availableFallbackSizes[i]=slideAvailableSizes;}}if(this.config.is_private){this.getImagePrivateSignatures(this.availableFallbackSizes,"image");}else{this.postInitialize();}},failure:criticalFailureHandler}};};SSPlayerController.prototype.fallbackMetaHandler=function(data){var conversionVersion=parseInt(data.version||1,10);var imageSizes=data.sizes||{};var availableSizes=data.available_sizes||{};var imageLinks=data.links||{};var

Page 21: teste

imageCount=this.slideModes.image.length;var slideAvailableSizes,dimensions,slide;for(i=0;i<imageCount;i++){slideIndex=this.slideModes.image[i];dimensions=imageSizes[slideIndex]||{};slideAvailableSizes=availableSizes[slideIndex];if(slideAvailableSizes===undefined){slideAvailableSizes={320:[75],768:[75]};slideAvailableSizes[dimensions.width]=[75];}slide=this.slides[this.realIndexToIndex[slideIndex]];slide.setContentDimensions(dimensions.width||0,dimensions.height||0);slide.updateResource('image',{sizes:{contentWidth:dimensions.width||0,availableSizes:slideAvailableSizes,conversionVersion:conversionVersion,is_private:this.config.is_private},linkData:imageLinks[slideIndex]||[]});}if(this.config.is_private){this.getImagePrivateSignatures(availableSizes,'imagefb');}};SSPlayerController.prototype.postInitialize=function(){this._initSlides();this._activateComponentSet('normal');this._setModeForSlides('normal');this.setDimensions();$(this).trigger('playerinitialized');};SSPlayerController.prototype._bindEvents=function(){var that=this;$(this).bind('playerinitialized',function(){this.initialized=true;that.play();});if(!(this.config.touch||this.config.player_type==='document'||this.config.player_type==='video')){$(document).bind('keyup',function(e){if(e.target.nodeName!=='INPUT'&&e.target.nodeName!=='TEXTAREA'){var leadForm=that.currentComponentSet.leadForm;if(e.keyCode===37&&!(leadForm&&leadForm.isVisible())){if(that.currentComponentSet.lastScreen){that.currentComponentSet.lastScreen.destroy();}$.slideshareEventManager.trigger('previous');}if(e.keyCode===39&&!(leadForm&&leadForm.isVisible())){$.slideshareEventManager.trigger('next');}}});}};SSPlayerController.prototype._bindComponentSetEvents=function(){var that=this;var componentSet=this.currentComponentSet;$(componentSet.slidedisplayer).bind('zoomchanged',function(e){that.repaint();});};SSPlayerController.prototype._createComponentSet=function(mode){var that=this;this.componentSets[mode]={};this.currentComponentSet=this.componentSets[mode];this.currentViewMode=mode;var componentSet=this.currentComponentSet;if(mode==='normal'){componentSet.container=$('#'+this.config.container);if(componentSet.container.length!==1){throw'Unable to find container for player';}componentSet.container.css({'overflow':'hidden'});}else if(mode==='fullscreen'){this.normalModeScrollPosition=$(window).scrollTop();componentSet.container=$('<div/>').css({'height':'100%','left':0,'position':'absolute','top':0,'width':'100%','overflow':'hidden','z-index':10050}).appendTo($('body'));$('body, html').css({'overflow':'hidden'});}var isFullScreen=(mode==='fullscreen')||this.config.is_fullscreen;var componentBackgroundColor='#ccc';if(isFullScreen){componentBackgroundColor=this.config.fullscreen_bgcolor;}else{componentBackgroundColor=this.config.player_bgcolor;}componentSet.navigators=[];var displayerConfig={renderTo:componentSet.container,spinnerUrl:this.config.spinner_url,errorImageUrl:this.config.error_image_url,mode:this.mode,slideCount:this.slideCount,playerType:this.config.player_type,playerBgColor:componentBackgroundColor};if(mode==='fullscreen'){displayerConfig.spinnerUrl=this.config.spinner_url_fullscreen;}if(this.config.player_type==='document'){componentSet.slidedisplayer=new SSDocumentDisplayer(displayerConfig);}else if(this.config.player_type==='video'){displayerConfig.videoBucket=this.config.video_bucket;displayerConfig.fileExtension=this.config.file_extension;displayerConfig.pptLocation=this.config.ppt_location;componentSet.slidedisplayer=new SSVideoDisplayer(displayerConfig);}else{componentSet.slidedisplayer=new SSPresentationDisplayer(displayerConfig);}componentSet.navigators.push(componentSet.slidedisplayer);this.hasToolbar=!this.config.touch&&this.mode!

Page 22: teste

=='video';this.setDimensions();if(this.config.hosted_in!=="mobile_slideview"&&this.currentComponentSet.width<510&&this.currentComponentSet.height<426){this.config.disable_lastscreen=true;}if(this.config.hosted_in=="embed"){this.config.shareScreenClass=this._getShareScreenClass(this.currentComponentSet.width,this.currentComponentSet.height);if(!this.config.shareScreenClass){this.config.disable_share=true;}}else{this.config.shareScreenClass="";}if(this.config.touch){componentSet.touchInteraction=new SSTouchInteraction({container:componentSet.slidedisplayer.container,playerType:this.config.player_type});componentSet.navigators.push(componentSet.touchInteraction);}else if(this.config.player_type!=='document'&&this.config.player_type!=='video'){componentSet.bandInteraction=new SSBandInteraction({container:componentSet.slidedisplayer.container,width:componentSet.width,linksDisabled:this.config.disable_links});componentSet.navigators.push(componentSet.bandInteraction);}if(this.config.has_lead&&!this.leadCreated){if(this.config.show_lead_cta){componentSet.leadcta=new SSLeadCTA({renderTo:componentSet.container,html:this.config.lead_form_cta_html,has_audio:this.config.has_audio});componentSet.navigators.push(componentSet.leadcta);}componentSet.leadForm=new SSLeadForm({leadFormHtml:this.config.leadFormHtml||'',renderTo:componentSet.slidedisplayer.container,lead_form_url:this.config.lead_form_url,show_skip_button:this.config.show_skip_button,width:this.currentComponentSet.width,height:this.currentComponentSet.height});componentSet.navigators.push(componentSet.leadForm);}if(this.hasToolbar){componentSet.toolbar=new SSToolbar({width:componentSet.width,height:this.TOOLBAR_HEIGHT,html:this.config.toolbar_html,renderTo:componentSet.container,totalSlideCount:this.slideCount,primaryResourceType:this.config.primaryResourceType,disableShare:this.config.disable_share,enableViewSS:this.config.enable_viewSS,isFullScreen:isFullScreen,playerType:this.config.player_type,hasAudio:this.config.has_audio});componentSet.navigators.push(componentSet.toolbar);}if(this.config.has_audio&&!this.config.touch){componentSet.audiobar=new SSAudioBar({renderTo:componentSet.container,slideCount:this.slideCount,height:this.AUDIOBAR_HEIGHT,html:this.config.audiobar_html,resource:this.audioResource,css2ConfettiUrl:this.config.css2_confetti_url});componentSet.navigators.push(componentSet.audiobar);}if(this.config.has_video){componentSet.videoConfetti=$('<img/>').attr({'src':this.config.confetti_url}).css({'position':'absolute','top':'-1px','left':'-1px'}).appendTo(componentSet.container);}if(this.mode!=='video'){this._bindComponentSetEvents();}};SSPlayerController.prototype._getShareScreenClass=function(componentSetWidth,componentSetHeight){var shareScreenClass=null;if(componentSetWidth>360&&componentSetHeight>260){shareScreenClass="normal";}else if(componentSetWidth>320&&componentSetHeight>250){shareScreenClass="small";}else if(componentSetWidth>290&&componentSetHeight>280){shareScreenClass="tiny";}return shareScreenClass;};SSPlayerController.prototype._destroyComponentSet=function(mode){var componentSet=this.componentSets[mode];$.each(componentSet.navigators,function(i,navigatorItem){navigatorItem.destroy();});delete(this.componentSets[mode].navigators);delete(this.componentSets[mode].slidedisplayer);if(mode==='fullscreen'){componentSet.container.remove();$('body, html').css({'overflow':'auto'});}var slide;for(var i=1;i<=this.slideCount;i++){slide=this.slides[i];slide.viewModes[mode].container.remove();delete(slide.viewModes[mode]);}delete(this.componentSets[mode].container);delete(this.componentSets[mode]);};SSPlayerController.prototype._mapIndexes=function(){var videoSlidesHash=this.config.video_hash;var realSlidePosition=1;var totalSlides=this.slideCount;var slideToRealIndexMap={},realIndexToIndexMap={};for(var i=1;i<=totalSlides;i++){if(videoSlidesHash&&videoSlidesHash[i])

Page 23: teste

{slideToRealIndexMap[i]=null;}else{slideToRealIndexMap[i]=realSlidePosition;realIndexToIndexMap[realSlidePosition]=i;realSlidePosition++;}}if(this.config.has_video){var tag=document.createElement('script');var protocol=(this.config.use_ssl?'https://':'http://');tag.src=protocol+"www.youtube.com/player_api";var firstScriptTag=document.getElementsByTagName('script')[0];firstScriptTag.parentNode.insertBefore(tag,firstScriptTag);}this.indexToRealIndex=slideToRealIndexMap;this.realIndexToIndex=realIndexToIndexMap;};SSPlayerController.prototype._percentageFailing=function(errorThreshold){var slidesFailing=0;for(var i in this.errorScores){if(this.errorScores[i]>errorThreshold){slidesFailing++;}}if(this.slideCount===0){return 0;}return parseInt(100*(slidesFailing/this.slideCount),10);};SSPlayerController.prototype._initSlides=function(){this.slides=[];this.slideModes.image=[];this.slideModes.html=[];var count=0;var i,slide,size,slideConfig,errorScore,slideMode;var imageMetaRequired=false;var realIndex,videoCount=0;var videoSlidesHash=this.config.video_hash;this._mapIndexes();var indexMap=this.indexToRealIndex;var errorThreshold=this.AUTOVERIFICATION_ERROR_THRESHOLD;var percentageFailing=0;var maxPercentageFailing=100;if(this.conversionVersion===2&&typeof this.AUTOVERIFICATION_THRESHOLDS[this.algo]!=='undefined'){errorThreshold=this.AUTOVERIFICATION_THRESHOLDS[this.algo];percentageFailing=this._percentageFailing(errorThreshold);}if(this.conversionVersion===2&&typeof this.MAX_PERCENTAGE_FAILING[this.algo]!=='undefined'){maxPercentageFailing=this.MAX_PERCENTAGE_FAILING[this.algo];}for(i in indexMap){if(indexMap.hasOwnProperty(i)){i=parseInt(i,10);realIndex=indexMap[i];if(indexMap[i]===null){slideMode='ytube_video';}else if(this.mode==='html'&&!this.config.image_ready){slideMode='html';}else if(this.mode==='image'){slideMode='image';}else{if(this.conversionVersion===2&&percentageFailing>maxPercentageFailing){slideMode='image';imageMetaRequired=true;}else{errorScore=parseFloat(this.errorScores[i]);if(isNaN(errorScore)){errorScore=this.DEFAULT_ERROR_SCORE;}if(errorScore>errorThreshold){slideMode='image';imageMetaRequired=true;}else{slideMode='html';}}}if(realIndex===null){realIndex=videoSlidesHash[i].parent;}size=this.slideSizes[realIndex]||{};if(slideMode==='html'){this.slideModes.html.push(realIndex);}else if(slideMode==='image'){this.slideModes.image.push(realIndex);}slideConfig={realIndex:realIndex,index:i,type:this.mode,slideMode:slideMode,indexGenerator:this._getIndexString,contentWidth:parseInt(size.width,10),contentHeight:parseInt(size.height,10),playerWidth:this.currentComponentSet.width,errorImageUrl:this.config.error_image_url,spinnerUrl:this.config.spinner_url,spinnerUrlFullscreen:this.config.spinner_url_fullscreen,playerType:this.config.player_type,stripped_title:this.config.stripped_title,timestamp:this.config.timestamp,ppt_location:this.config.ppt_location,is_private:this.config.is_private,conversionVersion:this.conversionVersion||1};if(slideMode==='html'){slideConfig.bucketLocation=this.config.bucket_location;slideConfig.availableSizes=this.availableBgSizes[realIndex];}else if(slideMode==='image'){slideConfig.bucketLocation=this.config.image_bucket_location;slideConfig.availableSizes=this.availableFallbackSizes[realIndex];}if(this.config.is_private){if(slideMode=='html'){if(this.htmlResourceSignatures&&this.htmlResourceSignatures[realIndex]){slideConfig.htmlResourceSignature=this.htmlResourceSignatures[realIndex].url;}slideConfig.privateImageSignatures=this.privateImageSignatures[realIndex];}else if(slideMode=='image'){if(this.privateFallBackImageSignatures){slideConfig.privateImageSignatures=this.privateFallBackImageSignatures[realIndex];}}}if(this.config.player_type==='document'){slide=new SSDocumentSlide(slideConfig);}else{if(slideMode!=='ytube_video'){slide=new SSPresentationSlide(slideConfig);}else{videoCount++;slideConfig.video_id=videoSlidesHash[i].video_id;slideConfig.current_video_cou

Page 24: teste

nt=videoCount;slideConfig.loading_message_partial=this.config.loading_message_partial;if(i===1){slideConfig.contentWidth=728;slideConfig.contentHeight=542;}slide=new SSVideoEmbedSlide(slideConfig);}}if(this.mode==='image'&&this.slideLinks[realIndex]!==undefined){slide.updateResource('image',{linkData:this.slideLinks[realIndex]||{}});}this.slides[i]=slide;delete(this.availableFallbackSizes[realIndex]);}}if(imageMetaRequired===true){this.slidesCreated=true;this.fallbackMetaData&&this.fallbackMetaHandler(this.fallbackMetaData);}};SSPlayerController.prototype._getIndexString=function(number,length){var s=''+number;var numberlen=s.length;var i;for(i=0;i<(length-numberlen);i++){s='0'+s;}return s;};SSPlayerController.prototype._getContainerSize=function(){this.currentComponentSet.width=this.currentComponentSet.container.width();this.currentComponentSet.height=this.currentComponentSet.container.height();};SSPlayerController.prototype.setDimensions=function(partial){var componentSet=this.currentComponentSet;this._getContainerSize();partial=partial||false;componentSet.viewHeight=componentSet.height;if(this.hasToolbar){componentSet.viewHeight=componentSet.viewHeight-this.TOOLBAR_HEIGHT-this.TOOLBAR_PADDING;}if(this.config.has_audio){componentSet.viewHeight=componentSet.viewHeight-this.AUDIOBAR_HEIGHT;}componentSet.slidedisplayer.setDimensions({width:componentSet.width,height:componentSet.viewHeight,partial:partial});if(!partial){var dimensions={height:componentSet.height,width:componentSet.width};this.currentComponentSet.toolbar&&this.currentComponentSet.toolbar.setDimensions(dimensions);this.currentComponentSet.audiobar&&this.currentComponentSet.audiobar.setDimensions(dimensions);this.currentComponentSet.shareScreen&&this.currentComponentSet.shareScreen.setDimensions(dimensions);this.currentComponentSet.lastScreen&&this.currentComponentSet.lastScreen.setDimensions(dimensions);}};SSPlayerController.prototype.repaint=function(){if(this.currentComponentSet.slidedisplayer===undefined){return;}this.setDimensions(true);this.setDimensions();this._repaintPrerenderedSlides();this.currentComponentSet.slidedisplayer._scrollTo(this.currentPosition);};SSPlayerController.prototype._repaintPrerenderedSlides=function(){var prerenderedSlides=this.currentComponentSet.slidedisplayer.prerenderedSlides;var slideIndex;if(prerenderedSlides.length>0){var i;for(i=0;i<prerenderedSlides.length;i++){slideIndex=prerenderedSlides[i];this.slides[slideIndex].show(true);}}};SSPlayerController.prototype.updateCurrentPosition=function(position){var toolbar=this.currentComponentSet.toolbar;var audiobar=this.currentComponentSet.audiobar;toolbar&&toolbar.updateCurrentPosition(position);audiobar&&audiobar.updateCurrentPosition(position);var audioResource=this.audioResource;if(toolbar&&this.config.has_audio&&audioResource){toolbar.updateAudioInteraction({audioReady:audioResource.audioReady,audioMetaReady:audioResource.metaDataReady,audioPlaying:audioResource.playing});toolbar.volumeControl.setVolume(this.audioResource.volume);}this.currentPosition=position;this.slides[position].painted=true;};SSPlayerController.prototype.displayLastScreen=function(){var that=this;if(typeof this.currentComponentSet.lastScreen==='undefined'){if(this.config.disable_lastscreen){this.currentComponentSet.lastScreen=new SSReplayScreen({renderTo:this.currentComponentSet.container,settings:this.config.replayscreen});}else{this.currentComponentSet.lastScreen=new SSLastScreen({renderTo:this.currentComponentSet.container,settings:this.config.lastscreen,embed_code:this.config.embed_code});}$(this.currentComponentSet.lastScreen).bind('gotofirstslide',function(){$(that).trigger('gotofirstslide');});$(this.currentComponentSet.lastScreen).bind('showshareoptions',function(){that.displayShareScreen();});}this.currentComponentSet.lastScreen.show({width:this.currentComponentSet.width,height:this.currentComponentSet.height});$.slideshareEventManager.trackEvent('lastscreen_shown');};SSPlayerController.prototype.displayShareScreen=function(){var that=this;if(typeof this.currentComponentSet.shareScreen==='undefined')

Page 25: teste

{this.currentComponentSet.shareScreen=new SSShareScreen({renderTo:this.currentComponentSet.container,settings:this.config.sharescreen,embed_code:this.config.embed_code,shareScreenClass:this.config.shareScreenClass});}this.currentComponentSet.shareScreen.show({width:this.currentComponentSet.width,height:this.currentComponentSet.height});};SSPlayerController.prototype.loadFonts=function(batchIndex){if(this.mode!=='html'){return;}var i=batchIndex;if(this.fontResources[batchIndex].status==='initialized'){this.fontResources[batchIndex].load();}};SSPlayerController.prototype._load=function(anchorIndex,isPreload){anchorIndex=anchorIndex||1;var i,slide;var that=this;this.loadFonts(Math.ceil(anchorIndex/this.FONT_BATCH_COUNT));if(!isPreload){var startPrerender=anchorIndex-this.PRERENDER_COUNT;if(startPrerender<1){startPrerender=1;}var endPrerender=anchorIndex+this.PRERENDER_COUNT;if(endPrerender>this.slideCount){endPrerender=this.slideCount;}for(i=startPrerender;i<=endPrerender;i++){this.slides[i].show();this.loadedSlides[i]=true;}if($.browser.msie){var prerenderedSlides=this.currentComponentSet.slidedisplayer.prerenderedSlides;var slideIndex;for(i=0;i<prerenderedSlides.length;i++){slideIndex=prerenderedSlides[i];if(slideIndex<startPrerender||slideIndex>endPrerender){slide=this.slides[slideIndex];slide.hide();}}}this.currentComponentSet.slidedisplayer.setPrerenderedSlides({start:startPrerender,end:endPrerender});}clearTimeout(this.preloadTimeoutId);this.preloadTimeoutId=setTimeout(function(){var slideCount=that.PRELOAD_PRE_LIMIT+that.PRELOAD_POST_LIMIT+1;var startSlideIndex=anchorIndex-that.PRELOAD_PRE_LIMIT;if(startSlideIndex<1){startSlideIndex=1;}var endSlideIndex=startSlideIndex+slideCount-1;if(endSlideIndex>that.slideCount){endSlideIndex=that.slideCount;}var startFontBatch=Math.ceil(startSlideIndex/that.FONT_BATCH_COUNT);var endFontBatch=Math.ceil(endSlideIndex/that.FONT_BATCH_COUNT);for(i=startFontBatch;i<=endFontBatch;i++){that.loadFonts(i);}for(i=startSlideIndex;i<=endSlideIndex;i++){if(!that.loadedSlides[i]){slide=that.slides[i];slide.load();that.loadedSlides[i]=true;}}delete(that.preloadTimeoutId);},2000);};SSPlayerController.prototype.preloadMoreIfIdle=function(index){var loadingSlides=this.loadingSlides;var pos=loadingSlides.indexOf(index);if(pos>-1){loadingSlides.splice(pos,1);}if(!this.preloadTimeoutId&&loadingSlides.length<2){var lastIndex=this.loadedSlides.length+1;if(lastIndex>this.realSlideCount){return;}var that=this;setTimeout(function(){that._load(lastIndex,true);},0);}};SSPlayerController.prototype.play=function(index,force){if(!this.initialized){this.playQueue=index||1;return;}if(index===undefined){if(typeof this.playQueue!=='undefined'){index=this.playQueue;delete(this.playQueue);}else{index=1;}}if(index<1){index=1;}if(index>this.slideCount){index=this.slideCount;}if(this.currentPosition===index&&!force){return;}if(this.mode==='video'){this.currentComponentSet.slidedisplayer.start();return;}$.slideshareEventManager.trigger('slidechanged',{index:index,force:force});};SSPlayerController.prototype._enableVideoReloading=function(){var slideindexes=this.slides;for(var i in slideindexes){if(slideindexes.hasOwnProperty(i)){if(slideindexes[i]&&slideindexes[i].config.slideMode==='ytube_video'){slideindexes[i].emptySlide();}}}};SSPlayerController.prototype.switchView=function(mode){if(mode===this.currentViewMode){return;}if(this.config.has_video){this._enableVideoReloading();$('[id*=ytube_player]').remove();}this._deactivateComponentSet(this.currentViewMode);if(this.componentSets[mode]===undefined){this._createComponentSet(mode);}this._activateComponentSet(mode);this._setModeForSlides(mode);this.setDimensions();this.play(this.currentPosition,true);this._load(this.currentPosition);this.updateCurrentPosition(this.currentPosition);};SSPlayerController.prototype._activa

Page 26: teste

teComponentSet=function(mode){var componentSet=this.componentSets[mode];var navigators=componentSet.navigators;this.currentComponentSet=componentSet;this.currentViewMode=mode;$.each(navigators,function(index,navigatorItem){navigatorItem.activate();});if(mode==='fullscreen'||this.config.is_fullscreen){$(document).bind('keyup',this.exitFullScreenHandler);$(window).scrollTop(0);}else{$(document).unbind('keyup',this.exitFullScreenHandler);this.normalModeScrollPosition&&$(window).scrollTop(this.normalModeScrollPosition);}};SSPlayerController.prototype.exitFullScreenHandlerFactory=function(){var that=this;return function(e){if(e.keyCode===27){try{$.slideshareEventManager.trigger('leavefullscreen');}catch(exception){}}};};SSPlayerController.prototype._deactivateComponentSet=function(mode){var componentSet=this.componentSets[mode];var navigators=componentSet.navigators;$.each(navigators,function(index,navigatorItem){navigatorItem.deactivate();});if(mode==='fullscreen'){this._destroyComponentSet('fullscreen');}this.currentComponentSet=null;this.currentViewMode=null;};SSPlayerController.prototype._setModeForSlides=function(mode){this.currentComponentSet.slidedisplayer.start({slides:this.slides,mode:mode});this.currentComponentSet.slidedisplayer._bindEvents();};SSPlayerController.prototype.getFullScreenUrl=function(){return this.config.fullscreen_url+'/'+this.currentPosition;};SSPlayerController.prototype.generateErrorDom=function(templateKey,dimensions){var cache_key=templateKey+'_'+dimensions.width+'_'+dimensions.height;var errorWrapper=this.cachedDomElements[cache_key];if(errorWrapper===undefined){var width=dimensions.width;var height=dimensions.height;var errorHeight=height/3;errorHeight=errorHeight>width/4?width/4:errorHeight;var borderRounding=parseInt(errorHeight/20,10);var sideMargin=14;var topOffsetFactor=this.config.player_type==='document'?4:2;var topMargin=(height-errorHeight)/topOffsetFactor;var fontSize=width/25;var imageMargin=errorHeight-sideMargin;errorWrapper=$(this.config[templateKey]);errorWrapper.css({'height':height-topMargin,'padding':topMargin+'px '+sideMargin+'px 0'});var errorDiv=errorWrapper.children('div');errorDiv.css({'-moz-border-radius':borderRounding,'-webkit-border-radius':borderRounding,'-o-border-radius':borderRounding,'-ms-border-radius':borderRounding,'border-radius':borderRounding,height:errorHeight});errorDiv.children('img').css({margin:sideMargin/2,height:imageMargin,width:imageMargin});errorDiv.children('div').css({left:imageMargin+sideMargin,padding:sideMargin+'px 0 0 '+sideMargin/2+'px','font-size':fontSize});this.cachedDomElements[cache_key]=errorWrapper;}return $(errorWrapper).clone();};;window.Modernizr=function(a,b,c){function z(a,b){for(var d in a)if(j[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function y(a,b){return!!~(""+a).indexOf(b)}function x(a,b){return typeof a===b}function w(a,b){return v(m.join(a+";")+(b||""))}function v(a){j.cssText=a}var d="2.0.6",e={},f=b.documentElement,g=b.head||b.getElementsByTagName("head")[0],h="modernizr",i=b.createElement(h),j=i.style,k,l=Object.prototype.toString,m=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),n={},o={},p={},q=[],r=function(a,c,d,e){var g,i,j,k=b.createElement("div");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),k.appendChild(j);g=["&shy;","<style>",a,"</style>"].join(""),k.id=h,k.innerHTML+=g,f.appendChild(k),i=c(k,a),k.parentNode.removeChild(k);return!!i},s,t={}.hasOwnProperty,u;!x(t,c)&&!x(t.call,c)?u=function(a,b){return t.call(a,b)}:u=function(a,b){return b in a&&x(a.constructor.prototype[b],c)};var A=function(c,d){var f=c.join(""),g=d.length;r(f,function(c,d){var f=b.styleSheets[b.styleSheets.length-1],h=f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"",i=c.childNodes,j={};while(g--)j[i[g].id]=i[g];e.touch="ontouchstart"in a||j.touch.offsetTop===9},g,d)}([,["@media (",m.join("touch-enabled),("),h,")","{#touch{top:9px;position:absolute}}"].join("")],[,"touch"]);n.touch=function(){return e.touch},n.csstransforms=function(){return!!

Page 27: teste

z(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])};for(var B in n)u(n,B)&&(s=B.toLowerCase(),e[s]=n[B](),q.push((e[s]?"":"no-")+s));v(""),i=k=null,e._version=d,e._prefixes=m,e.testProp=function(a){return z([a])},e.testStyles=r;return e}(this,this.document);if(!Array.prototype.indexOf){Array.prototype.indexOf=function(searchElement){"use strict";if(this==null){throw new TypeError();}var t=Object(this);var len=t.length>>>0;if(len===0){return-1;}var n=0;if(arguments.length>0){n=Number(arguments[1]);if(n!=n){n=0;}else if(n!=0&&n!=Infinity&&n!=-Infinity){n=(n>0||-1)*Math.floor(Math.abs(n));}}if(n>=len){return-1;}var k=n>=0?n:Math.max(len-Math.abs(n),0);for(;k<len;k++){if(k in t&&t[k]===searchElement){return k;}}return-1;};}function SSPlayer(config){this.config=config;this._init();};SSPlayer.prototype._init=function(){this.config.touch=Modernizr.touch;this.controller=new SSPlayerController(this.config);$.slideshareEventManager.registerPlayer(this);var that=this;$(window).bind('resize',function(){$.slideshareEventManager.trigger('repaint');});};SSPlayer.prototype.play=function(index){index=index||1;this.controller.play(index);};SSPlayer.prototype.gotoCurrent=function(){this.controller.play(this.controller.currentPosition,true);};