2014-03-10 05:18:05 +00:00
|
|
|
$(function () {
|
2014-12-16 14:14:54 +00:00
|
|
|
$('.plotInfo, .plot-daybyday').each(function () {
|
2014-12-11 12:55:42 +00:00
|
|
|
var match = $(this).attr('id').match(/^plot_info_(\d+)_(\d+)_(\d+)$/);
|
2014-03-10 05:18:05 +00:00
|
|
|
$(this).qtip({
|
|
|
|
content: {
|
2014-12-11 12:55:42 +00:00
|
|
|
text: function(event, api) {
|
|
|
|
// deferred object ensuring the request is only made once
|
|
|
|
$.ajax({
|
|
|
|
url: $('#sbRoot').val() + '/home/plotDetails',
|
|
|
|
type: 'GET',
|
|
|
|
data: {
|
|
|
|
show: match[1],
|
|
|
|
episode: match[3],
|
|
|
|
season: match[2]
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.then(function(content) {
|
|
|
|
// Set the tooltip content upon successful retrieval
|
|
|
|
api.set('content.text', content);
|
|
|
|
}, function(xhr, status, error) {
|
|
|
|
// Upon failure... set the tooltip content to the status and error value
|
|
|
|
api.set('content.text', status + ': ' + error);
|
|
|
|
});
|
|
|
|
return 'Loading...'; // Set initial text
|
2014-03-10 05:18:05 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
show: {
|
|
|
|
solo: true
|
|
|
|
},
|
|
|
|
position: {
|
|
|
|
viewport: $(window),
|
|
|
|
my: 'left center',
|
|
|
|
adjust: {
|
|
|
|
y: -10,
|
|
|
|
x: 2
|
|
|
|
}
|
|
|
|
},
|
|
|
|
style: {
|
2014-12-11 12:55:42 +00:00
|
|
|
classes: 'qtip-rounded qtip-shadow'
|
2014-03-10 05:18:05 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|