PageSourceSearch

http://exist-db.org/exist/apps/wiki/blogs/eXist/resources/scripts/gallery_new.js

js exist-db.org collected 2026-10-01 11:28:50 UTC 8,860 bytes, 232 lines download raw bytes

1/* only call galleria, if our target container exists */
2if ($('.galleria').length !== 0) {
3    
4    Galleria.loadTheme('resources/scripts/galleria/themes/classic/galleria.classic.js');
5    
6    Galleria.configure({
7        transition: 'fade',
8        imageCrop: false,
9        easing: 'galleriaOut',
10        carousel: true,
11        carouselSteps: 'auto',
12        carouselSpeed: 1234,
13        imagePosition: 'center center',
14        trueFullscreen: true,
15        keepSource: true,
16        idleTime: 1234
17        //lightbox: true
18    });
19            
20            
21    Galleria.ready(function() {
22        var self = this; // galleria is ready and the gallery is assigned
23        
24        // store our master container (.galleria)
25        var my_container = self.$("container").parent();
26        
27        self.addElement('fscr');
28        // appends the element to a container
29        self.appendChild('stage','fscr');
30
31        self.$('fscr').click(function() {
32            self.toggleFullscreen(); // toggles the fullscreen
33        });
34                
35        self.addElement('splay');
36        // appends the element to the container
37        self.appendChild('image-nav','splay');
38        /*
39        self.addElement('meta-block');
40        self.appendChild('container','meta-block');
41        */
42                
43        self.$('splay').click(function() {
44            //self.setPlaytime(4000);
45            self.playToggle();
46        });
47                
48        self.addIdleState(self.get('thumbnails'), {
49            opacity: 0
50        });
51                
52        self.addIdleState(self.get('image-nav'), {
53            opacity: 0
54        });
55        
56        // self.addIdleState(self.get('fscr'), {
57        //     opacity: 0
58        // });
59              
60        // self.addIdleState(self.get('info-link'), {
61        //     opacity: 0
62        // });
63             
64        // self.addIdleState(self.get('thumb-nav-left'), {
65        //     opacity: 0
66        // });
67                
68        // self.addIdleState(self.get('thumb-nav-right'), {
69        //     opacity: 0
70        // });
71
72                
73        /* togle playbutton to indicate the current slideshow status */
74        self.bind("play", function(e) {
75            self.$("splay").css('background-image','url("resources/scripts/galleria/themes/classic/pause_b.png")');
76        });
77        self.bind("pause", function(e) {
78            self.$("splay").css('background-image','url("resources/scripts/galleria/themes/classic/play_w.png")');
79        });
80        
81        /*
82        self.bind("idle_exit", function(e) {
83            self.removeIdleState(self.get('info'));
84        });
85        */
86        
87        
88        self.bind("idle_enter", function(e) {
89            self.$("info-link").fadeOut(100);
90            self.$("fscr").fadeOut(100);
91        });
92        self.bind("idle_exit", function(e) {
93            self.$("info-link").fadeIn(300);
94            self.$("fscr").fadeIn(300);
95        });
96        
97                
98        var info = self.$('info-link,info-close,info-text');
99        
100        function fixInfoHeight (option) {
101            if (option) {
102                self.resize();
103            }
104            var my_h = self.$("stage").height();
105            self.$("info").height(my_h - 100);
106            self.$("info-link").height(my_h - 100);
107            self.$("info-text").height(my_h - 110);
108        } 
109        
110        self.bind("fullscreen_enter", function(e) {
111            if (!!self.getData(0)[ "description" ]) {
112                self.$('info-link').removeClass('galleria-info-link-active');
113                self.$('info-link').click();
114            }
115            fixInfoHeight(false);
116        });
117        
118        self.bind("fullscreen_exit", function(e) {
119            fixInfoHeight(true);
120        });
121        
122        /*
123        self.bind("rescale", function(e) {
124            //self.resize();
125            console.log("rescale done");
126        });
127        */
128        
129        self.$('info-link').bind( 'click',function(e) {
130            if( ! self.$('info-link').hasClass('galleria-info-link-active')){
131                self.$('info-link').addClass('galleria-info-link-active');
132                
133                self.$('info').stop().animate({"left":"15px"}, 400, function() {
134                    self.$('info').css({"left":"15px"});
135                    self.$('stage').stop().animate({"margin-left":"360"}, 400, function() {
136                        self.resize();
137                    });
138                });
139            } else {
140                self.$('info-link').removeClass('galleria-info-link-active');
141
142                self.$('info').stop().animate({"left":"-320px"}, 400, function() {
143                    self.$('info').css({"left":"-320px"});
144                    self.$('stage').stop().animate({"margin-left":"0"}, 400, function() {
145                        self.resize();
146                    });
147                });
148            }
149        });
150        
151        // self.bind('thumbnail', function(e) {
152        //     $(e.thumbTarget).hover(self.proxy(function() {
153        //         self.setInfo(e.index); // sets the caption to display data from the hovered image
154        //         self.setCounter(e.index); // sets the counter to display the index of the hovered image
155        //     }, self.proxy(function() {
156        //         self.setInfo(); // reset the caption to display the currently active data
157        //         self.setCounter(); // reset the caption to display the currently active data
158        //     })));
159        // });
160        
161        // self.bind('thumbnail', function(e) {
162        //     $(e.thumbTarget).mouseout(self.proxy(function() {
163        //         self.setInfo(); // sets the caption to display data from the hovered image
164        //         self.setCounter(); // sets the counter to display the index of the hovered image
165        //         //self.setIndex(e.index);
166        //     }));
167        // });
168        
169        // self.bind('thumbnail', function(e) {
170        //     var desc = self.getData( e.index ).description;
171        //     if (desc) {
172        //         self.bindTooltip( e.thumbTarget, desc );
173        //     }
174        // });
175        
176        /* show infotext on startup */
177        //console.log("%o",self.getData( 0 ));
178        if (!!self.getData(0)[ "description" ]) {
179            //console.log(self.getData( 0 )[ "description" ]);
180            self.$('info-link').click();
181        }
182        
183        if (self.getData(0)[ "conf_autoplay" ] == "on") {
184            //self.setOptions('autoplay',parseInt(self.getData(0)[ "conf_intervall" ]));
185            self.setPlaytime(self.getData(0)[ "conf_intervall" ]);
186            self.playToggle();
187        } else {
188            self.setOptions('autoplay',false);
189        }
190        
191        // resize our master-container using customn settings for width and height
192        my_container.css({
193            "width": parseInt(self.getData(0)[ "conf_width" ].replace("px", "")) + "px",
194            "height": parseInt(self.getData(0)[ "conf_height" ].replace("px", "")) + "px"
195        });
196        
197        //self.resize();
198        fixInfoHeight(true);
199        
200        if (self.getData(0)[ "conf_align" ]) {
201            self.setOptions({
202                 imagePosition: "center " + self.getData(0)[ "conf_align" ],
203            }).refreshImage();
204        }
205                
206    }); /* end of: Galleria.ready() */
207    
208    /* here we go. fire up galleria */
209    Galleria.run('.galleria', {
210        dataConfig: function(img) {
211            var data = {
212                thumb: $(img).attr('src'),
213                image: $(img).parent().attr('href'),
214                big: $(img).attr('data-big'),
215                //title: $(img).parent().siblings('.title').html(),
216                //title: $(img).parent().siblings(".description").html(),
217                description: $(img).parent().siblings(".description").html(), // tell Galleria to grab the content from the .description div as caption
218                
219                conf_autoplay: $(img).parent().parent().parent().siblings("span[data-name='conf_autoplay']").filter(":first").eq(0).attr('data-value'),
220                conf_intervall: $(img).parent().parent().parent().siblings("span[data-name='conf_intervall']").filter(":first").eq(0).attr('data-value'),
221                conf_width: $(img).parent().parent().parent().siblings("span[data-name='conf_width']").filter(":first").eq(0).attr('data-value'),
222                conf_height: $(img).parent().parent().parent().siblings("span[data-name='conf_height']").filter(":first").eq(0).attr('data-value'),
223                conf_align: $(img).parent().parent().parent().siblings("span[data-name='conf_align']").filter(":first").eq(0).attr('data-value')
224            };
225            return data;
226        }
227    });
228            
229} /* end of: ($('.galleria').length != 0) */
230        // extend:
231        
232            

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.