rgraph-rails 5.00 → 6.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/publish-geml.yaml +46 -0
  3. data/.gitignore +1 -0
  4. data/README.md +4 -5
  5. data/lib/rgraph-rails/version.rb +1 -1
  6. data/rgraph-rails.gemspec +4 -4
  7. data/vendor/assets/javascripts/RGraph.activity.js +1691 -0
  8. data/vendor/assets/javascripts/RGraph.bar.js +4253 -236
  9. data/vendor/assets/javascripts/RGraph.bipolar.js +3958 -162
  10. data/vendor/assets/javascripts/RGraph.common.annotate.js +414 -35
  11. data/vendor/assets/javascripts/RGraph.common.context.js +635 -30
  12. data/vendor/assets/javascripts/RGraph.common.core.js +10485 -419
  13. data/vendor/assets/javascripts/RGraph.common.csv.js +508 -27
  14. data/vendor/assets/javascripts/RGraph.common.dynamic.js +1693 -90
  15. data/vendor/assets/javascripts/RGraph.common.effects.js +1629 -89
  16. data/vendor/assets/javascripts/RGraph.common.key.js +1003 -53
  17. data/vendor/assets/javascripts/RGraph.common.moment.js +5670 -0
  18. data/vendor/assets/javascripts/RGraph.common.sheets.js +541 -31
  19. data/vendor/assets/javascripts/RGraph.common.sheets.php +351 -0
  20. data/vendor/assets/javascripts/RGraph.common.starburst.js +382 -0
  21. data/vendor/assets/javascripts/RGraph.common.table.js +386 -0
  22. data/vendor/assets/javascripts/RGraph.common.tooltips.js +1433 -32
  23. data/vendor/assets/javascripts/RGraph.drawing.background.js +660 -35
  24. data/vendor/assets/javascripts/RGraph.drawing.circle.js +618 -34
  25. data/vendor/assets/javascripts/RGraph.drawing.image.js +857 -52
  26. data/vendor/assets/javascripts/RGraph.drawing.line.js +712 -0
  27. data/vendor/assets/javascripts/RGraph.drawing.marker1.js +760 -38
  28. data/vendor/assets/javascripts/RGraph.drawing.marker2.js +740 -37
  29. data/vendor/assets/javascripts/RGraph.drawing.marker3.js +573 -36
  30. data/vendor/assets/javascripts/RGraph.drawing.poly.js +667 -36
  31. data/vendor/assets/javascripts/RGraph.drawing.rect.js +638 -34
  32. data/vendor/assets/javascripts/RGraph.drawing.text.js +672 -37
  33. data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +653 -52
  34. data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +714 -51
  35. data/vendor/assets/javascripts/RGraph.fuel.js +1149 -59
  36. data/vendor/assets/javascripts/RGraph.funnel.js +1277 -56
  37. data/vendor/assets/javascripts/RGraph.gantt.js +1646 -82
  38. data/vendor/assets/javascripts/RGraph.gauge.js +1773 -89
  39. data/vendor/assets/javascripts/RGraph.hbar.js +3869 -159
  40. data/vendor/assets/javascripts/RGraph.horseshoe.js +970 -0
  41. data/vendor/assets/javascripts/RGraph.hprogress.js +1829 -81
  42. data/vendor/assets/javascripts/RGraph.line.js +5293 -244
  43. data/vendor/assets/javascripts/RGraph.meter.js +1570 -77
  44. data/vendor/assets/javascripts/RGraph.modaldialog.js +300 -19
  45. data/vendor/assets/javascripts/RGraph.odo.js +1553 -68
  46. data/vendor/assets/javascripts/RGraph.pie.js +3273 -129
  47. data/vendor/assets/javascripts/RGraph.radar.js +2333 -108
  48. data/vendor/assets/javascripts/RGraph.rose.js +2685 -114
  49. data/vendor/assets/javascripts/RGraph.rscatter.js +1920 -80
  50. data/vendor/assets/javascripts/RGraph.scatter.js +4215 -171
  51. data/vendor/assets/javascripts/RGraph.segmented.js +1006 -0
  52. data/vendor/assets/javascripts/RGraph.semicircularprogress.js +1980 -59
  53. data/vendor/assets/javascripts/RGraph.svg.activity.js +1696 -0
  54. data/vendor/assets/javascripts/RGraph.svg.bar.js +2575 -77
  55. data/vendor/assets/javascripts/RGraph.svg.bipolar.js +3533 -106
  56. data/vendor/assets/javascripts/RGraph.svg.common.ajax.js +240 -21
  57. data/vendor/assets/javascripts/RGraph.svg.common.core.js +7105 -299
  58. data/vendor/assets/javascripts/RGraph.svg.common.csv.js +408 -28
  59. data/vendor/assets/javascripts/RGraph.svg.common.fx.js +1291 -68
  60. data/vendor/assets/javascripts/RGraph.svg.common.key.js +451 -20
  61. data/vendor/assets/javascripts/RGraph.svg.common.sheets.js +543 -31
  62. data/vendor/assets/javascripts/RGraph.svg.common.table.js +391 -0
  63. data/vendor/assets/javascripts/RGraph.svg.common.tooltips.js +1072 -23
  64. data/vendor/assets/javascripts/RGraph.svg.funnel.js +1151 -32
  65. data/vendor/assets/javascripts/RGraph.svg.gauge.js +1429 -34
  66. data/vendor/assets/javascripts/RGraph.svg.hbar.js +2692 -65
  67. data/vendor/assets/javascripts/RGraph.svg.horseshoe.js +969 -0
  68. data/vendor/assets/javascripts/RGraph.svg.line.js +2855 -86
  69. data/vendor/assets/javascripts/RGraph.svg.pie.js +1630 -58
  70. data/vendor/assets/javascripts/RGraph.svg.radar.js +1772 -58
  71. data/vendor/assets/javascripts/RGraph.svg.rose.js +2419 -83
  72. data/vendor/assets/javascripts/RGraph.svg.scatter.js +2280 -65
  73. data/vendor/assets/javascripts/RGraph.svg.segmented.js +930 -0
  74. data/vendor/assets/javascripts/RGraph.svg.semicircularprogress.js +1612 -29
  75. data/vendor/assets/javascripts/RGraph.svg.waterfall.js +1525 -50
  76. data/vendor/assets/javascripts/RGraph.thermometer.js +1411 -64
  77. data/vendor/assets/javascripts/RGraph.vprogress.js +1915 -81
  78. data/vendor/assets/javascripts/RGraph.waterfall.js +1896 -89
  79. data/vendor/assets/javascripts/financial-data.js +1067 -0
  80. metadata +37 -16
  81. data/.travis.yml +0 -11
  82. data/vendor/assets/javascripts/RGraph.common.deprecated.js +0 -35
  83. data/vendor/assets/javascripts/RGraph.common.resizing.js +0 -38
  84. data/vendor/assets/javascripts/RGraph.common.zoom.js +0 -15
  85. data/vendor/assets/javascripts/RGraph.cornergauge.js +0 -71
