summaryrefslogtreecommitdiff
path: root/modules/digibug/js/digibug.js
blob: 837c8f7f19fbf60cda1c8df538dbb7135a55e694 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
$(document).ready(function() {
  $(".gDigibugPrintButton a").click(function(e) {
    e.preventDefault();
    queue_print(e);
  });
  $("#gDigibugLink").click(function(e) {
    e.preventDefault();
    return queue_print(e);
  });
});

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) {
  return popUp(e.currentTarget.href, { width: 800, height: 600 } );
};