Move to sane directory structure. Don't make 'cms' the top level of the silverstripe...
[silverstripe-elijah.git] / javascript / ImageEditor / Activator.js
blob0ee5ab78bd25991ef994ba35999eb675aa5fc5cc
1 var ImageEditorActivator = {\r
2         initialize: function() {\r
3                 this.onOpen = ImageEditorActivator.onOpen.bind(this);           \r
4         },\r
5         \r
6         onOpen: function() {\r
7                 var windowWidth = Element.getDimensions(window.top.document.body).width;\r
8         var windowHeight = Element.getDimensions(window.top.document.body).height;\r
9                 iframe = window.top.document.getElementById('imageEditorIframe');\r
10                 if(iframe != null) {\r
11                         iframe.parentNode.removeChild(iframe);\r
12                 }\r
13                 iframe = window.top.document.createElement('iframe');\r
14                 fileToEdit = $('ImageEditorActivator').firstChild.src;\r
15                 iframe.setAttribute("src","admin/ImageEditor?fileToEdit=" + fileToEdit);\r
16                 iframe.id = 'imageEditorIframe';\r
17                 iframe.style.width = windowWidth - 30 + 'px';\r
18                 iframe.style.height = windowHeight + 10 + 'px';\r
19                 iframe.style.zIndex = "1000";\r
20                 iframe.style.position = "absolute";\r
21                 iframe.style.top = "-2%";\r
22                 iframe.style.left = "1.5%";\r
23                 window.top.document.body.appendChild(iframe);\r
24                 divLeft = window.top.document.createElement('div');\r
25                 divRight = window.top.document.createElement('div');\r
26         divLeft.style.width = "1.5%";\r
27         divLeft.style.height = "300%";\r
28         divLeft.style.zIndex = "1000";\r
29         divLeft.style.top = "-1.5%";\r
30         divLeft.style.position = "absolute";\r
31         divRight.style.width = "1.5%";\r
32         divRight.style.height = "300%";\r
33         divRight.style.zIndex = "1000";\r
34         divRight.style.top = "-1.5%";\r
35         divRight.style.position = "absolute";\r
36         divRight.style.left = "98.5%";\r
37                 window.top.document.body.appendChild(divLeft);\r
38                 window.top.document.body.appendChild(divRight);\r
39         }\r
40                 \r