@@ -1,31 +1,636 @@
1
+ 'version:2023-09-16 (6.14)';
2
+ //
3
+ // o--------------------------------------------------------------------------------o
4
+ // | This file is part of the RGraph package - you can learn more at: |
5
+ // | |
6
+ // | https://www.rgraph.net |
7
+ // | |
8
+ // | RGraph is licensed under the Open Source MIT license. That means that it's |
9
+ // | totally free to use and there are no restrictions on what you can do with it! |
10
+ // o--------------------------------------------------------------------------------o
1
11
 
2
- RGraph=window.RGraph||{isRGraph:true};(function(win,doc,undefined)
3
- {var RG=RGraph,ua=navigator.userAgent,ma=Math;RG.contextmenu=RG.Contextmenu=function(obj,menuitems,e)
4
- {var canvas=obj.canvas;e=RG.FixEventObject(e);RG.FireCustomEvent(obj,'onbeforecontextmenu');if(RG.Registry.Get('chart.contextmenu')){RG.HideContext();}
5
- RG.HideZoomedCanvas();RG.HidePalette();obj.Set('chart.mousedown',false);var x=e.pageX;var y=e.pageY;var div=document.createElement('div');var bg=document.createElement('div');div.className='RGraph_contextmenu';div.__canvas__=canvas;div.style.position='absolute';div.style.left=0;div.style.top=0;div.style.border='1px solid #666';div.style.backgroundColor='white';div.style.boxShadow='1px 1px 3px #ddd';div.style.MozBoxShadow='1px 1px 3px #ddd';div.style.WebkitBoxShadow='1px 1px 3px #ddd';div.style.opacity=0;bg.className='RGraph_contextmenu_background';bg.style.position='absolute';bg.style.backgroundColor='#ccc';bg.style.borderRight='1px solid #aaa';bg.style.top=0;bg.style.left=0;bg.style.width='18px';bg.style.height='100%';bg.style.opacity=0;div=document.body.appendChild(div);bg=div.appendChild(bg);for(i=0;i<menuitems.length;++i){var menuitem=document.createElement('div');menuitem.__object__=obj;menuitem.__canvas__=canvas;menuitem.__contextmenu__=div;menuitem.className='RGraph_contextmenu_item';if(menuitems[i]){menuitem.style.padding='2px 5px 2px 23px';menuitem.style.fontFamily='Arial';menuitem.style.fontSize='10pt';menuitem.style.textAlign='left';menuitem.style.fontWeight='normal';menuitem.innerHTML=menuitems[i][0];if(RG.is_array(menuitems[i][1])){menuitem.style.backgroundImage='url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAQUlEQVQImY3NoQ2AMABE0ZewABMyGQ6mqWODzlAclBSFO8HZl8uf0FFxCHtwYkt4Y6ChYE44cGH9/fyae2p2LAleW9oVTQuVf6gAAAAASUVORK5CYII=)';menuitem.style.backgroundRepeat='no-repeat';menuitem.style.backgroundPosition='97% center';}
6
- if(menuitems[i][1]){if(menuitem.addEventListener){menuitem.addEventListener("mouseover",function(e){RG.HideContextSubmenu();e.target.style.backgroundColor='rgba(0,0,0,0.2)';e.target.style.cursor='pointer';},false);menuitem.addEventListener("mouseout",function(e){e.target.style.backgroundColor='inherit';e.target.style.cursor='default';},false);}else{menuitem.attachEvent("onmouseover",function(){RG.HideContextSubmenu();event.srcElement.style.backgroundColor='#eee';event.srcElement.style.cursor='pointer';},false);menuitem.attachEvent("onmouseout",function(){event.srcElement.style.backgroundColor='inherit';event.srcElement.style.cursor='default';},false);}}else{if(menuitem.addEventListener){menuitem.addEventListener("mouseover",function(e){e.target.style.cursor='default';},false);menuitem.addEventListener("mouseout",function(e){e.target.style.cursor='default';},false);}else{menuitem.attachEvent("onmouseover",function(){event.srcElement.style.cursor='default'},false);menuitem.attachEvent("onmouseout",function(){event.srcElement.style.cursor='default';},false);}}}else{menuitem.style.borderBottom='1px solid #ddd';menuitem.style.marginLeft='25px';}
7
- div.appendChild(menuitem);if(menuitems[i]&&menuitems[i][1]&&typeof(menuitems[i][1])=='function'){menuitem.addEventListener('click',menuitems[i][1],false);}else if(menuitems[i]&&menuitems[i][1]&&RG.is_array(menuitems[i][1])){(function()
8
- {var tmp=menuitems[i][1];menuitem.addEventListener('mouseover',function(e){RG.Contextmenu_submenu(obj,tmp,e.target);},false);})();}}
9
- div.style.width=(div.offsetWidth+10)+'px';div.style.height=(div.offsetHeight-2)+'px';if(x+div.offsetWidth>document.body.offsetWidth){x-=div.offsetWidth;}
10
- div.style.left=x+'px';div.style.top=y+'px';setTimeout("if (obj = RGraph.Registry.get('chart.contextmenu')) obj.style.opacity = 0.2",50);setTimeout("if (obj = RGraph.Registry.get('chart.contextmenu')) obj.style.opacity = 0.4",100);setTimeout("if (obj = RGraph.Registry.get('chart.contextmenu')) obj.style.opacity = 0.6",150);setTimeout("if (obj = RGraph.Registry.get('chart.contextmenu')) obj.style.opacity = 0.8",200);setTimeout("if (obj = RGraph.Registry.get('chart.contextmenu')) obj.style.opacity = 1",250);setTimeout("if (obj = RGraph.Registry.get('chart.contextmenu.bg')) obj.style.opacity = 0.2",50);setTimeout("if (obj = RGraph.Registry.get('chart.contextmenu.bg')) obj.style.opacity = 0.4",100);setTimeout("if (obj = RGraph.Registry.get('chart.contextmenu.bg')) obj.style.opacity = 0.6",150);setTimeout("if (obj = RGraph.Registry.get('chart.contextmenu.bg')) obj.style.opacity = 0.8",200);setTimeout("if (obj = RGraph.Registry.get('chart.contextmenu.bg')) obj.style.opacity = 1",250);RG.Registry.set('chart.contextmenu',div);RG.Registry.set('chart.contextmenu.bg',bg);RG.Registry.get('chart.contextmenu').oncontextmenu=function(){return false;};RG.Registry.get('chart.contextmenu.bg').oncontextmenu=function(){return false;};canvas.addEventListener('click',function(){RG.HideContext();},false);window.addEventListener('click',function()
11
- {RG.HideContext();},false);window.addEventListener('resize',function()
12
- {RG.HideContext();},false);if(typeof(obj.getShape)=='function'){RG.Registry.get('chart.contextmenu').__shape__=obj.getShape(e);}
13
- e.stopPropagation();RG.fireCustomEvent(obj,'oncontextmenu');return false;};RG.hideContext=RG.HideContext=function()
14
- {var cm=RG.Registry.get('chart.contextmenu');var cmbg=RG.Registry.get('chart.contextmenu.bg');RG.hideContextSubmenu();if(cm){cm.parentNode.removeChild(cm);cmbg.parentNode.removeChild(cmbg);cm.style.visibility='hidden';cm.style.display='none';RG.Registry.set('chart.contextmenu',null);cmbg.style.visibility='hidden';cmbg.style.display='none';RG.Registry.set('chart.contextmenu.bg',null);}};RG.hideContextSubmenu=RG.HideContextSubmenu=function()
15
- {var sub=RG.Registry.get('chart.contextmenu.submenu');if(sub){sub.style.visibility='none';sub.style.display='none';RG.Registry.set('chart.contextmenu.submenu',null);}};RG.showContext=RG.ShowContext=function(obj)
16
- {RG.HidePalette();if(obj.get('chart.contextmenu')&&obj.get('chart.contextmenu').length){var isOpera=navigator.userAgent.indexOf('Opera')>=0;var isSafari=navigator.userAgent.indexOf('Safari')>=0;var isChrome=navigator.userAgent.indexOf('Chrome')>=0;var isMacFirefox=navigator.userAgent.indexOf('Firefox')>0&&navigator.userAgent.indexOf('Mac')>0;var isIE9=navigator.userAgent.indexOf('MSIE 9')>=0;if(((!isOpera&&!isSafari)||isChrome)&&!isMacFirefox){obj.canvas.oncontextmenu=function(e)
17
- {e=RG.FixEventObject(e);if(e.ctrlKey)return true;RG.Contextmenu(obj,obj.get('chart.contextmenu'),e);return false;}}else{obj.canvas.addEventListener('dblclick',function(e)
18
- {if(e.ctrlKey)return true;if(!RG.Registry.get('chart.contextmenu')){RG.Contextmenu(obj,obj.get('chart.contextmenu'),e);}},false);}}};RG.contextmenu_submenu=RG.Contextmenu_submenu=function(obj,menuitems,parentMenuItem)
19
- {RG.HideContextSubmenu();var canvas=obj.canvas;var context=obj.context;var menu=parentMenuItem.parentNode;var subMenu=document.createElement('DIV');subMenu.style.position='absolute';subMenu.style.width='100px';subMenu.style.top=menu.offsetTop+parentMenuItem.offsetTop+'px';subMenu.style.left=(menu.offsetLeft+menu.offsetWidth-(RG.ISOLD?9:0))+'px';subMenu.style.backgroundColor='white';subMenu.style.border='1px solid black';subMenu.className='RGraph_contextmenu';subMenu.__contextmenu__=menu;subMenu.style.boxShadow='3px 3px 3px rgba(96,96,96,0.5)';subMenu.style.MozBoxShadow='3px 3px 3px rgba(96,96,96,0.5)';subMenu.style.WebkitBoxShadow='3px 3px 3px rgba(96,96,96,0.5)';subMenu.style.filter='progid:DXImageTransform.Microsoft.Shadow(color=#aaaaaa,direction=135)';document.body.appendChild(subMenu);for(var i=0;i<menuitems.length;++i){var menuitem=document.createElement('DIV');menuitem.__canvas__=canvas;menuitem.__contextmenu__=menu;menuitem.className='RGraph_contextmenu_item';if(menuitems[i]){menuitem.style.padding='2px 5px 2px 23px';menuitem.style.fontFamily='Arial';menuitem.style.fontSize='10pt';menuitem.style.fontWeight='normal';menuitem.style.textAlign='left';menuitem.innerHTML=menuitems[i][0];if(menuitems[i][1]){if(menuitem.addEventListener){menuitem.addEventListener("mouseover",function(e){e.target.style.backgroundColor='rgba(0,0,0,0.2)';e.target.style.cursor='pointer';},false);menuitem.addEventListener("mouseout",function(e){e.target.style.backgroundColor='inherit';e.target.style.cursor='default';},false);}else{menuitem.attachEvent("onmouseover",function(){event.srcElement.style.backgroundColor='rgba(0,0,0,0.2)';event.srcElement.style.cursor='pointer'},false);menuitem.attachEvent("onmouseout",function(){event.srcElement.style.backgroundColor='inherit';event.srcElement.style.cursor='default';},false);}}else{if(menuitem.addEventListener){menuitem.addEventListener("mouseover",function(e){e.target.style.cursor='default';},false);menuitem.addEventListener("mouseout",function(e){e.target.style.cursor='default';},false);}else{menuitem.attachEvent("onmouseover",function(){event.srcElement.style.cursor='default'},false);menuitem.attachEvent("onmouseout",function(){event.srcElement.style.cursor='default';},false);}}}else{menuitem.style.borderBottom='1px solid #ddd';menuitem.style.marginLeft='25px';}
20
- subMenu.appendChild(menuitem);if(menuitems[i]&&menuitems[i][1]){if(document.all){menuitem.attachEvent('onclick',menuitems[i][1]);}else{menuitem.addEventListener('click',menuitems[i][1],false);}}}
21
- var bg=document.createElement('DIV');bg.className='RGraph_contextmenu_background';bg.style.position='absolute';bg.style.backgroundColor='#ccc';bg.style.borderRight='1px solid #aaa';bg.style.top=0;bg.style.left=0;bg.style.width='18px';bg.style.height='100%';bg=subMenu.appendChild(bg);RG.Registry.set('chart.contextmenu.submenu',subMenu);};RG.showPNG=function()
22
- {if(RG.ISIE8){alert('[RGRAPH PNG] Sorry, showing a PNG is not supported on MSIE8.');return;}
23
- if(arguments[0]&&arguments[0].id){var canvas=arguments[0];var event=arguments[1];}else if(RG.Registry.Get('chart.contextmenu')){var canvas=RG.Registry.Get('chart.contextmenu').__canvas__;}else{alert('[RGRAPH SHOWPNG] Could not find canvas!');}
24
- var obj=canvas.__object__;var bg=document.createElement('DIV');bg.id='__rgraph_image_bg__';bg.style.position='fixed';bg.style.top='-10px';bg.style.left='-10px';bg.style.width='5000px';bg.style.height='5000px';bg.style.backgroundColor='rgb(204,204,204)';bg.style.opacity=0;document.body.appendChild(bg);var div=document.createElement('DIV');div.style.backgroundColor='white';div.style.opacity=0;div.style.border='1px solid black';div.style.position='fixed';div.style.top='20%';div.style.width=canvas.width+'px';div.style.height=canvas.height+35+'px';div.style.left=(document.body.clientWidth/2)-(canvas.width/2)+'px';div.style.padding='5px';div.style.borderRadius='10px';div.style.MozBorderRadius='10px';div.style.WebkitBorderRadius='10px';div.style.boxShadow='0 0 15px rgba(96,96,96,0.5)';div.style.MozBoxShadow='0 0 15px rgba(96,96,96,0.5)';div.style.WebkitBoxShadow='rgba(96,96,96,0.5) 0 0 15px';div.__canvas__=canvas;div.__object__=obj;div.id='__rgraph_image_div__';document.body.appendChild(div);div.innerHTML+='<div style="position: absolute; margin-left: 10px; top: '+canvas.height+'px; width: '+(canvas.width-50)+'px; height: 25px"><span style="font-size: 12pt;display: inline; display: inline-block; width: 65px; text-align: right">URL:</span><textarea style="float: right; overflow: hidden; height: 20px; width: '+(canvas.width-obj.gutterLeft-obj.gutterRight-80)+'px" onclick="this.select()" readonly="readonly" id="__rgraph_dataurl__">'+canvas.toDataURL()+'</textarea></div>';div.innerHTML+='<div style="position: absolute; top: '+(canvas.height+25)+'px; left: '+(obj.gutterLeft-65+(canvas.width/2))+'px; width: '+(canvas.width-obj.gutterRight)+'px; font-size: 65%">A link using the URL: <a href="'+canvas.toDataURL()+'">View</a></div>'
25
- var img=document.createElement('IMG');RG.Registry.Set('chart.png',img);img.__canvas__=canvas;img.__object__=obj;img.id='__rgraph_image_img__';img.className='RGraph_png';img.src=canvas.toDataURL();div.appendChild(img);setTimeout(function(){document.getElementById("__rgraph_dataurl__").select();},50);window.addEventListener('resize',function(e){var img=RG.Registry.get('chart.png');img.style.left=(document.body.clientWidth/2)-(img.width/2)+'px';},false);bg.onclick=function(e)
26
- {var div=document.getElementById("__rgraph_image_div__");var bg=document.getElementById("__rgraph_image_bg__");if(div){div.style.opacity=0;div.parentNode.removeChild(div);div.id='';div.style.display='none';div=null;}
27
- if(bg){bg.style.opacity=0;bg.id='';bg.style.display='none';bg=null;}}
28
- window.addEventListener('resize',function(e){bg.onclick(e);},false)
29
- RG.showpng_image_bg=bg;RG.showpng_image_div=div;setTimeout('RGraph.showpng_image_div.style.opacity = 0.2',50);setTimeout('RGraph.showpng_image_div.style.opacity = 0.4',100);setTimeout('RGraph.showpng_image_div.style.opacity = 0.6',150);setTimeout('RGraph.showpng_image_div.style.opacity = 0.8',200);setTimeout('RGraph.showpng_image_div.style.opacity = 1',250);setTimeout('RGraph.showpng_image_bg.style.opacity = 0.1',50);setTimeout('RGraph.showpng_image_bg.style.opacity = 0.2',100);setTimeout('RGraph.showpng_image_bg.style.opacity = 0.3',150);setTimeout('RGraph.showpng_image_bg.style.opacity = 0.4',200);setTimeout('RGraph.showpng_image_bg.style.opacity = 0.5',250);img.onclick=function(e)
30
- {if(e.stopPropagation)e.stopPropagation();else event.cancelBubble=true;}
31
- if(event&&event.stopPropagation){event.stopPropagation();}};})(window,document);
12
+ RGraph = window.RGraph || {isrgraph:true,isRGraph: true,rgraph:true};
13
+
14
+ // Module pattern
15
+ (function (win, doc, undefined)
16
+ {
17
+ var ua = navigator.userAgent;
18
+
19
+ //
20
+ // This gunction shows a context menu containing the parameters
21
+ // provided to it
22
+ //
23
+ // @param object canvas The canvas object
24
+ // @param array menuitems The context menu menuitems
25
+ // @param object e The event object
26
+ //
27
+ RGraph.contextMenu = function ()
28
+ {
29
+ var args = RGraph.getArgs(arguments, 'object,menuitems,event'),
30
+ obj = args.object,
31
+ menuitems = args.menuitems,
32
+ e = args.event,
33
+ canvas = obj.canvas;
34
+
35
+ //
36
+ // Fire the custom RGraph event onbeforecontextmenu
37
+ //
38
+ RGraph.fireCustomEvent(obj, 'onbeforecontextmenu');
39
+
40
+ //
41
+ // Hide any existing menu
42
+ //
43
+ if (RGraph.Registry.get('contextmenu')) {
44
+ RGraph.hideContext();
45
+ }
46
+
47
+ // Hide any zoomed canvas
48
+ //
49
+ // Commented out on 13th October 2019
50
+ //
51
+ //RGraph.hideZoomedCanvas();
52
+
53
+ //
54
+ // Hide the palette if necessary
55
+ //
56
+ RGraph.hidePalette();
57
+
58
+ //
59
+ // This is here to ensure annotating is OFF
60
+ //
61
+ obj.set('mousedown', false);
62
+
63
+ var x = e.pageX;
64
+ var y = e.pageY;
65
+ var div = document.createElement('div');
66
+ var bg = document.createElement('div');
67
+
68
+ div.className = 'RGraph_contextmenu';
69
+ div.__canvas__ = canvas; // Store a reference to the canvas on the contextmenu object
70
+ div.style.position = 'absolute';
71
+ div.style.left = 0;
72
+ div.style.top = 0;
73
+ div.style.border = '1px solid #666';
74
+ div.style.backgroundColor = 'white';
75
+ div.style.boxShadow = '1px 1px 3px #ddd';
76
+ div.style.MozBoxShadow = '1px 1px 3px #ddd';
77
+ div.style.WebkitBoxShadow = '1px 1px 3px #ddd';
78
+ div.style.opacity = 0;
79
+ div.style.lineHeight = 'initial';
80
+
81
+ bg.className = 'RGraph_contextmenu_background';
82
+ bg.style.position = 'absolute';
83
+ bg.style.backgroundColor = '#ccc';
84
+ bg.style.borderRight = '1px solid #aaa';
85
+ bg.style.top = 0;
86
+ bg.style.left = 0;
87
+ bg.style.width = '18px';
88
+ bg.style.height = '100%';
89
+ bg.style.opacity = 0;
90
+
91
+
92
+ div = document.body.appendChild(div);
93
+ bg = div.appendChild(bg);
94
+
95
+
96
+ //
97
+ // Now add the context menu items
98
+ //
99
+ for (i=0; i<menuitems.length; ++i) {
100
+
101
+ var menuitem = document.createElement('div');
102
+
103
+ menuitem.__object__ = obj;
104
+ menuitem.__canvas__ = canvas;
105
+ menuitem.__contextmenu__ = div;
106
+ menuitem.className = 'RGraph_contextmenu_item';
107
+
108
+ if (menuitems[i]) {
109
+ menuitem.style.padding = '2px 5px 2px 23px';
110
+ menuitem.style.fontFamily = 'Arial';
111
+ menuitem.style.fontSize = '10pt';
112
+ menuitem.style.textAlign = 'left';
113
+ menuitem.style.fontWeight = 'normal';
114
+ menuitem.innerHTML = menuitems[i][0];
115
+
116
+ if (RGraph.isArray(menuitems[i][1])) {
117
+ menuitem.style.backgroundImage = 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAQUlEQVQImY3NoQ2AMABE0ZewABMyGQ6mqWODzlAclBSFO8HZl8uf0FFxCHtwYkt4Y6ChYE44cGH9/fyae2p2LAleW9oVTQuVf6gAAAAASUVORK5CYII=)';
118
+ menuitem.style.backgroundRepeat = 'no-repeat';
119
+ menuitem.style.backgroundPosition = '97% center';
120
+ }
121
+
122
+ // Add the mouseover event
123
+ if (menuitems[i][1]) {
124
+ if (menuitem.addEventListener) {
125
+ menuitem.addEventListener("mouseover", function (e) {RGraph.hideContextSubmenu(); e.target.style.backgroundColor = 'rgba(0,0,0,0.2)'; e.target.style.cursor = 'pointer';}, false);
126
+ menuitem.addEventListener("mouseout", function (e) {e.target.style.backgroundColor = 'inherit'; e.target.style.cursor = 'default';}, false);
127
+ } else {
128
+ menuitem.attachEvent("onmouseover", function () {RGraph.hideContextSubmenu();event.srcElement.style.backgroundColor = '#eee';event.srcElement.style.cursor = 'pointer';}
129
+ , false);
130
+ menuitem.attachEvent("onmouseout", function () {event.srcElement.style.backgroundColor = 'inherit'; event.srcElement.style.cursor = 'default';}, false);
131
+ }
132
+ } else {
133
+ if (menuitem.addEventListener) {
134
+ menuitem.addEventListener("mouseover", function (e) {e.target.style.cursor = 'default';}, false);
135
+ menuitem.addEventListener("mouseout", function (e) {e.target.style.cursor = 'default';}, false);
136
+ } else {
137
+ menuitem.attachEvent("onmouseover", function () {event.srcElement.style.cursor = 'default'}, false);
138
+ menuitem.attachEvent("onmouseout", function () {event.srcElement.style.cursor = 'default';}, false);
139
+ }
140
+ }
141
+
142
+ } else {
143
+ menuitem.style.borderBottom = '1px solid #ddd';
144
+ menuitem.style.marginLeft = '25px';
145
+ }
146
+
147
+ div.appendChild(menuitem);
148
+
149
+ //
150
+ // Install the event handler that calls the menuitem
151
+ //
152
+ if (menuitems[i] && menuitems[i][1] && typeof menuitems[i][1] == 'function') {
153
+
154
+ menuitem.addEventListener('click', menuitems[i][1], false);
155
+
156
+ // Submenu
157
+ } else if (menuitems[i] && menuitems[i][1] && RGraph.isArray(menuitems[i][1])) {
158
+ (function ()
159
+ {
160
+ var tmp = menuitems[i][1]; // This is here because of "references vs primitives" and how they're passed around in Javascript
161
+
162
+ // TODO This may need attention
163
+ menuitem.addEventListener('mouseover', function (e) {RGraph.contextMenu_submenu(obj, tmp, e.target);}, false);
164
+ })();
165
+ }
166
+ }
167
+
168
+ //
169
+ // Now all the menu items have been added, set the shadow width
170
+ // Shadow now handled by CSS3
171
+ //
172
+ div.style.width = (div.offsetWidth + 10) + 'px';
173
+ div.style.height = (div.offsetHeight - 2) + 'px';
174
+
175
+ // Show the menu to the left or the right (normal) of the cursor?
176
+ if (x + div.offsetWidth > document.body.offsetWidth) {
177
+ x -= div.offsetWidth;
178
+ }
179
+
180
+ // Reposition the menu (now we have the real offsetWidth)
181
+ div.style.left = x + 'px';
182
+ div.style.top = y + 'px';
183
+
184
+ //
185
+ // Do a little fade in effect
186
+ //
187
+ setTimeout("if (obj = RGraph.Registry.get('contextmenu')) obj.style.opacity = 0.2", 50);
188
+ setTimeout("if (obj = RGraph.Registry.get('contextmenu')) obj.style.opacity = 0.4", 100);
189
+ setTimeout("if (obj = RGraph.Registry.get('contextmenu')) obj.style.opacity = 0.6", 150);
190
+ setTimeout("if (obj = RGraph.Registry.get('contextmenu')) obj.style.opacity = 0.8", 200);
191
+ setTimeout("if (obj = RGraph.Registry.get('contextmenu')) obj.style.opacity = 1", 250);
192
+
193
+ // The fade in effect on the left gray bar
194
+ setTimeout("if (obj = RGraph.Registry.get('contextmenu.bg')) obj.style.opacity = 0.2", 50);
195
+ setTimeout("if (obj = RGraph.Registry.get('contextmenu.bg')) obj.style.opacity = 0.4", 100);
196
+ setTimeout("if (obj = RGraph.Registry.get('contextmenu.bg')) obj.style.opacity = 0.6", 150);
197
+ setTimeout("if (obj = RGraph.Registry.get('contextmenu.bg')) obj.style.opacity = 0.8", 200);
198
+ setTimeout("if (obj = RGraph.Registry.get('contextmenu.bg')) obj.style.opacity = 1", 250);
199
+
200
+ // Store the context menu in the registry
201
+ RGraph.Registry.set('contextmenu', div);
202
+ RGraph.Registry.set('contextmenu.bg', bg);
203
+ RGraph.Registry.get('contextmenu').oncontextmenu = function () {return false;};
204
+ RGraph.Registry.get('contextmenu.bg').oncontextmenu = function () {return false;};
205
+
206
+ //
207
+ // Install the event handlers that hide the context menu
208
+ //
209
+ canvas.addEventListener('click', function () {RGraph.hideContext();}, false);
210
+
211
+ window.addEventListener('click', function ()
212
+ {
213
+ RGraph.hideContext();
214
+ }, false);
215
+
216
+ window.addEventListener('resize', function ()
217
+ {
218
+ RGraph.hideContext();
219
+ }, false);
220
+
221
+
222
+ //
223
+ // Add the __shape__ object to the context menu
224
+ //
225
+
226
+ //
227
+ // Set the shape coords from the .getShape() method
228
+ //
229
+ if (typeof obj.getShape == 'function') {
230
+ RGraph.Registry.get('contextmenu').__shape__ = obj.getShape(e);
231
+ }
232
+
233
+
234
+ e.stopPropagation();
235
+
236
+ //
237
+ // Fire the (RGraph) oncontextmenu event
238
+ //
239
+ RGraph.fireCustomEvent(obj, 'oncontextmenu');
240
+
241
+ return false;
242
+ };
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+ //
252
+ // Hides the context menu if it's currently visible
253
+ //
254
+ RGraph.hideContext = function ()
255
+ {
256
+ var cm = RGraph.Registry.get('contextmenu');
257
+ var cmbg = RGraph.Registry.get('contextmenu.bg');
258
+
259
+ //Hide any submenu currently being displayed
260
+ RGraph.hideContextSubmenu();
261
+
262
+ if (cm) {
263
+ cm.parentNode.removeChild(cm);
264
+ cmbg.parentNode.removeChild(cmbg);
265
+
266
+ cm.style.visibility = 'hidden';
267
+ cm.style.display = 'none';
268
+ RGraph.Registry.set('contextmenu', null);
269
+
270
+ cmbg.style.visibility = 'hidden';
271
+ cmbg.style.display = 'none';
272
+ RGraph.Registry.set('contextmenu.bg', null);
273
+ }
274
+ };
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+ //
284
+ // Hides the context menus SUBMENU if it's currently visible
285
+ //
286
+ RGraph.hideContextSubmenu = function ()
287
+ {
288
+ var sub = RGraph.Registry.get('contextmenu.submenu');
289
+
290
+ if (sub) {
291
+ sub.style.visibility = 'none';
292
+ sub.style.display = 'none';
293
+ RGraph.Registry.set('contextmenu.submenu', null);
294
+ }
295
+ };
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+ //
305
+ // Shows the context menu after making a few checks - not opera (doesn't support oncontextmenu,
306
+ // not safari (tempermentality), not chrome (hmmm)
307
+ //
308
+ RGraph.showContext = function ()
309
+ {
310
+ var args = RGraph.getArgs(arguments, 'object'),
311
+ obj = args.object;
312
+
313
+ RGraph.hidePalette();
314
+
315
+ if (obj.get('contextmenu') && obj.get('contextmenu').length) {
316
+
317
+ var isOpera = navigator.userAgent.indexOf('Opera') >= 0;
318
+ var isSafari = navigator.userAgent.indexOf('Safari') >= 0;
319
+ var isChrome = navigator.userAgent.indexOf('Chrome') >= 0;
320
+ var isMacFirefox = navigator.userAgent.indexOf('Firefox') > 0 && navigator.userAgent.indexOf('Mac') > 0;
321
+ var isIE9 = navigator.userAgent.indexOf('MSIE 9') >= 0;
322
+
323
+ if (((!isOpera && !isSafari) || isChrome) && !isMacFirefox) {
324
+
325
+ obj.canvas.oncontextmenu = function (e)
326
+ {
327
+ if (e.ctrlKey) return true;
328
+
329
+ RGraph.contextMenu(obj, obj.get('contextmenu'), e);
330
+
331
+ return false;
332
+ }
333
+
334
+ // Accomodate Opera and Safari - use double click event
335
+ } else {
336
+
337
+ obj.canvas.addEventListener('dblclick', function (e)
338
+ {
339
+ if (e.ctrlKey) return true;
340
+
341
+ if (!RGraph.Registry.get('contextmenu')) {
342
+ RGraph.contextMenu(obj, obj.get('contextmenu'), e);
343
+ }
344
+ }, false);
345
+ }
346
+ }
347
+ };
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+ //
357
+ // This draws a submenu should it be necessary
358
+ //
359
+ // @param object obj The graph object
360
+ // @param object menu The context menu
361
+ //
362
+ RGraph.contextMenu_submenu = function ()
363
+ {
364
+ var args = RGraph.getArgs(arguments, 'object,menuitems,parentMenuItem'),
365
+ obj = args.object,
366
+ menuitems = args.menuitems,
367
+ parentMenuItem = args.parentMenuItem;
368
+
369
+ RGraph.hideContextSubmenu();
370
+
371
+ var canvas = obj.canvas;
372
+ var context = obj.context;
373
+ var menu = parentMenuItem.parentNode;
374
+
375
+ var subMenu = document.createElement('DIV');
376
+ subMenu.style.position = 'absolute';
377
+ subMenu.style.width = '100px';
378
+ subMenu.style.top = menu.offsetTop + parentMenuItem.offsetTop + 'px';
379
+ subMenu.style.left = (menu.offsetLeft + menu.offsetWidth - (RGraph.ISOLD ? 9 : 0)) + 'px';
380
+ subMenu.style.backgroundColor = 'white';
381
+ subMenu.style.border = '1px solid black';
382
+ subMenu.className = 'RGraph_contextmenu';
383
+ subMenu.__contextmenu__ = menu;
384
+ subMenu.style.lineHeight = 'initial';
385
+ subMenu.style.boxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
386
+ subMenu.style.MozBoxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
387
+ subMenu.style.WebkitBoxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
388
+ subMenu.style.filter = 'progid:DXImageTransform.Microsoft.Shadow(color=#aaaaaa,direction=135)';
389
+ document.body.appendChild(subMenu);
390
+
391
+ for (var i=0; i<menuitems.length; ++i) {
392
+
393
+ var menuitem = document.createElement('DIV');
394
+
395
+ menuitem.__canvas__ = canvas;
396
+ menuitem.__contextmenu__ = menu;
397
+ menuitem.className = 'RGraph_contextmenu_item';
398
+
399
+ if (menuitems[i]) {
400
+ menuitem.style.padding = '2px 5px 2px 23px';
401
+ menuitem.style.fontFamily = 'Arial';
402
+ menuitem.style.fontSize = '10pt';
403
+ menuitem.style.fontWeight = 'normal';
404
+ menuitem.style.textAlign = 'left';
405
+ menuitem.innerHTML = menuitems[i][0];
406
+
407
+ if (menuitems[i][1]) {
408
+ if (menuitem.addEventListener) {
409
+ menuitem.addEventListener("mouseover", function (e) {e.target.style.backgroundColor = 'rgba(0,0,0,0.2)'; e.target.style.cursor = 'pointer';}, false);
410
+ menuitem.addEventListener("mouseout", function (e) {e.target.style.backgroundColor = 'inherit'; e.target.style.cursor = 'default';}, false);
411
+ } else {
412
+ menuitem.attachEvent("onmouseover", function () {event.srcElement.style.backgroundColor = 'rgba(0,0,0,0.2)'; event.srcElement.style.cursor = 'pointer'}, false);
413
+ menuitem.attachEvent("onmouseout", function () {event.srcElement.style.backgroundColor = 'inherit'; event.srcElement.style.cursor = 'default';}, false);
414
+ }
415
+ } else {
416
+ if (menuitem.addEventListener) {
417
+ menuitem.addEventListener("mouseover", function (e) {e.target.style.cursor = 'default';}, false);
418
+ menuitem.addEventListener("mouseout", function (e) {e.target.style.cursor = 'default';}, false);
419
+ } else {
420
+ menuitem.attachEvent("onmouseover", function () {event.srcElement.style.cursor = 'default'}, false);
421
+ menuitem.attachEvent("onmouseout", function () {event.srcElement.style.cursor = 'default';}, false);
422
+ }
423
+ }
424
+ } else {
425
+ menuitem.style.borderBottom = '1px solid #ddd';
426
+ menuitem.style.marginLeft = '25px';
427
+ }
428
+
429
+ subMenu.appendChild(menuitem);
430
+
431
+ if (menuitems[i] && menuitems[i][1]) {
432
+ if (document.all) {
433
+ menuitem.attachEvent('onclick', menuitems[i][1]);
434
+ } else {
435
+ menuitem.addEventListener('click', menuitems[i][1], false);
436
+ }
437
+ }
438
+ }
439
+
440
+
441
+ var bg = document.createElement('DIV');
442
+ bg.className = 'RGraph_contextmenu_background';
443
+ bg.style.position = 'absolute';
444
+ bg.style.backgroundColor = '#ccc';
445
+ bg.style.borderRight = '1px solid #aaa';
446
+ bg.style.top = 0;
447
+ bg.style.left = 0;
448
+ bg.style.width = '18px';
449
+ bg.style.height = '100%';
450
+
451
+ bg = subMenu.appendChild(bg);
452
+
453
+ RGraph.Registry.set('contextmenu.submenu', subMenu);
454
+ };
455
+
456
+
457
+
458
+
459
+
460
+
461
+
462
+
463
+ //
464
+ // A function designed to be used in conjunction with thed context menu
465
+ // to allow people to get image versions of canvases.
466
+ //
467
+ // @param canvas Optionally you can pass in the canvas, which will be used
468
+ //
469
+ RGraph.showPNG = function ()
470
+ {
471
+ if (RGraph.ISIE8) {
472
+ alert('[RGRAPH PNG] Sorry, showing a PNG is not supported on MSIE8.');
473
+ return;
474
+ }
475
+
476
+ if (arguments[0] && arguments[0].id) {
477
+ var canvas = arguments[0];
478
+ var event = arguments[1];
479
+
480
+ } else if (RGraph.Registry.get('contextmenu')) {
481
+ var canvas = RGraph.Registry.get('contextmenu').__canvas__;
482
+
483
+ } else {
484
+ alert('[RGRAPH SHOWPNG] Could not find canvas!');
485
+ }
486
+
487
+ var obj = canvas.__object__;
488
+
489
+ //
490
+ // Create the gray background DIV to cover the page
491
+ //
492
+ var bg = document.createElement('DIV');
493
+ bg.id = '__rgraph_image_bg__';
494
+ bg.style.position = 'fixed';
495
+ bg.style.top = '-10px';
496
+ bg.style.left = '-10px';
497
+ bg.style.width = '5000px';
498
+ bg.style.height = '5000px';
499
+ bg.style.backgroundColor = 'rgb(204,204,204)';
500
+ bg.style.opacity = 0;
501
+ document.body.appendChild(bg);
502
+
503
+
504
+ //
505
+ // Create the div that the graph sits in
506
+ //
507
+ var div = document.createElement('DIV');
508
+ div.style.backgroundColor = 'white';
509
+ div.style.opacity = 0;
510
+ div.style.border = '1px solid black';
511
+ div.style.position = 'fixed';
512
+ div.style.top = '20%';
513
+ div.style.width = canvas.width + 'px';
514
+ div.style.height = canvas.height + 35 + 'px';
515
+ div.style.left = (document.body.clientWidth / 2) - (canvas.width / 2) + 'px';
516
+ div.style.padding = '5px';
517
+
518
+ div.style.borderRadius = '10px';
519
+ div.style.MozBorderRadius = '10px';
520
+ div.style.WebkitBorderRadius = '10px';
521
+
522
+ div.style.boxShadow = '0 0 15px rgba(96,96,96,0.5)';
523
+ div.style.MozBoxShadow = '0 0 15px rgba(96,96,96,0.5)';
524
+ div.style.WebkitBoxShadow = 'rgba(96,96,96,0.5) 0 0 15px';
525
+
526
+ div.__canvas__ = canvas;
527
+ div.__object__ = obj;
528
+ div.id = '__rgraph_image_div__';
529
+ document.body.appendChild(div);
530
+
531
+
532
+ //
533
+ // Add the HTML text inputs
534
+ //
535
+ div.innerHTML += '<div id="rgraph_showpng_div_container"><textarea onclick="this.select()" readonly="readonly" id="__rgraph_dataurl__">' + canvas.toDataURL() + '</textarea></div>';
536
+
537
+ var nestedTextarea = document.getElementById('__rgraph_dataurl__');
538
+ nestedTextarea.style.overflow = 'hidden';
539
+ nestedTextarea.style.height = '20px';
540
+ nestedTextarea.style.width = (canvas.width - obj.marginLeft - obj.marginRight) + 'px';
541
+ nestedTextarea.style.position = 'relative';
542
+ nestedTextarea.style.left = obj.marginLeft + 'px';
543
+
544
+ var nestedDiv = document.getElementById('rgraph_showpng_div_container');
545
+ nestedDiv.style.position = 'absolute';
546
+ //nestedDiv.style.marginLeft = '10px';
547
+ nestedDiv.style.top = canvas.height + 'px';
548
+ nestedDiv.style.width = canvas.width + 'px';
549
+ nestedDiv.style.height = '25px';
550
+
551
+
552
+
553
+ //
554
+ // Create the image rendition of the graph
555
+ //
556
+ var img = document.createElement('IMG');
557
+ RGraph.Registry.set('png', img);
558
+ img.__canvas__ = canvas;
559
+ img.__object__ = obj;
560
+ img.id = '__rgraph_image_img__';
561
+ img.className = 'RGraph_png';
562
+
563
+ img.src = canvas.toDataURL();
564
+
565
+ div.appendChild(img);
566
+
567
+ setTimeout(function () {document.getElementById("__rgraph_dataurl__").select();}, 50);
568
+
569
+ window.addEventListener('resize', function (e){var img = RGraph.Registry.get('png');img.style.left = (document.body.clientWidth / 2) - (img.width / 2) + 'px';}, false);
570
+
571
+ bg.onclick = function (e)
572
+ {
573
+ var div = document.getElementById("__rgraph_image_div__");
574
+ var bg = document.getElementById("__rgraph_image_bg__");
575
+
576
+ if (div) {
577
+ div.style.opacity = 0;
578
+
579
+ div.parentNode.removeChild(div);
580
+
581
+ div.id = '';
582
+ div.style.display = 'none';
583
+ div = null;
584
+ }
585
+
586
+ if (bg) {
587
+ bg.style.opacity = 0;
588
+
589
+ bg.id = '';
590
+ bg.style.display = 'none';
591
+ bg = null;
592
+ }
593
+ }
594
+
595
+ window.addEventListener('resize', function (e) {bg.onclick(e);}, false)
596
+
597
+ //
598
+ // This sets the image BG and the DIV as global variables, circumventing repeated calls to document.getElementById()
599
+ //
600
+ RGraph.showpng_image_bg = bg;
601
+ RGraph.showpng_image_div = div;
602
+
603
+ setTimeout('RGraph.showpng_image_div.style.opacity = 0.2', 50);
604
+ setTimeout('RGraph.showpng_image_div.style.opacity = 0.4', 100);
605
+ setTimeout('RGraph.showpng_image_div.style.opacity = 0.6', 150);
606
+ setTimeout('RGraph.showpng_image_div.style.opacity = 0.8', 200);
607
+ setTimeout('RGraph.showpng_image_div.style.opacity = 1', 250);
608
+
609
+ setTimeout('RGraph.showpng_image_bg.style.opacity = 0.1', 50);
610
+ setTimeout('RGraph.showpng_image_bg.style.opacity = 0.2', 100);
611
+ setTimeout('RGraph.showpng_image_bg.style.opacity = 0.3', 150);
612
+ setTimeout('RGraph.showpng_image_bg.style.opacity = 0.4', 200);
613
+ setTimeout('RGraph.showpng_image_bg.style.opacity = 0.5', 250);
614
+
615
+
616
+
617
+ img.onclick = function (e)
618
+ {
619
+ if (e.stopPropagation) e.stopPropagation();
620
+ else event.cancelBubble = true;
621
+ }
622
+
623
+ if (event && event.stopPropagation) {
624
+ event.stopPropagation();
625
+ }
626
+ };
627
+
628
+
629
+
630
+
631
+
632
+
633
+
634
+
635
+ // End module pattern
636
+ })(window, document);