Created
May 31, 2012 01:58
-
-
Save mrobers1982/2840368 to your computer and use it in GitHub Desktop.
Fix to make changeConversation work better - use a closure to keep track of timeout ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setSlide:function(slide){ | |
var slideHTML = ''; | |
if (typeof slide == 'object') { // VVMPhoto object | |
var image = slide; | |
slideHTML = '<img '+(image.caption!=''?'title="'+image.caption.replace(/<(?:.|\n)*?>/gm, '')+'"':'')+' src="'+image.url+'"/>'; | |
if(!this.settings.streetteam){ | |
if(image.credit != '') | |
slideHTML += '<small>'+image.credit+'</small>'; | |
if(image.caption != '') | |
slideHTML += '<p>'+image.caption+'</p>'; | |
} | |
if(this.settings.showSocial) | |
this.VVMSocial.update(this.settings.pointer, image.url); | |
if(this.settings.showDisqus){ | |
var that = this; | |
if (typeof DISQUS !== 'undefined') { | |
this.VVMDisqus.update(this.settings.pointer); | |
} else { | |
// (Matt-Livefyre) Start | |
// If you don't use a closure to keep track of lfTimeout, it will be undefined and therfore | |
// clearTimout will not have the ID of the timeout you want to clear. | |
clearTimeout(this.lfTimeout) | |
this.lfTimeout = setTimeout(function(){ that.VVMDisqus.update(that.settings.pointer); }, 2200); | |
// (Matt-Livefyre) End | |
} | |
} | |
$('.details > .hidden', this.settings.container).removeClass('hidden').show(); | |
} else if (typeof slide == 'string') { // html for the final slide | |
slideHTML = slide; | |
if(this.settings.showSocial) | |
this.VVMSocial.remove(); | |
if(this.settings.showDisqus) | |
this.VVMDisqus.hide(); | |
$('.details > *:visible', this.settings.container).not('[class^=thumb]').addClass('hidden').hide(); | |
} | |
if(this.settings.changeAds) | |
this.VVMAds.update(); | |
$('.top_nav p', this.p).text(this.settings.pointer+' of '+this.settings.total); | |
this.changingHash = true; | |
if((!this.initing||this.settings.pointer!=this.settings.initPointer)&&location.hash.substring(1)!=this.settings.pointer) | |
window.location.hash = this.settings.pointer; | |
// TODO: Delete this after we launch VVM.trackPageView() | |
if(typeof _gaq == 'object'){ | |
var curHost = base_domain || location.protocol+'//'+location.hostnathis; | |
_gaq.push(['_trackPageview', this.settings.baseurl.substr(curHost.length)+this.settings.pointer+'/']); | |
} | |
$('.slide', this.p).animate({ | |
opacity:0 | |
},200,'linear',function(){ | |
$(this).html(slideHTML).animate({ | |
opacity:1 | |
}) | |
}); | |
this.initing = false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment