1(function($){ 2 window.NggPaginatedGallery = function(displayed_gallery_id, container, links) { 3 this.displayed_gallery_id = displayed_gallery_id; 4 this.links = links; 5 this.container = container; 6 7 this.get_displayed_gallery_obj = function(){ 8 var index = 'gallery_'+this.displayed_gallery_id; 9 if (typeof(window.galleries[index]) == 'undefined') 10 return false; 11 else 12 return window.galleries[index]; 13 }; 14 15 16 this.enable_ajax_pagination = function(){ 17 var transient_id = this.get_displayed_gallery_obj().transient_id; 18 var obj = this; 19 20 // Attach a click event handler for each pagination link to 21 // adjust the request to be sent via XHR 22 this.links.each(function(){ 23 var $link = $(this); 24 $link.click(function(e){ 25 e.preventDefault(); 26 27 // Describe AJAX request 28 var request = { 29 action: 'render_displayed_gallery', 30 displayed_gallery_id: transient_id, 31 ajax_referrer: $link.attr('href') 32 }; 33 34 // Notify the user that we're busy 35 obj.do_ajax(request); 36 }); 37 }); 38 }; 39 40 this.do_ajax = function(request){ 41 42 var container = this.container; 43 var self = this; 44 45 // Adjust the user notification 46 window['ngg_ajax_operaton_count']++; 47 $('body, a').css('cursor', 'wait'); 48 49 // Send the AJAX request 50 $.post(photocrati_ajax.url, request, function(response){ 51 52 // Adjust the user notification 53 window['ngg_ajax_operaton_count']--; 54 if (window['ngg_ajax_operaton_count'] <= 0) { 55 window['ngg_ajax_operaton_count'] = 0; 56 $('body, a').css('cursor', 'auto'); 57 } 58 59 // Ensure that the server returned JSON 60 if (typeof(response) != 'object') response = JSON.parse(response); 61 if (response) { 62 container.each(function() { 63 if ($(this).data('nextgen-gallery-id') != self.dis
63played_gallery_id) { 64 return true; 65 } 66 $(this).replaceWith(response.html); 67 return true; 68 }); 69 70 // Let the user know that we've refreshed the content 71 $(document).trigger('refreshed'); 72 } 73 }); 74 }; 75 76 // Initialize 77 var displayed_gallery = this.get_displayed_gallery_obj(); 78 if (displayed_gallery) { 79 if (typeof(displayed_gallery.display_settings['ajax_pagination']) != 'undefined') { 80 if (parseInt(displayed_gallery.display_settings['ajax_pagination'])) { 81 this.enable_ajax_pagination(); 82 } 83 } 84 } 85 86 // We maintain a count of all the current AJAX actions initiated 87 if (typeof(window['ngg_ajax_operation_count']) == 'undefined') { 88 window['ngg_ajax_operaton_count'] = 0; 89 } 90 }; 91 92})(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.