diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-06-23 22:13:28 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-06-23 22:13:28 -0700 |
commit | 231ad4f32950f42c76c16ab453246bedea8abf2c (patch) | |
tree | 1ed67e6461709459a7465b974a355a8c0b59a4d7 /modules/digibug/js | |
parent | 79522bd4f31f8e4d70e754e42d5d33c4031519c9 (diff) |
This implements the Digibug printing. When a a print request is made the digibug shopping cart is opened in a new
window. When the cart is emptied, the window is closed. Users can close the window by pressing the continue shopping
button
Diffstat (limited to 'modules/digibug/js')
-rw-r--r-- | modules/digibug/js/digibug.js | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/modules/digibug/js/digibug.js b/modules/digibug/js/digibug.js index f30678c0..e9e8933e 100644 --- a/modules/digibug/js/digibug.js +++ b/modules/digibug/js/digibug.js @@ -5,20 +5,42 @@ $(document).ready(function() { }); }); +function popUp(url, options) { + options = $.extend({ + /* default options */ + width: 400, + height: 400, + target: 'dbPopWin', + scrollbars: 'yes', + resizable: 'no', + menuBar: 'no', + addressBar: 'yes'}, options); + + /* center the window by default. */ + if (!options.winY) { + options.winY = screen.height / 2 - options.height / 2; + }; + if (!options.winX) { + options.winX = screen.width / 2 - options.width / 2; + }; + + open( + url, + options['target'], + 'width= ' + options.width + + ',height=' + options.height + + ',top=' + options.winY + + ',left=' + options.winX + + ',scrollbars=' + options.scrollbars + + ',resizable=' + options.resizable + + ',menubar=' + options.menuBar + + ',location=' + options.addressBar + ); + + return false; + +} + function queue_print(e) { - var parent = e.currentTarget.parentNode; - $(parent).addClass("gLoadingLarge"); - $.ajax({ - type: "GET", - url: e.currentTarget.href, - dataType: "json", - success: function(data) { - $(parent).removeClass("gLoadingLarge"); - if (data.location) { - window.location = data.location; - } else if (data.reload) { - window.location.reload(); - } - } - }); + return popUp(e.currentTarget.href, { width: 800, height: 600 } ); }; |