2013-05-30 13:17:34 +00:00
|
|
|
var $j = jQuery.noConflict();
|
|
|
|
|
2013-05-31 14:46:26 +00:00
|
|
|
// must load CSS rather than show/hide jQuery objects; can't trigger an event
|
|
|
|
// on an element not present on pageload, so binding it via on is useless
|
|
|
|
if (document.createStyleSheet) {
|
|
|
|
// make it work in IE <= 8
|
|
|
|
document.createStyleSheet('/static/css/enhanced_download_ie.css');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$j('<link rel="stylesheet" type="text/css" href="/static/css/enhanced_download.css" />').appendTo('head');
|
|
|
|
}
|
2013-05-30 13:17:34 +00:00
|
|
|
|
2013-05-31 14:46:26 +00:00
|
|
|
// browser has a better sense of DOM changes than jQuery, so user can trigger click element
|
2013-06-12 19:11:43 +00:00
|
|
|
$j(document).on('click', '.other_instructions', function(e) {
|
|
|
|
e.preventDefault();
|
2013-06-24 17:53:28 +00:00
|
|
|
var myLink = $j(this);
|
|
|
|
classes = myLink.attr('class').split(' ');
|
|
|
|
mySelector = classes[0];
|
|
|
|
var divSelector = '#' + mySelector + '_div';
|
2013-05-31 14:46:26 +00:00
|
|
|
var activeDiv = $j(divSelector);
|
|
|
|
activeDiv.show();
|
2013-06-24 17:53:28 +00:00
|
|
|
activeDiv.siblings().removeClass('active').hide();
|
2013-06-04 14:22:11 +00:00
|
|
|
});
|
|
|
|
|
2013-06-05 15:06:07 +00:00
|
|
|
$j(document).on('click', '#kindle.authenticated', function() {
|
2013-06-24 17:53:28 +00:00
|
|
|
var myDiv = $j(this);
|
2013-09-06 02:54:11 +00:00
|
|
|
work_id = myDiv.attr('title');
|
2013-06-24 17:53:28 +00:00
|
|
|
myDiv.html('<img src="/static/images/loading.gif">')
|
2013-09-06 02:54:11 +00:00
|
|
|
$j.post('/send_to_kindle/' + work_id + '/1/', function(data) {
|
2013-06-25 05:11:43 +00:00
|
|
|
myDiv.removeClass('btn_support');
|
2013-06-24 17:53:28 +00:00
|
|
|
myDiv.html(data);
|
2013-06-26 13:43:15 +00:00
|
|
|
myDiv.removeAttr('id');
|
2013-06-12 18:05:30 +00:00
|
|
|
return false;
|
2013-06-04 14:22:11 +00:00
|
|
|
});
|
2013-05-31 14:46:26 +00:00
|
|
|
});
|