PageSourceSearch

https://getreadytorock.me.uk/blog/wp-content/plugins/nextgen-gallery/js/ngg.js?ver=4.9.5

js getreadytorock.me.uk collected 2026-09-24 09:51:43 UTC 5,688 bytes, 188 lines download raw bytes

1jQuery("document").ready(function(){
2	// register ajax gallery-navigation listeners
3	jQuery("a.page-numbers").click(function(e) {
4		return ngg_ajax_navigation(e, this);
5	});
6	jQuery("a.prev").click(function(e) {
7		return ngg_ajax_navigation(e, this);
8	});
9	jQuery("a.next").click(function(e) {
10		return ngg_ajax_navigation(e, this);
11	});
12	
13	// register ajax browser-navigation listeners
14	jQuery("a.ngg-browser-next").click(function(e) {
15		return ngg_ajax_browser_navigation(e, this);
16	});
17	jQuery("a.ngg-browser-prev").click(function(e) {
18		return ngg_ajax_browser_navigation(e, this);
19	});
20});
21
22function ngg_ajax_navigation(e, obj) {
23	// try to find page number
24	var pageNumber = 0;
25	if (jQuery(obj).hasClass("page-numbers")) {
26		pageNumber = jQuery(obj).contents()[0].data;
27	} else if (jQuery(obj).hasClass("prev")) {
28		pageNumber = jQuery(obj).attr("id").substr(9);
29	} else if (jQuery(obj).hasClass("next")) {
30		pageNumber = jQuery(obj).attr("id").substr(9);
31	}
32	
33	// try to find gallery number by checking the parents ID until we find a matching one
34	var currentNode = obj;
35	while (null != currentNode.parentNode && !jQuery.nodeName(currentNode.parentNode, "body") && "ngg-gallery-" != jQuery(currentNode.parentNode).attr("id").substring(0, 12)) {
36		currentNode = currentNode.parentNode;
37	}
38	
39	if (jQuery(currentNode.parentNode).attr("id")) {
40		var gallery = jQuery(currentNode.parentNode);
41
42		// we found a gallery, let's extract the post id & gallery id
43		var payload = gallery.attr("id").substring(12);
44		var separatorPosition = parseInt(payload.indexOf("-"));
45		
46		var galleryId = payload.substr(0, separatorPosition);
47		var postId = payload.substr(separatorPosition + 1);
48
49		if ( (galleryId.length == 0) || (postId.length == 0) ) {
50			return true;
51		}
52				
53		ngg_show_loading(e);
54		
55		// load gallery content
56		jQuery.get(ngg_ajax.path + "nggajax.php", {p: postId, galleryid: galleryId, nggpage: pageNumber, type: "gallery"}, function (data, textStatus) {
57			
58			// delete old content
59			gallery.children().remove();
60			
61			// add new content
62			gallery.replaceWith(data);
63			
64			// add ajax-navigation, again
65			jQuery("document").ready(function(){
66				// remove old listeners to avoid double-clicks
67				jQuery("a.page-numbers").unbind("click");
68				jQuery("a.prev").unbind("click");
69				jQuery("a.next").unbind("click");
70				
71				// add shutter-listeners again
72				shutterReloaded.init('sh');
73				
74				jQuery("a.page-numbers").click(function(e) {
75					return ngg_ajax_navigation(e, this);
76				});
77				jQuery("a.prev").click(function(e) {
78					return ngg_ajax_navigation(e, this);
79				});
80				jQuery("a.next").click(function(e) {
81					return ngg_ajax_navigation(e, this);
82				});
83				
84				ngg_remove_loading();
85			});
86		});
87		
88		// deactivate HTML link
89		return false;
90	}
91	
92	// an error occurred, use traditional HTML link
93	return true;
94};
95
96function ngg_ajax_browser_navigation(e, obj) {
97	
98
99	// try to find gallery number
100	if ("ngg-prev-" == jQuery(obj).attr("id").substr(0, 9) || "ngg-next-" == jQuery(obj).attr("id").substr(0, 9)) {
101		
102		// extract the image-id
103		var imageNumber = jQuery(obj).attr("id").substr(9);
104
105		// find the image-browser-container
106		var currentNode = obj;
107		while (null != currentNode.parentNode && !jQuery.nodeName(currentNode.parentNode, "body") && !jQuery(currentNode.parentNode).hasClass("ngg-imagebrowser")) {
108			currentNode = currentNode.parentNode;
109		}
110		
111		if (jQuery(currentNode.parentNode).hasClass("ngg-imagebrowser")) {
112			var gallery = jQuery(currentNode.parentNode);
113
114			// let's extract the post id & gallery id
115			var payload = gallery.attr("id").substring(17);
116			var separatorPosition = parseInt(payload.indexOf("-"));
117			
118			var galleryId = payload.substr(0, separatorPosition);
119			var postId = payload.substr(separatorPosition + 1);
120			
121			if ( (galleryId.length == 0) || (postId.length == 0) ) {
122				return true;
123			}
124			
125			ngg_show_loading(e);
126			
127			// get content
128			jQuery.get(ngg_ajax.path + "nggajax.php", {p: postId, galleryid: galleryId, pid: imageNumber, type: "browser"}, function (data, textStatus) {
129				// delete old content
130				gallery.children().remove();
131				
132				// add new content
133				gallery.replaceWith(data);
134				
135				// add ajax-navigation, again
136				jQuery("document").ready(function(){
137					// remove old listeners to avoid double-clicks
138					jQuery("a.ngg-browser-next").unbind("click");
139					jQuery("a.ngg-browser-prev").unbind("click");
140					
141					// add shutter-listeners again
142					shutterReloaded.init('sh');
143					
144					// register ajax browser-navigation listeners
145					jQuery("a.ngg-browser-next").click(function(e) {
146						return ngg_ajax_browser_navigation(e, this);
147					});
148					jQuery("a.ngg-browser-prev").click(function(e) {
149						return ngg_ajax_browser_navigation(e, this);
150					});
151					
152					ngg_remove_loading();
153				});
154			});
155	
156			// deactivate HTML link
157			return false;
158		}
159	}
160	
161	return true;
162}
163
164var loadingImage;
165function ngg_show_loading(obj) {
166	loadingImage = jQuery(document.createElement("img")).attr("src", ngg_ajax.path + "images/ajax-loader.gif").attr("alt", ngg_ajax.loading);
167
168	jQuery("body").append(loadingImage);
169	
170	jQuery(loadingImage).css({
171		position: "absolute",
172		top: (obj.pageY + 15) + "px",
173		left: (obj.pageX + 15) + "px"
174	});
175	
176	jQuery(document).mousemove(function(e) {
177		loadingImage.css({
178			top: (e.pageY + 15) + "px",
179			left: (e.pageX + 15) + "px"
180		});
181	});
182}
183
184function ngg_remove_loading() {
185	jQuery(document).unbind("mousemove");
186	
187	jQuery(loadingImage).remove();
188}

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.