make metacode selector reliable after switching metacode sets (#816)

This commit is contained in:
Devin Howard 2016-10-23 22:11:26 +08:00 committed by GitHub
parent 87dc20fa50
commit 5db8e27496

View file

@ -194,7 +194,7 @@ jQuery.browser = browser;
}); });
*/ */
} }
$(container).bind('mouseover click',this,function(event){ $(container).unbind('mouseover click').bind('mouseover click',this,function(event){
clearInterval(event.data.autoRotateTimer); // Stop auto rotation if mouse over. clearInterval(event.data.autoRotateTimer); // Stop auto rotation if mouse over.
var text = $(event.target).attr('alt'); var text = $(event.target).attr('alt');
@ -208,10 +208,10 @@ jQuery.browser = browser;
//$(options.titleBox).html( ($(event.target).attr('title') )); //$(options.titleBox).html( ($(event.target).attr('title') ));
if ( options.bringToFront && event.type == 'click' ) if ( options.bringToFront && event.type == 'click' )
{ {
$(options.titleBox).html( ($(event.target).attr('title') )); options.titleBox).html( ($(event.target).attr('title') ));
// METAMAPS CODE // START METAMAPS CODE
Metamaps.Create.newTopic.metacode = $(event.target).attr('data-id'); Metamaps.Create.newTopic.metacode = $(event.target).attr('data-id');
// NOT METAMAPS CODE // END METAMAPS CODE
var idx = $(event.target).data('itemIndex'); var idx = $(event.target).data('itemIndex');
var frontIndex = event.data.frontIndex; var frontIndex = event.data.frontIndex;
//var diff = idx - frontIndex; //var diff = idx - frontIndex;
@ -224,6 +224,11 @@ jQuery.browser = browser;
} }
} }
}); });
// START METAMAPS CODE - initialize newTopic.metacode
var first = $(this.container).find('img').get(0)
Metamaps.Create.newTopic.metacode = $(first).data('id')
// END METAMAPS CODE
// If we have moved out of a carousel item (or the container itself), // If we have moved out of a carousel item (or the container itself),
// restore the text of the front item in 1 second. // restore the text of the front item in 1 second.
$(container).bind('mouseout',this,function(event){ $(container).bind('mouseout',this,function(event){
@ -247,11 +252,6 @@ jQuery.browser = browser;
this.showFrontText = function() this.showFrontText = function()
{ {
if ( items[this.frontIndex] === undefined ) { return; } // Images might not have loaded yet. if ( items[this.frontIndex] === undefined ) { return; } // Images might not have loaded yet.
// METAMAPS CODE
Metamaps.Create.newTopic.metacode = $(items[this.frontIndex].image).attr('data-id');
//$('img.cloudcarousel').css({"background":"none", "width":"","height":""});
//$(items[this.frontIndex].image).css({"width":"45px","height":"45px"});
// NOT METAMAPS CODE
$(options.titleBox).html( $(items[this.frontIndex].image).attr('title')); $(options.titleBox).html( $(items[this.frontIndex].image).attr('title'));
$(options.altBox).html( $(items[this.frontIndex].image).attr('alt')); $(options.altBox).html( $(items[this.frontIndex].image).attr('alt'));
}; };