ebook_rbdigital.cancelHold(authtoken, rbdigitalPatronId, cancelHoldCallback);
});
+ $(document).on('click','#ebook_circs_main_table_body a', function () {
+ var that = $(this);
+ var api_url = that.attr('href');
+
+ if (that.html() == "Download" && api_url.indexOf('api.rbdigital') > 0) {
+ showEbookSpinner(that);
+ downloadUrl(api_url);
+ }
+ return false;
+ });
+
//Download File
$(document).on('click', '.ebook_checkout_download_link', function () {
var that = $(this);
- var downloadUrl = that.attr('data-downloadurl');
+ var api_url = that.attr('data-downloadurl');
showEbookSpinner(that);
- //Change http protocol to https to avoid browser error on Mixed contents
- if (downloadUrl.indexOf('https') == -1) {
- downloadUrl = downloadUrl.replace("http", "https");
- }
+ downloadUrl(api_url);
- //Make an ajax call to get a download link
- $.ajax({
- type: 'GET',
- url: downloadUrl,
- success: function(result){
- console.log('success');
- console.log(result.url);
- window.open(result.url, '_self');
- hideEbookSpinner();
- }
- });
+ return false;
+ });
+}
+
+function downloadUrl(api_url) {
+ //Change http protocol to https to avoid browser error on Mixed contents
+ if (api_url.indexOf('https') == -1) {
+ api_url = api_url.replace("http", "https");
+ }
+
+ //Make an ajax call to get a download link
+ $.ajax({
+ type: 'GET',
+ url: api_url,
+ success: function(result){
+ console.log('success');
+ console.log(result.url);
+ window.open(result.url, '_self');
+ hideEbookSpinner();
+ }
});
}