remove creation of the rss/atom feeds - it does not work anyway
[mkgallery.git] / include / showwin.js
1 /*
2         $Id$
3
4         This is a part of mkgallery.pl suite
5         http://www.average.org/mkgallery/
6
7         Uses mootools (1.2) http://www.mootools.net/
8         Uses slideshow http://www.phatfusion.net/slideshow/
9 */
10
11 /*
12         Hideable "fullscreen" Window for Slideshow
13 */
14
15 var showWindow = new Class({
16
17         getOptions: function(){
18                 return {
19                         zIndex: 2,
20                         container: document.body,
21                         tohide: '',
22                         onClick: $empty
23                 }
24         },
25
26         initialize: function(name,options){
27                 this.setOptions(this.getOptions(), options);
28
29                 this.options.container = $(this.options.container);
30                 this.options.tohide = $(this.options.tohide);
31
32                 this.container = new Element('div').addClass(name).
33                 setProperties({
34                         id: name,
35                         name: name
36                 }).setStyles({
37                         position: 'absolute',
38                         left: '0px',
39                         top: '0px',
40                         width: '100%',
41                         zIndex: this.options.zIndex,
42                         overflow: 'hidden',
43                         display: 'none'
44                 }).addEvent('click', function(){
45                         this.options.onClick()
46                 }.bind(this)).injectInside(this.options.container);
47
48                 window.addEvent('resize', this.position.bind(this));
49                 window.addEvent('scroll', this.position.bind(this));
50         },
51
52         position: function(){
53                 if(this.options.container == document.body){
54                         this.w = window.getWidth();
55                         this.h = window.getHeight();
56                         this.s = window.getScrollTop();
57                 }else{
58                         var myCoords = this.options.container.getCoordinates();
59                         this.w = myCoords.width;
60                         this.h = myCoords.height;
61                         this.s = myCoords.top;
62                 }
63                 this.container.setStyles({
64                         top: this.s+'px',
65                         height: this.h+'px'
66                 })
67         },
68
69         getCoordinates: function(){
70                 return {
71                         width: this.w,
72                         height: this.h,
73                         top: this.s
74                 };
75         },
76
77         show: function(){
78                 if (this.options.tohide) {
79                         this.hiddenstyles = this.options.tohide.getStyles(
80                                 'display'
81                         );
82                         this.options.tohide.setStyles({
83                                 display: 'none'
84                         });
85                 }
86                 this.bodystyles = document.body.getStyles(
87                         'overflow', 'overflow-x', 'overflow-y'
88                 );
89                 document.body.setStyles({
90                         overflow: 'hidden',
91                         'overflow-x': 'hidden',
92                         'overflow-y': 'hidden'
93                 });
94                 this.position();
95                 this.container.setStyle('display', 'block');
96         },
97
98         hide: function(){
99                 if (this.options.tohide) {
100                         this.options.tohide.setStyles(this.hiddenstyles);
101                 }
102                 document.body.setStyles(this.bodystyles);
103                 this.container.setStyle('display', 'none');
104         },
105
106         grab: function(obj){
107                 return this.container.grab(obj);
108         }
109 });
110
111 showWindow.implement(new Options);
112