PageSourceSearch

https://www.clicking.it/wp-content/cache/wpfc-minified/g0i9ylgh/4l61v.js

js clicking.it collected 2026-10-04 21:12:02 UTC 8,311 bytes, 211 lines download raw bytes

1// source --> https://www.clicking.it/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_gallery_display/static/common.js?ver=3.26 
2(function($) {
3    window.NggPaginatedGallery = function(displayed_gallery_id, container) {
4        this.displayed_gallery_id = displayed_gallery_id;
5        this.container            = $(container);
6        this.container_name       = container;
7
8        this.get_displayed_gallery_obj = function() {
9            var index = 'gallery_' + this.displayed_gallery_id;
10            if (typeof(window.galleries[index]) == 'undefined') {
11                return false;
12            } else {
13                return window.galleries[index];
14            }
15        };
16
17        this.enable_ajax_pagination = function() {
18            var self = this;
19            // Attach a click event handler for each pagination link to adjust the request to be sent via XHR
20            $('body').on('click', 'a.ngg-browser-prev, a.ngg-browser-next', function (event) {
21
22                var skip = true;
23                $(this).parents(container).each(function() {
24                    if ($(this).data('nextgen-gallery-id') != self.dis
24played_gallery_id) {
25                        return true;
26                    }
27                    skip = false;
28                });
29
30                if (!skip) {
31                    event.preventDefault();
32                } else {
33                    return;
34                }
35
36                // Adjust the user notification
37                window['ngg_ajax_operaton_count']++;
38                $('body, a').css('cursor', 'wait');
39
40                // Send the AJAX request
41                $.get($(this).attr('href'), function (response) {
42                    window['ngg_ajax_operaton_count']--;
43                    if (window['ngg_ajax_operaton_count'] <= 0) {
44                        window['ngg_ajax_operaton_count'] = 0;
45                        $('body, a').css('cursor', 'auto');
46                    }
47
48                    if (response) {
49                        var html = $(response);
50                        var replacement = false;
51                        html.find(self.container_name).each(function() {
52                            if (replacement) {
53                                return true;
54                            }
55                            if ($(this).data('nextgen-gallery-id') != self.dis
55played_gallery_id) {
56                                return true;
57                            }
58                            replacement = $(this);
59                        });
60                        if (replacement) {
61                            self.container.each(function () {
62                                var $this = $(this);
63
64                                if ($this.data('nextgen-gallery-id') != self.displayed_gallery_id) {
65                                    return true;
66                                }
67
68                                // If the image gallery makes up the bulk of the post/page content the .html() call
69                                // below will empty the contents causing the browser's scroll position to be reset to
70                                // zero as the browser believes it has been pushed back to the top of the page. Here
71                                // we give the parent container a min-height equal to the gallery's height to prevent
72                                // this flicker and resetting of the scroll position.
73                                var $new_element = $(replacement.html());
74                                var promises = $new_element.find('img').toArray().map(function(img){
75                                    return new Promise(function(resolve, reject){
76                                        var i = new Image();
77                                        i.src = img.src;
78                                        $(i).on('load', resolve);
79                                    });
80                                });
81
82                                Promise.all(promises).then(function(){
83                                        $this.html($new_element);
84
85                                        // Let the user know that we've refreshed the content
86                                        $(document).trigger('refreshed');
87                                });
88
89                                return true;
90                            });
91                        }
92                    }
93                });
94            });
95        };
96
97        // Initialize
98        var displayed_gallery = this.get_displayed_gallery_obj();
99        if (displayed_gallery) {
100            if (typeof(displayed_gallery.display_settings['ajax_pagination']) != 'undefined') {
101                if (parseInt(displayed_gallery.display_settings['ajax_pagination'])) {
102                    this.enable_ajax_pagination();
103                }
104            }
105        }
106
107        // We maintain a count of all the current AJAX actions initiated
108        if (typeof(window['ngg_ajax_operation_count']) == 'undefined') {
109            window['ngg_ajax_operaton_count'] = 0;
110        }
111    };
112
113    // Polyfill for older browsers
114    Object.setPrototypeOf = Object.setPrototypeOf || function(obj, proto) {
115        obj.__proto__ = proto;
116        return obj;
117    };
118
119    if (typeof window.galleries !== 'undefined') {
120    Object.setPrototypeOf(
121        window.galleries,
122        {
123            get_api_version: function() {
124                return '0.1';
125            },
126
127            get_from_id: function (gallery_id) {
128                var self   = this;
129                var retval = null;
130                var keys   = Object.keys(this);
131
132                for (var i = 1; i <= keys.length; i++) {
133                    var gallery = self[keys[i - 1]];
134                    if (gallery.ID === gallery_id || gallery.ID === 'gallery_' + gallery_id || gallery.ID === parseInt(gallery_id)) {
135                        retval = gallery;
136                        break;
137                    }
138                }
139
140                return retval;
141            },
142
143            get_from_slug: function (slug) {
144                var self   = this;
145                var retval = null;
146                var keys   = Object.keys(this);
147
148                for (var i = 1; i <= keys.length; i++) {
149                    var gallery = self[keys[i - 1]];
150                    if (gallery.slug === slug) {
151                        retval = gallery;
152                        break;
153                    }
154                }
155
156                return retval;
157            },
158
159            get_setting: function(gallery_id, name, def) {
160                var tmp = '';
161                var gallery = this.get_from_id(gallery_id);
162                if (gallery && typeof gallery[name] !== 'undefined') {
163                    tmp = gallery[name];
164                } else {
165                    tmp = def;
166                }
167
168                if (tmp === 1)       tmp = true;
169                if (tmp === 0)       tmp = false;
170                if (tmp === '1')     tmp = true;
171                if (tmp === '0')     tmp = false;
172                if (tmp === 'false') tmp = false;
173                if (tmp === 'true')  tmp = true;
174
175                return tmp;
176            },
177
178            get_display_setting: function(gallery_id, name, def) {
179                var tmp = '';
180                var gallery = this.get_from_id(gallery_id);
181                if (gallery && typeof gallery.display_settings[name] !== 'undefined') {
182                    tmp = gallery.display_settings[name];
183                } else {
184                    tmp = def;
185                }
186
187                if (tmp === 1)       tmp = true;
188                if (tmp === 0)       tmp = false;
189                if (tmp === '1')     tmp = true;
190                if (tmp === '0')     tmp = false;
191                if (tmp === 'false') tmp = false;
192                if (tmp === 'true')  tmp = true;
193
194                return tmp;
195            },
196
197            is_widget: function(gallery_id) {
198                var retval  = false;
199                var gallery = this.get_from_id(gallery_id);
200                var slug    = gallery.slug;
201
202                if (slug) {
203                    return slug.indexOf('widget-ngg-images') !== -1;
204                }
205
206                return retval;
207            }
208        }
209    ); }
210
211})(jQuery);

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.