},
- onReady: function(callback) {
+ onReady: function (callback) {
if (this.isReady) {
callback();
} else {
- $(this).on('fluidbook.ready', function() {
+ $(this).on('fluidbook.ready', function () {
callback();
});
}
}
if (this.datas.url_link.indexOf('#') === 0) {
- window.location.hash = this.datas.url_link;
+ window.location.hash = this.datas.url_link;
} else {
- this.wopen(this.datas.url_link, '_blank');
+ this.wopen(this.datas.url_link, '_blank');
}
},
},
print: function (button) {
+ return this.openPDF(button, true);
+ },
+
+ downloadPDF: function (button) {
+ return this.openPDF(button, false)
+ },
+
+ openPDF: function (button, print) {
var $this = this;
var pdf;
var pdfName;
}
var e = pdf.split('/');
pdfName = e.pop();
- /*if (this.gal && !OFFLINEAPP) {
- this.displayLoader();
- this.gal.downloadAndCall('extras', function () {
- $this._openFile(pdf, $("#print"), 'pdf', pdfName);
- });
- } else {*/
- this._openFile(pdf, button, 'pdf', pdfName);
- //}
+
+ this._openFile(pdf, button, 'pdf', pdfName, print);
},
- _openFile: function (url, e, type, localname) {
+
+
+ _openFile: function (url, e, type, localname, print) {
var $this = this;
if (this.datas.phonegap != false) {
}
}
- this.wopen(url, '_blank');
+ var w = this.wopen(url, '_blank', '');
+ if (print) {
+ setTimeout(function () {
+ w.print();
+ }, 2000);
+ }
},
_downloadFilePhonegap: function (url, localname, fs, callback, callbackArgs) {
console.log('download file phonegap');
},
- wopen: function (url, target, options) {
+ wopen: function (url, target, options, print) {
+ var win;
+ if (this.support.nwjs) {
+ win = nw.Window.get().window;
+ } else {
+ win = window;
+ }
+
+
if (target == undefined) {
target = '_self';
}
var w;
if (options == undefined && replace == undefined) {
if (this.support.IE == 0) {
- w = window.open(url, mtarget);
+ w = win.open(url, mtarget);
} else {
$("#wopen").remove();
$('body').append('<a id="wopen" href="' + url + '" target="' + mtarget + '"></a>');
}, 200);
}
} else {
- w = window.open(url, mtarget, options, replace);
+ w = win.open(url, mtarget, options, replace);
}
try {
} catch (e) {
}
+ return w;
}
}