PageSourceSearch

https://wiehenburg.info/modules/imagegallery/imagegallery.js?ac=1615479575

js wiehenburg.info collected 2026-09-28 03:17:20 UTC 22,485 bytes, 883 lines download raw bytes

1(function ($) {
2
3$.imagegallery	= {
4	close: function () {
5		$.modal.close();
6	},
7	currentImage: {},
8	titleContainer: {},
9	descriptionContainer: {}
10};
11
12$.fn.imagegallery = function (options) {
13	var el = this,
14		settings = {},
15		isLocked = false,
16		itemsToLoad = [],
17		width, height;
18
19	el.updateSettings = function(newSettings) {
20		settings = $.extend(true, {}, settings, newSettings);
21		if (newSettings.store && newSettings.store.data) {
22			settings.store.data = newSettings.store.data.slice(0);
23		}
24		setCurrentPage(settings.store.currentPage, true);
25		return el;
26	};
27
28	init();
29
30	return el;
31
32	/**
33	 * Resets loaded items
34	 */
35	function resetItemsToLoad() {
36		itemsToLoad	= [];
37	}
38
39	/**
40	 * Add item to load
41	 *
42	 * @param {Number} i
43	 * @param {String} url
44	 */
45	function addItemToLoad(i, url) {
46		itemsToLoad[i] = url;
47	}
48
49	/**
50	 * Tells use when we already loaded item
51	 *
52	 * @param {Number} i
53	 * @return {Boolean}
54	 */
55	function isItemLoaded(i) {
56		return (false === itemsToLoad[i]);
57	}
58
59	/**
60	 * Mark item as already loaded
61	 *
62	 * @param {Number} i
63	 */
64	function markItemAsLoaded(i) {
65		itemsToLoad[i] = false;
66	}
67
68	/**
69	 * When item isn`t loaded -- we load item and mark it as loaded
70	 *
71	 * @param {Number} i
72	 */
73	function loadItem(i) {
74		if (0 == itemsToLoad.length) {
75			throw new Error('Items to load should be loaded before loading item');
76		}
77		if (isItemLoaded(i)) {
78			return;
79		}
80		$('#view-image-' + i).attr('src', itemsToLoad[i]);
81		markItemAsLoaded(i);
82	}
83
84	function isDefaultTitle(title) {
85		return title == settings.locale.defaultTitle;
86	}
87
88	function init() {
89		settings = $.extend(true, {}, $.fn.imagegallery.defaults, options);
90
91		var store = settings.store;
92
93		var page = getPageNumberFromUrl(el.parent().attr('id'));
94		if (page) {
95			store.currentPage = page;
96		}
97
98		$(window).bind('hashchange', function() {
99			setCurrentPage(getPageNumberFromUrl(el.parent().attr('id')), false);
100		});
101
102		switch (store.type) {
103			case 'array':
104				setCurrentPage(store.currentPage, true);
105				break;
106			case 'picasa':
107				if (store.username === '' || store.albumId === '' || store.album === '') {
108					throw new Error('Module not configured');
109				}
110				requestPicasaAlbum(store);
111				break;
112			default:
113				throw new Error('Unknown store type.');
114		}
115	}
116
117	function htmlEncode(str) {
118		return str.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
119	}
120
121	function newLineToBr(str) {
122		return str.replace(/\n/g, '<br />');
123	}
124
125	function filter(items) {
126		var filteredItems = [],
127			deletedImages = settings.store.deletedImages;
128		for (var i = 0, iMax = items.length; i < iMax; i++) {
129			var item = items[i];
130			if ($.inArray(item.id, deletedImages) == -1) {
131				filteredItems.push(item);
132			}
133		}
134		return filteredItems;
135	}
136
137	function render(store) {
138		var items = filter(store.data),
139			listHtml = $('<div class="frames-' + settings.thumbSize + '" style="text-align: ' + settings.align +
140				'"></div>'),
141			frameIdPrefix = 'frame-',
142			start = (store.currentPage - 1) * settings.pageSize,
143			end = start + parseInt(settings.pageSize),
144			iMax = items.length;
145
146		for (var i = start; i < end && i < iMax; i++) {
147			var item		= items[i],
148				title		= isDefaultTitle(item.title) ? '' : item.title,
149				itemHtml	= $(
150				'<div id="' + frameIdPrefix + item.id + '" class="frame">' +
151					'<div class="preview-holder">' +
152						'<div class="preview" style="background-image: url(\'' + item.thumbUrl + '\');">' +
153							'<a href="' + item.url + '">' +
154								'<img src="' + item.thumbUrl + '" alt="' + title + '"/>' +
155							'</a>' +
156						'</div>' +
157					'</div>' +
158					'<div class="name">' + title + '</div>' +
159					'<div class="description">' + newLineToBr(htmlEncode(item.description)) + '</div>' +
160				'</div>'
161			);
162			itemHtml.hover(function() {
163				$(this).addClass('frame-hover');
164			}, function() {
165				$(this).removeClass('frame-hover');
166			});
167			itemHtml.find('.preview').bind('click', [i], function(event) {
168				if (isLocked || settings.beforeOpenImageCallback() === false) {
169					return;
170				}
171				event.stopPropagation();
172				event.preventDefault();
173				openView(
174						settings.isRtl ? items.slice().reverse() : items,
175						convertIndexForRtl(event.data[0])
176				);
177			});
178			listHtml.append(itemHtml);
179		}
180
181		el.html(listHtml);
182		el.append(createPaging(store));
183	}
184
185	function openView(items, start) {
186		document.documentElement.className.indexOf('mobile-view') > -1
187			? openMobileView(items, start)
188			: openDesktopView(items, start);
189	}
190
191	function openMobileView(items, start) {
192		function close() {
193			$.imagegallery.currentImage = currentIndex;
194			$('#mobile-view').remove();
195			$('body').removeClass('imagegallery-mobile-view');
196			$('#page').show();
197		}
198
199		function updateView() {
200			var windowHeight = $(window).height(),
201				windowWidth = $(window).width(),
202				image = $('#mobile-view-img'),
203				buttonPrev = $('#mobile-view-prev'),
204				buttonNext = $('#mobile-view-next'),
205				buttonMargin;
206
207			// update image
208			image.css({
209				'max-height': windowHeight,
210				'max-width': windowWidth
211			});
212
213			var imageHeight = image.height();
214
215			image.css({
216				'margin-top': parseInt((windowHeight - imageHeight) / 2) + 'px'
217			});
218
219			image.fadeIn('slow');
220
221			//update buttons
222			currentIndex == 0
223				? buttonPrev.hide()
224				: buttonPrev.show();
225
226			currentIndex == items.length - 1
227				? buttonNext.hide()
228				: buttonNext.show();
229
230			buttonMargin = parseInt((windowHeight - buttonPrev.height()) / 2);
231			buttonPrev.css({'top': buttonMargin + 'px'});
232			buttonNext.css({'top': buttonMargin + 'px'});
233		}
234
235		function setImage(index) {
236			if (!items[index]) {
237				return;
238			}
239			currentIndex = index;
240
241			var image = $('#mobile-view-img');
242			image.fadeOut('fast', function() {
243				image.attr('src', items[index].url);
244			 });
245
246			loadPrevImage();
247			loadNextImage();
248		}
249
250		function showPrev() {
251			setImage(currentIndex - 1);
252			updateView();
253		}
254
255		function showNext() {
256			setImage(currentIndex + 1);
257			updateView();
258		}
259
260		function loadPrevImage() {
261			var index = currentIndex - 1;
262			if (!items[index]) {
263				return;
264			}
265			$('#mobile-view-img-prev').attr('src', items[index].url);
266		}
267
268		function loadNextImage() {
269			var index = currentIndex + 1;
270			if (!items[index]) {
271				return;
272			}
273			$('#mobile-view-img-next').attr('src', items[index].url);
274		}
275
276		function onTouchStart(e) {
277			if (e.originalEvent.touches.length == 1) {
278				e.stopPropagation();
279				startX = e.originalEvent.touches[0].pageX;
280				isMove = true;
281				image.bind('touchmove', onTouchMove);
282			}
283		}
284
285		function onTouchMove(e) {
286			if (isMove) {
287				var x = e.originalEvent.touches[0].pageX,
288					dx = startX - x;
289
290				if (Math.abs(dx) >= 21) {
291					cancelTouch();
292					dx > 0
293						? showNext()
294						: showPrev();
295				}
296			}
297		}
298
299		function cancelTouch() {
300			image.unbind('touchmove', onTouchMove);
301			startX = null;
302			isMove = false;
303		}
304
305		$.imagegallery.currentImage = items[start];
306
307		var currentIndex = start,
308			view = $('<div id="mobile-view"> \
309				<img id="mobile-view-img-prev" src="" alt=""> \
310				<img id="mobile-view-img" src="" alt=""> \
311				<img id="mobile-view-img-next" src="" alt=""> \
312				<div id="mobile-view-close" class="imagegallery-mobile-view-button">х</div> \
313				<div id="mobile-view-prev" class="imagegallery-mobile-view-button"><</div> \
314				<div id="mobile-view-next" class="imagegallery-mobile-view-button">></div> \
315			</div>'),
316			buttonPrev = view.find('#mobile-view-prev'),
317			buttonNext = view.find('#mobile-view-next'),
318			buttonClose = view.find('#mobile-view-close'),
319			image = view.find('#mobile-view-img'),
320			startX,
321			isMove = false;
322
323		image.load(updateView);
324		image.click(showNext);
325		image.bind('touchstart', onTouchStart);
326
327		buttonPrev.click(showPrev);
328		buttonNext.click(showNext);
329		buttonClose.click(close);
330
331		$(window).bind('orientationchange', updateView);
332
333		$('#page').hide();
334		$('body').addClass('imagegallery-mobile-view').append(view);
335		setImage(currentIndex);
336
337		if (settings.openImageCallback) {
338			settings.openImageCallback($.imagegallery);
339		}
340	}
341
342	function openDesktopView(items, start) {
343		var view, tools, mainViewUl, thumbViewUl, controls, i, item, mainView, thumbView, previewControlsDiv, previewControls,
344			isMobileView		= (document.documentElement.className.indexOf('mobile-view') > -1),
345			dialogViewWidth		= $(window).width() * (isMobileView ? 1 : 0.8),
346			imageViewMaxWidth	= dialogViewWidth - 160,
347			imageViewMaxHeight	= $(window).height() - 230,
348			msg					= settings.locale,
349			visibleItems		= Math.min(items.length, 5),
350			isMainNavigation	= items.length > 1,
351			isThumbNavigation	= items.length > visibleItems;
352
353		view = $('<div id="view"> \
354			<table cellpadding="0" cellspacing="0" id="thumb"> \
355				<tr> \
356					<td><div id="thumb-prev"></div></td> \
357					<td> \
358						<div id="thumb-view"></div> \
359					</td> \
360					<td><div id="thumb-next"></div></td> \
361				</tr> \
362			</table> \
363			<div id="main"> \
364				<table cellpadding="0" cellspacing="0" align="center"> \
365					<tr> \
366						<td id="view-prev"><div id="main-prev"></div></td> \
367						<td id="view-panel"> \
368							<div id="view-tools"></div> \
369							<div id="view-counter">' + msg.imageText + ' <span class="num">0</span> ' + msg.counterSeparatorText + ' <span class="count">0</span></div> \
370							<div id="main-view"></div> \
371							<div id="view-details"> \
372								<div id="view-title"></div> \
373								<div id="view-description"></div> \
374							</div> \
375							<div id="view-close" class="simplemodal-close">' + msg.closeText + '</div> \
376						</td> \
377						<td id="view-next"><div id="main-next"></div></td> \
378					</tr> \
379				</table> \
380			</div> \
381		</div>');
382
383		tools = view.find('#view-tools');
384
385		if (settings.isShowRemove) {
386			tools.append(renderTool({
387				id		: 'imageGalleryRemoveButton',
388				cls		: 'remove-button',
389				text	: msg.removeImage
390			}));
391		}
392
393		if (settings.isShowFullSize) {
394			tools.append(renderTool({
395				id		: 'imageGalleryFullSizeButton',
396				cls		: 'fullsize-button',
397				text	: msg.fullSizeImage
398			}));
399		}
400
401		mainViewUl			= $('<ul></ul>');
402		thumbViewUl			= $('<ul></ul>');
403		previewControlsDiv	= $('<div class="preview-controls"></div>');
404		controls			= [];
405		previewControls		= [];
406		resetItemsToLoad();
407		for (i = 0; i < items.length; i++) {
408			item = items[i];
409			addItemToLoad(i, item.url);
410			var imageUrl = item.thumbUrl;
411			if (i == start) {
412				markItemAsLoaded(i);
413				imageUrl = item.url;
414			}
415			mainViewUl.append(
416				'<li id="view' + i + '"> \
417					<table cellpadding="0" cellspacing="0"> \
418						<tr><td><img id="view-image-' + i + '" src="' + imageUrl + '" alt=""/></td></tr> \
419					</table> \
420				</li>'
421			);
422
423			thumbViewUl.append(
424				'<li class="view-control' + i + '"> \
425					<div class="preview-holder"> \
426						<a href="' + item.url + '" class="preview" style="background-image: url(' + item.thumbUrl + ');"><img src="' + item.thumbUrl + '" alt=""></a> \
427					</div> \
428				</li>'
429			);
430
431			previewControlsDiv.append('<span class="preview-control' + i + '"></span>');
432
433			controls.push('.view-control' + i);
434			previewControls.push('.preview-control' + i);
435		}
436
437		mainView	= view.find('#main-view');
438		thumbView	= view.find('#thumb-view');
439		mainView.append(mainViewUl);
440		thumbView.append(thumbViewUl);
441		view.append(previewControlsDiv);
442
443		view.find('#view-counter .count').html(items.length);
444
445		view.width(dialogViewWidth);
446		mainView.width(dialogViewWidth);
447		mainView.find('table').width(imageViewMaxWidth);
448		mainView.find('td').height(imageViewMaxHeight);
449		mainView.find('img').css({
450			'max-height': imageViewMaxHeight,
451			'max-width': imageViewMaxWidth
452		});
453
454		view.find('#main-prev, #main-next').css('margin-top', ($(window).height() / 2 - 49) + 'px');
455		$('html, body').addClass('scroll');
456		view.modal({
457			opacity			: 80,
458			zIndex			: 8000,
459			overlayId		: 'overlay',
460			overlayClose	: true,
461			onOpen			: function(dialog) {
462				dialog.overlay.show();
463				dialog.container.show();
464				dialog.data.show();
465			},
466			onClose			: function(dialog) {
467				isLocked = true;
468				if (settings.closeImageCallback) {
469					settings.closeImageCallback($.imagegallery);
470					$(document).unbind('keydown.imagegallery');
471				}
472				$('html, body').removeClass('scroll');
473				$.modal.close();
474				setTimeout(function() {isLocked = false;}, 20);
475				$.imagegallery.currentImage = {};
476
477				$(window).unbind('resize', onWindowResize);
478			}
479		});
480
481		if (!isMainNavigation) {
482			$('#main-next,#main-prev').addClass('disabled');
483		}
484		if (!isThumbNavigation) {
485			$('#thumb-next,#thumb-prev').addClass('disabled');
486		}
487		mainView.jCarouselLite({
488			btnNext		: isMainNavigation ? '#main-next' : null,
489			btnPrev		: isMainNavigation ? '#main-prev' : null,
490			visible		: 1,
491			btnGo		: controls,
492			start		: start,
493			circular	: false,
494			afterEnd	: function(a) {
495				var num = parseInt(a.attr('id').replace('view', ''), 10);
496				$.imagegallery.currentImage = items[num];
497				updateDetails(num);
498				selectPreview(num, true, visibleItems, items.length);
499			}
500		});
501		thumbView.jCarouselLite({
502			btnNext		: isThumbNavigation ? '#thumb-next' : null,
503			btnPrev		: isThumbNavigation ? '#thumb-prev' : null,
504			btnGo		: previewControls,
505			visible		: visibleItems,
506			circular	: false,
507			afterEnd	: function(a) {
508				a.each(function(i, li){
509					var num = $(li).attr('class').match(/view\-control(\d+)/)[1];
510					loadItem(num);
511				});
512			}
513		});
514
515		$.imagegallery.currentImage = items[start];
516		$.imagegallery.titleContainer = $('#view-title');
517		$.imagegallery.descriptionContainer = $('#view-description');
518
519		if (settings.openImageCallback) {
520			settings.openImageCallback($.imagegallery);
521		}
522
523		$(document).bind('keydown.imagegallery',function(e){
524			switch(e.keyCode){
525				case 37:
526					$('#main-prev').click();
527					e.stopPropagation();
528					e.preventDefault();
529					break;
530				case 39:
531					$('#main-next').click();
532					e.stopPropagation();
533					e.preventDefault();
534					break;
535			}
536		});
537
538		updateDetails(start);
539		selectPreview(start, true, visibleItems, items.length);
540
541		thumbView.find('a').click(function() {
542			$(this).parents('li').click();
543			return false;
544		});
545
546		$(window).resize(onWindowResize);
547	}
548
549	function updateDetails(num) {
550		var counterContainer	= $('#view-counter .num'),
551			ig 					= $.imagegallery,
552			title				= (isDefaultTitle(ig.currentImage.title) ? '' : ig.currentImage.title);
553
554		counterContainer.html(convertIndexForRtl(num) + 1);
555
556		ig.titleContainer.html(title);
557		ig.descriptionContainer.html(newLineToBr(htmlEncode(ig.currentImage.description)));
558		settings.changeImageCallback(ig);
559	}
560
561	function renderTool(config) {
562		var tool = $(
563			'<table id="' + config.id + '" cellpadding="0" cellspacing="0" class="button ' + config.cls + '"> \
564				<tr> \
565					<td class="l"></td> \
566					<td class="m"><i>&nbsp;</i>' + config.text + '</td> \
567					<td class="r"></td> \
568				</tr> \
569			</table>'
570		);
571
572		tool.hover(
573			function () { $(this).addClass('button-hover'); },
574			function () { $(this).removeClass('button-hover'); }
575		).mousedown(
576			function () { $(this).addClass('button-active'); }
577		).mouseup(
578			function () { $(this).removeClass('button-active'); }
579		);
580
581		if (config.handler) {
582			tool.bind('click', function(event) {
583				event.stopPropagation();
584				event.preventDefault();
585				config.handler();
586			});
587		}
588
589		return tool;
590	}
591
592	function selectPreview(index, move, visible, total) {
593		$('#thumb-view li').removeClass('active');
594		if (move) {
595			var shift = Math.floor(visible / 2),
596				moveTo = Math.max((index - shift), 0);
597
598			if ((total - index + 1) < visible) {
599				moveTo = total - visible;
600			}
601			$('.preview-control' + moveTo).click();
602		}
603		$('.view-control' + index).addClass('active').click();
604	}
605
606	function requestPicasaAlbum(store) {
607		var	params	= 'fields=entry(gphoto:id,content,title,summary)&kind=photo&v=2.0&alt=json',
608			tmp		= store.albumUrl.split('?').concat(params),
609			url		= tmp.shift().concat('?').concat(tmp.join('&'));
610		$.getJSON(url, 'callback=?', onResponsePicasaAlbum);
611	}
612
613	function onResponsePicasaAlbum(response) {
614		var album = parsePicasaAlbum(response.feed);
615		if (album) {
616			settings.store.data = album.items;
617			setCurrentPage(settings.store.currentPage, true);
618		}
619	}
620
621	function parsePicasaAlbum(data) {
622		if (!data.entry) {
623			return false;
624		}
625		var album	= {
626				title		: data.title === undefined				? '' : data.title.$t,
627				description	: data.subtitle === undefined			? '' : data.subtitle.$t,
628				location	: data.gphoto$location === undefined	? '' : data.gphoto$location.$t,
629				date		: data.gphoto$timestamp === undefined	? '' : data.gphoto$timestamp.$t,
630				items		: []
631			},
632			entry	= data.entry,
633			iMax	= entry.length;
634
635		for (var i = 0; i < iMax; i++) {
636			var image = entry[i];
637			album.items.push({
638				id			: image.gphoto$id.$t,
639				url			: image.content.src,
640				thumbUrl	: image.content.src + '?imgmax=150',
641				title		: image.title ? image.title.$t : '',
642				description	: image.summary ? image.summary.$t : ''
643			});
644		}
645
646		return album;
647	}
648
649	function onWindowResize() {
650		if (width == $(window).width() && height == $(window).height()) {
651			return;
652		}
653		width = $(window).width();
654		height = $(window).height();
655
656		if (!$.imagegallery.currentImage.id) {
657			return;
658		}
659		var items = filter(settings.store.data);
660		var index = 0;
661		$.each(items, function(key, item) {
662			if (item.id == $.imagegallery.currentImage.id) {
663				index = key;
664				return false;
665			}
666		});
667		$.modal.close();
668		setTimeout(function() {
669			openView(items, index);
670		}, 200);
671	}
672
673	function createPaging(store) {
674		var currentPage = parseInt(store.currentPage),
675			maxPage = Math.ceil(store.data.length / settings.pageSize);
676
677		if (maxPage < 2) {
678			return '';
679		}
680
681		var pagination = $('<table></table>').addClass('pagination'),
682			locale = settings.locale,
683			prevText = '&laquo; ' + locale.prevText,
684			nextText = locale.nextText + ' &raquo;',
685			paginationPrev = $('<td></td>').addClass('pagination-prev'),
686			paginationNext = $('<td></td>').addClass('pagination-next'),
687			paginationPages = [];
688
689		if (currentPage > 1) {
690			paginationPrev.append(getPagingLink(currentPage - 1, prevText, previousPageHandler));
691			paginationPages.push(getPagingLink(1, 1, changePageHandler));
692		} else {
693			paginationPrev.append(prevText);
694		}
695
696		if ((currentPage - 2) > 1) {
697			paginationPages.push('...');
698		}
699		if ((currentPage - 1) > 1) {
700			paginationPages.push(getPagingLink(currentPage - 1, currentPage - 1, changePageHandler));
701		}
702
703		paginationPages.push('<strong>' + currentPage + '</strong>');
704
705		if ((currentPage + 1) < maxPage) {
706			paginationPages.push(getPagingLink(currentPage + 1, currentPage + 1, changePageHandler));
707		}
708		if ((currentPage + 2) < maxPage) {
709			paginationPages.push('...');
710		}
711
712		if (currentPage < maxPage) {
713			paginationPages.push(getPagingLink(maxPage, maxPage, changePageHandler));
714			paginationNext.append(getPagingLink(currentPage + 1, nextText, nextPageHandler));
715		} else {
716			paginationNext.append(nextText);
717		}
718
719		pagination.append(paginationPrev);
720		$.each(paginationPages, function(i, page) {
721			pagination.append($('<td></td>').append(page));
722		});
723		pagination.append(paginationNext);
724
725		return pagination;
726	}
727
728	function getPagingLink(page, text, handler) {
729		var parentId = el.parent().attr('id');
730
731		return $('<a href="#"></a>')
732			.attr('href', updateHashParamsString(parentId, page))
733			.html(text)
734			.click([page], handler);
735	}
736
737	function setCurrentPage(page, updateHash) {
738		var store = settings.store,
739			total = store.data.length,
740			pageSize = settings.pageSize,
741			pages = total < pageSize ? 1 : Math.ceil(total / pageSize),
742			id = el.parent().attr('id');
743
744		if (page > 0) {
745			page = page > pages ? pages : page;
746		} else {
747			page = Math.abs(page) > pages ? 1 : page + pages + 1;
748		}
749
750		store.currentPage = page;
751		if (updateHash && settings.isChangeHashParams) {
752			if (page !== 1) {
753				window.location.hash = updateHashParamsString(id, 'page' + page);
754			} else if (window.location.hash.indexOf(id) !== -1) {
755				window.location.hash = removeHashParamsString(id);
756			}
757		}
758		render(store);
759		settings.changePageCallback();
760	}
761
762	function nextPageHandler() {
763		setCurrentPage(parseInt(settings.store.currentPage) + 1, true);
764		return false;
765	}
766
767	function previousPageHandler() {
768		setCurrentPage(parseInt(settings.store.currentPage) - 1, true);
769		return false;
770	}
771
772	function changePageHandler(event) {
773		var page = event.data[0];
774		setCurrentPage(page, true);
775		return false;
776	}
777
778	function parseHashParams() {
779		var hash = window.location.hash.replace(/^#(.*)/, "$1"),
780			result = {};
781
782		if (hash.length) {
783			var vars = hash.split('&');
784			$(vars).each(function(i) {
785				var param = vars[i].split('=');
786				if (param.length == 2) {
787					result[param[0]] = param[1];
788				}
789			});
790		}
791
792		return result;
793	}
794
795	function updateHashParamsString(name, value) {
796		var result = '',
797			params = parseHashParams();
798
799		params[name] = value;
800
801		for (var i in params) {
802			result += '&' + i + '=' + params[i];
803		}
804
805		if (result.length) {
806			result = result.replace(/^&(.*)/, "#$1");
807		}
808
809		return result;
810	}
811
812	function removeHashParamsString(name) {
813		var result = '',
814			params = parseHashParams();
815
816		for (var i in params) {
817			if (i != name) {
818				result += '&' + i + '=' + params[i];
819			}
820		}
821
822		if (result.length) {
823			result = result.replace(/^&(.*)/, "#$1");
824		}
825
826		return result;
827	}
828
829	function getPageNumberFromUrl(idGallery) {
830		var params = parseHashParams();
831
832		if (params[idGallery]) {
833			var pageReg = /page(\d+)/i,
834				matches = params[idGallery].match(pageReg);
835
836			if (matches && matches.length > 1) {
837				return matches[1];
838			}
839		}
840
841		return 1;
842	}
843
844	function convertIndexForRtl(index) {
845		if (settings.isRtl) {
846			return settings.store.data.length - index - 1;
847		}
848		return index;
849	}
850};
851
852$.fn.imagegallery.defaults = {
853	thumbSize: 'normal',
854	pageSize: 25,
855	align: 'left',
856	isShowRemove: false,
857	isShowFullSize: false,
858	isChangeHashParams: true,
859	isRtl: false,
860	beforeOpenImageCallback: function(gallery){},
861	openImageCallback: function(gallery){},
862	closeImageCallback: function(gallery){},
863	changeImageCallback: function(gallery){},
864	changePageCallback: function() {},
865	store: {
866		type: 'array',
867		data: [],
868		currentPage: 1,
869		deletedImages: []
870	},
871	locale: {
872		imageText: 'Image',
873		counterSeparatorText: ' of ',
874		prevText: 'Previous',
875		nextText: 'Next',
876		closeText: 'Close',
877		removeImage: 'Remove image',
878		fullSizeImage: 'See full size image',
879		defaultTitle: 'Name'
880	}
881};
882
883}
883)(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.